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);
63 WriteByte(MSG_ENTITY, this.team);
64 WriteInt24_t(MSG_ENTITY, this.spawnflags);
65 WriteByte(MSG_ENTITY, this.active);
66 WriteCoord(MSG_ENTITY, this.speed);
68 trigger_common_write(this, true);
73 void trigger_teleport_link(entity this)
75 trigger_link(this, trigger_teleport_send);
78 spawnfunc(trigger_teleport)
80 self.angles = '0 0 0';
82 self.active = ACTIVE_ACTIVE;
84 self.use = trigger_teleport_use;
86 // this must be called to spawn the teleport waypoints for bots
87 InitializeEntity(self, teleport_findtarget, INITPRIO_FINDTARGET);
89 if (self.target == "")
91 objerror ("Teleporter with no target");
95 self.teleport_next = teleport_first;
96 teleport_first = self;
99 NET_HANDLE(ENT_CLIENT_TRIGGER_TELEPORT, bool isnew)
101 self.classname = "trigger_teleport";
102 int mytm = ReadByte(); if(mytm) { self.team = mytm - 1; }
103 self.spawnflags = ReadInt24_t();
104 self.active = ReadByte();
105 self.speed = ReadCoord();
107 trigger_common_read(true);
109 self.entremove = trigger_remove_generic;
110 self.solid = SOLID_TRIGGER;
111 //self.draw = trigger_draw_generic;
112 //self.move_touch = trigger_push_touch;
113 self.drawmask = MASK_NORMAL;
114 self.move_time = time;
115 defer(self, 0.25, teleport_findtarget);
117 self.teleport_next = teleport_first;
118 teleport_first = self;