| 10368 | asks, because a district you can hover is not necessarily one that is |
| 10369 | standing. */ |
| 10370 | function handTargetAt(cx,cy){ |
| 10371 | if(!W)return null; |
| 10372 | const p=groundAt(cx,cy,0); if(!p)return null; |
| 10373 | if(OPEN){ |
| 10374 | if(!W.own)return null; |
| 10375 | const o=W.own.get(hexKey(...hexAt(p.x,p.z))); |
| 10376 | if(o===undefined)return null; |
| 10377 | const d=W.districts[o]; |
| 10378 | return (d&&d.built&&d.town&&d.realm===OPEN.realm)?d:null; |
| 10379 | } |
| 10380 | for(const q of W.quarters){ |
| 10381 | if(q.shown<=0||!q.island)continue; |
| 10382 | if(Math.hypot(p.x-q.x,p.z-q.z)<=spec(Math.max(1,q.level)).radius+3)return q; |
| 10383 | } |
| 10384 | return null; |
| 10385 | } |
| 10386 | function handArm(cx,cy,t){ |
| 10387 | const x=handTargetAt(cx,cy); |
| 10388 | HAND.armed=x; HAND.hold=x?t:0; |