public void TeleporterTriggerTeleFrag(coSimDataBlock thisobj, coPlayer player, coTrigger exit)
        {
            // When a telefrag happens, there are two cases we have to consider.
            // The first case occurs when the player's bounding box is much larger than the exit location,
            // it is possible to have players colide even though a player is not within the bounds
            // of the trigger Because of this we first check a radius the size of a player's bounding
            // box around the exit location.

            // Get the bounding box of the player

            Point3F boundingBoxSize = new Point3F(((coPlayerData)player.getDataBlock())["boundingBox"]);
            float   radius          = boundingBoxSize.x;
            float   boxSizeY        = boundingBoxSize.y;
            float   boxSizeZ        = boundingBoxSize.z;

            // Use the largest dimention as the radius to check
            if (boxSizeY > radius)
            {
                radius = boxSizeY;
            }
            if (boxSizeZ > radius)
            {
                radius = boxSizeZ;
            }

            Point3F position = exit.getTransform().MPosition; // new TransformF(con.getTransform(exit));
            uint    mask     = (uint)SceneObjectTypesAsUint.PlayerObjectType;

            // Check all objects within the found radius of the exit location, and telefrag
            // any players that meet the conditions.

            Dictionary <uint, float> r = console.initContainerRadiusSearch(position, radius, mask);

            foreach (coShapeBase objectNearExit in r.Keys.Where(objectNearExit => ((coShapeBase)objectNearExit).isMemberOfClass("Player")).Where(objectNearExit => objectNearExit.AsString() != player))
            {
                ShapeBaseDamage(objectNearExit, player, exit.getTransform().MPosition, 10000, "Telefrag");
            }
            // The second case occurs when the bounds of the trigger are much larger
            // than the bounding box of the player. (So multiple players can exist within the
            // same trigger). For this case we check all objects contained within the trigger
            // and telefrag all players.

            int objectsInExit = exit.getNumObjects();

            // Loop through all objects in the teleporter exit
            // And kill any players
            for (int i = 0; i < objectsInExit; i++)
            {
                coShapeBase objectInTeleporter = console.Call(exit, "getObject", new[] { i.AsString() });
                if (objectInTeleporter.isMemberOfClass("Player"))
                {
                    continue;
                }
                // Avoid killing the player that is teleporting in the case of two
                // Teleporters near eachother.
                if (objectInTeleporter == player)
                {
                    continue;
                }

                ShapeBaseDamage(objectInTeleporter, player, exit.getTransform().MPosition, 10000, "Telefrag");
            }
        }
        public void TeleporterTriggerOnEnterTrigger(coSimDataBlock thisobj, coSceneObject entrance, coPlayer obj)
        {
            //if (!console.isMemberOfClass(obj, "Player"))
            //    return;

            if (obj["isTeleporting"].AsBool())
            {
                return;
            }
            // Get the location of our target position
            coTrigger exit = entrance["exit"];

            bool valid = TeleporterTriggerVerifyObject(thisobj, obj, entrance, exit);

            if (!valid)
            {
                return;
            }

            TeleporterTriggerTeleFrag(thisobj, obj, exit);
            // Create our entrance effects on all clients.



            coSimObject entranceeffect = entrance["entranceEffect"];

            if (entranceeffect.isObject())
            {
                foreach (coGameConnection client in ClientGroup)
                {
                    if (console.isObject(client))
                    {
                        console.commandToClient(client, "PlayTeleportEffect", new[] { entrance["position"], entranceeffect.getId().AsString() });
                    }
                }
            }


            TeleporterTriggerTeleportPlayer(thisobj, obj, exit);
            // Create our exit effects on all clients.

            coSimObject exitEffect = entrance["exitEffect"];

            if (exitEffect.isObject())
            {
                foreach (coGameConnection client in ClientGroup)
                {
                    if (console.isObject(client))
                    {
                        console.commandToClient(client, "PlayTeleportEffect", new[] { entrance["position"], exitEffect.getId().AsString() });
                    }
                }
            }

            // Record what time we last teleported so we can determine if enough
            // time has elapsed to teleport again
            int tolt = console.getSimTime();

            entrance["timeOfLastTeleport"] = tolt.AsString();

            // If this is a bidirectional teleporter, log it's exit too.
            if (exit["exit"] == entrance["name"])
            {
                exit["timeOfLastTeleport"] = tolt.AsString();
            }


            // Tell the client to play the 2D sound for the player that teleported.
            if (((coSimObject)thisobj["teleportSound"]).isObject() && ((coGameConnection)obj["client"]).isObject())
            {
                ((coGameConnection)obj["client"]).play2D(thisobj["teleportSound"]);
                //GameConnection.play2D(obj, thisobj["teleportSound"]);
            }
        }