public virtual bool verifyObject(GameBase gobj, SceneObject entrance, SceneObject exit) { ShapeBase obj = gobj._ID; // Bail out early if we couldn't find an exit for this teleporter. if (!exit.isObject()) { console.error(string.Format("Cound not find an exit for {0}", console.GetVarString(entrance + ".name"))); return(false); } if (!obj.isMemberOfClass("Player")) { return(false); } // If the entrance is once sided, make sure the object // approached it from it's front. if (entrance["oneSided"].AsBool()) { TransformF forwardvector = new TransformF(entrance.getForwardVector()); Point3F velocity = obj.getVelocity(); float dotProduct = TransformF.vectorDot(forwardvector, velocity); if (dotProduct > 0) { return(false); } // If we are coming directly from another teleporter and it happens // to be bidirectional, We need to avoid ending sending objects through // an infinite loop. if (obj["isTeleporting"].AsBool()) { return(false); } // We only want to teleport players // So bail out early if we have found any // other object. if (entrance["timeOfLastTeleport"].AsInt() > 0 && entrance["teleporterCooldown"].AsInt() > 0) { int currentTime = console.getSimTime(); int timedifference = currentTime - entrance["timeOfLastTeleport"].AsInt(); SimDataBlock db = console.getDatablock(entrance); if (timedifference <= db["teleporterCooldown"].AsInt()) { return(false); } } } return(true); }