public static void serverCmdcarUnmountObj(GameConnection client, Player obj)
        {
            obj.unmount();
            obj.setControlObject(obj);

            TransformF ejectpos = obj.getTransform();
            ejectpos += new TransformF(0, 0, 5);
            obj.setTransform(ejectpos);

            Vehicle mvehicle = obj["mVehicle"];

            Point3F ejectvel = mvehicle.getVelocity();
            ejectvel += new Point3F(0, 0, 10);

            ejectvel = ejectvel.vectorScale(((SimDataBlock) (obj.getDataBlock()))["mass"].AsFloat());

            obj.applyImpulse(ejectpos.GetPosition(), ejectvel);
        }
Exemplo n.º 2
0
 public virtual void mountPlayer(Vehicle vehicle, Player player)
 {
     if (!vehicle.isObject() || vehicle.getDamageState() == "Destroyed")
         return;
     player.startFade(1000, 0, true);
     this.schedule("1000", "setMountVehicle", vehicle, player);
     player.schedule("1500", "startFade", "1000", "0", "false");
 }
Exemplo n.º 3
0
 public virtual int findEmptySeat(Vehicle vehicle, Player player)
 {
     for (int i = 0; i < this["numMountPoints"].AsInt(); i++)
         {
         int node = vehicle.getMountNodeObject(i);
         if (node != 0)
             return i;
         }
     return -1;
 }
Exemplo n.º 4
0
 public virtual int switchSeats(Vehicle vehicle, Player player)
 {
     for (int i = 0; i < this["numMountPoints"].AsInt(); i++)
         {
         int node = vehicle.getMountNodeObject(i);
         if (node == player || node > 0)
             continue;
         if (node == 0)
             return i;
         }
     return -1;
 }
Exemplo n.º 5
0
public virtual  void onStartSwim(Player obj){}
Exemplo n.º 6
0
        public virtual void setMountVehicle(Vehicle vehicle, Player player)
        {
            if (!vehicle.isObject() || vehicle.getDamageState() == "Destroyed")
                return;

            int node = findEmptySeat(vehicle, player);
            if (node == -1)
                return;
            vehicle.mountObject(player, node, new TransformF());
            player["mVehicle"] = vehicle;
        }
Exemplo n.º 7
0
public virtual  void animationDone(Player obj){}
Exemplo n.º 8
0
        public virtual TransformF PointInSpawnSphere(Player objectToSpawn, SpawnSphere spawnSphere)
        {
            bool spawnLocationFound = false;
            int attemptsToSpawn = 0;

            TransformF spherLocationP3F = new TransformF();

            while (!spawnLocationFound && attemptsToSpawn < 5)
                {
                spherLocationP3F = spawnSphere.getTransform();

                Random r = new Random();

                float angleY = (float) tMath.mDegToRad((r.NextDouble()*100)*tMath.M_2PI_F);
                float angleXZ = (float) tMath.mDegToRad((r.NextDouble()*100)*tMath.M_2PI_F);

                int radius = spawnSphere["radius"].AsInt();
                spherLocationP3F.mPositionX += (float) (Math.Cos(angleY)*Math.Sin(angleXZ)*(r.Next(radius*-1, radius)));
                spherLocationP3F.mPositionY += (float) (Math.Cos(angleXZ)*(r.Next(radius*-1, radius)));
                spawnLocationFound = true;

                // Now have to check that another object doesn't already exist at this spot.
                // Use the bounding box of the object to check if where we are about to spawn in is
                // clear.

                TransformF boundingboxsize = new TransformF(((SimDataBlock) objectToSpawn.getDataBlock())["boundingBox"]);
                float searchRadius = boundingboxsize.mPositionX;
                float boxSizeY = boundingboxsize.mPositionY;
                if (boxSizeY > searchRadius)
                    searchRadius = boxSizeY;
                List<UInt32> objectsfound = console.ContainerRadiusSearch(spherLocationP3F.GetPosition(), searchRadius, (UInt32) SceneObjectTypesAsUint.PlayerObjectType, false);
                if (objectsfound.Count > 0)
                    spawnLocationFound = false;

                attemptsToSpawn++;
                }
            if (!spawnLocationFound)
                {
                spherLocationP3F = spawnSphere.getTransform();
                console.warn("WARNING: Could not spawn player after 5 times");
                }
            return spherLocationP3F;
        }
Exemplo n.º 9
0
public virtual  void onEnterLiquid(Player obj, float coverage, string type){}
Exemplo n.º 10
0
public virtual  void onLeaveLiquid(Player obj, string type){}
Exemplo n.º 11
0
public virtual  void doDismount(Player obj){}
Exemplo n.º 12
0
public virtual  void onStopSprintMotion(Player obj){}
Exemplo n.º 13
0
public virtual  void onStopSwim(Player obj){}
Exemplo n.º 14
0
 public virtual float GetTargetDistance(Player target)
 {
     return Util.VectorDist(target.getPosition(), getWorldBoxCenter());
 }
Exemplo n.º 15
0
public virtual  void onEnterMissionArea(Player obj){}
Exemplo n.º 16
0
        public virtual bool TargetIsInLos(Player target)
        {
            const uint mask = (uint) (SceneObjectTypesAsUint.StaticObjectType | SceneObjectTypesAsUint.TerrainObjectType);

            string collision = Util.containerRayCast(getEyePoint(), target.getEyePoint(), mask, this, true);
            if (collision == "0")
                return true;

            string hit = collision.Split(' ')[0];
            return hit == target.ID;
        }
Exemplo n.º 17
0
public virtual  void onLeaveMissionArea(Player obj){}
Exemplo n.º 18
0
        public virtual void LoadOut(Player player)
        {
            player.clearWeaponCycle();

            player.setInventory("Ryder", 1);
            player.setInventory("RyderClip", player.maxInventory("RyderClip"));
            player.setInventory("RyderAmmo", player.maxInventory("RyderAmmo"));

            player.addToWeaponCycle("Ryder");

            player.setInventory("Lurker", 1);
            player.setInventory("LurkerClip", player.maxInventory("LurkerClip"));
            player.setInventory("LurkerAmmo", player.maxInventory("LurkerAmmo"));

            player.addToWeaponCycle("Lurker");

            player.setInventory("LurkerGrenadeLauncher", 1);
            player.setInventory("LurkerGrenadeAmmo", player.maxInventory("LurkerGrenadeAmmo"));

            player.addToWeaponCycle("LurkerGrenadeLauncher");

            player.setInventory("ProxMine", player.maxInventory("ProxMine"));

            player.addToWeaponCycle("ProxMine");

            player.setInventory("DeployableTurret", player.maxInventory("DeployableTurret"));
            player.addToWeaponCycle("DeployableTurret");

            SimDataBlock playerdatablock = player.getDataBlock();
            string junk = playerdatablock["mainWeapon.image"];

            player.mountImage(junk == string.Empty ? "LurkerWeaponImage" : junk, 0, true, string.Empty);

            //ShapeBase.mountImage(player, junk == "" ? junk : "LurkerWeaponImage", 0, true, "");
        }
Exemplo n.º 19
0
public virtual  void onPoseChange(Player obj, string oldPose, string newPose){}