Skip to content

Commit 9e7398d

Browse files
authored
Merge pull request #12 from oscar-wos/wall
feat: ZoneType.Wall
2 parents ac2e03d + 4158e39 commit 9e7398d

File tree

7 files changed

+20
-8
lines changed

7 files changed

+20
-8
lines changed

lang/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"zone.Hurt": "Hurt",
1515
"zone.Kill": "Kill",
1616
"zone.Teleport": "Teleport",
17+
"zone.Wall": "Wall",
1718
"menu.Add": "Add Zone",
1819
"menu.View": "View Zones",
1920
"menu.None": "No Zones",

src/AntiRush.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,14 +127,14 @@ private bool PrintAction(CCSPlayerController controller, Zone zone)
127127

128128
private void DoAction(CCSPlayerController controller, Zone zone)
129129
{
130+
const PlayerButtons checkButtons = PlayerButtons.Forward | PlayerButtons.Back | PlayerButtons.Moveleft | PlayerButtons.Moveright;
131+
130132
if (PrintAction(controller, zone))
131133
_playerData[controller].LastMessage = Server.CurrentTime;
132134

133135
switch (zone.Type)
134136
{
135137
case ZoneType.Bounce:
136-
const PlayerButtons checkButtons = PlayerButtons.Forward | PlayerButtons.Back | PlayerButtons.Moveleft | PlayerButtons.Moveright;
137-
138138
if ((controller.Buttons & checkButtons) != 0)
139139
controller.PlayerPawn.Value?.Teleport(new Vector(_playerData[controller].LastPos[0], _playerData[controller].LastPos[1], _playerData[controller].LastPos[2]), null, new Vector(_playerData[controller].LastVel[0], _playerData[controller].LastVel[1], _playerData[controller].LastVel[2]));
140140

@@ -156,6 +156,11 @@ private void DoAction(CCSPlayerController controller, Zone zone)
156156
case ZoneType.Teleport:
157157
controller.PlayerPawn.Value!.Teleport(_playerData[controller].SpawnPos, controller.PlayerPawn.Value.EyeAngles, Vector.Zero);
158158
return;
159+
160+
case ZoneType.Wall:
161+
controller.PlayerPawn.Value?.Teleport(new Vector(_playerData[controller].LastPos[0], _playerData[controller].LastPos[1], _playerData[controller].LastPos[2]), null, Vector.Zero);
162+
163+
return;
159164
}
160165
}
161166
}

src/Config.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ namespace AntiRush;
55

66
public class AntiRushConfig : BasePluginConfig
77
{
8-
public override int Version { get; set; } = 6;
8+
public override int Version { get; set; } = 7;
99
[JsonPropertyName("Messages")] public string Messages { get; set; } = "simple";
1010
[JsonPropertyName("DrawZones")] public bool DrawZones { get; set; } = false;
1111
[JsonPropertyName("Warmup")] public bool Warmup { get; set; } = false;
1212
[JsonPropertyName("DisableOnBombPlant")] public bool DisableOnBombPlant { get; set; } = true;
1313
[JsonPropertyName("RestartOnLoad")] public bool RestartOnLoad { get; set; } = true;
1414
[JsonPropertyName("NoRushTime")] public int NoRushTime { get; set; } = 0;
1515
[JsonPropertyName("NoCampTime")] public int NoCampTime { get; set; } = 0;
16-
[JsonPropertyName("RushZones")] public int[] RushZones { get; set; } = [0, 2, 3];
16+
[JsonPropertyName("RushZones")] public int[] RushZones { get; set; } = [0, 2, 3, 4];
1717
[JsonPropertyName("CampZones")] public int[] CampZones { get; set; } = [1];
1818
[JsonPropertyName("Countdown")] public int[] Countdown { get; set; } = [60, 30, 15, 10, 5, 3, 2, 1];
1919
[JsonPropertyName("MinPlayers")] public int MinPlayers { get; set; } = 1;

src/Enums/ZoneType.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ public enum ZoneType
55
Bounce = 0,
66
Hurt = 1,
77
Kill = 2,
8-
Teleport = 3
8+
Teleport = 3,
9+
Wall = 4
910
}

