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, 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;
87 self.use = trigger_teleport_use;
90 precache_sound(self.noise);
92 // this must be called to spawn the teleport waypoints for bots
93 InitializeEntity(self, teleport_findtarget, INITPRIO_FINDTARGET);
95 if (self.target == "")
97 objerror ("Teleporter with no target");
101 self.teleport_next = teleport_first;
102 teleport_first = self;
105 NET_HANDLE(ENT_CLIENT_TRIGGER_TELEPORT, bool isnew)
107 self.classname = "trigger_teleport";
108 int mytm = ReadByte(); if(mytm) { self.team = mytm - 1; }
109 self.spawnflags = ReadInt24_t();
110 self.active = ReadByte();
111 self.speed = ReadCoord();
113 trigger_common_read(true);
115 self.entremove = trigger_remove_generic;
116 self.solid = SOLID_TRIGGER;
117 //self.draw = trigger_draw_generic;
118 //self.move_touch = trigger_push_touch;
119 self.drawmask = MASK_NORMAL;
120 self.move_time = time;
121 defer(self, 0.25, teleport_findtarget);
123 self.teleport_next = teleport_first;
124 teleport_first = self;