]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/triggers/trigger/multi.qc
Some optimizations to client side items and spawn points
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / triggers / trigger / multi.qc
index 1f08796dd65f99282a46a2fcf07cc2573363d235..5e8c641be542735efe020f155f2d7ff556f7dcbc 100644 (file)
@@ -1,3 +1,4 @@
+#include "multi.qh"
 // NOTE: also contains trigger_once at bottom
 
 #ifdef SVQC
@@ -53,8 +54,8 @@ void multi_trigger(entity this)
                multi_wait(this); // waiting finished
        }
        else
-       {       // we can't just remove (this) here, because this is a touch function
-               // called wheil C code is looping through area links...
+       {       // we can't just delete(this) here, because this is a touch function
+               // called while C code is looping through area links...
                settouch(this, func_null);
        }
 }
@@ -66,34 +67,33 @@ void multi_use(entity this, entity actor, entity trigger)
        multi_trigger(this);
 }
 
-void multi_touch(entity this)
+void multi_touch(entity this, entity toucher)
 {
        if(!(this.spawnflags & 2))
-       if(!other.iscreature)
+       if(!toucher.iscreature)
                        return;
 
        if(this.team)
-               if(((this.spawnflags & 4) == 0) == (this.team != other.team))
+               if(((this.spawnflags & 4) == 0) == (this.team != toucher.team))
                        return;
 
 // if the trigger has an angles field, check player's facing direction
        if (this.movedir != '0 0 0')
        {
-               makevectors (other.angles);
+               makevectors (toucher.angles);
                if (v_forward * this.movedir < 0)
                        return;         // not facing the right way
        }
 
        // if the trigger has pressed keys, check that the player is pressing those keys
-       if(this.pressedkeys)
-       if(IS_PLAYER(other)) // only for players
-       if(!(other.pressedkeys & this.pressedkeys))
+       if(this.pressedkeys && IS_PLAYER(toucher)) // only for players
+       if(!(CS(toucher).pressedkeys & this.pressedkeys))
                return;
 
-       EXACTTRIGGER_TOUCH;
+       EXACTTRIGGER_TOUCH(this, toucher);
 
-       this.enemy = other;
-       this.goalentity = other;
+       this.enemy = toucher;
+       this.goalentity = toucher;
        multi_trigger(this);
 }
 
@@ -163,23 +163,24 @@ spawnfunc(trigger_multiple)
        EXACTTRIGGER_INIT;
 
        this.team_saved = this.team;
+       IL_PUSH(g_saved_team, this);
 
        if (this.health)
        {
                if (this.spawnflags & SPAWNFLAG_NOTOUCH)
-                       objerror ("health and notouch don't make sense\n");
+                       objerror (this, "health and notouch don't make sense\n");
                this.max_health = this.health;
                this.event_damage = multi_eventdamage;
                this.takedamage = DAMAGE_YES;
                this.solid = SOLID_BBOX;
-               setorigin (this, this.origin);  // make sure it links into the world
+               setorigin(this, this.origin);   // make sure it links into the world
        }
        else
        {
                if ( !(this.spawnflags & SPAWNFLAG_NOTOUCH) )
                {
                        settouch(this, multi_touch);
-                       setorigin (this, this.origin);  // make sure it links into the world
+                       setorigin(this, this.origin);   // make sure it links into the world
                }
        }
 }