Add breakables respawn timer.

This commit is contained in:
Marco Cawthorne 2021-09-12 00:09:40 +02:00
parent ac5e2a1b72
commit d959313700
Signed by: eukara
GPG key ID: C196CD8BA993248A
2 changed files with 18 additions and 1 deletions

View file

@ -19,6 +19,7 @@
class SHMultiplayerRules:CGameRules class SHMultiplayerRules:CGameRules
{ {
float m_flRestockTimer; float m_flRestockTimer;
float m_flBreakRespawnTimer;
/* client */ /* client */
virtual void(base_player) PlayerSpawn; virtual void(base_player) PlayerSpawn;

View file

@ -309,14 +309,30 @@ SHMultiplayerRules::ScientistKill(base_player pp, entity sci)
void void
SHMultiplayerRules::FrameStart(void) SHMultiplayerRules::FrameStart(void)
{ {
entity e;
if (m_flRestockTimer < time) { if (m_flRestockTimer < time) {
m_flRestockTimer = time + 120.0f; m_flRestockTimer = time + 120.0f;
for ( entity e = world; ( e = find( e, ::classname, "player" ) ); ) { for (e = world; (e = find(e, ::classname, "player"));) {
player pl = (player)e; player pl = (player)e;
SHData_GetItems(pl); SHData_GetItems(pl);
} }
} }
if (autocvar(sh_respbreak, 1))
if (m_flBreakRespawnTimer < time) {
m_flBreakRespawnTimer = time + 120.0f;
for (e = world; (e = find( e, ::classname, "func_breakable"));) {
func_breakable br = (func_breakable)e;
br.Respawn();
}
for (e = world; (e = find( e, ::classname, "func_pushable"));) {
func_pushable pb = (func_pushable)e;
pb.Respawn();
}
}
} }
void void