X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fmutators%2Fmutator%2Finstagib%2Finstagib.qc;h=34836ab3d4e40327dc5ea773c23f5c46de56f78c;hb=5eea97bc262bfaf271817ca034439ad551f691d4;hp=f8f2e5a7dfb41ec821f611b8f8573a784e97d01c;hpb=d271f27a5ac351a3a7b39636932f6d661492be1d;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/mutators/mutator/instagib/instagib.qc b/qcsrc/common/mutators/mutator/instagib/instagib.qc index f8f2e5a7d..34836ab3d 100644 --- a/qcsrc/common/mutators/mutator/instagib/instagib.qc +++ b/qcsrc/common/mutators/mutator/instagib/instagib.qc @@ -24,25 +24,25 @@ REGISTER_MUTATOR(mutator_instagib, cvar("g_instagib") && !g_nexball); spawnfunc(item_minst_cells) { - if (!g_instagib) { remove(self); return; } - if (!self.ammo_cells) self.ammo_cells = autocvar_g_instagib_ammo_drop; + if (!g_instagib) { remove(this); return; } + if (!this.ammo_cells) this.ammo_cells = autocvar_g_instagib_ammo_drop; StartItem(this, ITEM_VaporizerCells); } -void instagib_invisibility() -{SELFPARAM(); - self.strength_finished = autocvar_g_balance_powerup_strength_time; +void instagib_invisibility(entity this) +{ + this.strength_finished = autocvar_g_balance_powerup_strength_time; StartItem(this, ITEM_Invisibility); } -void instagib_extralife() -{SELFPARAM(); +void instagib_extralife(entity this) +{ StartItem(this, ITEM_ExtraLife); } -void instagib_speed() -{SELFPARAM(); - self.invincible_finished = autocvar_g_balance_powerup_invincible_time; +void instagib_speed(entity this) +{ + this.invincible_finished = autocvar_g_balance_powerup_invincible_time; StartItem(this, ITEM_Speed); } @@ -55,86 +55,86 @@ void instagib_stop_countdown(entity e) Kill_Notification(NOTIF_ONE_ONLY, e, MSG_CENTER, CPID_INSTAGIB_FINDAMMO); e.instagib_needammo = false; } -void instagib_ammocheck() -{SELFPARAM(); - if(time < self.instagib_nextthink) +void instagib_ammocheck(entity this) +{ + if(time < this.instagib_nextthink) return; - if(!IS_PLAYER(self)) + if(!IS_PLAYER(this)) return; // not a player - if(IS_DEAD(self) || gameover) - instagib_stop_countdown(self); - else if (self.ammo_cells > 0 || (self.items & IT_UNLIMITED_WEAPON_AMMO) || (self.flags & FL_GODMODE)) - instagib_stop_countdown(self); + if(IS_DEAD(this) || gameover) + instagib_stop_countdown(this); + else if (this.ammo_cells > 0 || (this.items & IT_UNLIMITED_WEAPON_AMMO) || (this.flags & FL_GODMODE)) + instagib_stop_countdown(this); else if(autocvar_g_rm && autocvar_g_rm_laser) { - if(!self.instagib_needammo) + if(!this.instagib_needammo) { - Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_INSTAGIB_DOWNGRADE); - self.instagib_needammo = true; + Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_INSTAGIB_DOWNGRADE); + this.instagib_needammo = true; } } else { - self.instagib_needammo = true; - if (self.health <= 5) + this.instagib_needammo = true; + if (this.health <= 5) { - Damage(self, self, self, 5, DEATH_NOAMMO.m_id, self.origin, '0 0 0'); - Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_INSTAGIB_TERMINATED); + Damage(this, this, this, 5, DEATH_NOAMMO.m_id, this.origin, '0 0 0'); + Send_Notification(NOTIF_ONE, this, MSG_ANNCE, ANNCE_INSTAGIB_TERMINATED); } - else if (self.health <= 10) + else if (this.health <= 10) { - Damage(self, self, self, 5, DEATH_NOAMMO.m_id, self.origin, '0 0 0'); - Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_1); + Damage(this, this, this, 5, DEATH_NOAMMO.m_id, this.origin, '0 0 0'); + Send_Notification(NOTIF_ONE, this, MSG_ANNCE, ANNCE_NUM_1); } - else if (self.health <= 20) + else if (this.health <= 20) { - Damage(self, self, self, 10, DEATH_NOAMMO.m_id, self.origin, '0 0 0'); - Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_2); + Damage(this, this, this, 10, DEATH_NOAMMO.m_id, this.origin, '0 0 0'); + Send_Notification(NOTIF_ONE, this, MSG_ANNCE, ANNCE_NUM_2); } - else if (self.health <= 30) + else if (this.health <= 30) { - Damage(self, self, self, 10, DEATH_NOAMMO.m_id, self.origin, '0 0 0'); - Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_3); + Damage(this, this, this, 10, DEATH_NOAMMO.m_id, this.origin, '0 0 0'); + Send_Notification(NOTIF_ONE, this, MSG_ANNCE, ANNCE_NUM_3); } - else if (self.health <= 40) + else if (this.health <= 40) { - Damage(self, self, self, 10, DEATH_NOAMMO.m_id, self.origin, '0 0 0'); - Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_4); + Damage(this, this, this, 10, DEATH_NOAMMO.m_id, this.origin, '0 0 0'); + Send_Notification(NOTIF_ONE, this, MSG_ANNCE, ANNCE_NUM_4); } - else if (self.health <= 50) + else if (this.health <= 50) { - Damage(self, self, self, 10, DEATH_NOAMMO.m_id, self.origin, '0 0 0'); - Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_5); + Damage(this, this, this, 10, DEATH_NOAMMO.m_id, this.origin, '0 0 0'); + Send_Notification(NOTIF_ONE, this, MSG_ANNCE, ANNCE_NUM_5); } - else if (self.health <= 60) + else if (this.health <= 60) { - Damage(self, self, self, 10, DEATH_NOAMMO.m_id, self.origin, '0 0 0'); - Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_6); + Damage(this, this, this, 10, DEATH_NOAMMO.m_id, this.origin, '0 0 0'); + Send_Notification(NOTIF_ONE, this, MSG_ANNCE, ANNCE_NUM_6); } - else if (self.health <= 70) + else if (this.health <= 70) { - Damage(self, self, self, 10, DEATH_NOAMMO.m_id, self.origin, '0 0 0'); - Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_7); + Damage(this, this, this, 10, DEATH_NOAMMO.m_id, this.origin, '0 0 0'); + Send_Notification(NOTIF_ONE, this, MSG_ANNCE, ANNCE_NUM_7); } - else if (self.health <= 80) + else if (this.health <= 80) { - Damage(self, self, self, 10, DEATH_NOAMMO.m_id, self.origin, '0 0 0'); - Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_8); + Damage(this, this, this, 10, DEATH_NOAMMO.m_id, this.origin, '0 0 0'); + Send_Notification(NOTIF_ONE, this, MSG_ANNCE, ANNCE_NUM_8); } - else if (self.health <= 90) + else if (this.health <= 90) { - Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_INSTAGIB_FINDAMMO); - Damage(self, self, self, 10, DEATH_NOAMMO.m_id, self.origin, '0 0 0'); - Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_9); + Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_INSTAGIB_FINDAMMO); + Damage(this, this, this, 10, DEATH_NOAMMO.m_id, this.origin, '0 0 0'); + Send_Notification(NOTIF_ONE, this, MSG_ANNCE, ANNCE_NUM_9); } else { - Send_Notification(NOTIF_ONE_ONLY, self, MSG_MULTI, MULTI_INSTAGIB_FINDAMMO); - Damage(self, self, self, 10, DEATH_NOAMMO.m_id, self.origin, '0 0 0'); + Send_Notification(NOTIF_ONE_ONLY, this, MSG_MULTI, MULTI_INSTAGIB_FINDAMMO); + Damage(this, this, this, 10, DEATH_NOAMMO.m_id, this.origin, '0 0 0'); } } - self.instagib_nextthink = time + 1; + this.instagib_nextthink = time + 1; } MUTATOR_HOOKFUNCTION(mutator_instagib, MatchEnd) @@ -145,7 +145,9 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, MatchEnd) MUTATOR_HOOKFUNCTION(mutator_instagib, MonsterDropItem) { - other.monster_loot = spawnfunc_item_minst_cells; + entity item = M_ARGV(1, entity); + + item.monster_loot = spawnfunc_item_minst_cells; return false; } @@ -174,14 +176,15 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, MakePlayerObserver) } MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerSpawn) -{SELFPARAM(); - self.effects |= EF_FULLBRIGHT; - return false; +{ + entity player = M_ARGV(0, entity); + + player.effects |= EF_FULLBRIGHT; } MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerPreThink) -{ - instagib_ammocheck(); +{SELFPARAM(); + instagib_ammocheck(self); return false; } @@ -252,10 +255,8 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerPhysics) MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerDamage_SplitHealthArmor) { - damage_save = 0; - damage_take = frag_damage; - - return false; + M_ARGV(4, float) = M_ARGV(7, float); // take = damage + M_ARGV(5, float) = 0; // save } MUTATOR_HOOKFUNCTION(mutator_instagib, ForbidThrowCurrentWeapon) @@ -267,6 +268,13 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, ForbidThrowCurrentWeapon) MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerDamage_Calculate) { + entity frag_attacker = M_ARGV(1, entity); + entity frag_target = M_ARGV(2, entity); + float frag_deathtype = M_ARGV(3, float); + float frag_damage = M_ARGV(4, float); + float frag_mirrordamage = M_ARGV(5, float); + vector frag_force = M_ARGV(6, vector); + if(autocvar_g_friendlyfire == 0 && SAME_TEAM(frag_target, frag_attacker) && IS_PLAYER(frag_target) && IS_PLAYER(frag_attacker)) frag_damage = 0; @@ -288,6 +296,9 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerDamage_Calculate) if(IS_PLAYER(frag_attacker)) if(DEATH_ISWEAPON(frag_deathtype, WEP_VAPORIZER)) { + if(!autocvar_g_instagib_friendlypush && SAME_TEAM(frag_target, frag_attacker)) + frag_force = '0 0 0'; + if(frag_target.armorvalue) { frag_target.armorvalue -= 1; @@ -303,7 +314,11 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerDamage_Calculate) if(frag_deathtype & HITTYPE_SECONDARY) { if(!autocvar_g_instagib_blaster_keepdamage || frag_attacker == frag_target) - frag_damage = frag_mirrordamage = 0; + { + frag_damage = 0; + if(!autocvar_g_instagib_mirrordamage) + frag_mirrordamage = 0; // never do mirror damage on enemies + } if(frag_target != frag_attacker) { @@ -315,6 +330,7 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerDamage_Calculate) } } + if(!autocvar_g_instagib_mirrordamage) // only apply the taking lives hack if we don't want to support real damage mirroring if(IS_PLAYER(frag_attacker)) if(frag_mirrordamage > 0) { @@ -329,8 +345,13 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerDamage_Calculate) } if(frag_target.alpha && frag_target.alpha < 1) + if(IS_PLAYER(frag_target)) yoda = 1; + M_ARGV(4, float) = frag_damage; + M_ARGV(5, float) = frag_mirrordamage; + M_ARGV(6, vector) = frag_force; + return false; } @@ -402,6 +423,9 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, CustomizeWaypoint) MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerDies) { + float frag_deathtype = M_ARGV(3, float); + float frag_damage = M_ARGV(4, float); + if(DEATH_ISWEAPON(frag_deathtype, WEP_VAPORIZER)) frag_damage = 1000; // always gib if it was a vaporizer death @@ -448,11 +472,11 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, OnEntityPreSpawn) float r = random(); if (r < 0.3) - e.think = instagib_invisibility; + setthink(e, instagib_invisibility); else if (r < 0.6) - e.think = instagib_extralife; + setthink(e, instagib_extralife); else - e.think = instagib_speed; + setthink(e, instagib_speed); e.nextthink = time + 0.1; e.spawnflags = self.spawnflags;