namespace COLLIDE { shared enum Collide { BULLET, BULLETPU, BUMP, STOMP, SUGARRUSH, SPECIALMOVE }; shared funcdef void HOOK(jjPLAYER@, jjPLAYER@, Collide, uint8); // Reference: https://docs.jj2.plus/plus-angelscript.html#jjpublicinterface shared DetectorI@ getDetector() { jjPUBLICINTERFACE@ pi = jjGetPublicInterface("player_collision_detector.mut"); if (pi !is null) { DetectorI@ detector = cast(pi); if (detector is null) { jjDebug("COLLIDE::getDetector: Incompatible player_collision_detector.mut version: " + pi.getVersion()); } return detector; } jjDebug("COLLIDE::getDetector: player_collision_detector.mut needs to be running first."); return null; } shared interface DetectorI : jjPUBLICINTERFACE { void setHook(COLLIDE::HOOK@ = onCollide, uint moduleID = jjScriptModuleID); void unsetHook(uint moduleID = jjScriptModuleID); void startDetecting(); void stopDetecting(); } shared jjOBJ@ getProbableBulletAccordingToThisCollision(const jjPLAYER@ victim, const jjPLAYER@ collider, uint8 eventID) { if (victim !is null && victim.isActive && collider !is null && collider.isActive && ((eventID >= OBJECT::BLASTERBULLET && eventID < OBJECT::SMOKERING) || eventID == OBJECT::TNT)) { for (int i = 1; i < jjObjectCount; i++) { jjOBJ@ obj = jjObjects[i]; if (obj.isActive && obj.eventID == eventID && obj.creatorType == CREATOR::PLAYER && int8(obj.creatorID) == collider.playerID) { float x = victim.xPos - obj.xPos; float y = victim.yPos - obj.yPos; if (((x*x)+(y*y)) <= (24 * 24) * 2) { return obj; } } } } return null; } }