Esempio n. 1
0
 public void ArmorOnStopSprintMotion(coPlayerData datablock, coPlayer player)
     {
     player.setImageGenericTrigger(WeaponSlot, 0, false);
     }
Esempio n. 2
0
 public void ArmorOnTrigger(coPlayerData datablock, coPlayer player, string triggernum, string val)
     {
     // This method is invoked when the player receives a trigger move event.
     // The player automatically triggers slot 0 and slot one off of triggers #
     // 0 & 1.  Trigger # 2 is also used as the jump key.
     }
Esempio n. 3
0
 public void ArmorOnPosechange(coPlayerData datablock, coPlayer player, string oldpose, string newpose)
     {
     player.setImageScriptAnimPrefix(WeaponSlot, console.addTaggedString(newpose));
     }
Esempio n. 4
0
 public void ArmorOnEnterLiquid(coPlayerData datablock, coPlayer player, string coverage, string type)
     {
     }
Esempio n. 5
0
 public void ArmorOnLeaveLiquid(coPlayerData datablock, coPlayer player, string type)
     {
     }
Esempio n. 6
0
 public void ArmorOnNewDataBlock(coPlayerData datablock, coPlayer player)
     {
     }
Esempio n. 7
0
 public void ArmorOnEnterMissionArea(coPlayerData datablock, coPlayer player)
     {
     GameConnectionOnEnterMissionArea(player["client"]);
     }
Esempio n. 8
0
        public void ArmorDamage(coPlayerData datablock, coPlayer player, TransformF position, coPlayer sourceobject, float damage, string damageType)
            {
            if (!player.isObject())
                return;
            if (player.getState() == "Dead")
                return;
            if (damage == 0.0)
                return;


            player.applyDamage(damage);

            const string location = "Body";

            //PlayerUpdateHealth(player);

            coGameConnection client = player["client"];
            //Only continue if it is a player, if it is an AI return.
            if (!client.isObject())
                return;


            coGameConnection sourceClient = null;
            if (sourceobject != 0)
                sourceClient = sourceobject["client"];


            if (player.getDamageLevel() >= 99)
                player.unmountImage(0);

            // Determine damage direction
            if (damageType != "Suicide")
                PlayerSetDamageDirection(player, sourceobject, position);

            if (player.getState() == "Dead")
                GameConnectionOnDeath(client, sourceobject, sourceClient, damageType, location);
            }
Esempio n. 9
0
 public void ArmorOnDamage(coPlayerData datablock, coPlayer player, float delta)
     {
     // This method is invoked by the ShapeBase code whenever the
     // object's damage level changes.
     if ((delta <= 0) || player.getState() == "Dead")
         return;
     // Apply a damage flash
     player.setDamageFlash(1);
     // If the pain is excessive, let's hear about it.
     if (delta > 10)
         PlayerPlayPain(player);
     }
Esempio n. 10
0
        public void ArmorOnCollision(coPlayerData datablock, coPlayer player, coShapeBase col)
            {
            if (player.getState() == "Dead")
                return;
            // Try and pickup all items
            if (col.getClassName() == "Item")
                {
                player.call("pickup", col);
                return;
                }
            //AI are not allowed to drive they are lousey drivers....
            coGameConnection client = player["client"];

            if (!client.isObject())
                return;
            //Mount Vehicle.
            if ((console.getTypeMask(col) & (UInt32)SceneObjectTypesAsUint.GameBaseObjectType) != (UInt32)SceneObjectTypesAsUint.GameBaseObjectType)
                return;
            coVehicleData db = col.getDataBlock();
            if (((db.getClassName() == "WheeledVehicleData") || player["mountVehicle"].AsBool() || player.getState() == "Move" || col["mountable"].AsBool()))
                return;
            // Only mount drivers for now.
            ((coGameConnection)player["client"]).setFirstPerson(false);
            // For this specific example, only one person can fit
            // into a vehicle
            int mount = col.getMountNodeObject(0);
            if (mount > 0)
                return;
            // For this specific FPS Example, always mount the player to node 0
            col.mountObject(player, 0, new TransformF(true));
            player["mVehicle"] = col;
            }
Esempio n. 11
0
        public void ArmorOnImpact(coPlayerData datablock, coPlayer player, coShapeBase collidedObject, TransformF vec, float vecLen)
            {
            TransformF p = player.getTransform();
            p = p + vec;
            float speedDamageScale = vecLen + datablock["speedDamageScale"].AsFloat();

            ShapeBaseDamage(player, "0", p.MPosition, speedDamageScale, "Impact");
            }
