]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add an intrusive list for entities that are damaged by contents (liquids etc)
authorMario <mario@smbclan.net>
Wed, 24 Aug 2016 09:38:39 +0000 (19:38 +1000)
committerMario <mario@smbclan.net>
Wed, 24 Aug 2016 09:38:39 +0000 (19:38 +1000)
22 files changed:
qcsrc/common/monsters/monster/shambler.qc
qcsrc/common/monsters/monster/spider.qc
qcsrc/common/monsters/sv_monsters.qc
qcsrc/common/mutators/mutator/nades/nades.qc
qcsrc/common/mutators/mutator/overkill/rpc.qc
qcsrc/common/turrets/turret/ewheel.qc
qcsrc/common/turrets/turret/walker.qc
qcsrc/common/vehicles/sv_vehicles.qc
qcsrc/common/weapons/weapon/arc.qc
qcsrc/common/weapons/weapon/devastator.qc
qcsrc/common/weapons/weapon/electro.qc
qcsrc/common/weapons/weapon/hagar.qc
qcsrc/common/weapons/weapon/hook.qc
qcsrc/common/weapons/weapon/minelayer.qc
qcsrc/common/weapons/weapon/mortar.qc
qcsrc/common/weapons/weapon/seeker.qc
qcsrc/server/client.qc
qcsrc/server/defs.qh
qcsrc/server/g_hook.qc
qcsrc/server/mutators/mutator/gamemode_ctf.qc
qcsrc/server/player.qc
qcsrc/server/sv_main.qc

index 3ba01fe21f226005c15b0bc04d59084e0b923938..f4f3daa7eb73b0c6855a29432e97cfc597376b27 100644 (file)
@@ -144,6 +144,7 @@ void M_Shambler_Attack_Lightning(entity this)
        gren.damageforcescale = 0;
        gren.event_damage = M_Shambler_Attack_Lightning_Damage;
        gren.damagedbycontents = true;
+       IL_PUSH(g_damagedbycontents, gren);
        gren.missile_flags = MIF_SPLASH | MIF_ARC;
        W_SetupProjVelocity_Explicit(gren, v_forward, v_up, (autocvar_g_monster_shambler_attack_lightning_speed), (autocvar_g_monster_shambler_attack_lightning_speed_up), 0, 0, false);
 
index 43a07e650c419a08f7675279f79df203f0ca517c..5723dafe63bf826dc4037bfeeaa9a4aece3a700f 100644 (file)
@@ -162,6 +162,7 @@ void M_Spider_Attack_Web(entity this)
        proj.flags = FL_PROJECTILE;
        IL_PUSH(g_projectiles, proj);
        proj.damagedbycontents = true;
+       IL_PUSH(g_damagedbycontents, proj);
 
        proj.bouncefactor = 0.3;
        proj.bouncestop = 0.05;
index a4f7e6acaace738772fd366d81f499b57a4cdf7c..cce1d37cd340f8c982fdbabadf87154376d9b238 100644 (file)
@@ -1300,7 +1300,10 @@ bool Monster_Spawn(entity this, int mon_id)
        if(!autocvar_g_monsters) { Monster_Remove(this); return false; }
 
        if(!(this.spawnflags & MONSTERFLAG_RESPAWNED))
+       {
                IL_PUSH(g_monsters, this);
+               IL_PUSH(g_damagedbycontents, this);
+       }
 
        if(Monster_Appear_Check(this, mon_id)) { return true; } // return true so the monster isn't removed
 
index d15353745e694868381c0aaf589e015c697c78ad..afd7f5af5ffe9b917792c558b45b93a1555ca4b7 100644 (file)
@@ -939,6 +939,7 @@ void toss_nade(entity e, bool set_owner, vector _velocity, float _time)
        _nade.gravity = 1;
        _nade.missile_flags = MIF_SPLASH | MIF_ARC;
        _nade.damagedbycontents = true;
+       IL_PUSH(g_damagedbycontents, _nade);
        _nade.angles = vectoangles(_nade.velocity);
        _nade.flags = FL_PROJECTILE;
        IL_PUSH(g_projectiles, _nade);
