Esempio n. 1
0
        public void TurretShapeData_OnAdd(coTurretShapeData thisobj, coShapeBase obj)
            {
            obj.setRechargeRate(thisobj["rechargeRate"].AsFloat());
            obj.setEnergyLevel(thisobj["MaxEnergy"].AsFloat());
            obj.setRepairRate(0);


            if (obj["mountable"] == "1" || obj["mountable"] == "")
                thisobj.call("isMountable", obj, true.AsString());
            else
                thisobj.call("isMountable", obj, false.AsString());

            if (thisobj["nameTag"] != "")
                obj.setShapeName(thisobj["nameTag"]);
            for (int i = 0; i < thisobj["numWeaponMountPoints"].AsInt(); i++)
                {
                ShapeBaseShapeBaseIncInventory(obj, thisobj["weapon[" + i + "]"], 1);

                coItemData weaponAmmo = thisobj["weaponAmmo[" + i + "]"];


                string weaponAmmoAmount = thisobj["weaponAmmoAmount[" + i + "]"];
                ShapeBaseShapeBaseIncInventory(obj, weaponAmmo, weaponAmmoAmount.AsInt());


                bool startLoaded = thisobj["startLoaded"].AsBool();

                obj.mountImage(thisobj["weapon[" + i + "].Image"], i, startLoaded, "");
                obj.setImageGenericTrigger(i, 0, false);
                }
            if (thisobj["enterSequence"] != "")
                {
                obj["entranceThread"] = "0";
                int et = obj["entranceThread"].AsInt();
                string es = thisobj["enterSequence"];
                obj.playThread(et, es);
                obj.pauseThread(et);
                }
            else
                {
                obj["entranceThread"] = "-1";
                }
            }
Esempio n. 2
0
 public void TurretShapeDataOnMount(coTurretShapeData thisobj, coTurretShape turret, coShapeBase player, int node)
     {
     ((coGameConnection)player["client"]).call("RefreshVehicleHud", turret, thisobj["reticle"], thisobj["zoomReticle"]);
     }
Esempio n. 3
0
 public void TurretShapeDataOnUnmount(coTurretShapeData thisobj, coTurretShape turret, coShapeBase player, int node)
     {
     player.call("RefreshVehicleHud", "0", "", "");
     }
Esempio n. 4
0
 public int TurrestshapeDataFindEmptySeat(coTurretShapeData thisobj, coTurretShape turret, coShapeBase player)
     {
     for (int i = 0; i < thisobj["numMountPoints"].AsInt(); i++)
         {
         int node = turret.getMountNodeObject(i);
         if (node == 0)
             return i;
         }
     return -1;
     }
Esempio n. 5
0
 public int TurrestShapeDataSwitchSeats(coTurretShapeData thisobj, coTurretShape turret, coShapeBase player)
     {
     for (int i = 0; i < thisobj["numMountPoints"].AsInt(); i++)
         {
         int node = turret.getMountNodeObject(i);
         if (node == player || node != 0)
             continue;
         if (node == 0)
             return i;
         }
     return -1;
     }
Esempio n. 6
0
 public void TurretShapeDataMountPlayer(coTurretShapeData thisobj, coTurretShape turret, coShapeBase player)
     {
     if (turret.isObject() && turret.getDamageState() != "Destroyed")
         turret.call("setMountTurret", player);
     }
Esempio n. 7
0
        public void TurretShapeDataSetMountTurret(coTurretShapeData thisobj, coTurretShape turret, coShapeBase player)
            {
            if (!turret.isObject() || turret.getDamageState() == "Destroyed")
                return;
            int node = thisobj.call("findEmptySeat", turret, player).AsInt();
            if (node < 0)
                return;
            turret.mountObject(player, node, new TransformF("0 0 0"));

            player["mVehicle"] = turret;
            }
Esempio n. 8
0
        public void TurretShapeDataOnMountObject(coTurretShapeData thisobj, coTurretShape turret, coShapeBase player, int node)
            {
            if (turret["entranceThread"].AsInt() < 0)
                return;

            int et = turret["entranceThread"].AsInt();

            turret.setThreadDir(et, false);
            turret.setThreadPosition(et, 0);
            turret.playThread(et, "");
            }
