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" });
            }
 public void DeployableTurretWeaponOnUse(coAITurretShapeData thisobj, coAITurretShape obj)
     {
     console.Call_Classname("Weapon", "onUse", new string[] { thisobj, obj });
     }
 public void DeployableTurretWeaponOnPickup(coAITurretShapeData thisobj, coAITurretShape obj, string shape, string amount)
     {
     console.Call_Classname("Weapon", "onPickup", new string[] { thisobj, obj, shape, amount });
     }
 public void AiTurretShapeDataOnThrown(coAITurretShapeData thisobj, coAITurretShape turret)
     {
     turret.playAudio(0, "TurretThrown");
     }
        public void AITurretShapeData_OnDeploy(coAITurretShapeData thisobj, coAITurretShape turret)
            {
            for (int i = 0; i < thisobj["numWeaponMountPoints"].AsInt(); i++)
                turret.setImageLoaded(i, true);

            turret.playAudio(0, "TurretActivatedSound");
            }
 public void AITurretShapeData_OnNoTarget(coAITurretShapeData thisobj, coAITurretShape turret)
     {
     turret.setAllGunsFiring(false);
     turret.recenterTurret();
     turret.playAudio(0, "TargetLostSound");
     }
 public void AITurretShapeData_OnFiring(coAITurretShapeData thisobj, coAITurretShape turret)
     {
     turret.setAllGunsFiring(true);
     }
 public void AITurretShapeData_OnTarget(coAITurretShapeData thisobj, coAITurretShape turret)
     {
     turret.call("startTrackingTarget");
     turret.playAudio(0, "TargetAquiredSound");
     }
 public void AiTurretShapeDataOnScanning(coAITurretShapeData thisobj, coAITurretShape turret)
     {
     turret.call("startScanForTargets");
     turret.playAudio(0, "TurretScanningSound");
     }
        public void AiTurretShapeData(coAITurretShapeData thisobj, coAITurretShape turret, string lastState, string nameSpaceDepth)
            {
            turret.playAudio(0, "TurretDestroyed");
            turret.setAllGunsFiring(false);
            turret.resetTarget();
            turret.setTurretState("Destroyed", false);


            for (int i = 0; i < thisobj["numWeaponMountPoints"].AsInt(); i++)
                turret.setImageGenericTrigger(i, 0, true);

            int nsd = (nameSpaceDepth.AsInt());
            console.ParentExecute(thisobj, "onDestroyed", nsd, new string[] { thisobj, turret, lastState });
            }
        public string AiTurretShapeDataOnThrow(coAITurretShapeData thisobj, coPlayer user, int amount)
            {
            if (amount == 0)
                amount = 1;

            if (thisobj["maxInventory"] != "")
                if (amount > thisobj["maxInventory"].AsInt())
                    amount = thisobj["maxInventory"].AsInt();

            if (amount == 0)
                return "0";

            ShapeBaseShapeBaseDecInventory(user, thisobj, amount);
            //console.Call(user, "decInventory", new[] {thisobj, amount});
            TransformF rot = new TransformF(user.getEulerRotation());

            Torque_Class_Helper tc_obj = new Torque_Class_Helper("AITurretShape", "");
            tc_obj.Props.Add("datablock", thisobj);
            tc_obj.Props.Add("rotation", string.Format("{0}0 0 1 {1}{0}", '"', rot.MPosition.z));
            tc_obj.Props.Add("count", "1");
            tc_obj.Props.Add("sourceObject", user);
            tc_obj.Props.Add("client", console.GetVarString(string.Format("{0}.client", user)));
            tc_obj.Props.Add("isAiControlled", "1");

            coAITurretShape obj = tc_obj.Create();
            ((coSimSet)"MissionGroup").pushToBack(obj);
            obj.call("addToIgnoreList", user);


            coGameConnection client = user["client"];
            if (client.isObject())
                {
                if (client["ownedTurrets"] == "")
                    client["ownedTurrets"] = new Torque_Class_Helper("SimSet", "").Create().AsString();

                coSimSet SimSet_id = client["ownedTurrets"];
                int countofitems = SimSet_id.getCount();
                for (uint i = 0; i < countofitems; i++)
                    {
                    coAITurretShape turret = SimSet_id.getObject(i);
                    turret.call("addToIgnoreList", obj);
                    obj.call("addToIgnoreList", turret);
                    }
                SimSet_id.pushToBack(obj);
                }

            return obj;
            }
 public void AiTurretShapeDataOnAdd(coAITurretShapeData thisobj, coAITurretShape obj, string nameSpaceDepth)
     {
     int nsd = (nameSpaceDepth.AsInt() + 1);
     console.ParentExecute(thisobj, "onAdd", nsd, new string[] { thisobj, obj });
     obj["mountable"] = false.AsString();
     }