| 10023 | asks, because a district you can hover is not necessarily one that is |
| 10024 | standing. */ |
| 10025 | function handTargetAt(cx,cy){ |
| 10026 | if(!W)return null; |
| 10027 | const p=groundAt(cx,cy,0); if(!p)return null; |
| 10028 | if(OPEN){ |
| 10029 | if(!W.own)return null; |
| 10030 | const o=W.own.get(hexKey(...hexAt(p.x,p.z))); |
| 10031 | if(o===undefined)return null; |
| 10032 | const d=W.districts[o]; |
| 10033 | return (d&&d.built&&d.town&&d.realm===OPEN.realm)?d:null; |
| 10034 | } |
| 10035 | for(const q of W.quarters){ |
| 10036 | if(q.shown<=0||!q.island)continue; |
| 10037 | if(Math.hypot(p.x-q.x,p.z-q.z)<=spec(Math.max(1,q.level)).radius+3)return q; |
| 10038 | } |
| 10039 | return null; |
| 10040 | } |
| 10041 | function handArm(cx,cy,t){ |
| 10042 | const x=handTargetAt(cx,cy); |
| 10043 | HAND.armed=x; HAND.hold=x?t:0; |