public class NetPackageSpawnVehicleRebirth : NetPackage { public NetPackageSpawnVehicleRebirth Setup(string _className, ItemValue[] _itemValues, int _blockPosX, int _blockPosY, int _blockPosZ, float _durability, int _ownerID) { //Log.Out("NetPackageSpawnVehicleRebirth-Setup START"); this.className = _className; this.itemValues = _itemValues; this.blockPosX = _blockPosX; this.blockPosY = _blockPosY; this.blockPosZ = _blockPosZ; this.durability = _durability; this.ownerID = _ownerID; return this; } public override void read(PooledBinaryReader _reader) { //Log.Out("NetPackageSpawnVehicleRebirth-read START"); this.className = _reader.ReadString(); this.itemValues = GameUtils.ReadItemValueArray((BinaryReader)_reader); this.blockPosX = _reader.ReadInt32(); this.blockPosY = _reader.ReadInt32(); this.blockPosZ = _reader.ReadInt32(); this.durability = _reader.ReadSingle(); this.ownerID = _reader.ReadInt32(); } public override void write(PooledBinaryWriter _writer) { //Log.Out("NetPackageSpawnVehicleRebirth-write START"); base.write(_writer); _writer.Write(this.className); GameUtils.WriteItemValueArray((BinaryWriter)_writer, this.itemValues); _writer.Write(this.blockPosX); _writer.Write(this.blockPosY); _writer.Write(this.blockPosZ); _writer.Write(this.durability); _writer.Write(this.ownerID); } public override void ProcessPackage(World _world, GameManager _callbacks) { //Log.Out("NetPackageSpawnVehicleRebirth-ProcessPackage START"); if (_world == null) { return; } Vector3i vector3i = new Vector3i(this.blockPosX, this.blockPosY, this.blockPosZ); Chunk chunk = (Chunk)GameManager.Instance.World.GetChunkFromWorldPos(vector3i); TileEntityDriveableLootContainer vehicleTE = _world.GetTileEntity(chunk.ClrIdx, vector3i) as TileEntityDriveableLootContainer; if (vehicleTE != null) { GameManager.Instance.StartCoroutine(RebirthUtilities.SpawnVehicleCoroutine( vector3i, this.itemValues, //vehicleTE.itemValues, vehicleTE.vehicleHealth, vehicleTE.GasPerc, vehicleTE.OilPerc, vehicleTE.vehicleHealth, vehicleTE.vehicleHealth, RebirthUtilities.GetBlockAngle(vehicleTE.blockValue.rotation), this.className, this.ownerID )); } } public override int GetLength() { return 26; } public string className; public ItemValue[] itemValues; public int blockPosX; public int blockPosY; public int blockPosZ; public float durability; public int ownerID; }