Esempio n. 9
0
        public void TurretShapeDataOnUnmountObject(coTurretShapeData thisobj, coTurretShape turret, coShapeBase player)
            {
            if (turret["entranceThread"].AsInt() < 0)
                return;

            int et = turret["entranceThread"].AsInt();

            // Play the entrance thread backwards for an exit

            turret.setThreadDir(et, false);
            turret.setThreadPosition(et, (float)1.0);
            turret.playThread(et, "");
            }
Esempio n. 10
0
 public void TurrestShapeDataOnEnable(coTurretShapeData thisobj, coTurretShape obj, string laststate)
     {
     // This method is invoked by the ShapeBase code whenever the
     // object's damage state changes.
     }
Esempio n. 11
0
 public void TurretShapeDataIsMountable(coTurretShapeData thisobj, coTurretShape obj, string val)
     {
     obj["mountable"] = val;
     }
Esempio n. 12
0
        public void TurretShapeDataOnDestroy(coTurretShapeData thisobj, coTurretShape obj, string laststate)
            {
            // This method is invoked by the ShapeBase code whenever the
            // object's damage state changes.

            // Fade out the destroyed object.  Then schedule a return.
            int destroydelay = iGlobal["$TurretShape::DestroyedFadeDelay"];
            obj.startFade(1000, destroydelay, true);

            obj.schedule((destroydelay + 1000).AsString(), "delete");

            if (obj.call("doRespawn") != "")
                ((coSimSet)"MissionGroup").schedule(sGlobal["$TurretShape::RespawnTime"], "respawnTurret", thisobj, console.GetClassName(obj), obj.getTransform().AsString(), true.AsString(), true.AsString());
            }
Esempio n. 13
0
 private void TurretShapeData_onDamage(coTurretShapeData thisobj, coTurretShape obj, float delta)
     {
     // This method is invoked by the ShapeBase code whenever the
     // object's damage level changes.
     }
Esempio n. 14
0
        private void TurretShapeData_damage(coTurretShapeData thisobj, coTurretShape turret, TransformF position, coShapeBase sourceobject, float damage, string datatype)
            {
            if (turret.getDamageState() == "Dead")
                return;

            turret.applyDamage(damage);

            // Update the numerical Health HUD
            coShapeBase mountedobject = turret.getObjectMount();

            //if (mountedobject != 0)
            //    console.Call(mountedobject, "updateHealth");
            if (turret.getState() != "Dead")
                return;

            for (int i = 0; i < thisobj["numMountPoints"].AsInt(); i++)
                {
                coShapeBase player = turret.getMountNodeObject(i);
                if (player != 0)
                    console.Call(player, "killWithSource", new[] { "sourceobject", "InsideTurret" });
                }
            }
Esempio n. 15
0
        public string MissionGroupRespawnTurret(coSimSet thisobj, coTurretShapeData datablock, coTurretShape classname, TransformF transform, bool isstatic, bool respawn)
            {
            Torque_Class_Helper turret = new Torque_Class_Helper(classname, "");
            turret.Props.Add("datablock", datablock);
            turret.Props.Add("static", isstatic.AsString());
            turret.Props.Add("respawn", respawn.AsString());
            coTurretShape turretid = turret.Create();

            turretid.setTransform(transform);
            ((coSimSet)"MissioinGroup").pushToBack(turretid);
            return turretid;
            }
Esempio n. 16
0
        public void TurretShapeData_OnRemove(coTurretShapeData thisobj, coShapeBase obj)
            {
            for (int i = 0; i < thisobj["numMountPoints"].AsInt(); i++)
                {
                if (obj.getMountNodeObject(i) == 0)
                    continue;

                coPlayer passenger = obj.getMountNodeObject(i).AsString();


                ((coTurretShapeData)passenger.getDataBlock()).call("doDismount", true.AsString());
                }
            }