- // If not attach one.
- //centerprint(toucher,"Entering swamp!\n");
- toucher.swampslug = spawn();
- #ifdef SVQC
- SetResourceAmountExplicit(toucher.swampslug, RESOURCE_HEALTH, 2);
- #elif defined(CSQC)
- toucher.swampslug.health = 2;
- #endif
- setthink(toucher.swampslug, swampslug_think);
- toucher.swampslug.nextthink = time;
- toucher.swampslug.owner = toucher;
- toucher.swampslug.dmg = this.dmg;
- toucher.swampslug.swamp_interval = this.swamp_interval;
- toucher.swamp_slowdown = this.swamp_slowdown;
- toucher.in_swamp = 1;
- return;
+ FOREACH_ENTITY_RADIUS((this.absmin + this.absmax) * 0.5, vlen(this.absmax - this.absmin) * 0.5 + 1, it.swampslug.active == ACTIVE_NOT && IS_PLAYER(it) && !IS_DEAD(it),
+ {
+ vector emin = it.absmin;
+ vector emax = it.absmax;
+ if(this.solid == SOLID_BSP)
+ {
+ emin -= '1 1 1';
+ emax += '1 1 1';
+ }
+ if(boxesoverlap(emin, emax, this.absmin, this.absmax)) // quick
+ if(WarpZoneLib_BoxTouchesBrush(emin, emax, this, it)) // accurate
+ {
+ if(!it.swampslug)
+ IL_PUSH(g_swamped, it);
+ it.swampslug = this;
+ }
+ });
+
+ IL_EACH(g_swamped, it.swampslug == this,
+ {
+ if(time > it.swamp_interval)
+ {
+ Damage (it, this, this, this.dmg, DEATH_SWAMP.m_id, DMG_NOWEP, it.origin, '0 0 0');
+ it.swamp_interval = time + this.swamp_interval;
+ }
+ });