示例#1
0
        public void WeaponOnPickup(coScriptObject thisobj, string obj, coShapeBase shape, int amount, int nameSpaceDepth)
        {
            int nsd = (nameSpaceDepth + 1);

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


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

            if (shape.getClassName() == "Player" && shape.getMountedImage(WeaponSlot) == 0)
            {
                shape.call("use", thisobj);
            }
        }
示例#2
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;
        }