예제 #1
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" });
            }
        }
예제 #2
0
        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();
        }
예제 #3
0
        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");
        }
예제 #4
0
        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 });
        }
예제 #5
0
 public void DeployableTurretWeaponOnPickup(coAITurretShapeData thisobj, coAITurretShape obj, string shape, string amount)
 {
     console.Call_Classname("Weapon", "onPickup", new string[] { thisobj, obj, shape, amount });
 }
예제 #6
0
 public void DeployableTurretWeaponOnUse(coAITurretShapeData thisobj, coAITurretShape obj)
 {
     console.Call_Classname("Weapon", "onUse", new string[] { thisobj, obj });
 }
예제 #7
0
 public void AiTurretShapeDataOnThrown(coAITurretShapeData thisobj, coAITurretShape turret)
 {
     turret.playAudio(0, "TurretThrown");
 }
예제 #8
0
 public void AITurretShapeData_OnFiring(coAITurretShapeData thisobj, coAITurretShape turret)
 {
     turret.setAllGunsFiring(true);
 }
예제 #9
0
 public void AITurretShapeData_OnNoTarget(coAITurretShapeData thisobj, coAITurretShape turret)
 {
     turret.setAllGunsFiring(false);
     turret.recenterTurret();
     turret.playAudio(0, "TargetLostSound");
 }
예제 #10
0
 public void AITurretShapeData_OnTarget(coAITurretShapeData thisobj, coAITurretShape turret)
 {
     turret.call("startTrackingTarget");
     turret.playAudio(0, "TargetAquiredSound");
 }
예제 #11
0
 public void AiTurretShapeDataOnScanning(coAITurretShapeData thisobj, coAITurretShape turret)
 {
     turret.call("startScanForTargets");
     turret.playAudio(0, "TurretScanningSound");
 }
예제 #12
0
        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);
        }