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);
46 func_ladder_link(this);
48 if(min(this.absmax.x - this.absmin.x, this.absmax.y - this.absmin.y) > 100)
51 vector top_min = (this.absmin + this.absmax) / 2;
52 top_min.z = this.absmax.z;
53 vector top_max = top_min;
54 top_max.z += PL_MAX_CONST.z - PL_MIN_CONST.z;
55 tracebox(top_max + jumpstepheightvec, PL_MIN_CONST, PL_MAX_CONST, top_min, MOVE_NOMONSTERS, NULL);
58 tracebox(top_max + stepheightvec, PL_MIN_CONST, PL_MAX_CONST, top_min, MOVE_NOMONSTERS, NULL);
61 tracebox(top_max, PL_MIN_CONST, PL_MAX_CONST, top_min, MOVE_NOMONSTERS, NULL);
66 if(trace_endpos.z < this.absmax.z)
69 this.bot_pickup = true; // allow bots to make use of this ladder
70 float cost = waypoint_getlinearcost(trace_endpos.z - this.absmin.z);
71 top_min = trace_endpos;
72 waypoint_spawnforteleporter_boxes(this, WAYPOINTFLAG_LADDER, this.absmin, this.absmax, top_min, top_min, cost);
75 spawnfunc(func_ladder)
77 IL_PUSH(g_ladders, this); // TODO: also func_water? bots currently loop through func_ladder only
79 func_ladder_init(this);
84 func_ladder_init(this);
90 void func_ladder_remove(entity this)
92 if(this.classname) { strunzone(this.classname); }
93 this.classname = string_null;
96 NET_HANDLE(ENT_CLIENT_LADDER, bool isnew)
98 this.classname = strzone(ReadString());
99 this.skin = ReadByte();
100 this.speed = ReadCoord();
102 trigger_common_read(this, false);
104 this.solid = SOLID_TRIGGER;
105 settouch(this, func_ladder_touch);
106 this.drawmask = MASK_NORMAL;
107 this.move_time = time;
108 this.entremove = func_ladder_remove;