]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/triggers/func/ladder.qc
Merge branch 'master' into terencehill/spectatee_status_update
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / triggers / func / ladder.qc
index 5a96b9bb6e68f05f02162e3f2a64e353946064f2..5ff2bdcc247133ac99b9c7a95f1ae4da3fe38a82 100644 (file)
@@ -1,83 +1,85 @@
-void func_ladder_touch()
+#include "ladder.qh"
+REGISTER_NET_LINKED(ENT_CLIENT_LADDER)
+
+void func_ladder_touch(entity this, entity toucher)
 {
 #ifdef SVQC
-       if (!other.iscreature)
+       if (!toucher.iscreature)
                return;
-       if(IS_VEHICLE(other))
+       if(IS_VEHICLE(toucher))
                return;
-#endif
-#ifdef CSQC
-       if(other.classname != "csqcmodel")
+#elif defined(CSQC)
+       if(!toucher.isplayermodel)
                return;
 #endif
 
-       EXACTTRIGGER_TOUCH;
+       EXACTTRIGGER_TOUCH(this, toucher);
 
-       other.ladder_time = time + 0.1;
-       other.ladder_entity = self;
+       toucher.ladder_time = time + 0.1;
+       toucher.ladder_entity = this;
 }
 
 #ifdef SVQC
-float func_ladder_send(entity to, float sf)
+bool func_ladder_send(entity this, entity to, int sf)
 {
-       WriteByte(MSG_ENTITY, ENT_CLIENT_LADDER);
+       WriteHeader(MSG_ENTITY, ENT_CLIENT_LADDER);
 
-       WriteString(MSG_ENTITY, self.classname);
-       WriteByte(MSG_ENTITY, self.skin);
-       WriteByte(MSG_ENTITY, self.speed);
-       WriteString(MSG_ENTITY, self.mdl);
+       WriteString(MSG_ENTITY, this.classname);
+       WriteByte(MSG_ENTITY, this.skin);
+       WriteCoord(MSG_ENTITY, this.speed);
 
-       trigger_common_write(false);
+       trigger_common_write(this, false);
 
        return true;
 }
 
-void func_ladder_link()
+void func_ladder_link(entity this)
 {
-       //self.SendEntity = func_ladder_send;
-       //self.SendFlags = 0xFFFFFF;
-       //self.model = "null";
+       trigger_link(this, func_ladder_send);
+       //this.model = "null";
 }
 
-void spawnfunc_func_ladder()
+void func_ladder_init(entity this)
 {
-       self.mdl = self.model;
-       EXACTTRIGGER_INIT;
-       self.touch = func_ladder_touch;
+       settouch(this, func_ladder_touch);
 
-       func_ladder_link();
+       trigger_init(this);
+       func_ladder_link(this);
 }
 
-void spawnfunc_func_water()
+spawnfunc(func_ladder)
 {
-       self.mdl = self.model;
-       EXACTTRIGGER_INIT;
-       self.touch = func_ladder_touch;
+       func_ladder_init(this);
+}
 
-       func_ladder_link();
+spawnfunc(func_water)
+{
+       func_ladder_init(this);
 }
 
 #elif defined(CSQC)
 .float speed;
 
-void ent_func_ladder()
+void func_ladder_remove(entity this)
+{
+       if(this.classname) { strunzone(this.classname); }
+       this.classname = string_null;
+}
+
+NET_HANDLE(ENT_CLIENT_LADDER, bool isnew)
 {
-       self.classname = strzone(ReadString());
-       self.skin = ReadByte();
-       self.speed = ReadByte();
-       self.model = strzone(ReadString());
-
-       trigger_common_read(false);
-       self.mins = self.maxs = '0 0 0';
-
-       self.solid = SOLID_TRIGGER;
-       self.draw = trigger_draw_generic;
-       self.trigger_touch = func_ladder_touch;
-       self.drawmask = MASK_NORMAL;
-       self.move_time = time;
-       self.entremove = trigger_remove_generic;
-
-       //precache_model(self.mdl);
-       EXACTTRIGGER_INIT;
+       this.classname = strzone(ReadString());
+       this.skin = ReadByte();
+       this.speed = ReadCoord();
+
+       trigger_common_read(this, false);
+
+       this.solid = SOLID_TRIGGER;
+       settouch(this, func_ladder_touch);
+       this.drawmask = MASK_NORMAL;
+       this.move_time = time;
+       this.entremove = func_ladder_remove;
+
+       return true;
 }
 #endif