2 void spawnfunc_trigger_swamp(void);
4 void swamp_touch(void);
5 void swampslug_think();
9 * Uses a entity calld swampslug to handle players in the swamp
10 * It works like this: When the plyer enters teh swamp the spawnfunc_trigger_swamp
11 * attaches a new "swampslug" to the player. As long as the plyer is inside
12 * the swamp the swamp gives the slug new health. But the slug slowly kills itself
13 * so when the player goes outside the swamp, it dies and releases the player from the
14 * swamps curses (dmg/slowdown)
16 * I do it this way becuz there is no "untouch" event.
18 void swampslug_think(void)
20 //Slowly kill the slug
21 self.health = self.health - 1;
23 //Slug dead? then remove curses.
26 self.owner.in_swamp = 0;
28 //centerprint(self.owner,"Killing slug...\n");
32 // Slug still alive, so we are still in the swamp
33 // Or we have exited it very recently.
34 // Do the damage and renew the timer.
36 Damage (self.owner, self, self, self.dmg, DEATH_SWAMP, other.origin, '0 0 0');
39 self.nextthink = time + self.swamp_interval;
42 void swamp_touch(void)
44 // If whatever thats touching the swamp is not a player
45 // or if its a dead player, just dont care abt it.
46 if(!IS_PLAYER(other) || PHYS_DEAD(other))
51 // Chech if player alredy got a swampslug.
52 if(other.in_swamp != 1)
55 //centerprint(other,"Entering swamp!\n");
56 other.swampslug = spawn();
57 other.swampslug.health = 2;
58 other.swampslug.think = swampslug_think;
59 other.swampslug.nextthink = time;
60 other.swampslug.owner = other;
61 other.swampslug.dmg = self.dmg;
62 other.swampslug.swamp_interval = self.swamp_interval;
63 other.swamp_slowdown = self.swamp_slowdown;
70 //Revitalize players swampslug
71 other.swampslug.health = 2;
75 float swamp_send(entity to, float sf)
77 WriteByte(MSG_ENTITY, ENT_CLIENT_LADDER);
79 WriteByte(MSG_ENTITY, self.warpzone_isboxy);
80 WriteByte(MSG_ENTITY, self.scale);
81 WriteByte(MSG_ENTITY, self.dmg); // can probably get away with using a single byte here
82 WriteByte(MSG_ENTITY, self.swamp_slowdown);
83 WriteByte(MSG_ENTITY, self.swamp_interval);
84 WriteCoord(MSG_ENTITY, self.origin_x);
85 WriteCoord(MSG_ENTITY, self.origin_y);
86 WriteCoord(MSG_ENTITY, self.origin_z);
88 WriteCoord(MSG_ENTITY, self.mins_x);
89 WriteCoord(MSG_ENTITY, self.mins_y);
90 WriteCoord(MSG_ENTITY, self.mins_z);
91 WriteCoord(MSG_ENTITY, self.maxs_x);
92 WriteCoord(MSG_ENTITY, self.maxs_y);
93 WriteCoord(MSG_ENTITY, self.maxs_z);
95 WriteCoord(MSG_ENTITY, self.movedir_x);
96 WriteCoord(MSG_ENTITY, self.movedir_y);
97 WriteCoord(MSG_ENTITY, self.movedir_z);
99 WriteAngle(MSG_ENTITY, self.angles_x);
100 WriteAngle(MSG_ENTITY, self.angles_y);
101 WriteAngle(MSG_ENTITY, self.angles_z);
108 Net_LinkEntity(self, FALSE, 0, func_ladder_send);
111 /*QUAKED spawnfunc_trigger_swamp (.5 .5 .5) ?
112 Players gettin into the swamp will
113 get slowd down and damaged
115 void spawnfunc_trigger_swamp(void)
119 self.touch = swamp_touch;
121 // Setup default keys, if missing
124 if(self.swamp_interval <= 0)
125 self.swamp_interval = 1;
126 if(self.swamp_slowdown <= 0)
127 self.swamp_slowdown = 0.5;
136 self.warpzone_isboxy = ReadByte();
137 self.scale = ReadByte();
138 self.dmg = ReadByte();
139 self.swamp_slowdown = ReadByte();
140 self.swamp_interval = ReadByte();
142 self.origin_x = ReadCoord();
143 self.origin_y = ReadCoord();
144 self.origin_z = ReadCoord();
145 setorigin(self, self.origin);
147 self.mins_x = ReadCoord();
148 self.mins_y = ReadCoord();
149 self.mins_z = ReadCoord();
150 self.maxs_x = ReadCoord();
151 self.maxs_y = ReadCoord();
152 self.maxs_z = ReadCoord();
153 setsize(self, self.mins, self.maxs);
155 self.movedir_x = ReadCoord();
156 self.movedir_y = ReadCoord();
157 self.movedir_z = ReadCoord();
159 self.angles_x = ReadAngle();
160 self.angles_y = ReadAngle();
161 self.angles_z = ReadAngle();
163 self.classname = "trigger_swamp";
164 self.solid = SOLID_TRIGGER;
165 self.draw = trigger_draw_generic;
166 self.trigger_touch = swamp_touch;
167 self.drawmask = MASK_NORMAL;
168 self.move_time = time;