]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/triggers/trigger/teleport.qc
Merge branch 'terencehill/menu_fixes' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / triggers / trigger / teleport.qc
index 48b0341d33c832315133470715c668d844fd6b4c..c9b8147139aa8eb27b99a5b28694a41092e046ac 100644 (file)
@@ -1,12 +1,12 @@
 REGISTER_NET_LINKED(ENT_CLIENT_TRIGGER_TELEPORT)
 
 #ifdef SVQC
-void trigger_teleport_use()
-{SELFPARAM();
+void trigger_teleport_use(entity this, entity actor, entity trigger)
+{
        if(teamplay)
-               self.team = activator.team;
+               this.team = actor.team;
 #ifdef SVQC
-       self.SendFlags |= SF_TRIGGER_UPDATE;
+       this.SendFlags |= SF_TRIGGER_UPDATE;
 #endif
 }
 #endif
@@ -26,9 +26,12 @@ void Teleport_Touch ()
 
        if(IS_TURRET(other))
                return;
+#elif defined(CSQC)
+       if(!IS_PLAYER(other))
+               return;
 #endif
 
-       if(PHYS_DEAD(other))
+       if(IS_DEAD(other))
                return;
 
        if(self.team)
@@ -46,12 +49,11 @@ void Teleport_Touch ()
        e = Simple_TeleportPlayer(self, other);
 
 #ifdef SVQC
-       activator = other;
        string s = self.target; self.target = string_null;
-       SUB_UseTargets();
+       SUB_UseTargets(self, other, other); // TODO: should we be using other for trigger too?
        if (!self.target) self.target = s;
 
-       WITH(entity, self, e, SUB_UseTargets());
+       SUB_UseTargets(e, other, other);
 #endif
 }
 
@@ -72,7 +74,7 @@ float trigger_teleport_send(entity this, entity to, float sf)
 
 void trigger_teleport_link(entity this)
 {
-       trigger_link(this, trigger_teleport_send);
+       //trigger_link(this, trigger_teleport_send);
 }
 
 spawnfunc(trigger_teleport)
@@ -80,9 +82,13 @@ spawnfunc(trigger_teleport)
        self.angles = '0 0 0';
 
        self.active = ACTIVE_ACTIVE;
-       trigger_init(self);
+       //trigger_init(self); // only for predicted triggers?
+       EXACTTRIGGER_INIT;
        self.use = trigger_teleport_use;
 
+       if(self.noise != "")
+               FOREACH_WORD(self.noise, true, precache_sound(it));
+
        // this must be called to spawn the teleport waypoints for bots
        InitializeEntity(self, teleport_findtarget, INITPRIO_FINDTARGET);