]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/triggers/func/ladder.qc
Merge branch 'master' into terencehill/infomessages_panel_update
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / triggers / func / ladder.qc
index 483fef80cd537e0f35084f79ccb1bd5fdc3e70fc..af5065643bf9a6957fd0de37d50cba53a7f58d9c 100644 (file)
-void func_ladder_touch()
+REGISTER_NET_LINKED(ENT_CLIENT_LADDER)
+
+void func_ladder_touch(entity this)
 {
 #ifdef SVQC
        if (!other.iscreature)
                return;
-       if (other.vehicle_flags & VHF_ISVEHICLE)
+       if(IS_VEHICLE(other))
                return;
-#endif
-#ifdef CSQC
-       if(other.classname != "csqcmodel")
+#elif defined(CSQC)
+       if(!other.isplayermodel)
                return;
 #endif
 
        EXACTTRIGGER_TOUCH;
 
        other.ladder_time = time + 0.1;
-       other.ladder_entity = self;
+       other.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);
-
-       WriteString(MSG_ENTITY, self.classname);
-       WriteByte(MSG_ENTITY, self.warpzone_isboxy);
-       WriteByte(MSG_ENTITY, self.skin);
-       WriteByte(MSG_ENTITY, self.speed);
-       WriteByte(MSG_ENTITY, self.scale);
-       WriteCoord(MSG_ENTITY, self.origin_x);
-       WriteCoord(MSG_ENTITY, self.origin_y);
-       WriteCoord(MSG_ENTITY, self.origin_z);
-
-       WriteCoord(MSG_ENTITY, self.mins_x);
-       WriteCoord(MSG_ENTITY, self.mins_y);
-       WriteCoord(MSG_ENTITY, self.mins_z);
-       WriteCoord(MSG_ENTITY, self.maxs_x);
-       WriteCoord(MSG_ENTITY, self.maxs_y);
-       WriteCoord(MSG_ENTITY, self.maxs_z);
-
-       WriteCoord(MSG_ENTITY, self.movedir_x);
-       WriteCoord(MSG_ENTITY, self.movedir_y);
-       WriteCoord(MSG_ENTITY, self.movedir_z);
-
-       WriteCoord(MSG_ENTITY, self.angles_x);
-       WriteCoord(MSG_ENTITY, self.angles_y);
-       WriteCoord(MSG_ENTITY, self.angles_z);
+       WriteHeader(MSG_ENTITY, ENT_CLIENT_LADDER);
+
+       WriteString(MSG_ENTITY, this.classname);
+       WriteByte(MSG_ENTITY, this.skin);
+       WriteCoord(MSG_ENTITY, this.speed);
+
+       trigger_common_write(this, false);
 
        return true;
 }
 
-void func_ladder_link()
+void func_ladder_link(entity this)
 {
-       Net_LinkEntity(self, false, 0, func_ladder_send);
+       trigger_link(this, func_ladder_send);
+       //this.model = "null";
 }
 
-void spawnfunc_func_ladder()
+void func_ladder_init(entity this)
 {
-       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)
 {
-       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)
 {
-       self.classname = strzone(ReadString());
-       self.warpzone_isboxy = ReadByte();
-       self.skin = ReadByte();
-       self.speed = ReadByte();
-       self.scale = ReadByte();
-       self.origin_x = ReadCoord();
-       self.origin_y = ReadCoord();
-       self.origin_z = ReadCoord();
-       setorigin(self, self.origin);
-       self.mins_x = ReadCoord();
-       self.mins_y = ReadCoord();
-       self.mins_z = ReadCoord();
-       self.maxs_x = ReadCoord();
-       self.maxs_y = ReadCoord();
-       self.maxs_z = ReadCoord();
-       setsize(self, self.mins, self.maxs);
-       self.movedir_x = ReadCoord();
-       self.movedir_y = ReadCoord();
-       self.movedir_z = ReadCoord();
-       self.angles_x = ReadCoord();
-       self.angles_y = ReadCoord();
-       self.angles_z = ReadCoord();
-
-       self.solid = SOLID_TRIGGER;
-       self.draw = trigger_draw_generic;
-       self.trigger_touch = func_ladder_touch;
-       self.drawmask = MASK_NORMAL;
-       self.move_time = time;
+       if(this.classname) { strunzone(this.classname); }
+       this.classname = string_null;
+}
+
+NET_HANDLE(ENT_CLIENT_LADDER, bool isnew)
+{
+       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