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

Function accept

packages/webapp/components/world/engine/world.js:7469–7479  ·  view source on GitHub ↗
(p,minD)

Source from the content-addressed store, hash-verified

7467 const claimed=claims;
7468 const slotXZ=p=>{ const rr=radiusAt(prof,p.a)*p.r; return [Math.cos(p.a)*rr,Math.sin(p.a)*rr]; };
7469 const accept=(p,minD)=>{
7470 if(p.r>R-minD*0.6)return false; // must be on the island
7471 /* A wall is tested in the radial direction alone. Both the wall and the
7472 slot are placed at a radius scaled by the same profile, so "how far is
7473 this slot from that ring" is a subtraction rather than a search along it. */
7474 for(const b of bands) if(Math.abs(p.r-b)<0.45+minD*0.5)return false;
7475 const [x,z]=slotXZ(p);
7476 for(const c of claimed){ const dx=c.x-x,dz=c.z-z;
7477 if(dx*dx+dz*dz<(c.d+minD)*(c.d+minD))return false; }
7478 claimed.push({x,z,d:minD}); return true;
7479 };
7480 const put=(obj,p,key,extra)=>{
7481 const [x,z]=slotXZ(p);
7482 obj.position.set(x,tierY(p.r)+0.16,z); obj.userData.key=key; out.add(obj);

Callers 3

placeNFunction · 0.85
placeFFunction · 0.85
buildIslandFunction · 0.85

Calls 2

slotXZFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected