2 REGISTER_NET_LINKED(ENT_CLIENT_TRIGGER_TELEPORT)
5 void trigger_teleport_use(entity this, entity actor, entity trigger)
8 this.team = actor.team;
10 this.SendFlags |= SF_TRIGGER_UPDATE;
15 void Teleport_Touch(entity this, entity toucher)
17 if (this.active != ACTIVE_ACTIVE)
21 if (!toucher.teleportable)
25 if(!toucher.vehicle.teleportable)
28 if(IS_TURRET(toucher))
31 if(!IS_PLAYER(toucher))
39 if(((this.spawnflags & 4) == 0) == (DIFF_TEAM(this, toucher)))
42 EXACTTRIGGER_TOUCH(this, toucher);
45 if(IS_PLAYER(toucher))
46 RemoveGrapplingHook(toucher);
50 e = Simple_TeleportPlayer(this, toucher);
53 string s = this.target; this.target = string_null;
54 SUB_UseTargets(this, toucher, toucher); // TODO: should we be using toucher for trigger too?
55 if (!this.target) this.target = s;
57 SUB_UseTargets(e, toucher, toucher);
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 this.angles = '0 0 0';
85 this.active = ACTIVE_ACTIVE;
86 //trigger_init(this); // only for predicted triggers?
88 this.use = trigger_teleport_use;
91 FOREACH_WORD(this.noise, true, precache_sound(it));
93 // this must be called to spawn the teleport waypoints for bots
94 InitializeEntity(this, teleport_findtarget, INITPRIO_FINDTARGET);
96 if (this.target == "")
98 objerror (this, "Teleporter with no target");
102 this.teleport_next = teleport_first;
103 teleport_first = this;
106 NET_HANDLE(ENT_CLIENT_TRIGGER_TELEPORT, bool isnew)
108 this.classname = "trigger_teleport";
109 int mytm = ReadByte(); if(mytm) { this.team = mytm - 1; }
110 this.spawnflags = ReadInt24_t();
111 this.active = ReadByte();
112 this.speed = ReadCoord();
114 trigger_common_read(this, true);
116 this.entremove = trigger_remove_generic;
117 this.solid = SOLID_TRIGGER;
118 //settouch(this, trigger_push_touch);
119 this.move_time = time;
120 defer(this, 0.25, teleport_findtarget);
122 this.teleport_next = teleport_first;
123 teleport_first = this;