Skip to content

Commit

Permalink
specify sd countdown
Browse files Browse the repository at this point in the history
  • Loading branch information
destoer committed Dec 17, 2023
1 parent c896785 commit 35a7b95
Show file tree
Hide file tree
Showing 14 changed files with 42 additions and 27 deletions.
1 change: 1 addition & 0 deletions src/Jail.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ public class JailConfig : BasePluginConfig

// main plugin file, controls central hooking
// defers to warden, lr and sd
[MinimumApiVersion(128)]
public class JailPlugin : BasePlugin, IPluginConfig<JailConfig>
{
// workaround to query global state!
Expand Down
2 changes: 1 addition & 1 deletion src/SpecialDay/Dodgeball.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class SDDodgeball : SDBase
public override void setup()
{
announce("Dodgeball started");
announce("Please 15 seconds for damage be enabled");
announce($"Please {delay} seconds for damage be enabled");
}

public override void start()
Expand Down
2 changes: 1 addition & 1 deletion src/SpecialDay/FriendlyFire.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class SDFriendlyFire : SDBase
public override void setup()
{
announce("Friendly fire day started");
announce("Please 15 seconds for friendly fire to be enabled");
announce($"Please {delay} seconds for friendly fire to be enabled");
}

public override void start()
Expand Down
2 changes: 1 addition & 1 deletion src/SpecialDay/Grenade.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class SDGrenade : SDBase
public override void setup()
{
announce("Grenade started");
announce("Please 15 seconds for damage be enabled");
announce($"Please {delay} seconds for damage be enabled");
}

public override void start()
Expand Down
2 changes: 1 addition & 1 deletion src/SpecialDay/HeadshotOnly.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class SDHeadshotOnly : SDBase
public override void setup()
{
announce("Headshot only started");
announce("Please 15 seconds for damage be enabled");
announce($"Please {delay} seconds for damage be enabled");
}

public override void start()
Expand Down
2 changes: 1 addition & 1 deletion src/SpecialDay/HideAndSeek.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class SDHideAndSeek : SDBase
public override void setup()
{
announce("hide and seek started");
announce("T's have 15 seconds to hide");
announce($"T's have {delay} seconds to hide");
}

public override void start()
Expand Down
2 changes: 1 addition & 1 deletion src/SpecialDay/Juggernaut.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class SDJuggernaut : SDBase
public override void setup()
{
announce("Juggernaut started");
announce("Please 15 seconds for friendly fire to be enabled");
announce($"Please {delay} seconds for friendly fire to be enabled");
}

public override void start()
Expand Down
2 changes: 1 addition & 1 deletion src/SpecialDay/Knife.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class SDKnifeWarday : SDBase
public override void setup()
{
announce("knife warday started");
announce("Please 15 seconds for damage be enabled");
announce($"Please {delay} seconds for damage be enabled");
}

public override void start()
Expand Down
2 changes: 2 additions & 0 deletions src/SpecialDay/SDBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,4 +162,6 @@ public void announce(String str)
public bool restrict_damage = false;
public String weapon_restrict = "";
public SDState state = SDState.INACTIVE;

public int delay = 15;
}
2 changes: 1 addition & 1 deletion src/SpecialDay/ScoutKnife.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class SDScoutKnife : SDBase
public override void setup()
{
announce("Scout knife started");
announce("Please 15 seconds for damage be enabled");
announce($"Please {delay} seconds for damage be enabled");
}

public override void start()
Expand Down
22 changes: 17 additions & 5 deletions src/SpecialDay/SpecialDay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,15 @@ public void setup_sd(CCSPlayerController? invoke, ChatMenuOption option)
if(active_sd != null)
{
JailPlugin.start_event();

active_sd.delay = delay;
active_sd.setup_common();
}

// start the countdown for enable
if(JailPlugin.global_ctx != null)
{
countdown.start($"{name} specialday",15,0,null,start_sd);
countdown.start($"{name} specialday",delay,0,null,start_sd);
}

team_save.save();
Expand Down Expand Up @@ -269,14 +271,22 @@ public void cancel_sd_cmd(CCSPlayerController? player,CommandInfo command)
end_sd(true);
}

public void sd_cmd_internal(CCSPlayerController? player)
public void sd_cmd_internal(CCSPlayerController? player,CommandInfo command)
{
if(player == null || !player.is_valid())
{
return;
}

var sd_menu = new ChatMenu("SD Menu");
delay = 15;

if(Int32.TryParse(command.ArgByIndex(1),out int delay_opt))
{
delay = delay_opt;
}


ChatMenu sd_menu = new ChatMenu("Specialday");

// Build the basic LR menu
for(int s = 0; s < SD_NAME.Length - 1; s++)
Expand Down Expand Up @@ -308,15 +318,15 @@ public void sd_cmd(CCSPlayerController? player,CommandInfo command)
{
override_ff = false;

sd_cmd_internal(player);
sd_cmd_internal(player,command);
}

[RequiresPermissions("@css/generic")]
public void sd_ff_cmd(CCSPlayerController? player,CommandInfo command)
{
override_ff = true;

sd_cmd_internal(player);
sd_cmd_internal(player,command);
}

public enum SDType
Expand Down Expand Up @@ -350,6 +360,8 @@ public enum SDType
"None"
};

int delay = 15;

SDBase? active_sd = null;

bool override_ff = false;
Expand Down
2 changes: 1 addition & 1 deletion src/SpecialDay/Spectre.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class SDSpectre : SDBase
public override void setup()
{
announce("spectre started");
announce("Please 15 seconds for damage be enabled");
announce($"Please {delay} seconds for damage be enabled");
}

public override void make_boss(CCSPlayerController? spectre, int count)
Expand Down
2 changes: 1 addition & 1 deletion src/SpecialDay/Tank.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class SDTank : SDBase
public override void setup()
{
announce("tank day started");
announce("Please 15 seconds for damage be enabled");
announce($"Please {delay} seconds for damage be enabled");
}

public override void make_boss(CCSPlayerController? tank, int count)
Expand Down
24 changes: 12 additions & 12 deletions src/Warden/Warden.cs
Original file line number Diff line number Diff line change
Expand Up @@ -281,10 +281,15 @@ void round_timer_callback()
start_timer = null;
}

public void round_start()
void setup_cvar()
{
Server.ExecuteCommand("mp_force_pick_time 3000");
Server.ExecuteCommand("mp_autoteambalance 0");

}

public void round_start()
{
purge_round();

if(JailPlugin.global_ctx != null)
Expand Down Expand Up @@ -436,27 +441,22 @@ public bool join_team(CCSPlayerController? invoke, CommandInfo command)
{
if(invoke == null || !invoke.is_valid())
{
return true;
invoke.play_sound("sounds/ui/counter_beep.vsnd");
return false;
}

if(command.ArgCount != 3)
if(command.ArgCount < 2)
{
return true;
invoke.play_sound("sounds/ui/counter_beep.vsnd");
return false;
}

CCSPlayerPawn? pawn = invoke.pawn();


if(!Int32.TryParse(command.ArgByIndex(1),out int team))
{
return true;
}


JailPlayer? jail_player = jail_player_from_player(invoke);

if(jail_player == null)
{
invoke.play_sound("sounds/ui/counter_beep.vsnd");
return false;
}

Expand Down

0 comments on commit 35a7b95

Please sign in to comment.