示例#1
0
        public void ArmorOnDisabled(coPlayerData datablock, coPlayer player, string state)
            {
            player.setImageTrigger(0, false);
            coItem item = (((coItemData)(player.getMountedImage(WeaponSlot)))["item"]);

            if (item.isObject())
                {
                int amount = ShapeBaseShapeBaseGetInventory(player, (item["image.ammo"]));

                if (amount.AsBool())
                    ShapeBaseShapeBaseThrow(player, (item["image.clip"]), 1);
                }
            ShapeBaseTossPatch(player);
            PlayerPlayDeathCry(player);
            PlayerPlayDeathAnimation(player);


            //If it's a player check.....
            coGameConnection client = player["client"];
            if (client.isObject())
                console.commandToClient(client, console.addTaggedString("toggleVehicleMap"), new[] { "false" });

            int ctov = iGlobal["$CorpseTimeoutValue"];

            player.schedule((ctov - 1000).AsString(), "startFade", "1000", "0", "true");
            player.schedule(ctov.AsString(), "delete");
            }
示例#2
0
 public void VehicleDataMountPlayer(coVehicleData thisobj, coVehicle vehicle, coPlayer player)
     {
     if (!vehicle.isObject() || vehicle.getDamageState() == "Destroyed")
         return;
     player.startFade(1000, 0, true);
     thisobj.schedule("1000", "setMountVehicle", vehicle, player);
     player.schedule("1500", "startFade", "1000", "0", "false");
     }
示例#3
0
        public void ArmorDoDismount(coPlayerData datablock, coPlayer player, bool forced)
            {
            coVehicle vehicle = player["mVehicle"];
            if (!vehicle.isObject())
                return;
            if (!player.isMounted())
                return;


            Point3F vvel = vehicle.getVelocity();
            coVehicleData 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.MPosition;
                pos.MPosition.x = 0;
                pos.MPosition.y = 0;
                pos.MPosition.z = 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.MPosition, pos.MPosition))
                        continue;
                    success = i;
                    impulsevec = vecs[i].copy();
                    break;
                    }
                if ((forced) && (success == -1))
                    pos = oldpos.copy();

                player["mountVehicle"] = false.AsString();
                player.schedule("4000", "mountVehicles", "true");
                player.unmount();
                player.setTransform(new TransformF(pos.MPosition.x, pos.MPosition.y, pos.MPosition.z, rot.MOrientation.x, rot.MOrientation.y, rot.MOrientation.z, rot.MAngle));


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

                player.applyImpulse(pos.MPosition, 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
                {
                MessageClient(player["client"], "msgUnmount", @"\c2Cannot exit %1 while moving.", console.GetVarString(vdb + ".nameTag"));
                }
            }