2 REGISTER_NET_LINKED(ENT_CLIENT_LADDER)
4 void func_ladder_touch(entity this, entity toucher)
7 if (!toucher.iscreature)
9 if(IS_VEHICLE(toucher))
12 if(!toucher.isplayermodel)
16 EXACTTRIGGER_TOUCH(this, toucher);
18 toucher.ladder_time = time + 0.1;
19 toucher.ladder_entity = this;
23 bool func_ladder_send(entity this, entity to, int sf)
25 WriteHeader(MSG_ENTITY, ENT_CLIENT_LADDER);
27 WriteString(MSG_ENTITY, this.classname);
28 WriteByte(MSG_ENTITY, this.skin);
29 WriteCoord(MSG_ENTITY, this.speed);
31 trigger_common_write(this, false);
36 void func_ladder_link(entity this)
38 trigger_link(this, func_ladder_send);
39 //this.model = "null";
42 void func_ladder_init(entity this)
44 settouch(this, func_ladder_touch);
47 func_ladder_link(this);
48 vector top = (this.absmin + this.absmax) / 2;
49 top.z = this.absmax.z + 1 - PL_MIN_CONST.z;
50 float cost = waypoint_getdistancecost_simple(this.absmax.z - this.absmin.z);
51 waypoint_spawnforteleporter_boxes(this, WAYPOINTFLAG_LADDER, this.absmin, this.absmax, top, top, cost);
54 spawnfunc(func_ladder)
56 IL_PUSH(g_ladders, this); // TODO: also func_water? bots currently loop through func_ladder only
58 func_ladder_init(this);
63 func_ladder_init(this);
69 void func_ladder_remove(entity this)
71 if(this.classname) { strunzone(this.classname); }
72 this.classname = string_null;
75 NET_HANDLE(ENT_CLIENT_LADDER, bool isnew)
77 this.classname = strzone(ReadString());
78 this.skin = ReadByte();
79 this.speed = ReadCoord();
81 trigger_common_read(this, false);
83 this.solid = SOLID_TRIGGER;
84 settouch(this, func_ladder_touch);
85 this.drawmask = MASK_NORMAL;
86 this.move_time = time;
87 this.entremove = func_ladder_remove;