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)
38 if(((self.spawnflags & 4) == 0) == (DIFF_TEAM(this, other)))
45 RemoveGrapplingHook(other);
49 e = Simple_TeleportPlayer(self, other);
53 string s = self.target; self.target = string_null;
55 if (!self.target) self.target = s;
57 WITH(entity, self, e, SUB_UseTargets());
62 float trigger_teleport_send(entity this, entity to, float sf)
64 WriteHeader(MSG_ENTITY, ENT_CLIENT_TRIGGER_TELEPORT);
66 WriteByte(MSG_ENTITY, TMID(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(this, true);
76 void trigger_teleport_link(entity this)
78 //trigger_link(this, trigger_teleport_send);
81 spawnfunc(trigger_teleport)
83 self.angles = '0 0 0';
85 self.active = ACTIVE_ACTIVE;
86 //trigger_init(self); // only for predicted triggers?
88 self.use = trigger_teleport_use;
91 FOREACH_WORD(self.noise, true, precache_sound(it));
93 // this must be called to spawn the teleport waypoints for bots
94 InitializeEntity(self, teleport_findtarget, INITPRIO_FINDTARGET);
96 if (self.target == "")
98 objerror ("Teleporter with no target");
102 self.teleport_next = teleport_first;
103 teleport_first = self;
106 NET_HANDLE(ENT_CLIENT_TRIGGER_TELEPORT, bool isnew)
108 self.classname = "trigger_teleport";
109 int mytm = ReadByte(); if(mytm) { setteam(self, mytm - 1); }
110 self.spawnflags = ReadInt24_t();
111 self.active = ReadByte();
112 self.speed = ReadCoord();
114 trigger_common_read(true);
116 self.entremove = trigger_remove_generic;
117 self.solid = SOLID_TRIGGER;
118 //self.draw = trigger_draw_generic;
119 //self.move_touch = trigger_push_touch;
120 self.drawmask = MASK_NORMAL;
121 self.move_time = time;
122 defer(self, 0.25, teleport_findtarget);
124 self.teleport_next = teleport_first;
125 teleport_first = self;