]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/mutators/mutator/nades/nades.qc
Merge branch 'master' into Mario/wepent_experimental
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mutators / mutator / nades / nades.qc
index d907864ef490c9ba5d7c5f530e4d8415701fb8a0..f81b58c243494d18df148a347fb8096087eacdfa 100644 (file)
@@ -7,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)
@@ -146,7 +146,7 @@ void DrawAmmoNades(vector myPos, vector mySize, bool draw_expanding, float expan
 #ifdef SVQC
 
 #include <common/gamemodes/_mod.qh>
-#include <common/monsters/spawn.qh>
+#include <common/monsters/sv_spawn.qh>
 #include <common/monsters/sv_monsters.qh>
 #include <server/g_subs.qh>
 
@@ -211,7 +211,7 @@ void napalm_damage(entity this, float dist, float damage, float edgedamage, floa
                        if(d < dist)
                        {
                                e.fireball_impactvec = p;
-                               RandomSelection_Add(e, 0, string_null, 1 / (1 + d), !Fire_IsBurning(e));
+                               RandomSelection_AddEnt(e, 1 / (1 + d), !Fire_IsBurning(e));
                        }
                }
        if(RandomSelection_chosen_ent)
@@ -293,6 +293,7 @@ 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);
@@ -349,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;
@@ -650,7 +654,7 @@ void nade_heal_boom(entity this)
 
 void nade_monster_boom(entity this)
 {
-       entity e = spawnmonster(this.pokenade_type, 0, this.realowner, this.realowner, this.origin, false, false, 1);
+       entity e = spawnmonster(spawn(), this.pokenade_type, 0, this.realowner, this.realowner, this.origin, false, false, 1);
 
        if(autocvar_g_nades_pokenade_monster_lifetime > 0)
                e.monster_lifetime = time + autocvar_g_nades_pokenade_monster_lifetime;
@@ -730,10 +734,9 @@ 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);
+               RemoveHook(it);
        });
 
        delete(this);
@@ -780,10 +783,9 @@ 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);
+                       RemoveHook(it);
                });
                delete(this);
                return;
@@ -889,7 +891,7 @@ void toss_nade(entity e, bool set_owner, vector _velocity, float _time)
        makevectors(e.v_angle);
 
        // NOTE: always throw from first weapon entity?
-       W_SetupShot(e, weaponentities[0], false, false, SND_Null, CH_WEAPON_A, 0);
+       W_SetupShot(e, _nade.weaponentity_fld, false, false, SND_Null, CH_WEAPON_A, 0);
 
        Kill_Notification(NOTIF_ONE_ONLY, e, MSG_CENTER, CPID_NADES);
 
@@ -909,7 +911,7 @@ void toss_nade(entity e, bool set_owner, vector _velocity, float _time)
                setsize(_nade, '-16 -16 -16', '16 16 16');
        set_movetype(_nade, MOVETYPE_BOUNCE);
 
-       tracebox(_nade.origin, _nade.mins, _nade.maxs, _nade.origin, false, _nade);
+       tracebox(_nade.origin, _nade.mins, _nade.maxs, _nade.origin, MOVE_NOMONSTERS, _nade);
        if (trace_startsolid)
                setorigin(_nade, e.origin);
 
@@ -942,6 +944,7 @@ void toss_nade(entity e, bool set_owner, vector _velocity, float _time)
        _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);
@@ -1030,6 +1033,8 @@ void spawn_held_nade(entity player, entity nowner, float ntime, int ntype, strin
        if(Nades_from(n.nade_type) == NADE_TYPE_Null)
                n.nade_type = NADE_TYPE_NORMAL.m_id;
 
+       .entity weaponentity = weaponentities[0]; // TODO: unhardcode
+
        setmodel(n, MDL_PROJECTILE_NADE);
        //setattachment(n, player, "bip01 l hand");
        n.exteriormodeltoclient = player;
@@ -1044,9 +1049,9 @@ void spawn_held_nade(entity player, entity nowner, float ntime, int ntype, strin
        setthink(n, nade_beep);
        n.nextthink = max(n.wait - 3, time);
        n.projectiledeathtype = DEATH_NADE.m_id;
+       n.weaponentity_fld = weaponentity;
 
        setmodel(fn, MDL_NADE_VIEW);
-       .entity weaponentity = weaponentities[0]; // TODO: unhardcode
        setattachment(fn, player.(weaponentity), "");
        fn.realowner = fn.owner = player;
        fn.colormod = Nades_from(n.nade_type).m_color;
@@ -1054,6 +1059,7 @@ void spawn_held_nade(entity player, entity nowner, float ntime, int ntype, strin
        fn.glowmod = player.glowmod;
        setthink(fn, SUB_Remove);
        fn.nextthink = n.wait;
+       fn.weaponentity_fld = weaponentity;
 
        player.nade = n;
        player.fake_nade = fn;