From 274d8386fb4e9455f7f2fda5ad4a11a8cd651cb4 Mon Sep 17 00:00:00 2001 From: Marco Hladik Date: Thu, 10 Jan 2019 11:16:22 +0100 Subject: [PATCH] func_button: Added support for shooting buttons to trigger them, if they have health attached. --- Source/gs-entbase/server/func_button.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Source/gs-entbase/server/func_button.cpp b/Source/gs-entbase/server/func_button.cpp index 95e87975..df8f5b2f 100644 --- a/Source/gs-entbase/server/func_button.cpp +++ b/Source/gs-entbase/server/func_button.cpp @@ -52,6 +52,8 @@ class func_button:CBaseTrigger virtual void() Blocked; virtual void() Trigger; virtual void() Use; + virtual void(entity eAttacker, int iType, int iDamage) vPain; + virtual void(entity eAttacker, int iType, int iDamage) vDeath; virtual void() SetMovementDirection; virtual void(vector vdest, void() func) MoveToDestination; @@ -241,6 +243,16 @@ void func_button::Use(void) Trigger(); } +void func_button::vPain (entity attacker, int type, int damage) +{ + Trigger(); +} + +void func_button::vDeath (entity attacker, int type, int damage) +{ + Trigger(); +} + void func_button::Blocked(void) { if (m_iDamage) { @@ -320,6 +332,11 @@ void func_button::Respawn(void) blocked = Blocked; velocity = [0,0,0]; nextthink = -1; + health = m_oldHealth; + + if (health > 0) { + takedamage = DAMAGE_YES; + } if (!m_flSpeed) { m_flSpeed = 100;