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

Function handTargetAt

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

Source from the content-addressed store, hash-verified

10368 asks, because a district you can hover is not necessarily one that is
10369 standing. */
10370function 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}
10386function handArm(cx,cy,t){
10387 const x=handTargetAt(cx,cy);
10388 HAND.armed=x; HAND.hold=x?t:0;

Callers 1

handArmFunction · 0.85

Calls 5

groundAtFunction · 0.85
hexKeyFunction · 0.85
hexAtFunction · 0.85
specFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected