Adapted Save- and LoadManager to new Vehicle System
This commit is contained in:
@@ -4,6 +4,7 @@ using System.Text;
|
||||
using GTANetworkAPI;
|
||||
using reallife_gamemode.Model;
|
||||
using reallife_gamemode.Server.Entities;
|
||||
using reallife_gamemode.Server.Extensions;
|
||||
|
||||
/**
|
||||
* @overview Life of German Reallife - Managers LoadManager (LoadManager.cs)
|
||||
@@ -15,10 +16,6 @@ namespace reallife_gamemode.Server.Managers
|
||||
{
|
||||
public class LoadManager : Script
|
||||
{
|
||||
public static List<GotoPoint> GotoPointList = new List<GotoPoint>();
|
||||
public static List<Vehicle> FactionVehicleList = new List<Vehicle>();
|
||||
public static List<Vehicle> ShopVehicleList = new List<Vehicle>();
|
||||
public static List<Vehicle> UserVehicleList = new List<Vehicle>();
|
||||
|
||||
[ServerEvent(Event.ResourceStart)]
|
||||
public void OnResourceStart()
|
||||
@@ -33,13 +30,6 @@ namespace reallife_gamemode.Server.Managers
|
||||
b.Color, b.Name, b.Alpha, b.DrawDistance, b.ShortRange, (short) b.Rotation, b.Dimension);
|
||||
}
|
||||
}
|
||||
foreach (GotoPoint g in loadData.GotoPoints)
|
||||
{
|
||||
if (g.Active == true)
|
||||
{
|
||||
GotoPointList.Add(g);
|
||||
}
|
||||
}
|
||||
|
||||
foreach(ServerVehicle veh in loadData.ServerVehicles)
|
||||
{
|
||||
@@ -52,24 +42,13 @@ namespace reallife_gamemode.Server.Managers
|
||||
NAPI.Vehicle.CreateVehicle((uint)savedV.Model, new Vector3(savedV.PositionX, savedV.PositionY, savedV.PositionZ), savedV.Heading, savedV.PrimaryColor,
|
||||
savedV.SecondaryColor, savedV.NumberPlate, 255, savedV.Locked);
|
||||
}
|
||||
if (veh is FactionVehicle factionV)
|
||||
{
|
||||
current.SetData("factionId", factionV.FactionId);
|
||||
FactionVehicleList.Add(current);
|
||||
}
|
||||
if (veh is ShopVehicle shopV)
|
||||
else if (veh is ShopVehicle shopV)
|
||||
{
|
||||
string displayName = NAPI.Vehicle.GetVehicleDisplayName(shopV.Model);
|
||||
ShopVehicleList.Add(current);
|
||||
NAPI.Vehicle.SetVehicleEngineHealth(current, 0);
|
||||
var tLabel = NAPI.TextLabel.CreateTextLabel(displayName + " | " + shopV.Price + "~g~$", new Vector3(shopV.PositionX, shopV.PositionY, shopV.PositionZ + 1.5), 10, 1, 0, new Color(255, 255, 255), false);
|
||||
current.SetData("shopVehicleId", shopV.Id);
|
||||
var tLabel = NAPI.TextLabel.CreateTextLabel(displayName + " | " + shopV.Price.ToMoneyString(), new Vector3(shopV.PositionX, shopV.PositionY, shopV.PositionZ + 1.5), 10, 1, 0, new Color(255, 255, 255), false);
|
||||
tLabel.AttachTo(current, "chassis", new Vector3(0, 0, 1.5), new Vector3(0, 0, 0));
|
||||
}
|
||||
if (veh is UserVehicle userV)
|
||||
{
|
||||
UserVehicleList.Add(current);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user