Skip to content

Commit

Permalink
implement force_open, fix warday no weapon config for t's
Browse files Browse the repository at this point in the history
  • Loading branch information
destoer committed Dec 28, 2023
1 parent a3a6e23 commit 1fe958a
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 9 deletions.
26 changes: 21 additions & 5 deletions src/Lib.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions src/SpecialDay/SDBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public void start_common()
restrict_damage = false;

state = SDState.ACTIVE;
Lib.force_open();
start();
}

Expand Down
14 changes: 10 additions & 4 deletions src/Warden/Warday.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}
Expand Down

0 comments on commit 1fe958a

Please sign in to comment.