1 REGISTER_NET_LINKED(ENT_CLIENT_TRIGGER_TELEPORT)
4 void trigger_teleport_use()
7 self.team = activator.team;
9 self.SendFlags |= SF_TRIGGER_UPDATE;
14 void Teleport_Touch ()
16 if (self.active != ACTIVE_ACTIVE)
20 if (!other.teleportable)
24 if(!other.vehicle.teleportable)
35 if(((self.spawnflags & 4) == 0) == (DIFF_TEAM(this, other)))
42 RemoveGrapplingHook(other);
46 e = Simple_TeleportPlayer(self, other);
50 string s = self.target; self.target = string_null;
52 if (!self.target) self.target = s;
54 WITH(entity, self, e, SUB_UseTargets());
59 float trigger_teleport_send(entity this, entity to, float sf)
61 WriteHeader(MSG_ENTITY, ENT_CLIENT_TRIGGER_TELEPORT);
62 WriteByte(MSG_ENTITY, sf);
66 WriteByte(MSG_ENTITY, this.team);
67 WriteInt24_t(MSG_ENTITY, this.spawnflags);
68 WriteByte(MSG_ENTITY, this.active);
69 WriteCoord(MSG_ENTITY, this.speed);
71 trigger_common_write(true);
76 WriteByte(MSG_ENTITY, this.team);
77 WriteByte(MSG_ENTITY, this.active);
83 void trigger_teleport_link(entity this)
85 Net_LinkEntity(this, false, 0, trigger_teleport_send);
88 spawnfunc(trigger_teleport)
90 self.angles = '0 0 0';
94 self.active = ACTIVE_ACTIVE;
96 self.use = trigger_teleport_use;
98 // this must be called to spawn the teleport waypoints for bots
99 InitializeEntity(self, teleport_findtarget, INITPRIO_FINDTARGET);
101 if (self.target == "")
103 objerror ("Teleporter with no target");
107 self.teleport_next = teleport_first;
108 teleport_first = self;
111 NET_HANDLE(ENT_CLIENT_TRIGGER_TELEPORT, bool isnew)
117 self.classname = "trigger_teleport";
118 int mytm = ReadByte(); if(mytm) { self.team = mytm - 1; }
119 self.spawnflags = ReadInt24_t();
120 self.active = ReadByte();
121 self.speed = ReadCoord();
123 trigger_common_read(true);
125 self.entremove = trigger_remove_generic;
126 self.solid = SOLID_TRIGGER;
127 //self.draw = trigger_draw_generic;
128 //self.move_touch = trigger_push_touch;
129 self.drawmask = MASK_NORMAL;
130 self.move_time = time;
131 defer(self, 0.25, teleport_findtarget);
133 self.teleport_next = teleport_first;
134 teleport_first = self;
139 self.team = ReadByte();
140 self.active = ReadByte();