Vehicle dead and door synchronization added

This commit is contained in:
EntenKoeniq
2021-08-14 11:14:34 +02:00
parent 5faac16404
commit ffe808d1ba
6 changed files with 199 additions and 4 deletions

View File

@ -162,6 +162,11 @@ namespace CoopClient
flags |= (byte)VehicleDataFlags.IsSirenActive;
}
if (veh.IsDead)
{
flags |= (byte)VehicleDataFlags.IsDead;
}
return flags;
}
@ -223,6 +228,40 @@ namespace CoopClient
return result;
}
public static Dictionary<int, int> GetVehicleMods(Vehicle veh)
{
Dictionary<int, int> result = new Dictionary<int, int>();
foreach (VehicleMod mod in veh.Mods.ToArray())
{
result.Add((int)mod.Type, mod.Index);
}
return result;
}
public static VehicleDoors[] GetVehicleDoors(VehicleDoorCollection doors)
{
int doorLength = doors.ToArray().Length;
if (doorLength == 0)
{
return null;
}
VehicleDoors[] result = new VehicleDoors[doorLength];
for (int i = 0; i < (doorLength - 1); i++)
{
VehicleDoors currentDoor = new VehicleDoors()
{
AngleRatio = doors[(VehicleDoorIndex)i].AngleRatio,
Broken = doors[(VehicleDoorIndex)i].IsBroken,
Open = doors[(VehicleDoorIndex)i].IsOpen,
FullyOpen = doors[(VehicleDoorIndex)i].IsFullyOpen
};
result[i] = currentDoor;
}
return result;
}
public static Settings ReadSettings()
{
XmlSerializer ser = new XmlSerializer(typeof(Settings));