1 REGISTER_NET_LINKED(ENT_CLIENT_TRIGGER_TELEPORT)
4 void trigger_teleport_use(entity this, entity actor, entity trigger)
7 this.team = actor.team;
9 this.SendFlags |= SF_TRIGGER_UPDATE;
14 void Teleport_Touch(entity this, entity toucher)
16 if (this.active != ACTIVE_ACTIVE)
20 if (!toucher.teleportable)
24 if(!toucher.vehicle.teleportable)
27 if(IS_TURRET(toucher))
30 if(!IS_PLAYER(toucher))
38 if(((this.spawnflags & 4) == 0) == (DIFF_TEAM(this, toucher)))
41 EXACTTRIGGER_TOUCH(this, toucher);
44 if(IS_PLAYER(toucher))
45 RemoveGrapplingHook(toucher);
49 e = Simple_TeleportPlayer(this, toucher);
52 string s = this.target; this.target = string_null;
53 SUB_UseTargets(this, toucher, toucher); // TODO: should we be using toucher for trigger too?
54 if (!this.target) this.target = s;
56 SUB_UseTargets(e, toucher, toucher);
61 float trigger_teleport_send(entity this, entity to, float sf)
63 WriteHeader(MSG_ENTITY, ENT_CLIENT_TRIGGER_TELEPORT);
65 WriteByte(MSG_ENTITY, this.team);
66 WriteInt24_t(MSG_ENTITY, this.spawnflags);
67 WriteByte(MSG_ENTITY, this.active);
68 WriteCoord(MSG_ENTITY, this.speed);
70 trigger_common_write(this, true);
75 void trigger_teleport_link(entity this)
77 //trigger_link(this, trigger_teleport_send);
80 spawnfunc(trigger_teleport)
82 this.angles = '0 0 0';
84 this.active = ACTIVE_ACTIVE;
85 //trigger_init(this); // only for predicted triggers?
87 this.use = trigger_teleport_use;
90 FOREACH_WORD(this.noise, true, precache_sound(it));
92 // this must be called to spawn the teleport waypoints for bots
93 InitializeEntity(this, teleport_findtarget, INITPRIO_FINDTARGET);
95 if (this.target == "")
97 objerror (this, "Teleporter with no target");
101 this.teleport_next = teleport_first;
102 teleport_first = this;
105 NET_HANDLE(ENT_CLIENT_TRIGGER_TELEPORT, bool isnew)
107 this.classname = "trigger_teleport";
108 int mytm = ReadByte(); if(mytm) { this.team = mytm - 1; }
109 this.spawnflags = ReadInt24_t();
110 this.active = ReadByte();
111 this.speed = ReadCoord();
113 trigger_common_read(this, true);
115 this.entremove = trigger_remove_generic;
116 this.solid = SOLID_TRIGGER;
117 //this.move_touch = trigger_push_touch;
118 this.move_time = time;
119 defer(this, 0.25, teleport_findtarget);
121 this.teleport_next = teleport_first;
122 teleport_first = this;