From 61d350c343629503dc218136130186b47f3493d7 Mon Sep 17 00:00:00 2001 From: destoer Date: Fri, 24 Nov 2023 18:27:57 +0000 Subject: [PATCH] make lr take away knife --- src/Debug.cs | 6 ++++++ src/Jail.cs | 1 + src/LastRequest/LRKnife.cs | 1 + src/LastRequest/LastRequest.cs | 2 +- src/LastRequest/ScoutKnife.cs | 3 ++- src/Lib.cs | 12 +++++------- 6 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/Debug.cs b/src/Debug.cs index 258e64c..a028370 100644 --- a/src/Debug.cs +++ b/src/Debug.cs @@ -41,6 +41,12 @@ public static void test_laser(CCSPlayerController? invoke, CommandInfo command) Lib.draw_laser(invoke); } + [RequiresPermissions("@jail/debug")] + public static void test_strip_cmd(CCSPlayerController? invoke, CommandInfo command) + { + invoke.strip_weapons(true); + } + // are these commands allowed or not? public static readonly bool enable = true; diff --git a/src/Jail.cs b/src/Jail.cs index c085750..4bcd79c 100644 --- a/src/Jail.cs +++ b/src/Jail.cs @@ -113,6 +113,7 @@ void register_commands() AddCommand("lr_debug","debug : start an lr without restriction",lr.lr_debug_cmd); AddCommand("is_blocked","debug : print block state",warden.block.is_blocked); AddCommand("test_laser","test laser",Debug.test_laser); + AddCommand("test_strip","test weapon strip",Debug.test_strip_cmd); } } diff --git a/src/LastRequest/LRKnife.cs b/src/LastRequest/LRKnife.cs index 2d0a04d..8586dd7 100644 --- a/src/LastRequest/LRKnife.cs +++ b/src/LastRequest/LRKnife.cs @@ -21,6 +21,7 @@ public LRKnife(LastRequest manager,int lr_slot, int player_slot, String choice) public override void init_player(CCSPlayerController player) { // give player a knife and restrict them to it + player.GiveNamedItem("weapon_knife"); weapon_restrict = "knife"; // Handle options diff --git a/src/LastRequest/LastRequest.cs b/src/LastRequest/LastRequest.cs index 26a98db..ad6f1eb 100644 --- a/src/LastRequest/LastRequest.cs +++ b/src/LastRequest/LastRequest.cs @@ -50,7 +50,7 @@ void init_player_common(CCSPlayerController? player) // strip weapons restore hp player.set_health(100); player.set_armour(100); - player.strip_weapons(); + player.strip_weapons(true); player.GiveNamedItem("item_assaultsuit"); } diff --git a/src/LastRequest/ScoutKnife.cs b/src/LastRequest/ScoutKnife.cs index 12a1aac..a0e1b78 100644 --- a/src/LastRequest/ScoutKnife.cs +++ b/src/LastRequest/ScoutKnife.cs @@ -19,7 +19,8 @@ public LRScoutKnife(LastRequest manager,int lr_slot, int player_slot, String cho } public override void init_player(CCSPlayerController player) - { + { + player.GiveNamedItem("weapon_knife"); player.GiveNamedItem("weapon_ssg08"); player.set_gravity(0.1f); } diff --git a/src/Lib.cs b/src/Lib.cs index 3bf37c4..14870c9 100644 --- a/src/Lib.cs +++ b/src/Lib.cs @@ -156,13 +156,10 @@ static public bool is_generic_admin(this CCSPlayerController? player) static public void draw_laser(CCSPlayerController? player) { - /* - CEnvLaser? laser = Utilities.CreateEntityByName("env_laser"); + CEnvBeam? laser = Utilities.CreateEntityByName("env_beam"); CEnvBeam? end = Utilities.CreateEntityByName("env_beam"); - end.Globalname = "boop!"; - - if(laser == null) + if(laser == null || end == null) { return; } @@ -171,17 +168,18 @@ static public void draw_laser(CCSPlayerController? player) laser.Width = 2.0f; //laser.Life = 1.0f; + end.Globalname = "boop!"; + Vector player_vec = player.PlayerPawn.Value.AbsOrigin; Vector end_pos = new Vector(player_vec.X + 100.0f,player_vec.Y + 100.0f, player_vec.Z + 100.0f); end.Teleport(end_pos, player.PlayerPawn.Value.AbsRotation, player.PlayerPawn.Value.AbsVelocity); end.DispatchSpawn(); - laser.LaserTarget = "boop!"; + laser.EndEntity = "boop!"; laser.Teleport(player.PlayerPawn.Value.AbsOrigin, player.PlayerPawn.Value.AbsRotation, player.PlayerPawn.Value.AbsVelocity); laser.DispatchSpawn(); - */ } static public void mute(this CCSPlayerController? player)