]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/weapons/weapon/hagar.qc
Notifications: strong references
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / weapon / hagar.qc
index 17d0cee06d780da328d5b515bc289724463c2025..505a656ec8c9866df0b0b8e5e691b7147dc76f14 100644 (file)
@@ -79,28 +79,28 @@ void W_Hagar_Explode2()
        remove(self);
 }
 
-void W_Hagar_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
-       if(self.health <= 0)
+void W_Hagar_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
+       if(this.health <= 0)
                return;
 
-       float is_linkexplode = ( ((inflictor.owner != world) ? (inflictor.owner == self.owner) : true)
+       float is_linkexplode = ( ((inflictor.owner != world) ? (inflictor.owner == this.owner) : true)
                && (inflictor.projectiledeathtype & HITTYPE_SECONDARY)
-               && (self.projectiledeathtype & HITTYPE_SECONDARY));
+               && (this.projectiledeathtype & HITTYPE_SECONDARY));
 
        if(is_linkexplode)
                is_linkexplode = (is_linkexplode && WEP_CVAR_SEC(hagar, load_linkexplode));
        else
                is_linkexplode = -1; // not secondary load, so continue as normal without exception.
 
-       if(!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, is_linkexplode))
+       if(!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, is_linkexplode))
                return; // g_projectiles_damage says to halt
 
-       self.health = self.health - damage;
-       self.angles = vectoangles(self.velocity);
+       this.health = this.health - damage;
+       this.angles = vectoangles(this.velocity);
 
-       if(self.health <= 0)
-               W_PrepareExplosionByDamage(attacker, self.think);
+       if(this.health <= 0)
+               WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, this.think));
 }
 
 void W_Hagar_Touch()
@@ -305,7 +305,7 @@ void W_Hagar_Attack2_Load(Weapon thiswep, .entity weaponentity)
        else if(autocvar_g_balance_hagar_reload_ammo)
                enough_ammo = self.(weapon_load[WEP_HAGAR.m_id]) >= WEP_CVAR_SEC(hagar, ammo);
        else
-               enough_ammo = self.WEP_AMMO(HAGAR) >= WEP_CVAR_SEC(hagar, ammo);
+               enough_ammo = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(hagar, ammo);
 
        bool stopped = loaded || !enough_ammo;
 
@@ -412,7 +412,7 @@ void W_Hagar_Attack2_Load(Weapon thiswep, .entity weaponentity)
                        if(loadable_secondary)
                                W_Hagar_Attack2_Load(thiswep, weaponentity); // must always run each frame
                        if(autocvar_g_balance_hagar_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(hagar, ammo), WEP_CVAR_SEC(hagar, ammo))) { // forced reload
-                               thiswep.wr_reload(thiswep);
+                               thiswep.wr_reload(thiswep, actor, weaponentity);
                        } else if((fire & 1) && !actor.hagar_load && !actor.hagar_loadblock) // not while secondary is loaded or awaiting reset
                        {
                                if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(hagar, refire)))
@@ -452,13 +452,13 @@ void W_Hagar_Attack2_Load(Weapon thiswep, .entity weaponentity)
                }
                METHOD(Hagar, wr_checkammo1, bool(entity thiswep))
                {
-                       float ammo_amount = self.WEP_AMMO(HAGAR) >= WEP_CVAR_PRI(hagar, ammo);
+                       float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(hagar, ammo);
                        ammo_amount += self.(weapon_load[WEP_HAGAR.m_id]) >= WEP_CVAR_PRI(hagar, ammo);
                        return ammo_amount;
                }
                METHOD(Hagar, wr_checkammo2, bool(entity thiswep))
                {
-                       float ammo_amount = self.WEP_AMMO(HAGAR) >= WEP_CVAR_SEC(hagar, ammo);
+                       float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(hagar, ammo);
                        ammo_amount += self.(weapon_load[WEP_HAGAR.m_id]) >= WEP_CVAR_SEC(hagar, ammo);
                        return ammo_amount;
                }
@@ -473,16 +473,16 @@ void W_Hagar_Attack2_Load(Weapon thiswep, .entity weaponentity)
                        if(self.hagar_load && WEP_CVAR_SEC(hagar, load_releasedeath))
                                W_Hagar_Attack2_Load_Release(weaponentity);
                }
-               METHOD(Hagar, wr_reload, void(entity thiswep))
+               METHOD(Hagar, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
                {
                        if(!self.hagar_load) // require releasing loaded rockets first
                                W_Reload(self, min(WEP_CVAR_PRI(hagar, ammo), WEP_CVAR_SEC(hagar, ammo)), SND(RELOAD));
                }
-               METHOD(Hagar, wr_suicidemessage, int(entity thiswep))
+               METHOD(Hagar, wr_suicidemessage, Notification(entity thiswep))
                {
                        return WEAPON_HAGAR_SUICIDE;
                }
-               METHOD(Hagar, wr_killmessage, int(entity thiswep))
+               METHOD(Hagar, wr_killmessage, Notification(entity thiswep))
                {
                        if(w_deathtype & HITTYPE_SECONDARY)
                                return WEAPON_HAGAR_MURDER_BURST;