X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fmutators%2Fmutator%2Fnades%2Fnades.qc;h=4b65abc55675319c966d3df4419be11b0f6867a7;hb=9f1091e432a2db424bfad2482694ee8b34edbe9c;hp=12a53ff1392bef5bffb9e2efb89f1a60541b7573;hpb=1e31381058a302273d1a3f907f1dd72885845b27;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/mutators/mutator/nades/nades.qc b/qcsrc/common/mutators/mutator/nades/nades.qc index 12a53ff13..4b65abc55 100644 --- a/qcsrc/common/mutators/mutator/nades/nades.qc +++ b/qcsrc/common/mutators/mutator/nades/nades.qc @@ -31,9 +31,9 @@ entity Nade_TrailEffect(int proj, int nade_team) REGISTER_MUTATOR(cl_nades, true); MUTATOR_HOOKFUNCTION(cl_nades, HUD_Draw_overlay) { - if (getstatf(STAT_HEALING_ORB) <= time) return false; + if (STAT(HEALING_ORB) <= time) return false; MUTATOR_ARGV(0, vector) = NADE_TYPE_HEAL.m_color; - MUTATOR_ARGV(0, float) = getstatf(STAT_HEALING_ORB_ALPHA); + MUTATOR_ARGV(0, float) = STAT(HEALING_ORB_ALPHA); return true; } MUTATOR_HOOKFUNCTION(cl_nades, Ent_Projectile) @@ -82,9 +82,9 @@ bool Projectile_isnade(int p) } void DrawAmmoNades(vector myPos, vector mySize, bool draw_expanding, float expand_time) { - float bonusNades = getstatf(STAT_NADE_BONUS); - float bonusProgress = getstatf(STAT_NADE_BONUS_SCORE); - float bonusType = getstati(STAT_NADE_BONUS_TYPE); + float bonusNades = STAT(NADE_BONUS); + float bonusProgress = STAT(NADE_BONUS_SCORE); + float bonusType = STAT(NADE_BONUS_TYPE); Nade def = Nades_from(bonusType); vector nadeColor = def.m_color; string nadeIcon = def.m_icon; @@ -124,20 +124,7 @@ void DrawAmmoNades(vector myPos, vector mySize, bool draw_expanding, float expan #include "../../../monsters/sv_monsters.qh" #include "../../../../server/g_subs.qh" -REGISTER_MUTATOR(nades, cvar("g_nades")) -{ - MUTATOR_ONADD - { - addstat(STAT_NADE_TIMER, AS_FLOAT, nade_timer); - addstat(STAT_NADE_BONUS, AS_FLOAT, bonus_nades); - addstat(STAT_NADE_BONUS_TYPE, AS_INT, nade_type); - addstat(STAT_NADE_BONUS_SCORE, AS_FLOAT, bonus_nade_score); - addstat(STAT_HEALING_ORB, AS_FLOAT, stat_healing_orb); - addstat(STAT_HEALING_ORB_ALPHA, AS_FLOAT, stat_healing_orb_alpha); - } - - return false; -} +REGISTER_MUTATOR(nades, cvar("g_nades")); .float nade_time_primed; @@ -671,6 +658,11 @@ void nade_boom() void nade_touch() {SELFPARAM(); + if(other) + UpdateCSQCProjectile(self); + + if(other == self.realowner) + return; // no self impacts /*float is_weapclip = 0; if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NODRAW) if (!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NONSOLID)) @@ -751,7 +743,7 @@ void nade_damage(entity inflictor, entity attacker, float damage, int deathtype, self.velocity += force; UpdateCSQCProjectile(self); - if(damage <= 0 || ((self.flags & FL_ONGROUND) && IS_PLAYER(attacker))) + if(damage <= 0 || ((IS_ONGROUND(self)) && IS_PLAYER(attacker))) return; if(self.health == self.max_health) @@ -1137,20 +1129,19 @@ MUTATOR_HOOKFUNCTION(nades, PlayerPreThink) { vector revive_extra_size = '1 1 1' * autocvar_g_freezetag_revive_extra_size; n = 0; - FOR_EACH_PLAYER(other) if(self != other) - { - if(other.deadflag == DEAD_NO) - if(other.frozen == 0) - if(SAME_TEAM(other, self)) - if(boxesoverlap(self.absmin - revive_extra_size, self.absmax + revive_extra_size, other.absmin, other.absmax)) + FOREACH_CLIENT(IS_PLAYER(it) && it != self, LAMBDA( + if(it.deadflag == DEAD_NO) + if(it.frozen == 0) + if(SAME_TEAM(it, self)) + if(boxesoverlap(self.absmin - revive_extra_size, self.absmax + revive_extra_size, it.absmin, it.absmax)) { if(!o) - o = other; + o = it; if(self.frozen == 1) - other.reviving = true; + it.reviving = true; ++n; } - } + )); } if(n && self.frozen == 3) // OK, there is at least one teammate reviving us @@ -1166,11 +1157,10 @@ MUTATOR_HOOKFUNCTION(nades, PlayerPreThink) Send_Notification(NOTIF_ONE, o, MSG_CENTER, CENTER_FREEZETAG_REVIVE, self.netname); } - FOR_EACH_PLAYER(other) if(other.reviving) - { + FOREACH_CLIENT(IS_PLAYER(it) && it.reviving, LAMBDA( other.revive_progress = self.revive_progress; other.reviving = false; - } + )); } return false; @@ -1319,5 +1309,12 @@ MUTATOR_HOOKFUNCTION(nades, BuildMutatorsPrettyString) ret_string = strcat(ret_string, ", Nades"); return false; } + +MUTATOR_HOOKFUNCTION(nades, BuildGameplayTipsString) +{ + ret_string = strcat(ret_string, "\n\n^3nades^8 are enabled, press 'g' to use them\n"); + return false; +} + #endif #endif