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 RemoveGrapplingHooks(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 IL_PUSH(g_teleporters, this);
104 this.teleport_next = teleport_first;
105 teleport_first = this;
108 NET_HANDLE(ENT_CLIENT_TRIGGER_TELEPORT, bool isnew)
110 this.classname = "trigger_teleport";
112 IL_PUSH(g_teleporters, this);
113 int mytm = ReadByte(); if(mytm) { this.team = mytm - 1; }
114 this.spawnflags = ReadInt24_t();
115 this.active = ReadByte();
116 this.speed = ReadCoord();
118 trigger_common_read(this, true);
120 this.entremove = trigger_remove_generic;
121 this.solid = SOLID_TRIGGER;
122 //settouch(this, trigger_push_touch);
123 this.move_time = time;
124 defer(this, 0.25, teleport_findtarget);
126 this.teleport_next = teleport_first;
127 teleport_first = this;