From: Mario Date: Wed, 24 Aug 2016 09:38:39 +0000 (+1000) Subject: Add an intrusive list for entities that are damaged by contents (liquids etc) X-Git-Tag: xonotic-v0.8.2~474^2~7 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=1d4a1688f09d4192f8b783d0c081e22d292af761;p=xonotic%2Fxonotic-data.pk3dir.git Add an intrusive list for entities that are damaged by contents (liquids etc) --- diff --git a/qcsrc/common/monsters/monster/shambler.qc b/qcsrc/common/monsters/monster/shambler.qc index 3ba01fe21..f4f3daa7e 100644 --- a/qcsrc/common/monsters/monster/shambler.qc +++ b/qcsrc/common/monsters/monster/shambler.qc @@ -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); diff --git a/qcsrc/common/monsters/monster/spider.qc b/qcsrc/common/monsters/monster/spider.qc index 43a07e650..5723dafe6 100644 --- a/qcsrc/common/monsters/monster/spider.qc +++ b/qcsrc/common/monsters/monster/spider.qc @@ -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; diff --git a/qcsrc/common/monsters/sv_monsters.qc b/qcsrc/common/monsters/sv_monsters.qc index a4f7e6aca..cce1d37cd 100644 --- a/qcsrc/common/monsters/sv_monsters.qc +++ b/qcsrc/common/monsters/sv_monsters.qc @@ -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 diff --git a/qcsrc/common/mutators/mutator/nades/nades.qc b/qcsrc/common/mutators/mutator/nades/nades.qc index d15353745..afd7f5af5 100644 --- a/qcsrc/common/mutators/mutator/nades/nades.qc +++ b/qcsrc/common/mutators/mutator/nades/nades.qc @@ -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); diff --git a/qcsrc/common/mutators/mutator/overkill/rpc.qc b/qcsrc/common/mutators/mutator/overkill/rpc.qc index 4540a26f2..682c66c06 100644 --- a/qcsrc/common/mutators/mutator/overkill/rpc.qc +++ b/qcsrc/common/mutators/mutator/overkill/rpc.qc @@ -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; diff --git a/qcsrc/common/turrets/turret/ewheel.qc b/qcsrc/common/turrets/turret/ewheel.qc index b5716f7a9..0a633c784 100644 --- a/qcsrc/common/turrets/turret/ewheel.qc +++ b/qcsrc/common/turrets/turret/ewheel.qc @@ -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; diff --git a/qcsrc/common/turrets/turret/walker.qc b/qcsrc/common/turrets/turret/walker.qc index 94ecdd332..7882a15fc 100644 --- a/qcsrc/common/turrets/turret/walker.qc +++ b/qcsrc/common/turrets/turret/walker.qc @@ -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) diff --git a/qcsrc/common/vehicles/sv_vehicles.qc b/qcsrc/common/vehicles/sv_vehicles.qc index 39f959d14..c1bf1ed1d 100644 --- a/qcsrc/common/vehicles/sv_vehicles.qc +++ b/qcsrc/common/vehicles/sv_vehicles.qc @@ -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; diff --git a/qcsrc/common/weapons/weapon/arc.qc b/qcsrc/common/weapons/weapon/arc.qc index 1f8b8e7f0..9b44d0f71 100644 --- a/qcsrc/common/weapons/weapon/arc.qc +++ b/qcsrc/common/weapons/weapon/arc.qc @@ -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; diff --git a/qcsrc/common/weapons/weapon/devastator.qc b/qcsrc/common/weapons/weapon/devastator.qc index 5ffe08bad..3087f964f 100644 --- a/qcsrc/common/weapons/weapon/devastator.qc +++ b/qcsrc/common/weapons/weapon/devastator.qc @@ -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); diff --git a/qcsrc/common/weapons/weapon/electro.qc b/qcsrc/common/weapons/weapon/electro.qc index bd6fb8969..d28167097 100644 --- a/qcsrc/common/weapons/weapon/electro.qc +++ b/qcsrc/common/weapons/weapon/electro.qc @@ -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); diff --git a/qcsrc/common/weapons/weapon/hagar.qc b/qcsrc/common/weapons/weapon/hagar.qc index ece4b3589..a59c5acf5 100644 --- a/qcsrc/common/weapons/weapon/hagar.qc +++ b/qcsrc/common/weapons/weapon/hagar.qc @@ -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; diff --git a/qcsrc/common/weapons/weapon/hook.qc b/qcsrc/common/weapons/weapon/hook.qc index b2c317459..f2718a8fa 100644 --- a/qcsrc/common/weapons/weapon/hook.qc +++ b/qcsrc/common/weapons/weapon/hook.qc @@ -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); diff --git a/qcsrc/common/weapons/weapon/minelayer.qc b/qcsrc/common/weapons/weapon/minelayer.qc index a3b356954..2c1c35c13 100644 --- a/qcsrc/common/weapons/weapon/minelayer.qc +++ b/qcsrc/common/weapons/weapon/minelayer.qc @@ -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); diff --git a/qcsrc/common/weapons/weapon/mortar.qc b/qcsrc/common/weapons/weapon/mortar.qc index 81be15654..e55cf0bbd 100644 --- a/qcsrc/common/weapons/weapon/mortar.qc +++ b/qcsrc/common/weapons/weapon/mortar.qc @@ -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); diff --git a/qcsrc/common/weapons/weapon/seeker.qc b/qcsrc/common/weapons/weapon/seeker.qc index 850659069..ebfcfd8ff 100644 --- a/qcsrc/common/weapons/weapon/seeker.qc +++ b/qcsrc/common/weapons/weapon/seeker.qc @@ -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) diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index 7d38c3ea4..085756e18 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -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; diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index a6bd1552d..9a53c1305 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -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(); } diff --git a/qcsrc/server/g_hook.qc b/qcsrc/server/g_hook.qc index 46508a919..fb073e9f1 100644 --- a/qcsrc/server/g_hook.qc +++ b/qcsrc/server/g_hook.qc @@ -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; diff --git a/qcsrc/server/mutators/mutator/gamemode_ctf.qc b/qcsrc/server/mutators/mutator/gamemode_ctf.qc index 017fb265b..6eeb7d06d 100644 --- a/qcsrc/server/mutators/mutator/gamemode_ctf.qc +++ b/qcsrc/server/mutators/mutator/gamemode_ctf.qc @@ -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; diff --git a/qcsrc/server/player.qc b/qcsrc/server/player.qc index f2ceecf9e..7dfcf4c3f 100644 --- a/qcsrc/server/player.qc +++ b/qcsrc/server/player.qc @@ -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; } } diff --git a/qcsrc/server/sv_main.qc b/qcsrc/server/sv_main.qc index 1bb6974eb..20299f613 100644 --- a/qcsrc/server/sv_main.qc +++ b/qcsrc/server/sv_main.qc @@ -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);