From 1fe958a09dddbba2d7313d3bcf7de74acc352c13 Mon Sep 17 00:00:00 2001 From: destoer <destoer1234@protonmail.com> Date: Thu, 28 Dec 2023 00:19:37 +0000 Subject: [PATCH] implement force_open, fix warday no weapon config for t's --- src/Lib.cs | 26 +++++++++++++++++++++----- src/SpecialDay/SDBase.cs | 1 + src/Warden/Warday.cs | 14 ++++++++++---- 3 files changed, 32 insertions(+), 9 deletions(-) diff --git a/src/Lib.cs b/src/Lib.cs index 73079ed..520fac8 100644 --- a/src/Lib.cs +++ b/src/Lib.cs @@ -871,15 +871,31 @@ static public void set_cvar_str(String name, String value) return to_slot(player.UserId); } + static void force_ent_input(String name, String input) + { + // search for door entitys and open all of them! + var target = Utilities.FindAllEntitiesByDesignerName<CBaseEntity>(name); + + foreach(var ent in target) + { + if(!ent.IsValid) + { + continue; + } + + ent.AcceptInput(input); + } + } + public static void force_open() { announce("[Door control]: ","Forcing open all doors!"); - /* - // search for door entitys and open all of them! - var doors = Utilities.FindAllEntitiesByDesignerName<CBaseDoor>("func_door"); - - */ + force_ent_input("func_door","Open"); + force_ent_input("func_movelinear","Open"); + force_ent_input("func_door_rotating","Open"); + force_ent_input("prop_door_rotating","Open"); + force_ent_input("func_breakable","Break"); } static public bool is_active_team(int team) diff --git a/src/SpecialDay/SDBase.cs b/src/SpecialDay/SDBase.cs index b73c0a6..2d358b2 100644 --- a/src/SpecialDay/SDBase.cs +++ b/src/SpecialDay/SDBase.cs @@ -41,6 +41,7 @@ public void start_common() restrict_damage = false; state = SDState.ACTIVE; + Lib.force_open(); start(); } diff --git a/src/Warden/Warday.cs b/src/Warden/Warday.cs index 885c666..9b9a011 100644 --- a/src/Warden/Warday.cs +++ b/src/Warden/Warday.cs @@ -20,15 +20,21 @@ void gun_callback(int unused) if(warday_active) { - // give T guns - foreach(CCSPlayerController player in Utilities.GetPlayers()) + + if(config.warday_guns) { - if(player.is_valid() && player.TeamNum == Lib.TEAM_T) + // give T guns + foreach(CCSPlayerController player in Utilities.GetPlayers()) { - player.event_gun_menu(); + if(player.is_valid() && player.TeamNum == Lib.TEAM_T) + { + player.event_gun_menu(); + } } } + Lib.force_open(); + Lib.localise_announce(WARDAY_PREFIX,"warday.live"); } }