Added tuning support for colored lights
This commit is contained in:
@@ -47,17 +47,23 @@ namespace reallife_gamemode.Server.Managers
|
||||
|
||||
|
||||
veh.SetSharedData("mod18", false);
|
||||
veh.SetSharedData("mod22", false);
|
||||
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
foreach(VehicleMod vMod in dbContext.VehicleMods.ToList().FindAll(vM => vM.ServerVehicleId == sVeh.Id))
|
||||
{
|
||||
if(vMod.Slot == 18 || vMod.Slot == 22)
|
||||
if(vMod.Slot == 18)
|
||||
{
|
||||
veh.SetSharedData("mod" + vMod.Slot, true);
|
||||
}
|
||||
veh.SetMod(vMod.Slot, vMod.ModId - 1);
|
||||
else if(vMod.Slot == 22)
|
||||
{
|
||||
int color = vMod.ModId - 2;
|
||||
if (vMod.ModId == 0) color = -1;
|
||||
if (vMod.ModId == 1) color = 13;
|
||||
veh.SetSharedData("headlightColor", color);
|
||||
}
|
||||
else veh.SetMod(vMod.Slot, vMod.ModId - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -83,13 +89,24 @@ namespace reallife_gamemode.Server.Managers
|
||||
Vehicle pV = player.Vehicle;
|
||||
if (index == 0) index--;
|
||||
|
||||
if(slot != 18 && slot != 22)
|
||||
if(slot != 18)
|
||||
{
|
||||
pV.SetMod(slot, index - 1);
|
||||
if(slot == 22)
|
||||
{
|
||||
int color = index - 2;
|
||||
if (index == 0) color = -1;
|
||||
if (index == 1) color = 13;
|
||||
pV.SetSharedData("headlightColor", color);
|
||||
}
|
||||
else
|
||||
{
|
||||
pV.SetMod(slot, index - 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bool newVal = index == -1 ? false : true;
|
||||
NAPI.Util.ConsoleOutput("Setting turbo to: " + newVal.ToString());
|
||||
pV.SetSharedData("mod" + slot, newVal);
|
||||
NAPI.ClientEvent.TriggerClientEventForAll("vehicleToggleMod", pV, slot, newVal);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user