3 * Adds spawnfunc_trigger_swamp and suppoart routines for voretournament 1.2.1+
\r
4 * Author tZork (Jakob MG)
\r
9 .float swamp_interval; //Hurt players in swamp with this interval
\r
10 .float swamp_slowdown; //Players in swamp get slowd down by this mutch 0-1 is slowdown 1-~ is speedup (!?)
\r
13 void spawnfunc_trigger_swamp(void);
\r
14 void swamp_touch(void);
\r
15 void swampslug_think();
\r
19 * Uses a entity calld swampslug to handle players in the swamp
\r
20 * It works like this: When the plyer enters teh swamp the spawnfunc_trigger_swamp
\r
21 * attaches a new "swampslug" to the player. As long as the plyer is inside
\r
22 * the swamp the swamp gives the slug new health. But the slug slowly kills itself
\r
23 * so when the player goes outside the swamp, it dies and releases the player from the
\r
24 * swamps curses (dmg/slowdown)
\r
26 * I do it this way becuz there is no "untouch" event.
\r
29 * THE ACCTUAL slowdown is done in cl_physics.c on line 57-60
\r
32 void swampslug_think(void)
\r
34 //Slowly kill the slug
\r
35 self.health = self.health - 1;
\r
37 //Slug dead? then remove curses.
\r
38 if(self.health <= 0) {
\r
39 self.owner.in_swamp = 0;
\r
41 //centerprint(self.owner,"Killing slug...\n");
\r
45 // Slug still alive, so we are still in the swamp
\r
46 // Or we have exited it very recently.
\r
47 // Do the damage and renew the timer.
\r
48 Damage (self.owner, self, self, self.dmg, DEATH_SWAMP, other.origin, '0 0 0');
\r
50 self.nextthink = time + self.swamp_interval;
\r
53 void swamp_touch(void)
\r
55 // If whatever thats touching the swamp is not a player
\r
56 // or if its a dead player, just dont care abt it.
\r
57 if((other.classname != "player")||(other.deadflag != DEAD_NO))
\r
62 // Chech if player alredy got a swampslug.
\r
63 if(other.in_swamp != 1) {
\r
64 // If not attach one.
\r
65 //centerprint(other,"Entering swamp!\n");
\r
66 other.swampslug = spawn();
\r
67 other.swampslug.health = 2;
\r
68 other.swampslug.think = swampslug_think;
\r
69 other.swampslug.nextthink = time;
\r
70 other.swampslug.owner = other;
\r
71 other.swampslug.dmg = self.dmg;
\r
72 other.swampslug.swamp_interval = self.swamp_interval;
\r
73 other.swamp_slowdown = self.swamp_slowdown;
\r
78 //other.in_swamp = 1;
\r
80 //Revitalize players swampslug
\r
81 other.swampslug.health = 2;
\r
84 /*QUAKED spawnfunc_trigger_swamp (.5 .5 .5) ?
\r
85 Players gettin into the swamp will
\r
86 get slowd down and damaged
\r
88 void spawnfunc_trigger_swamp(void)
\r
92 self.touch = swamp_touch;
\r
94 // Setup default keys, if missing
\r
97 if(self.swamp_interval <= 0)
\r
98 self.swamp_interval = 1;
\r
99 if(self.swamp_slowdown <= 0)
\r
100 self.swamp_slowdown = 0.5;
\r