MCPcopy Create free account
hub / github.com/dailydotdev/apps / handTargetAt

Function handTargetAt

packages/webapp/components/world/engine/world.js:10025–10040  ·  view source on GitHub ↗
(cx,cy)

Source from the content-addressed store, hash-verified

10023 asks, because a district you can hover is not necessarily one that is
10024 standing. */
10025function 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}
10041function handArm(cx,cy,t){
10042 const x=handTargetAt(cx,cy);
10043 HAND.armed=x; HAND.hold=x?t:0;

Callers 1

handArmFunction · 0.85

Calls 4

groundAtFunction · 0.85
hexKeyFunction · 0.85
hexAtFunction · 0.85
specFunction · 0.85

Tested by

no test coverage detected