コード例 #1
0
        public void WeaponOnUser(coScriptObject data, coPlayer obj)
            {
            if (obj.getMountedImage(WeaponSlot) == data["image"].AsInt())
                return;

            AudioServerPlay3D("WeaponUseSound", obj.getTransform());


            obj.mountImage(data["image"], WeaponSlot, true, "");

            if (obj["client"].AsBool())
                {
                if (data["description"] != "")

                    MessageClient(obj["client"], "MsgWeaponUsed", "\\c3%1 \\c5 selected.", data["description"]);
                else
                    MessageClient(obj["client"], "MsgWeaponUsed", console.addTaggedString(@"\c0Weapon selected"));
                }

            if (obj.isInNamespaceHierarchy("Player"))
                return;

            obj.allowAllPoses();
            coSimObject image = data["image"];

            if (image["jumpingDisallowed"].AsBool())
                obj.allowJumping(false);

            if (image["jetJumpingDisallowed"].AsBool())
                obj.allowJetJumping(false);

            if (image["sprintDisallowed"].AsBool())
                obj.allowSprinting(false);

            if (image["crouchDisallowed"].AsBool())
                obj.allowCrouching(false);

            if (image["proneDisallowed"].AsBool())
                obj.allowProne(false);

            if (image["swimmingDisallowed"].AsBool())
                obj.allowSwimming(false);
            }
コード例 #2
0
        public void AmmoOnInventory(coItemData thisobj, coPlayer player, int amount)
            {
            coGameConnection client = player["client"];
            for (int i = 0; i < 8; i++)
                {
                coItemData image = player.getMountedImage(i);
                if (image <= 0)
                    continue;

                if (!image["ammo"].isObject())
                    continue;
                if (console.Call(image["ammo"], "getID") != console.Call(thisobj, "getID"))
                    continue;


                player.setImageAmmo(i, amount != 0);

                int currentammo = ShapeBaseShapeBaseGetInventory(player, thisobj);

                if (player.getClassName() != "Player")
                    continue;

                int amountInClips;

                if (thisobj["clip"].isObject())
                    {
                    amountInClips = ShapeBaseShapeBaseGetInventory(player, thisobj["clip"]);

                    amountInClips *= thisobj["maxInventory"].AsInt();

                    amountInClips += player["remaining" + thisobj.getName()].AsInt();
                    }
                else
                    {
                    amountInClips = currentammo;
                    currentammo = 1;
                    }
                if (player["client"] != "" && !player["isAiControlled"].AsBool())
                    {
                    GameConnectionSetAmmoAmountHud(client, currentammo, amountInClips);
                    }
                }
            }
コード例 #3
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");
            }
コード例 #4
0
        public void AmmoClipOnPickup(coItem thisobj, string obj, coPlayer shape, string amount, int nameSpaceDepth)
            {
            int nsd = nameSpaceDepth + 1;

            if (!console.ParentExecute(thisobj, "onPickup", nsd, new string[] { thisobj, obj, shape, amount }).AsBool())
                return;

            AudioServerPlay3D("WeaponPickupSound", shape.getTransform());

            coItemData image = shape.getMountedImage(WeaponSlot);

            if (image == 0)
                return;

            if (!console.isField(image, "clip") || console.Call(string.Format("{0}.clip", image), "getID") != console.Call(thisobj, "getID"))
                return;

            bool outOfAmmo = !shape.getImageAmmo(WeaponSlot);

            int amountInClips = 0;

            int currentAmmo = ShapeBaseShapeBaseGetInventory(shape, image["ammo"]);

            if (console.isObject(image["clip"]))
                amountInClips = ShapeBaseShapeBaseGetInventory(shape, image["clip"]);

            int t = console.GetVarInt(string.Format("{0}.ammo.maxInventory", image));

            amountInClips *= t;

            int amountloadedingun = console.GetVarInt(string.Format("{0}.remaining{1}", obj, console.GetVarString(string.Format("{0}.ammo", this))));

            amountInClips += amountloadedingun;



            GameConnectionSetAmmoAmountHud(shape["client"], currentAmmo, amountInClips);

            if (outOfAmmo)
                console.Call(image, "onClipEmpty", new string[] { shape, WeaponSlot.AsString() });
            }
コード例 #5
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);
                }
            }