Ejemplo n.º 1
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;
            }
Ejemplo n.º 2
0
        public void DeployableTurretWeaponOnInventory(coAITurretShapeData thisobj, coPlayer obj, int amount)
            {
            if (obj["client"] != "0" && obj["isAiControlled"].AsBool() == false)
                GameConnectionSetAmmoAmountHud(obj["client"], 1, amount);


            //Sometimes....  Alice to the moon.
            /*
             * So here I was thinking that this line of code in the torque script...
             *    if ( !%amount && ( %slot = %obj.getMountSlot( %this.image ) ) != -1 )
             *    was checking to see if the slot was != to -1... but that is not the case.
             *    What it is actually checking is if %slot is blank or not.  As in is the temporary 
             *    variable %slot a variable or not, (i.e. it's id is -1)
             *    
             * It's nice how they use error suppression in there tokens to hide
             * the error message that the function doesn't exist from the console.
             * But... really?  I mean, you couldn't comment that that was what the f**k you
             * where doing??????
             *    
             * Well shit, I do believe there could be an easier way.....
             */
            //error("Amount = " + amount);
            if (amount == 0 && obj.isMethod("getMountSlot"))
                obj.call("cycleWeapon", new[] { "prev" });
            }