From a977b4e8d30b3f388b4c36a2327440d047b3948c Mon Sep 17 00:00:00 2001 From: destoer Date: Wed, 10 Apr 2024 21:40:58 +0100 Subject: [PATCH] add block config, fix high speed knife, show option in lr print --- src/Jail.cs | 4 ++++ src/LastRequest/LRBase.cs | 13 +++++++++++-- src/LastRequest/LRKnife.cs | 11 +++++++++++ src/LastRequest/LastRequest.cs | 16 ++++++++++++---- src/Warden/Block.cs | 14 +++++++++++--- 5 files changed, 49 insertions(+), 9 deletions(-) diff --git a/src/Jail.cs b/src/Jail.cs index 3eb7c49..182eccf 100644 --- a/src/Jail.cs +++ b/src/Jail.cs @@ -33,6 +33,9 @@ public class JailConfig : BasePluginConfig [JsonPropertyName("database")] public String database { get; set; } = "cs2_jail"; + [JsonPropertyName("no_block")] + public bool noBlock { get; set; } = true; + [JsonPropertyName("mute_dead")] public bool muteDead { get; set; } = true; @@ -268,6 +271,7 @@ public void OnConfigParsed(JailConfig config) warden.Config = config; warden.mute.Config = config; warden.warday.Config = config; + warden.block.Config = config; JailPlayer.Config = config; sd.Config = config; diff --git a/src/LastRequest/LRBase.cs b/src/LastRequest/LRBase.cs index a5606ac..6f90a67 100644 --- a/src/LastRequest/LRBase.cs +++ b/src/LastRequest/LRBase.cs @@ -263,8 +263,17 @@ static public void PrintCountdown(LRBase lr, int delay) return; } - tPlayer.PrintToCenter($"Starting {lr.lrName} against {ctPlayer.PlayerName} in {delay} seconds"); - ctPlayer.PrintToCenter($"Starting {lr.lrName} against {tPlayer.PlayerName} in {delay} seconds"); + if(lr.choice == "") + { + tPlayer.PrintToCenter($"Starting {lr.lrName} against {ctPlayer.PlayerName} in {delay} seconds"); + ctPlayer.PrintToCenter($"Starting {lr.lrName} against {tPlayer.PlayerName} in {delay} seconds"); + } + + else + { + tPlayer.PrintToCenter($"Starting {lr.lrName} ({lr.choice}) against {ctPlayer.PlayerName} in {delay} seconds"); + ctPlayer.PrintToCenter($"Starting {lr.lrName} ({lr.choice}) against {tPlayer.PlayerName} in {delay} seconds"); + } } public void CountdownStart() diff --git a/src/LastRequest/LRKnife.cs b/src/LastRequest/LRKnife.cs index 89131b4..2260768 100644 --- a/src/LastRequest/LRKnife.cs +++ b/src/LastRequest/LRKnife.cs @@ -51,4 +51,15 @@ public override void InitPlayer(CCSPlayerController player) } } } + + public override void PlayerHurt(int health,int damage, int hitgroup) + { + CCSPlayerController? player = Utilities.GetPlayerFromSlot(playerSlot); + + // re init the player + if(choice == "High speed" && player.IsLegalAlive()) + { + player.SetVelocity(2.5f); + } + } } \ No newline at end of file diff --git a/src/LastRequest/LastRequest.cs b/src/LastRequest/LastRequest.cs index d6e370f..e986185 100644 --- a/src/LastRequest/LastRequest.cs +++ b/src/LastRequest/LastRequest.cs @@ -45,7 +45,7 @@ void CreateLRSlots(uint slots) } } - void InitPlayerCommon(CCSPlayerController? player, String lrName) + void InitPlayerCommon(CCSPlayerController? player, String lrName, String option) { if(!player.IsLegalAlive()) { @@ -58,7 +58,15 @@ void InitPlayerCommon(CCSPlayerController? player, String lrName) player.StripWeapons(true); player.GiveArmour(); - player.Announce(LR_PREFIX,$"{lrName} is starting\n"); + if(option == "") + { + player.Announce(LR_PREFIX,$"{lrName} is starting\n"); + } + + else + { + player.Announce(LR_PREFIX,$"{lrName} ({option}) is starting\n"); + } } bool LRExists(LRBase lr) @@ -234,8 +242,8 @@ void InitLR(LRChoice choice) } // do common player setup - InitPlayerCommon(tPlayer,tLR.lrName); - InitPlayerCommon(ctPlayer,ctLR.lrName); + InitPlayerCommon(tPlayer,tLR.lrName,choice.option); + InitPlayerCommon(ctPlayer,ctLR.lrName,choice.option); // bind lr pair tLR.partner = ctLR; diff --git a/src/Warden/Block.cs b/src/Warden/Block.cs index dcf5a79..24d06de 100644 --- a/src/Warden/Block.cs +++ b/src/Warden/Block.cs @@ -43,10 +43,18 @@ public void UnBlockAll() public void RoundStart() { - // TODO: for now we just assume no block - // we wont have a cvar - UnBlockAll(); + if(Config.noBlock) + { + UnBlockAll(); + } + + else + { + BlockAll(); + } } + + public JailConfig Config = new JailConfig(); bool blockState = false; } \ No newline at end of file