public override void onObjectDetached(SceneObject obj)
        {
            // If no riders are left, return to the start
            if (!this.hasHumanRider())
                this.setMoveState(TypePathShapeState.Backward);

            base.onObjectDetached(obj);
        }
 public override void onObjectAttached(SceneObject obj)
 {
     if (obj["client"].isObject())
         {
         this.setMoveState(TypePathShapeState.Forward);
         this.checkWinner(obj["client"]);
         }
     base.onObjectAttached(obj);
 }
 public override void onCollision(Projectile proj, SceneObject col, float fade, Point3F pos, Point3F normal)
 {
     // Apply damage to the object all shape base objects
     if (this["directDamage"].AsFloat() > 0)
         {
         if ((console.getTypeMask(col) & (uint) SceneObjectTypesAsUint.ShapeBaseObjectType) == (uint) SceneObjectTypesAsUint.ShapeBaseObjectType)
             {
             ShapeBase shapebase = col._ID;
             shapebase.damage(proj, pos, this["directDamage"].AsFloat(), this["damageType"]);
             }
         }
 }
示例#4
0
        public override void onCollision(ShapeBase obj, SceneObject collObj, Point3F vec, float len)
        {
            if (!((collObj.GetType() == typeof (Player)) || (collObj.GetType() == typeof (AIPlayer))))
                return;
            Player player = (Player) collObj;

            if (player.getDamageLevel() <= 0.00 || player.getState() == "Dead")
                return;

            player.applyRepair(this["repairAmount"].AsFloat());
            player.setEnergyLevel(1);

            obj.schedule((100).AsString(), "startFade", "1000", "0", "true");
            obj.schedule((1200).AsString(), "delete");
            Audio.AudioServerPlay3D("HealthUseSound", player.getTransform());
        }
示例#5
0
        public override void onObjectAttached(SceneObject obj)
        {
            if (!obj["client"].isObject())
                return;

            bool driverAvailable = (ClientGroup.Count > 1);
            if (driverAvailable)
                {
                ShapeBase driver = ((WheeledVehicle) this["car"]).getMountNodeObject(0);
                if (driver.isObject())
                    message.MessageClient(obj["client"], "MsgItemPickup", "\\c1Hang On!");
                else
                    message.MessageAllExcept(obj["client"], "-1", "MsgItemPickup", "\\c2%1 is on the Cheetah and needs a driver...", obj["client.playerName"]);
                }
            else
                message.MessageClient(obj["client"], "MsgItemPickup", "\\c2Good luck finding a driver...");
        }
        public override void onObjectAttached(SceneObject obj)
        {
            // Start moving forward whenever we get a rider
            this.setMoveState(TypePathShapeState.Forward);

            if (obj["client"].isObject())
                {
                if (!obj["client.gotInstructions"].AsBool())
                    {
                    message.MessageClient(obj["client"], "MsgItemPickup", "\\c1Hop to the center grey platform to win.");
                    obj["client.gotInstructions"] = "true";
                    }

                if (obj["client.miniStartTime"] == "")
                    {
                    // Record this as their start time and clear the tracking variables
                    obj["client.miniStartTime"] = Util.getSimTime().AsString();
                    for (int i = 0; i < 4; i++)
                        obj["client.touchedPlatform[" + i + "]"] = "false";
                    }
                }
            base.onObjectAttached(obj);
        }
示例#7
0
 public override void onMount(GameBase obj, SceneObject mountObj, int node)
 {
     Player player = obj.getId();
     VehicleData vehicleDataBlock = mountObj.getDataBlock();
     if (node == 0)
         {
         player.setTransform(new TransformF("0 0 0 0 0 1 0"));
         string mountPose = vehicleDataBlock["mountPose[" + node + "]"];
         player.setActionThread(mountPose, true, true);
         player["lastWeapon"] = player.getMountedImage(Constants.WeaponSlot).AsString();
         GameConnection client = player["client"];
         if (client.isObject())
             player["lastperson"] = client.isFirstPerson().AsString();
         player.unmountImage(Constants.WeaponSlot);
         player.setControlObject(mountObj);
         if (player.getClassName() == "Player")
             console.commandToClient(player["client"], console.addTaggedString("toggleVehicleMapToggle"), new[] {"true"});
         }
     else
         {
         string pose = vehicleDataBlock["mountPose[" + node + "]"];
         player.setActionThread(pose != string.Empty ? pose : "root", false, true);
         }
 }
public virtual  void onCollision(Projectile proj, SceneObject col, float fade, Point3F pos, Point3F normal){}
public virtual  void onTriggered(ProximityMine obj, SceneObject target){}
 public override void onCollision(ShapeBase obj, SceneObject collObj, Point3F vec, float len)
 {
     // Collision with other objects, including items
 }
 public virtual void teleportPlayer(GameBase gplayer, SceneObject exit)
 {
     Player player = gplayer._ID;
     TransformF targetPosition;
     if (exit["reorientPlayer"].AsBool())
         targetPosition = exit.getTransform();
     else
         {
         targetPosition = exit.getTransform();
         TransformF playerrot = player.getTransform();
         targetPosition.mOrientationX = playerrot.mOrientationX;
         targetPosition.mOrientationY = playerrot.mOrientationY;
         targetPosition.mOrientationZ = playerrot.mOrientationZ;
         targetPosition.MAngle = playerrot.MAngle;
         }
     player.setTransform(targetPosition);
     Point3F playervelocity = player.getVelocity();
     playervelocity = playervelocity.vectorScale(exit["exitVelocityScale"].AsFloat());
     player.setVelocity(playervelocity);
     // Prevent the object from doing an immediate second teleport
     // In the case of a bidirectional teleporter
     player["isTeleporting"] = true.AsString();
 }
        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;
        }
