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 onEnterMissionArea(Player obj){}
Exemplo n.º 3
0
public virtual  void animationDone(Player obj){}
Exemplo n.º 4
0
 public override void onEnterMissionArea(Player obj)
 {
     ((GameConnection) obj["client"]).onEnterMissionArea();
 }
Exemplo n.º 5
0
 public virtual float GetTargetDistance(Player target)
 {
     return Util.VectorDist(target.getPosition(), getWorldBoxCenter());
 }
Exemplo n.º 6
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.º 7
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.º 8
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.º 9
0
public virtual  void onStartSwim(Player obj){}
Exemplo n.º 10
0
public virtual  void onPoseChange(Player obj, string oldPose, string newPose){}
Exemplo n.º 11
0
 public override void onStopSprintMotion(Player obj)
 {
     obj.setImageGenericTrigger(Constants.WeaponSlot, 0, false);
 }
Exemplo n.º 12
0
 public override void onPoseChange(Player obj, string oldPose, string newPose)
 {
     obj.setImageScriptAnimPrefix(Constants.WeaponSlot, Util.addTaggedString(newPose));
 }
Exemplo n.º 13
0
 public override void onLeaveLiquid(Player obj, string type)
 {
 }
Exemplo n.º 14
0
 public override void onEnterLiquid(Player obj, float coverage, string type)
 {
 }
Exemplo n.º 15
0
public virtual  void onLeaveMissionArea(Player obj){}
Exemplo n.º 16
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.º 17
0
public virtual  void onStopSwim(Player obj){}
Exemplo n.º 18
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.º 19
0
public virtual  void onStopSprintMotion(Player obj){}
Exemplo n.º 20
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.º 21
0
public virtual  void doDismount(Player obj){}
Exemplo n.º 22
0
public virtual  void onEnterLiquid(Player obj, float coverage, string type){}
Exemplo n.º 23
0
public virtual  void onLeaveLiquid(Player obj, string type){}
Exemplo n.º 24
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.º 25
0
        public override void doDismount(Player obj)
        {
            Player player = obj.getId();

            Vehicle vehicle = player["mVehicle"];
            if (!vehicle.isObject())
                return;
            if (!player.isMounted())
                return;

            Point3F vvel = vehicle.getVelocity();
            VehicleData vdb = vehicle.getDataBlock();
            int maxDismountSpeed = vdb["maxDismountSpeed"].AsInt();
            if ((vvel.len() <= maxDismountSpeed)) //|| (forced))
                {
                TransformF pos = player.getTransform();
                TransformF rot = pos;
                TransformF oldpos = pos.copy();

                List<Point3F> vecs = new List<Point3F> {new Point3F(-1, 0, 0), new Point3F(0, 0, 1), new Point3F(0, 0, -1), new Point3F(1, 0, 0), new Point3F(0, -1, 0), new Point3F(0, 0, 0)};

                Point3F impulsevec = new Point3F(0, 0, 0);

                TransformF r = math.MatrixMulVector(player.getTransform(), vecs[0]);

                vecs[0] = r.GetPosition();
                pos.mPositionX = 0;
                pos.mPositionY = 0;
                pos.mPositionZ = 0;

                const int numofAttempts = 5;
                int success = -1;

                for (int i = 0; i < numofAttempts; i++)
                    {
                    Point3F vectorscale = vecs[i].vectorScale(3);

                    pos = oldpos + new TransformF(vectorscale);
                    if (!player.checkDismountPoint(oldpos.GetPosition(), pos.GetPosition()))
                        continue;
                    success = i;
                    impulsevec = vecs[i].copy();
                    break;
                    }
                //if ((forced) && (success == -1))
                if (success == -1)
                    pos = oldpos.copy();

                player["mountVehicle"] = false.AsString();
                player.schedule("4000", "mountVehicles", "true");
                player.unmount();
                player.setTransform(new TransformF(pos.mPositionX, pos.mPositionY, pos.mPositionZ, rot.mOrientationX, rot.mOrientationY, rot.mOrientationZ, rot.MAngle));

                Point3F velo = impulsevec.vectorScale(player["mass"].AsFloat());
                velo.z = 1;

                player.applyImpulse(pos.GetPosition(), velo);

                Point3F vel = player.getVelocity();
                float vec = Point3F.vectorDot(vel, vel.normalizeSafe());
                if (vec > 50)
                    {
                    float scale = 50/vec;
                    player.setVelocity(vel.vectorScale(scale));
                    }
                }
            else
                message.MessageClient(player["client"], "msgUnmount", @"\c2Cannot exit %1 while moving.", console.GetVarString(vdb + ".nameTag"));
        }