Esempio n. 12
0
        public void ArmorDoDismount(coPlayerData datablock, coPlayer player, bool forced)
            {
            coVehicle vehicle = player["mVehicle"];
            if (!vehicle.isObject())
                return;
            if (!player.isMounted())
                return;


            Point3F vvel = vehicle.getVelocity();
            coVehicleData vdb = vehicle.getDataBlock();
            int maxDismountSpeed = vdb["maxDismountSpeed"].AsInt();
            if ((vvel.len() <= maxDismountSpeed) || (forced))
                {
                TransformF pos = player.getTransform();
                TransformF rot = pos;
                TransformF oldpos = pos.copy();

                List<Point3F> vecs = new List<Point3F> { new Point3F(-1, 0, 0), new Point3F(0, 0, 1), new Point3F(0, 0, -1), new Point3F(1, 0, 0), new Point3F(0, -1, 0), new Point3F(0, 0, 0) };

                Point3F impulsevec = new Point3F(0, 0, 0);


                TransformF r = math.MatrixMulVector(player.getTransform(), vecs[0]);

                vecs[0] = r.MPosition;
                pos.MPosition.x = 0;
                pos.MPosition.y = 0;
                pos.MPosition.z = 0;

                const int numofAttempts = 5;
                int success = -1;

                for (int i = 0; i < numofAttempts; i++)
                    {
                    Point3F vectorscale = vecs[i].vectorScale(3);

                    pos = oldpos + new TransformF(vectorscale);
                    if (!player.checkDismountPoint(oldpos.MPosition, pos.MPosition))
                        continue;
                    success = i;
                    impulsevec = vecs[i].copy();
                    break;
                    }
                if ((forced) && (success == -1))
                    pos = oldpos.copy();

                player["mountVehicle"] = false.AsString();
                player.schedule("4000", "mountVehicles", "true");
                player.unmount();
                player.setTransform(new TransformF(pos.MPosition.x, pos.MPosition.y, pos.MPosition.z, rot.MOrientation.x, rot.MOrientation.y, rot.MOrientation.z, rot.MAngle));


                Point3F velo = impulsevec.vectorScale(player["mass"].AsFloat());
                velo.z = 1;

                player.applyImpulse(pos.MPosition, velo);


                Point3F vel = player.getVelocity();
                float vec = Point3F.vectorDot(vel, vel.normalizeSafe());
                if (vec > 50)
                    {
                    float scale = 50 / vec;
                    player.setVelocity(vel.vectorScale(scale));
                    }
                }
            else
                {
                MessageClient(player["client"], "msgUnmount", @"\c2Cannot exit %1 while moving.", console.GetVarString(vdb + ".nameTag"));
                }
            }
Esempio n. 13
0
        public void ArmorOnUnmount(coPlayerData datablock, coPlayer player, coVehicle vehicle, int node)
            {
            if (node != 0)
                return;

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

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

            coGameConnection client = player["client"];
            if (client.isObject())
                client.setFirstPerson(player["lastperson"].AsBool());
            }
Esempio n. 14
0
        public void ArmorOnMount(coPlayerData datablock, coPlayer player, coVehicle vehicle, int node)
            {
            coVehicleData vehicleDataBlock = vehicle.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(WeaponSlot).AsString();


                coGameConnection client = player["client"];
                if (client.isObject())
                    player["lastperson"] = client.isFirstPerson().AsString();

                player.unmountImage(WeaponSlot);


                player.setControlObject(vehicle);

                if (player.getClassName() == "Player")
                    {
                    console.commandToClient(player["client"], console.addTaggedString("toggleVehicleMap"), new[] { "true" });
                    }
                }
            else
                {
                string pose = vehicleDataBlock["mountPose[" + node + "]"];
                player.setActionThread(pose != "" ? pose : "root", false, true);
                }
            }
Esempio n. 15
0
 public void ArmorOnAdd(coPlayerData datablock, coPlayer player)
     {
     player["mountVehicle"] = true.AsString();
     player.setRechargeRate(datablock["rechargeRate"].AsFloat());
     player.setRepairRate(0);
     //player.schedule("50", "updateHealth");
     }
Esempio n. 16
0
        public void ArmorOnDisabled(coPlayerData datablock, coPlayer player, string state)
            {
            player.setImageTrigger(0, false);
            coItem item = (((coItemData)(player.getMountedImage(WeaponSlot)))["item"]);

            if (item.isObject())
                {
                int amount = ShapeBaseShapeBaseGetInventory(player, (item["image.ammo"]));

                if (amount.AsBool())
                    ShapeBaseShapeBaseThrow(player, (item["image.clip"]), 1);
                }
            ShapeBaseTossPatch(player);
            PlayerPlayDeathCry(player);
            PlayerPlayDeathAnimation(player);


            //If it's a player check.....
            coGameConnection client = player["client"];
            if (client.isObject())
                console.commandToClient(client, console.addTaggedString("toggleVehicleMap"), new[] { "false" });

            int ctov = iGlobal["$CorpseTimeoutValue"];

            player.schedule((ctov - 1000).AsString(), "startFade", "1000", "0", "true");
            player.schedule(ctov.AsString(), "delete");
            }
        public void ServerCmdMissionStartPhase2Ack(coGameConnection client, string seq, coPlayerData playerDB)
            {
            // Make sure to ignore calls from a previous mission load
            if (seq != sGlobal["$missionSequence"] || !missionRunning)
                return;
            if (client["currentPhase"].AsDouble() != 1.5)
                return;

            client["currentPhase"] = "2";
            // Set the player datablock choice

            client["playerDB"] = playerDB;

            // Update mod paths, this needs to get there before the objects.
            client.transmitPaths();

            // Start ghosting objects to the client
            client.activateGhosting();
            }
Esempio n. 18
0
 public void ArmorOnRemove(coPlayerData datablock, coPlayer player)
     {
     if (player["client.player"] == player)
         player["client.player"] = "0";
     }