bool Agent::tryMoveToPlaceAround(float x, float y) { if (!suffercollisions()) { moveTo(x, y); return true; } // TODO: fix for has_custom_core_size case // second hacky attempt, move from side to side (+/- width) and up (- height) a little unsigned int trywidth = getWidth() * 2; if (trywidth < 100) trywidth = 100; unsigned int tryheight = getHeight() * 2; if (tryheight < 100) tryheight = 100; for (unsigned int xadjust = 0; xadjust < trywidth; xadjust++) { for (unsigned int yadjust = 0; yadjust < tryheight; yadjust++) { if (validInRoomSystem(Point(x - xadjust, y - yadjust), getWidth(), getHeight(), perm)) moveTo(x - xadjust, y - yadjust); else if ((xadjust != 0) && validInRoomSystem(Point(x + xadjust, y - yadjust), getWidth(), getHeight(), perm)) moveTo(x + xadjust, y - yadjust); else continue; return true; } } return false; }
bool Agent::validInRoomSystem() { // Return true if this agent is inside the world room system at present, or false if it isn't. // TODO: c1 if (engine.version == 1) return true; if (has_custom_core_size) return validInRoomSystem(Point(x + custom_core_xleft, y + custom_core_ytop), custom_core_xright - custom_core_xleft, custom_core_ybottom - custom_core_ytop, perm); else return validInRoomSystem(Point(x, y), getWidth(), getHeight(), perm); }
void SkeletalCreature::physicsTick() { // TODO: mmh if (engine.version > 1) { if (falling) { if (engine.version == 2 || validInRoomSystem()) { Agent::physicsTick(); } } } if (!carriedby && !invehicle) { if (engine.version == 1 || (!falling)) snapDownFoot(); else downfootroom.reset(); } else downfootroom.reset(); }