src/Globals.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace AntiRush;
88
public partial class AntiRush
99
{
1010
public override string ModuleName => "AntiRush";
11-
public override string ModuleVersion => "1.0.9";
11+
public override string ModuleVersion => "1.0.10";
1212
public override string ModuleAuthor => "https://github.com/oscar-wos/AntiRush";
1313
public AntiRushConfig Config { get; set; } = new();
1414
public Menu.Menu Menu { get; } = new();

src/Menus.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ private void BuildAddZoneMenu(CCSPlayerController controller)
116116
new(Localizer["zone.Bounce"]) { Prefix = "<font color=\"#FFFF00\">", Suffix = "<font color=\"#FFFFFF\">" },
117117
new(Localizer["zone.Hurt"]) { Prefix = "<font color=\"#FFA500\">", Suffix = "<font color=\"#FFFFFF\">" },
118118
new(Localizer["zone.Kill"]) { Prefix = "<font color=\"#FF0000\">", Suffix = "<font color=\"#FFFFFF\">" },
119-
new(Localizer["zone.Teleport"]) { Prefix = "<font color=\"#FF00FF\">", Suffix = "<font color=\"#FFFFFF\">" }
119+
new(Localizer["zone.Teleport"]) { Prefix = "<font color=\"#FF00FF\">", Suffix = "<font color=\"#FFFFFF\">" },
120+
new(Localizer["zone.Wall"]) { Prefix = "<font color=\"#0000FF\">", Suffix = "<font color=\"#FFFFFF\">" }
120121
};
121122

122123
var teams = new List<MenuValue>
@@ -130,7 +131,9 @@ private void BuildAddZoneMenu(CCSPlayerController controller)
130131
addZoneMenu.AddItem(new MenuItem(MenuItemType.Choice, new MenuValue($"{Localizer["menu.Teams"]} "), teams, true));
131132
addZoneMenu.AddItem(new MenuItem(MenuItemType.Input, new MenuValue($"{Localizer["menu.Name"]} ")));
132133

133-
addZoneMenu.AddItem(_playerData[controller].AddZone!.Items[0].Option != 0
134+
var delayCheck = _playerData[controller].AddZone!.Items[0].Option != 0 && _playerData[controller].AddZone!.Items[0].Option != 4;
135+
136+
addZoneMenu.AddItem(delayCheck
134137
? new MenuItem(MenuItemType.Input, new MenuValue($"{Localizer["menu.Delay"]} "), new MenuValue($" {Localizer["menu.Seconds"]}"))
135138
: new MenuItem(MenuItemType.Spacer));
136139

src/Zone.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public string ToString(IStringLocalizer localize)
3232
ZoneType.Hurt => $"{ChatColors.Orange}{localize["zone.Hurt"]}{ChatColors.White}",
3333
ZoneType.Kill => $"{ChatColors.Red}{localize["zone.Kill"]}{ChatColors.White}",
3434
ZoneType.Teleport => $"{ChatColors.Magenta}{localize["zone.Teleport"]}{ChatColors.White}",
35+
ZoneType.Wall => $"{ChatColors.Blue}{localize["zone.Wall"]}{ChatColors.White}",
3536
_ => ""
3637
};
3738
}
@@ -92,6 +93,7 @@ private Color GetBeamColor()
9293
ZoneType.Hurt => Color.DarkOrange,
9394
ZoneType.Kill => Color.Red,
9495
ZoneType.Teleport => Color.Magenta,
96+
ZoneType.Wall => Color.Blue,
9597
_ => Color.White
9698
};
9799
}

0 commit comments

Comments
 (0)