]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/mapobjects/trigger/multi.qc
Transifex autosync
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mapobjects / trigger / multi.qc
index 5447b992c373e1c1694b7e5bacb926cd8953f2e9..0b0efc21c284d1e82cb6f253ccde21d30c6bdc3e 100644 (file)
@@ -7,7 +7,7 @@ void multi_wait(entity this)
 {
        if (this.max_health)
        {
-               SetResourceAmountExplicit(this, RESOURCE_HEALTH, this.max_health);
+               SetResourceExplicit(this, RES_HEALTH, this.max_health);
                this.takedamage = DAMAGE_YES;
                this.solid = SOLID_BBOX;
        }
@@ -24,21 +24,12 @@ void multi_trigger(entity this)
                return;         // allready been triggered
        }
 
-       if(this.spawnflags & ONLY_PLAYERS && !IS_PLAYER(this.enemy))
+       if((this.spawnflags & ONLY_PLAYERS) && !IS_PLAYER(this.enemy))
        {
                return; // only players
        }
 
-       // TODO: restructure this so that trigger_secret is more independent
-       if (this.classname == "trigger_secret")
-       {
-               if (!IS_PLAYER(this.enemy))
-                       return;
-               found_secrets = found_secrets + 1;
-               WriteByte (MSG_ALL, SVC_FOUNDSECRET);
-       }
-
-       if (this.noise)
+       if (this.noise && this.noise != "")
        {
                _sound (this.enemy, CH_TRIGGER, this.noise, VOL_BASE, ATTEN_NORM);
        }
@@ -61,6 +52,7 @@ void multi_trigger(entity this)
        {       // 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);
+               this.use = func_null;
        }
 }
 
@@ -120,8 +112,8 @@ void multi_eventdamage(entity this, entity inflictor, entity attacker, float dam
        if(this.team)
                if(((this.spawnflags & INVERT_TEAMS) == 0) == (this.team != attacker.team))
                        return;
-       TakeResource(this, RESOURCE_HEALTH, damage);
-       if (GetResourceAmount(this, RESOURCE_HEALTH) <= 0)
+       TakeResource(this, RES_HEALTH, damage);
+       if (GetResource(this, RES_HEALTH) <= 0)
        {
                this.enemy = attacker;
                this.goalentity = inflictor;
@@ -135,13 +127,14 @@ void multi_reset(entity this)
                settouch(this, multi_touch);
        if (this.max_health)
        {
-               SetResourceAmountExplicit(this, RESOURCE_HEALTH, this.max_health);
+               SetResourceExplicit(this, RES_HEALTH, this.max_health);
                this.takedamage = DAMAGE_YES;
                this.solid = SOLID_BBOX;
        }
        setthink(this, func_null);
        this.nextthink = 0;
        this.team = this.team_saved;
+       this.use = multi_use;
 }
 
 /*QUAKED spawnfunc_trigger_multiple (.5 .5 .5) ? notouch
@@ -167,7 +160,7 @@ spawnfunc(trigger_multiple)
        else if (this.sounds == 3)
                this.noise = "misc/trigger1.wav";
 
-       if(this.noise)
+       if(this.noise && this.noise != "")
                precache_sound(this.noise);
 
        if (!this.wait)
@@ -176,17 +169,20 @@ spawnfunc(trigger_multiple)
                this.wait = 0;
        this.use = multi_use;
 
+       if(this.wait == -1 && (q3compat & Q3COMPAT_DEFI))
+               this.wait = 0.1; // compatibility for q3df: "instant" return
+
        EXACTTRIGGER_INIT;
 
        this.team_saved = this.team;
        IL_PUSH(g_saved_team, this);
 
-       if (GetResourceAmount(this, RESOURCE_HEALTH))
+       if (GetResource(this, RES_HEALTH))
        {
                if (this.spawnflags & SPAWNFLAG_NOTOUCH)
                        objerror (this, "health and notouch don't make sense\n");
                this.canteamdamage = true;
-               this.max_health = GetResourceAmount(this, RESOURCE_HEALTH);
+               this.max_health = GetResource(this, RES_HEALTH);
                this.event_damage = multi_eventdamage;
                this.takedamage = DAMAGE_YES;
                this.solid = SOLID_BBOX;