Refactor Code in RefuseCollector.ts
This commit is contained in:
@@ -19,7 +19,7 @@ namespace ReallifeGamemode.Server.Job
|
||||
|
||||
public override bool NeedVehicleToStart => false;
|
||||
|
||||
const int MAX_BAG = 40;
|
||||
private const int MAX_BAG = 40;
|
||||
|
||||
public RefuseCollectorJob()
|
||||
{
|
||||
@@ -157,7 +157,6 @@ namespace ReallifeGamemode.Server.Job
|
||||
new Vector3(-921.0493774414062, -1095.1513671875, 2.1503124237060547),
|
||||
new Vector3(-942.0684204101562, -1077.1378173828125, 2.1503121852874756),
|
||||
new Vector3(-951.5316772460938, -1078.955078125, 2.1503100395202637),
|
||||
|
||||
}.AsReadOnly();
|
||||
|
||||
[RemoteEvent("CLIENT:MuellmannJobStarten")]
|
||||
@@ -165,7 +164,6 @@ namespace ReallifeGamemode.Server.Job
|
||||
{
|
||||
if (vehicle.Model == (uint)Types.VehicleModel.Trash || vehicle.Model == (uint)Types.VehicleModel.Trash2)
|
||||
{
|
||||
|
||||
Vehicle veh;
|
||||
foreach (var data in muellmanData)
|
||||
{
|
||||
@@ -192,7 +190,7 @@ namespace ReallifeGamemode.Server.Job
|
||||
|
||||
if (data.hasFreePlace())
|
||||
{
|
||||
if(data.vehicle != null)
|
||||
if (data.vehicle != null)
|
||||
data.vehicle.GetServerVehicle().Spawn(data.vehicle);
|
||||
muellmanData.Remove(data);
|
||||
return;
|
||||
@@ -211,13 +209,13 @@ namespace ReallifeGamemode.Server.Job
|
||||
}
|
||||
|
||||
[RemoteEvent("CLIENT:MuellmannImShape")]
|
||||
public void MuellmannImShape(Player player, int colshapeIndex)
|
||||
public void MuellmannImShape(Player player, string jsonIdentifier)
|
||||
{
|
||||
foreach (var data in muellmanData)
|
||||
{
|
||||
if (data.getDataFromClient(player) == null) continue;
|
||||
Player target = data.getPartnerClient(player);
|
||||
if (target != null) target.TriggerEvent("MuellmannUpdateColshape", colshapeIndex);
|
||||
if (target != null) target.TriggerEvent("MuellmannUpdateColshape", jsonIdentifier);
|
||||
player.TriggerEvent("renderTextOnScreen", "Wirf den Müllsack in den Müllwagen.");
|
||||
player.AddAttachment("binbag", false);
|
||||
return;
|
||||
@@ -260,19 +258,17 @@ namespace ReallifeGamemode.Server.Job
|
||||
}
|
||||
player.TriggerEvent("SERVER:MuellmannZuBase");
|
||||
}
|
||||
else if(data.getTrashCount() > MAX_BAG)
|
||||
else if (data.getTrashCount() > MAX_BAG)
|
||||
{
|
||||
data.setTrashCount(MAX_BAG);
|
||||
ChatService.ErrorMessage((Player)player, "Der Müllwagen ist schon voll.");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (target != null)
|
||||
{
|
||||
user1.Wage += 25;
|
||||
user2.Wage += 25;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -307,13 +303,13 @@ namespace ReallifeGamemode.Server.Job
|
||||
if (target != null)
|
||||
{
|
||||
user1.Wage += (int)(bonus / 2);
|
||||
user2.Wage += (int)(bonus / 2);
|
||||
user2.Wage += (int)(bonus / 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
user1.Wage += bonus;
|
||||
}
|
||||
|
||||
|
||||
data.setTrashCount(0);
|
||||
|
||||
dbContext.SaveChanges();
|
||||
|
||||
Reference in New Issue
Block a user