]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/mapobjects/trigger/multi.qc
Merge branch 'master' into Lyberta/WaypointIcons
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mapobjects / trigger / multi.qc
index 5447b992c373e1c1694b7e5bacb926cd8953f2e9..9ce5f52cea877d9a1f556c9fa1ee88b06027fe08 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);
        }
@@ -120,8 +111,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,7 +126,7 @@ 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;
        }
@@ -167,7 +158,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 +167,20 @@ spawnfunc(trigger_multiple)
                this.wait = 0;
        this.use = multi_use;
 
+       if(this.wait == -1 && autocvar_sv_q3defragcompat)
+               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;