Ejemplo n.º 1
0
        private void RetrieveVehicle(InteractableVehicle desiredVehicle, InteractableVehicle newVehicle, UnturnedPlayer uPlayer)
        {
            uint instanceID = newVehicle.instanceID;

            VehicleManager.instance.channel.send("tellVehicleHealth", ESteamCall.ALL, ESteamPacket.UPDATE_UNRELIABLE_BUFFER, new object[2]
            {
                (object)instanceID,
                (object)desiredVehicle.health
            });

            VehicleManager.instance.channel.send("tellVehicleFuel", ESteamCall.ALL, ESteamPacket.UPDATE_UNRELIABLE_BUFFER, new object[2]
            {
                (object)instanceID,
                (object)desiredVehicle.fuel
            });

            VehicleManager.instance.channel.send("tellVehicleBatteryCharge", ESteamCall.ALL, ESteamPacket.UPDATE_UNRELIABLE_BUFFER, new object[2]
            {
                (object)instanceID,
                (object)desiredVehicle.batteryCharge
            });

            VehicleManager.instance.channel.send("tellVehicleLock", ESteamCall.ALL, ESteamPacket.UPDATE_UNRELIABLE_BUFFER, new object[4]
            {
                (object)instanceID,
                (object)uPlayer.CSteamID,
                (object)uPlayer.SteamGroupID,
                (object)true
            });

            for (int i = 0; i < newVehicle.tires.Length; i++)
            {
                if (!desiredVehicle.tires[i].isAlive)
                {
                    newVehicle.tires[i].isAlive = false;
                    newVehicle.sendTireAliveMaskUpdate();
                }
            }

            if (desiredVehicle.headlightsOn)
            {
                VehicleManager.instance.channel.send("tellVehicleHeadlights", ESteamCall.ALL, ESteamPacket.UPDATE_UNRELIABLE_BUFFER, new object[2]
                {
                    (object)instanceID,
                    (object)desiredVehicle.headlightsOn
                });
            }

            if (desiredVehicle.sirensOn)
            {
                VehicleManager.instance.channel.send("tellVehicleSirens", ESteamCall.ALL, ESteamPacket.UPDATE_UNRELIABLE_BUFFER, new object[2]
                {
                    (object)instanceID,
                    (object)desiredVehicle.sirensOn
                });
            }

            for (int i = 0; i < desiredVehicle.turrets.Length; i++)
            {
                newVehicle.turrets[i].state[10] = (byte)desiredVehicle.turrets[i].state[10];
            }

            if (VehicleTeleporter.Instance.Configuration.Instance.RemoveVehicleOnGet)
            {
                VehicleManager.askVehicleDestroy(desiredVehicle);
                VehicleManager.instance.channel.send("tellVehicleDestroy", ESteamCall.ALL, ESteamPacket.UPDATE_RELIABLE_BUFFER, desiredVehicle.instanceID);
            }

            return;
        }