X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fmutators%2Fmutator%2Fnades%2Fnades.qc;h=c4e73d286d13946e64024fc976ae1d5987e3347a;hb=268f9c69576b6bb929f66d19f0d077d19ba47edd;hp=5570a1b084aa6befa6a67ca796e1dae109504c7a;hpb=c13fdf2b49eff1d26abc73d42e33636162a9b527;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 5570a1b08..c4e73d286 100644 --- a/qcsrc/common/mutators/mutator/nades/nades.qc +++ b/qcsrc/common/mutators/mutator/nades/nades.qc @@ -1,7 +1,5 @@ #include "nades.qh" -#ifdef IMPLEMENTATION - #ifdef SVQC bool autocvar_g_nades_nade_small; float autocvar_g_nades_spread = 0.04; @@ -9,7 +7,7 @@ float autocvar_g_nades_spread = 0.04; REGISTER_STAT(NADES_SMALL, int, autocvar_g_nades_nade_small) -#ifndef MENUQC +#ifdef GAMEQC entity Nade_TrailEffect(int proj, int nade_team) { switch (proj) @@ -147,8 +145,8 @@ void DrawAmmoNades(vector myPos, vector mySize, bool draw_expanding, float expan #ifdef SVQC -#include -#include +#include +#include #include #include @@ -163,7 +161,7 @@ void nade_timer_think(entity this) this.skin = 8 - (this.owner.wait - time) / (autocvar_g_nades_nade_lifetime / 10); this.nextthink = time; if(!this.owner || wasfreed(this.owner)) - remove(this); + delete(this); } void nade_burn_spawn(entity _nade) @@ -232,13 +230,13 @@ void napalm_ball_think(entity this) if(round_handler_IsActive()) if(!round_handler_IsRoundStarted()) { - remove(this); + delete(this); return; } if(time > this.pushltime) { - remove(this); + delete(this); return; } @@ -294,6 +292,8 @@ void nade_napalm_ball(entity this) proj.angles = vectoangles(proj.velocity); proj.flags = FL_PROJECTILE; + IL_PUSH(g_projectiles, proj); + IL_PUSH(g_bot_dodge, proj); proj.missile_flags = MIF_SPLASH | MIF_PROXY | MIF_ARC; //CSQCProjectile(proj, true, PROJECTILE_NAPALM_FIRE, true); @@ -306,13 +306,13 @@ void napalm_fountain_think(entity this) if(round_handler_IsActive()) if(!round_handler_IsRoundStarted()) { - remove(this); + delete(this); return; } if(time >= this.ltime) { - remove(this); + delete(this); return; } @@ -350,6 +350,9 @@ void nade_napalm_boom(entity this) fountain.owner = this.owner; fountain.realowner = this.realowner; fountain.origin = this.origin; + fountain.flags = FL_PROJECTILE; + IL_PUSH(g_projectiles, fountain); + IL_PUSH(g_bot_dodge, fountain); setorigin(fountain, fountain.origin); setthink(fountain, napalm_fountain_think); fountain.nextthink = time; @@ -379,7 +382,7 @@ void nade_ice_think(entity this) if(round_handler_IsActive()) if(!round_handler_IsRoundStarted()) { - remove(this); + delete(this); return; } @@ -396,7 +399,7 @@ void nade_ice_think(entity this) Damage_DamageInfo(this.origin, autocvar_g_nades_nade_damage, autocvar_g_nades_nade_edgedamage, autocvar_g_nades_nade_radius, '1 1 1' * autocvar_g_nades_nade_force, this.projectiledeathtype, 0, this); } - remove(this); + delete(this); return; } @@ -502,7 +505,7 @@ void nade_spawn_boom(entity this) if(this.realowner.nade_spawnloc) { - remove(this.realowner.nade_spawnloc); + delete(this.realowner.nade_spawnloc); this.realowner.nade_spawnloc = NULL; } @@ -513,7 +516,7 @@ void nades_orb_think(entity this) { if(time >= this.ltime) { - remove(this); + delete(this); return; } @@ -731,13 +734,12 @@ void nade_boom(entity this) case NADE_TYPE_ENTRAP: nade_entrap_boom(this); break; } - FOREACH_ENTITY_ENT(aiment, this, + IL_EACH(g_projectiles, it.classname == "grapplinghook" && it.aiment == this, { - if(it.classname == "grapplinghook") - RemoveGrapplingHook(it.realowner); + RemoveGrapplingHook(it.realowner); }); - remove(this); + delete(this); } void spawn_held_nade(entity player, entity nowner, float ntime, int ntype, string pntype); @@ -771,7 +773,7 @@ void nade_touch(entity this, entity toucher) { nade_pickup(toucher, this); sound(this, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, 0.5 *(ATTEN_LARGE + ATTEN_MAX)); - remove(this); + delete(this); return; } /*float is_weapclip = 0; @@ -781,12 +783,11 @@ void nade_touch(entity this, entity toucher) is_weapclip = 1;*/ if(ITEM_TOUCH_NEEDKILL()) // || is_weapclip) { - FOREACH_ENTITY_ENT(aiment, this, + IL_EACH(g_projectiles, it.classname == "grapplinghook" && it.aiment == this, { - if(it.classname == "grapplinghook") - RemoveGrapplingHook(it.realowner); + RemoveGrapplingHook(it.realowner); }); - remove(this); + delete(this); return; } @@ -884,12 +885,13 @@ void toss_nade(entity e, bool set_owner, vector _velocity, float _time) entity _nade = e.nade; e.nade = NULL; - remove(e.fake_nade); + delete(e.fake_nade); e.fake_nade = NULL; makevectors(e.v_angle); - W_SetupShot(e, false, false, SND_Null, CH_WEAPON_A, 0); + // NOTE: always throw from first weapon entity? + W_SetupShot(e, weaponentities[0], false, false, SND_Null, CH_WEAPON_A, 0); Kill_Notification(NOTIF_ONE_ONLY, e, MSG_CENTER, CPID_NADES); @@ -941,6 +943,8 @@ void toss_nade(entity e, bool set_owner, vector _velocity, float _time) _nade.damagedbycontents = true; _nade.angles = vectoangles(_nade.velocity); _nade.flags = FL_PROJECTILE; + IL_PUSH(g_projectiles, _nade); + IL_PUSH(g_bot_dodge, _nade); _nade.projectiledeathtype = DEATH_NADE.m_id; _nade.toss_time = time; _nade.solid = SOLID_CORPSE; //((_nade.nade_type == NADE_TYPE_TRANSLOCATE) ? SOLID_CORPSE : SOLID_BBOX); @@ -1065,10 +1069,10 @@ void nade_prime(entity this) return; // only allow bonus nades if(this.nade) - remove(this.nade); + delete(this.nade); if(this.fake_nade) - remove(this.fake_nade); + delete(this.fake_nade); int ntype; string pntype = this.pokenade_type; @@ -1149,9 +1153,9 @@ void nades_CheckThrow(entity this) void nades_Clear(entity player) { if(player.nade) - remove(player.nade); + delete(player.nade); if(player.fake_nade) - remove(player.fake_nade); + delete(player.fake_nade); player.nade = player.fake_nade = NULL; player.nade_timer = 0; @@ -1172,7 +1176,7 @@ CLASS(NadeOffhand, OffhandWeapon) if (held_nade) { player.nade_timer = bound(0, (time - held_nade.nade_time_primed) / autocvar_g_nades_nade_lifetime, 1); - // LOG_TRACEF("%d %d\n", player.nade_timer, time - held_nade.nade_time_primed); + // LOG_TRACEF("%d %d", player.nade_timer, time - held_nade.nade_time_primed); makevectors(player.angles); held_nade.velocity = player.velocity; setorigin(held_nade, player.origin + player.view_ofs + v_forward * 8 + v_right * -8 + v_up * 0); @@ -1349,7 +1353,7 @@ MUTATOR_HOOKFUNCTION(nades, PlayerSpawn) if(player.nade_spawnloc.cnt <= 0) { - remove(player.nade_spawnloc); + delete(player.nade_spawnloc); player.nade_spawnloc = NULL; } } @@ -1427,7 +1431,7 @@ MUTATOR_HOOKFUNCTION(nades, MonsterDies) MUTATOR_HOOKFUNCTION(nades, DropSpecialItems) { entity frag_target = M_ARGV(0, entity); - + if(frag_target.nade) toss_nade(frag_target, true, '0 0 0', time + 0.05); } @@ -1483,4 +1487,3 @@ MUTATOR_HOOKFUNCTION(nades, BuildGameplayTipsString) } #endif -#endif