]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/triggers/trigger/swamp.qc
Rename PHYS_DEAD to IS_DEAD and make it usable outside of player physics
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / triggers / trigger / swamp.qc
index b99332b984533c9853a79b0618c859e4c5a78eff..ad9c872dae6a4e17f3d233390186045539d16850 100644 (file)
@@ -1,11 +1,10 @@
 #if defined(CSQC)
 #elif defined(MENUQC)
 #elif defined(SVQC)
-       #include "../../../server/_all.qh"
-    #include "../../../warpzonelib/util_server.qh"
-    #include "../../weapons/all.qh"
-    #include "../../../server/defs.qh"
-    #include "../../deathtypes.qh"
+    #include <lib/warpzone/util_server.qh>
+    #include <common/weapons/all.qh>
+    #include <server/defs.qh>
+    #include <common/deathtypes/all.qh>
 #endif
 
 /*
@@ -21,9 +20,9 @@
 .entity swampslug;
 
 #ifdef SVQC
-void spawnfunc_trigger_swamp(void);
+spawnfunc(trigger_swamp);
 #endif
-void swamp_touch(void);
+void swamp_touch();
 void swampslug_think();
 
 
@@ -37,8 +36,8 @@ void swampslug_think();
 *
 * I do it this way becuz there is no "untouch" event.
 */
-void swampslug_think(void)
-{
+void swampslug_think()
+{SELFPARAM();
        //Slowly kill the slug
        self.health = self.health - 1;
 
@@ -55,17 +54,17 @@ void swampslug_think(void)
        // Or we have exited it very recently.
        // Do the damage and renew the timer.
 #ifdef SVQC
-       Damage (self.owner, self, self, self.dmg, DEATH_SWAMP, other.origin, '0 0 0');
+       Damage (self.owner, self, self, self.dmg, DEATH_SWAMP.m_id, other.origin, '0 0 0');
 #endif
 
        self.nextthink = time + self.swamp_interval;
 }
 
-void swamp_touch(void)
-{
+void swamp_touch()
+{SELFPARAM();
        // If whatever thats touching the swamp is not a player
        // or if its a dead player, just dont care abt it.
-       if(!IS_PLAYER(other) || PHYS_DEAD(other))
+       if(!IS_PLAYER(other) || IS_DEAD(other))
                return;
 
        EXACTTRIGGER_TOUCH;
@@ -93,33 +92,35 @@ void swamp_touch(void)
        other.swampslug.health = 2;
 }
 
+REGISTER_NET_LINKED(ENT_CLIENT_SWAMP)
+
 #ifdef SVQC
-float swamp_send(entity to, float sf)
+float swamp_send(entity this, entity to, float sf)
 {
-       WriteByte(MSG_ENTITY, ENT_CLIENT_LADDER);
+       WriteHeader(MSG_ENTITY, ENT_CLIENT_SWAMP);
 
-       WriteByte(MSG_ENTITY, self.dmg); // can probably get away with using a single byte here
-       WriteByte(MSG_ENTITY, self.swamp_slowdown);
-       WriteByte(MSG_ENTITY, self.swamp_interval);
+       WriteByte(MSG_ENTITY, this.dmg); // can probably get away with using a single byte here
+       WriteByte(MSG_ENTITY, this.swamp_slowdown);
+       WriteByte(MSG_ENTITY, this.swamp_interval);
 
-       trigger_common_write(false);
+       trigger_common_write(this, false);
 
        return true;
 }
 
 void swamp_link()
-{
-       Net_LinkEntity(self, false, 0, func_ladder_send);
+{SELFPARAM();
+       trigger_link(self, swamp_send);
 }
 
 /*QUAKED spawnfunc_trigger_swamp (.5 .5 .5) ?
 Players gettin into the swamp will
 get slowd down and damaged
 */
-void spawnfunc_trigger_swamp(void)
+spawnfunc(trigger_swamp)
 {
        // Init stuff
-       EXACTTRIGGER_INIT;
+       trigger_init(self);
        self.touch = swamp_touch;
 
        // Setup default keys, if missing
@@ -135,7 +136,7 @@ void spawnfunc_trigger_swamp(void)
 
 #elif defined(CSQC)
 
-void ent_swamp()
+NET_HANDLE(ENT_CLIENT_SWAMP, bool isnew)
 {
        self.dmg = ReadByte();
        self.swamp_slowdown = ReadByte();
@@ -143,10 +144,11 @@ void ent_swamp()
 
        trigger_common_read(false);
 
+       return = true;
+
        self.classname = "trigger_swamp";
        self.solid = SOLID_TRIGGER;
-       self.draw = trigger_draw_generic;
-       self.trigger_touch = swamp_touch;
+       self.move_touch = swamp_touch;
        self.drawmask = MASK_NORMAL;
        self.move_time = time;
        self.entremove = trigger_remove_generic;