示例#13
0
 public virtual void setMode(Camera camera, string mode, SceneObject arg1, string arg2, string arg3)
 {
 }
示例#14
0
public virtual  void applyDamage(string hitPosition, string hitNormal, SceneObject hitObject){}
示例#15
0
 public override void setMode(Extendable.Camera camera, string mode, SceneObject arg1, string arg2, string arg3)
 {
     switch (mode)
         {
             case "Observer":
                 camera.setFlyMode();
                 break;
             case "Corpse":
                 camera.setOrbitMode(arg1, arg1.getTransform(), (float) 0.5, (float) 4.5, (float) 4.5, false, new Point3F(), false);
                 camera["orbitObj"] = arg1;
                 break;
         }
     camera["mode"] = mode;
 }
 public override void onUnmount(GameBase obj, SceneObject mountObj, int node)
 {
     //todo change to csharp
     mountObj.call("RefreshVehicleHud", "0", string.Empty, string.Empty);
 }
 public override void onMount(GameBase obj, SceneObject mountObj, int node)
 {
     //todo change to csharp
     ((GameConnection) mountObj["client"]).call("RefreshVehicleHud", obj, this["reticle"], this["zoomReticle"]);
 }
示例#18
0
 public override void onMount(GameBase obj, SceneObject mountObj, int node)
 {
     WheeledVehicle vehicle = obj._ID;
     vehicle.setImageAmmo(node, true);
 }
public virtual  void onMountObject(TurretShape turret, SceneObject obj, int node){}
 public override void onTriggered(ProximityMine obj, SceneObject target)
 {
 }
示例#21
0
        public override void onImpact(ShapeBase obj, SceneObject collObj, Point3F vec, float len)
        {
            Player player = obj.getId();
            TransformF p = player.getTransform() + new TransformF(vec);

            float speedDamageScale = len + this["speedDamageScale"].AsFloat();
            //Do not confuse the player.event_damage with the PlayerData.event_damage...
            player.damage(0, p.GetPosition(), speedDamageScale, "Impact");
        }
public virtual  void onUnmount(GameBase obj, SceneObject mountObj, int node){}
示例#23
0
        public override void onUnmount(GameBase obj, SceneObject mountObj, int node)
        {
            Player player = obj.getId();
            if (node != 0)
                return;

            player.mountImage(player["lastWeapon"], Constants.WeaponSlot, true, string.Empty);
            player.setControlObject(string.Empty);

            if (!player["lastperson"].AsBool())
                return;

            GameConnection client = player["client"];
            if (client.isObject())
                client.setFirstPerson(player["lastperson"].AsBool());
        }
示例#24
0
 public override void onObjectAttached(SceneObject obj)
 {
     if (obj["client"].isObject() && this["platform"] != "")
         obj["client.touchedPlatform[" + this["platform"] + "]"] = "true";
 }
public virtual  void onObjectDetached(SceneObject obj){}
public virtual  void onUnmountObject(TurretShape turret, SceneObject obj){}
示例#27
0
        public override void onCollision(ShapeBase obj, SceneObject col, Point3F vec, float len)
        {
            Player player = obj.getId();
            if (player.getState() == "Dead")
                return;
            // Try and pickup all items
            if (col.getClassName() == "Item")
                {
                player.pickup(col.ID, 1);
                return;
                }

            if (col.GetType() != typeof (WheeledVehicle))
                return;

            WheeledVehicle vcol = (WheeledVehicle) col;

            //AI are not allowed to drive they are lousey drivers....
            GameConnection client = player["client"];

            if (!client.isObject())
                return;
            //Mount Vehicle.
            if ((console.getTypeMask(col) & (UInt32) SceneObjectTypesAsUint.GameBaseObjectType) != (UInt32) SceneObjectTypesAsUint.GameBaseObjectType)
                return;
            VehicleData db = vcol.getDataBlock();
            if (!(((db.getClassName() == "WheeledVehicleData") || player["mountVehicle"].AsBool() || player.getState() == "Move" || col["mountable"].AsBool())))
                return;
            // Only mount drivers for now.

            // For this specific example, only one person can fit
            // into a vehicle
            int mount = vcol.getMountNodeObject(0);

            if (mount > 0)
                {
                try
                    {
                    Player p = mount;
                    return;
                    }
                catch (Exception err)
                    {
                    //Water particle emitters seem to take up the seat when the vehicle is in water.
                    vcol.unmountObject(mount.AsString());
                    vcol.mountObject(player, 0, new TransformF());
                    ((GameConnection) player["client"]).setFirstPerson(false);
                    console.commandToClient(client, "PushVehicleMap");
                    }
                }
            else
                {
                vcol.mountObject(player, 0, new TransformF());
                ((GameConnection) player["client"]).setFirstPerson(false);
                console.commandToClient(client, "PushVehicleMap");
                }
            //if (mount > 0)
            //return;
            // For this specific FPS Example, always mount the player to node 0

            player["mVehicle"] = col;
        }