-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCommandClearFobandBarricades.cs
More file actions
62 lines (50 loc) · 2.12 KB
/
CommandClearFobandBarricades.cs
File metadata and controls
62 lines (50 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
using Rocket.API;
using Rocket.Unturned.Chat;
using SDG.Unturned;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
namespace Ekin.EACFOB
{
internal class CommandClearFobandBarricades : IRocketCommand
{
public AllowedCaller AllowedCaller => AllowedCaller.Player;
public string Name => "FobCleanAll";
public string Help => "";
public string Syntax => "";
public List<string> Aliases => new List<string>();
public List<string> Permissions => new List<string>();
public void Execute(IRocketPlayer caller, string[] command)
{
var INST = EACFOBPlugin.Instance;
UnturnedChat.Say(caller,"Fob cleaning started.", Color.magenta);
int deleted = 0;
foreach (var region in BarricadeManager.regions)
{
for (int i = region.drops.Count - 1; i >= 0; i--)
{
var drop = region.drops[i];
ushort id = drop.asset.id;
if (id == INST.Configuration.Instance.fobobjectid ||
id == INST.Configuration.Instance.team1fobobjectid ||
id == INST.Configuration.Instance.team2fobobjectid)
{
if (BarricadeManager.tryGetRegion(drop.model.transform, out byte x, out byte y, out ushort plant, out BarricadeRegion correctRegion))
{
int index = correctRegion.drops.FindIndex(d => d.instanceID == drop.instanceID);
if (index != -1)
{
BarricadeManager.destroyBarricade(correctRegion, x, y, plant, (ushort)index);
deleted++;
}
}
}
}
}
UnturnedChat.Say($"Fob cleaning complated, {deleted} Fob/OldBarricade deleted.", Color.cyan);
}
}
}