]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/g_hook.qc
Attempt to remove more g_minstagib checks from the code
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / g_hook.qc
index 4f655ca5738220c1dc75da1c95849f347b2cef68..f7af47d924036f121a6b8340a8dc2df5a0edaee4 100644 (file)
@@ -79,7 +79,7 @@ void GrapplingHook_Stop()
        self.state = 1;
        self.think = GrapplingHookThink;
        self.nextthink = time;
-       self.touch = SUB_Null;
+       self.touch = func_null;
        self.velocity = '0 0 0';
        self.movetype = MOVETYPE_NONE;
        self.hook_length = -1;
@@ -116,12 +116,12 @@ void GrapplingHookThink()
 {
        float spd, dist, minlength, pullspeed, ropestretch, ropeairfriction, rubberforce, newlength, rubberforce_overstretch, s;
        vector dir, org, end, v0, dv, v, myorg, vs;
-       if(self.realowner.health <= 0 || self.realowner.hook != self)   // how did that happen?
-       {                                                                                                               // well, better fix it anyway
-               remove(self);
+       if(self.realowner.hook != self) // how did that happen?
+       {
+               error("Owner lost the hook!\n");
                return;
        }
-       if(LostMovetypeFollow(self))
+       if(LostMovetypeFollow(self) || intermission_running)
        {
                RemoveGrapplingHook(self.realowner);
                return;
@@ -213,6 +213,7 @@ void GrapplingHookThink()
                                                self.aiment.flags &~= FL_ONGROUND;
                                                self.aiment.pusher = self.realowner;
                                                self.aiment.pushltime = time + autocvar_g_maxpushtime;
+                                               self.aiment.istypefrag = self.aiment.BUTTON_CHAT;
                                        }
                                }
 
@@ -271,25 +272,30 @@ void GrapplingHookTouch (void)
 
 void GrapplingHook_Damage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
 {
-       if(self.health > 0)
+       if(self.health <= 0)
+               return;
+               
+       if (!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, -1)) // no exceptions
+               return; // g_balance_projectiledamage says to halt
+                       
+       self.health = self.health - damage;
+               
+       if (self.health <= 0)
        {
-               self.health = self.health - damage;
-               if (self.health <= 0)
+               if(attacker != self.realowner)
                {
-                       if(attacker != self.realowner)
-                       {
-                               self.realowner.pusher = attacker;
-                               self.realowner.pushltime = time + autocvar_g_maxpushtime;
-                       }
-                       RemoveGrapplingHook(self.realowner);
+                       self.realowner.pusher = attacker;
+                       self.realowner.pushltime = time + autocvar_g_maxpushtime;
+                       self.realowner.istypefrag = self.realowner.BUTTON_CHAT;
                }
+               RemoveGrapplingHook(self.realowner);
        }
 }
 
 void FireGrapplingHook (void)
 {
-       local entity missile;
-       local vector org;
+       entity missile;
+       vector org;
        float s;
        vector vs;
 
@@ -324,6 +330,7 @@ void FireGrapplingHook (void)
        self.hook = missile;
        missile.reset = GrapplingHookReset;
        missile.classname = "grapplinghook";
+       missile.flags = FL_PROJECTILE;
 
        missile.movetype = MOVETYPE_FLY;
        PROJECTILE_MAKETRIGGER(missile);
@@ -349,6 +356,7 @@ void FireGrapplingHook (void)
        missile.event_damage = GrapplingHook_Damage;
        missile.takedamage = DAMAGE_AIM;
        missile.damageforcescale = 0;
+       missile.damagedbycontents = (autocvar_g_balance_grapplehook_damagedbycontents);
 
        missile.hook_start = missile.hook_end = missile.origin;
 
@@ -376,7 +384,7 @@ void FireGrapplingHook (void)
 
 void GrapplingHookFrame()
 {
-       if(g_grappling_hook && timeoutStatus != 2 && self.weapon != WEP_HOOK)
+       if(g_grappling_hook && timeout_status != TIMEOUT_ACTIVE && self.weapon != WEP_HOOK)
        {
                // offhand hook controls
                if(self.BUTTON_HOOK)