]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add hook primary/secondary to have health and such so it can be damaged by contents too
authorSamual <samual@xonotic.org>
Wed, 28 Sep 2011 19:17:35 +0000 (15:17 -0400)
committerSamual <samual@xonotic.org>
Wed, 28 Sep 2011 19:17:35 +0000 (15:17 -0400)
qcsrc/server/autocvars.qh
qcsrc/server/g_hook.qc
qcsrc/server/sv_main.qc
qcsrc/server/w_hook.qc

index 1e21a7c8a8c80aa5e3387223d9dc75538e6c7c8c..aa27f741294095400ab41cedfb5ef95b3fd7f628 100644 (file)
@@ -408,6 +408,8 @@ float autocvar_g_balance_hook_secondary_power;
 float autocvar_g_balance_hook_secondary_radius;
 float autocvar_g_balance_hook_secondary_refire;
 float autocvar_g_balance_hook_secondary_speed;
+float autocvar_g_balance_hook_secondary_health;
+float autocvar_g_balance_hook_secondary_damageforcescale;
 float autocvar_g_balance_keyhunt_damageforcescale;
 float autocvar_g_balance_keyhunt_delay_collect;
 float autocvar_g_balance_keyhunt_delay_return;
index 544d197cb7a14be203e2a0588e70dba145bfda0d..dfd68e2ecc4efc4ff92dc8b1ea2e9c2fef78e9b5 100644 (file)
@@ -274,6 +274,9 @@ void GrapplingHook_Damage (entity inflictor, entity attacker, float damage, floa
        if(self.health > 0)
        {
                self.health = self.health - damage;
+               
+               print(strcat("hook health ", ftos(self.health), " after ", ftos(damage), " damage... (at time: ", ftos(time), ")\n"));
+               
                if (self.health <= 0)
                {
                        if(attacker != self.realowner)
index 3d2f562977f564689ff04213c59c23a2c6d13cb5..c4eb965a7d95ec74070568adc3160a192edf89a9 100644 (file)
@@ -14,9 +14,6 @@ void CreatureFrame (void)
                float vehic = (self.vehicle_flags & VHF_ISVEHICLE);
                float projectile = (self.projectiledeathtype);
                
-               //if(projectile)
-               //      print("waterlevel: ", ftos((self.watertype <= CONTENT_WATER && self.waterlevel > 0)), ". \n");
-               
                if (self.watertype <= CONTENT_WATER && self.waterlevel > 0) // workaround a retarded bug made by id software :P (yes, it's that old of a bug)
                {
                        if (!(self.flags & FL_INWATER))
@@ -25,7 +22,7 @@ void CreatureFrame (void)
                                self.dmgtime = 0;
                                //te_customflash(self.origin, 200, 20, '50 0.1 0.1');
                        }
-                       
+
                        if(!vehic && !projectile) // vehicles and projectiles don't drown
                        {
                                if (self.waterlevel != WATERLEVEL_SUBMERGED)
index 754ffff909bf1a90a75976f115e86d70f8c9bef5..f4e8cac4d336768b924ef2ca84ec661d4b68eb61 100644 (file)
@@ -52,6 +52,18 @@ void W_Hook_Explode2 (void)
        self.movetype = MOVETYPE_NONE;
 }
 
+void W_Hook_Damage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
+{
+       if (self.health <= 0)
+               return;
+       self.health = self.health - damage;
+       
+       print(strcat("hookbomb health ", ftos(self.health), " after ", ftos(damage), " damage... (at time: ", ftos(time), ")\n"));
+       
+       if (self.health <= 0)
+               W_PrepareExplosionByDamage(attacker, W_Hook_Explode2);
+}
+
 void W_Hook_Touch2 (void)
 {
        PROJECTILE_TOUCH;
@@ -80,6 +92,12 @@ void W_Hook_Attack2()
        gren.think = adaptor_think2use_hittype_splash;
        gren.use = W_Hook_Explode2;
        gren.touch = W_Hook_Touch2;
+       
+       gren.takedamage = DAMAGE_YES;
+       gren.health = autocvar_g_balance_hook_secondary_health;
+       gren.damageforcescale = autocvar_g_balance_hook_secondary_damageforcescale;
+       gren.event_damage = W_Hook_Damage;
+       gren.damagedbycontents = TRUE;
 
        gren.velocity = '0 0 1' * autocvar_g_balance_hook_secondary_speed;
        if(autocvar_g_projectiles_newton_style)