Gangwar-System base Structure
This commit is contained in:
@@ -9,7 +9,7 @@ using Newtonsoft.Json;
|
||||
|
||||
namespace ReallifeGamemode.Server.Gangwar
|
||||
{
|
||||
public class Gangwar
|
||||
public class Gangwar : Script
|
||||
{
|
||||
public static Turf[] _loadedTurfs;
|
||||
private static List<Turfs> turfs;
|
||||
@@ -40,5 +40,33 @@ namespace ReallifeGamemode.Server.Gangwar
|
||||
return _loadedTurfs;
|
||||
}
|
||||
|
||||
|
||||
[RemoteEvent("SERVER:SetTurf")]
|
||||
public void RmtEvent_SetTurf(Client client, string jsonX, string jsonY, string jsonRot, string jsonRange, string Name)
|
||||
{
|
||||
float pX = JsonConvert.DeserializeObject<float>(jsonX);
|
||||
float pY = (float)JsonConvert.DeserializeObject<float>(jsonY);
|
||||
float Rot = (float)JsonConvert.DeserializeObject<float>(jsonRot);
|
||||
float Range = (float)JsonConvert.DeserializeObject<float>(jsonRange);
|
||||
|
||||
var newTurf = new Turfs
|
||||
{
|
||||
Name = Name,
|
||||
X = pX,
|
||||
Y = pY,
|
||||
Rotation = client.Heading,
|
||||
Range = Range,
|
||||
Owner = "Neutral",
|
||||
Color = 0
|
||||
};
|
||||
using(var dbContext = new DatabaseContext())
|
||||
{
|
||||
dbContext.Turfs.Add(newTurf);
|
||||
dbContext.SaveChanges();
|
||||
}
|
||||
loadTurfs();
|
||||
NAPI.ClientEvent.TriggerClientEventForAll("GangAreas:Create", JsonConvert.SerializeObject(turfs.ToArray()));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user