index 4540a26f2e626ccc4761536b0b0cabc0d95e474d..682c66c060eb71bfa09e28932863ff0c232dbfb1 100644 (file)
@@ -82,6 +82,7 @@ void W_RocketPropelledChainsaw_Attack (Weapon thiswep, entity actor, .entity wea
        missile.health = WEP_CVAR(rpc, health);
        missile.event_damage = W_RocketPropelledChainsaw_Damage;
        missile.damagedbycontents = true;
+       IL_PUSH(g_damagedbycontents, missile);
        set_movetype(missile, MOVETYPE_FLY);
 
        missile.projectiledeathtype = WEP_RPC.m_id;
index b5716f7a9867195973b98d95ffa254d883da85a6..0a633c78446431fdb0f0c841d67c5d70e49da369 100644 (file)
@@ -198,6 +198,7 @@ METHOD(EWheel, tr_setup, void(EWheel this, entity it))
     it.iscreature                              = true;
     it.teleportable                    = TELEPORT_NORMAL;
     it.damagedbycontents               = true;
+    IL_PUSH(g_damagedbycontents, it);
     set_movetype(it, MOVETYPE_WALK);
     it.solid                                   = SOLID_SLIDEBOX;
     it.takedamage                              = DAMAGE_AIM;
index 94ecdd332a0a264625d7ac7be3727564b60bf8c3..7882a15fc162d80b8dcf28b82392234f7e706063 100644 (file)
@@ -569,6 +569,7 @@ METHOD(WalkerTurret, tr_setup, void(WalkerTurret this, entity it))
     it.iscreature = true;
     it.teleportable = TELEPORT_NORMAL;
     it.damagedbycontents = true;
+    IL_PUSH(g_damagedbycontents, it);
     it.solid = SOLID_SLIDEBOX;
     it.takedamage = DAMAGE_AIM;
     if(it.move_movetype != MOVETYPE_WALK)
index 39f959d14b9f03f851f6b8edebf6d3efd90008e3..c1bf1ed1dfa16ae7bcb5d5095e6bb012ac95a0d9 100644 (file)
@@ -1164,6 +1164,7 @@ bool vehicle_initialize(entity this, Vehicle info, bool nodrop)
        this.iscreature                         = true;
        this.teleportable                       = false; // no teleporting for vehicles, too buggy
        this.damagedbycontents          = true;
+       IL_PUSH(g_damagedbycontents, this);
        this.vehicleid                          = info.vehicleid;
        this.PlayerPhysplug                     = info.PlayerPhysplug;
        this.event_damage                       = func_null;
index 1f8b8e7f085e7d6e6484095e3cb4a6cb279dcea5..9b44d0f7188203709f0d495b29162e8f24251ff2 100644 (file)
@@ -289,6 +289,7 @@ void W_Arc_Attack_Bolt(Weapon thiswep, entity actor, .entity weaponentity)
        missile.damageforcescale = WEP_CVAR(arc, bolt_damageforcescale);
        missile.event_damage = W_Arc_Bolt_Damage;
        missile.damagedbycontents = true;
+       IL_PUSH(g_damagedbycontents, missile);
 
        settouch(missile, W_Arc_Bolt_Touch);
        missile.use = W_Arc_Bolt_Explode_use;
index 5ffe08bad9613ee7303ab9c256d8726e97b13f52..3087f964f061c74aefe0121c6612b2d7467cd185 100644 (file)
@@ -384,6 +384,7 @@ void W_Devastator_Attack(Weapon thiswep, entity actor, .entity weaponentity)
        missile.health = WEP_CVAR(devastator, health);
        missile.event_damage = W_Devastator_Damage;
        missile.damagedbycontents = true;
+       IL_PUSH(g_damagedbycontents, missile);
 
        set_movetype(missile, MOVETYPE_FLY);
        PROJECTILE_MAKETRIGGER(missile);
index bd6fb89694bda3bb0d4a265cc3d525c66218822d..d281670971209448e8a4e6639f03d1b9dc454c88 100644 (file)
@@ -331,6 +331,7 @@ void W_Electro_Orb_Stick(entity this, entity to)
        newproj.event_damage = this.event_damage;
        newproj.spawnshieldtime = this.spawnshieldtime;
        newproj.damagedbycontents = true;
+       IL_PUSH(g_damagedbycontents, newproj);
 
        set_movetype(newproj, MOVETYPE_NONE); // lock the orb in place
        newproj.projectiledeathtype = this.projectiledeathtype;
@@ -449,6 +450,8 @@ void W_Electro_Attack_Orb(Weapon thiswep, entity actor, .entity weaponentity)
        proj.flags = FL_PROJECTILE;
        IL_PUSH(g_projectiles, proj);
        proj.damagedbycontents = (WEP_CVAR_SEC(electro, damagedbycontents));
+       if(proj.damagedbycontents)
+               IL_PUSH(g_damagedbycontents, proj);
 
        proj.bouncefactor = WEP_CVAR_SEC(electro, bouncefactor);
        proj.bouncestop = WEP_CVAR_SEC(electro, bouncestop);
index ece4b358950281f125ab71561799b9afb9142e4b..a59c5acf5f4c3bc2709c0f82988a846e3c0c668e 100644 (file)
@@ -155,6 +155,7 @@ void W_Hagar_Attack(Weapon thiswep, entity actor, .entity weaponentity)
        missile.damageforcescale = WEP_CVAR_PRI(hagar, damageforcescale);
        missile.event_damage = W_Hagar_Damage;
        missile.damagedbycontents = true;
+       IL_PUSH(g_damagedbycontents, missile);
 
        settouch(missile, W_Hagar_Touch);
        missile.use = W_Hagar_Explode_use;
@@ -198,6 +199,7 @@ void W_Hagar_Attack2(Weapon thiswep, entity actor, .entity weaponentity)
        missile.damageforcescale = WEP_CVAR_SEC(hagar, damageforcescale);
        missile.event_damage = W_Hagar_Damage;
        missile.damagedbycontents = true;
+       IL_PUSH(g_damagedbycontents, missile);
 
        settouch(missile, W_Hagar_Touch2);
        missile.cnt = 0;
@@ -258,6 +260,7 @@ void W_Hagar_Attack2_Load_Release(entity actor, .entity weaponentity)
                missile.damageforcescale = WEP_CVAR_SEC(hagar, damageforcescale);
                missile.event_damage = W_Hagar_Damage;
                missile.damagedbycontents = true;
+               IL_PUSH(g_damagedbycontents, missile);
 
                settouch(missile, W_Hagar_Touch); // not bouncy
                missile.use = W_Hagar_Explode2_use;
index b2c317459935f818088d5d9feaa7773232257b3a..f2718a8fad1704e41464c66125095a4158fe2719 100644 (file)
@@ -169,6 +169,7 @@ void W_Hook_Attack2(Weapon thiswep, entity actor, .entity weaponentity)
        gren.damageforcescale = WEP_CVAR_SEC(hook, damageforcescale);
        gren.event_damage = W_Hook_Damage;
        gren.damagedbycontents = true;
+       IL_PUSH(g_damagedbycontents, gren);
        gren.missile_flags = MIF_SPLASH | MIF_ARC;
 
        gren.velocity = '0 0 1' * WEP_CVAR_SEC(hook, speed);
index a3b356954af68f47a0b07d76ac61aa5d81e4f204..2c1c35c137494e29b077fb3294c228f628b92b1c 100644 (file)
@@ -92,6 +92,7 @@ void W_MineLayer_Stick(entity this, entity to)
        newmine.event_damage = this.event_damage;
        newmine.spawnshieldtime = this.spawnshieldtime;
        newmine.damagedbycontents = true;
+       IL_PUSH(g_damagedbycontents, newmine);
 
        set_movetype(newmine, MOVETYPE_NONE); // lock the mine in place
        newmine.projectiledeathtype = this.projectiledeathtype;
@@ -357,6 +358,7 @@ void W_MineLayer_Attack(Weapon thiswep, entity actor, .entity weaponentity)
        mine.health = WEP_CVAR(minelayer, health);
        mine.event_damage = W_MineLayer_Damage;
        mine.damagedbycontents = true;
+       IL_PUSH(g_damagedbycontents, mine);
 
        set_movetype(mine, MOVETYPE_TOSS);
        PROJECTILE_MAKETRIGGER(mine);
index 81be156541cb7f31c40d9dd5081ad76c3b41677d..e55cf0bbdd962e52e49d63f372c5b0a3d1707b08 100644 (file)
@@ -242,6 +242,7 @@ void W_Mortar_Attack(Weapon thiswep, entity actor, .entity weaponentity)
        gren.damageforcescale = WEP_CVAR_PRI(mortar, damageforcescale);
        gren.event_damage = W_Mortar_Grenade_Damage;
        gren.damagedbycontents = true;
+       IL_PUSH(g_damagedbycontents, gren);
        gren.missile_flags = MIF_SPLASH | MIF_ARC;
        W_SetupProjVelocity_UP_PRI(gren, mortar);
 
@@ -290,6 +291,7 @@ void W_Mortar_Attack2(Weapon thiswep, entity actor, .entity weaponentity)
        gren.damageforcescale = WEP_CVAR_SEC(mortar, damageforcescale);
        gren.event_damage = W_Mortar_Grenade_Damage;
        gren.damagedbycontents = true;
+       IL_PUSH(g_damagedbycontents, gren);
        gren.missile_flags = MIF_SPLASH | MIF_ARC;
        W_SetupProjVelocity_UP_SEC(gren, mortar);
 
index 850659069a30cd71a6c259aa3c4c49775787515a..ebfcfd8ff631444ce5df84d9e95b080732c7f716 100644 (file)
@@ -282,6 +282,7 @@ void W_Seeker_Fire_Missile(Weapon thiswep, entity actor, .entity weaponentity, v
        missile.health          = WEP_CVAR(seeker, missile_health);
        missile.damageforcescale = WEP_CVAR(seeker, missile_damageforcescale);
        missile.damagedbycontents = true;
+       IL_PUSH(g_damagedbycontents, missile);
        //missile.think           = W_Seeker_Missile_Animate; // csqc projectiles.
 
        if(missile.enemy != NULL)
index 7d38c3ea44e2ad45455193926b41e2866e5c2bf9..085756e18b045b4e8fcc7d8db152aff7fbfcd58a 100644 (file)
@@ -300,6 +300,8 @@ void PutObserverInServer(entity this)
        TRANSMUTE(Observer, this);
        this.iscreature = false;
        this.teleportable = TELEPORT_SIMPLE;
+       if(this.damagedbycontents)
+               IL_REMOVE(g_damagedbycontents, this);
        this.damagedbycontents = false;
        this.health = FRAGS_SPECTATOR;
        SetSpectatee_status(this, etof(this));
@@ -521,6 +523,8 @@ void PutClientInServer(entity this)
                this.wasplayer = true;
                this.iscreature = true;
                this.teleportable = TELEPORT_NORMAL;
+               if(!this.damagedbycontents)
+                       IL_PUSH(g_damagedbycontents, this);
                this.damagedbycontents = true;
                set_movetype(this, MOVETYPE_WALK);
                this.solid = SOLID_SLIDEBOX;
index a6bd1552d2250d7c0a2ee1895173586b4f9ab81f..9a53c1305966368ffed9c2cacb9251fc5c1ceac1 100644 (file)
@@ -429,6 +429,9 @@ const int MIF_GUIDED_CONFUSABLE = MIF_GUIDED_HEAT | MIF_GUIDED_AI;
 .bool init_for_player_needed;
 .void(entity this, entity player) init_for_player;
 
+IntrusiveList g_damagedbycontents;
+STATIC_INIT(g_damagedbycontents) { g_damagedbycontents = IL_NEW(); }
+
 IntrusiveList g_monsters;
 STATIC_INIT(g_monsters) { g_monsters = IL_NEW(); }
 
index 46508a9191162f34554428248f7d6118a221d41f..fb073e9f13455911b5b75f30bcd2dd590ea6c463 100644 (file)
@@ -397,6 +397,8 @@ void FireGrapplingHook(entity actor)
        missile.takedamage = DAMAGE_AIM;
        missile.damageforcescale = 0;
        missile.damagedbycontents = (autocvar_g_balance_grapplehook_damagedbycontents);
+       if(missile.damagedbycontents)
+               IL_PUSH(g_damagedbycontents, missile);
 
        missile.hook_start = missile.hook_end = missile.origin;
 
index 017fb265b9adc89fcb7aa5d63ab61d8c66e8dff6..6eeb7d06d23b9562327330b563c11bf17f5b911c 100644 (file)
@@ -1245,6 +1245,8 @@ void ctf_FlagSetup(int teamnumber, entity flag) // called when spawning a flag e
        flag.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_PLAYERCLIP;
        flag.damagedbytriggers = autocvar_g_ctf_flag_return_when_unreachable;
        flag.damagedbycontents = autocvar_g_ctf_flag_return_when_unreachable;
+       if(flag.damagedbycontents)
+               IL_PUSH(g_damagedbycontents, flag);
        flag.velocity = '0 0 0';
        flag.mangle = flag.angles;
        flag.reset = ctf_Reset;
index f2ceecf9ee4596d1cc9125da2dc7513f69f13c25..7dfcf4c3f7696fa97d4cb306f14de49c327c3d93 100644 (file)
@@ -62,6 +62,8 @@ void CopyBody(entity this, float keepvelocity)
        clone.iscreature = this.iscreature;
        clone.teleportable = this.teleportable;
        clone.damagedbycontents = this.damagedbycontents;
+       if(clone.damagedbycontents)
+               IL_PUSH(g_damagedbycontents, clone);
        clone.angles = this.angles;
        clone.v_angle = this.v_angle;
        clone.avelocity = this.avelocity;
@@ -210,6 +212,8 @@ void PlayerCorpseDamage(entity this, entity inflictor, entity attacker, float da
                this.alpha = -1;
                this.solid = SOLID_NOT; // restore later
                this.takedamage = DAMAGE_NO; // restore later
+               if(this.damagedbycontents)
+                       IL_REMOVE(g_damagedbycontents, this);
                this.damagedbycontents = false;
        }
 }
index 1bb6974eb03ccf0460c46210dda635f8ec45a34f..20299f61329053483fb8a1bbe91f1558bd04d025 100644 (file)
@@ -117,7 +117,8 @@ void CreatureFrame_FallDamage(entity this)
 
 void CreatureFrame_All()
 {
-       FOREACH_ENTITY_FLOAT(damagedbycontents, true, {
+       IL_EACH(g_damagedbycontents, it.damagedbycontents,
+       {
                if (it.move_movetype == MOVETYPE_NOCLIP) continue;
                CreatureFrame_Liquids(it);
                CreatureFrame_FallDamage(it);