]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/triggers/platforms.qc
Move an assault constant into the assault file
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / triggers / platforms.qc
index 10af3e1944316a7f1b6299297cfbd6a3686cb3d3..4747877314a3ac52f78c30c06233ec3f63dcf170 100644 (file)
@@ -6,13 +6,13 @@ void generic_plat_blocked(entity this, entity blocker)
        {
                if(this.dmgtime2 < time)
                {
-                       Damage (blocker, this, this, this.dmg, DEATH_HURTTRIGGER.m_id, blocker.origin, '0 0 0');
+                       Damage (blocker, this, this, this.dmg, DEATH_HURTTRIGGER.m_id, DMG_NOWEP, blocker.origin, '0 0 0');
                        this.dmgtime2 = time + this.dmgtime;
                }
 
                // Gib dead/dying stuff
                if(IS_DEAD(blocker))
-                       Damage (blocker, this, this, 10000, DEATH_HURTTRIGGER.m_id, blocker.origin, '0 0 0');
+                       Damage (blocker, this, this, 10000, DEATH_HURTTRIGGER.m_id, DMG_NOWEP, blocker.origin, '0 0 0');
        }
 #endif
 }
@@ -61,29 +61,29 @@ void plat_spawn_inside_trigger(entity this)
 void plat_hit_top(entity this)
 {
        _sound (this, CH_TRIGGER_SINGLE, this.noise1, VOL_BASE, ATTEN_NORM);
-       this.state = 1;
+       this.state = STATE_TOP;
 
-       SUB_THINK(this, plat_go_down);
-       this.SUB_NEXTTHINK = this.SUB_LTIME + 3;
+       setthink(this, plat_go_down);
+       this.nextthink = this.ltime + 3;
 }
 
 void plat_hit_bottom(entity this)
 {
        _sound (this, CH_TRIGGER_SINGLE, this.noise1, VOL_BASE, ATTEN_NORM);
-       this.state = 2;
+       this.state = STATE_BOTTOM;
 }
 
 void plat_go_down(entity this)
 {
        _sound (this, CH_TRIGGER_SINGLE, this.noise, VOL_BASE, ATTEN_NORM);
-       this.state = 3;
+       this.state = STATE_DOWN;
        SUB_CalcMove (this, this.pos2, TSPEED_LINEAR, this.speed, plat_hit_bottom);
 }
 
 void plat_go_up(entity this)
 {
        _sound (this, CH_TRIGGER_SINGLE, this.noise, VOL_BASE, ATTEN_NORM);
-       this.state = 4;
+       this.state = STATE_UP;
        SUB_CalcMove (this, this.pos1, TSPEED_LINEAR, this.speed, plat_hit_top);
 }
 
@@ -102,10 +102,10 @@ void plat_center_touch(entity this, entity toucher)
                return;
 #endif
 
-       if (this.enemy.state == 2) {
+       if (this.enemy.state == STATE_BOTTOM) {
                plat_go_up(this.enemy);
-       } else if (this.enemy.state == 1)
-               this.enemy.SUB_NEXTTHINK = this.enemy.SUB_LTIME + 1;
+       } else if (this.enemy.state == STATE_TOP)
+               this.enemy.nextthink = this.enemy.ltime + 1;
 }
 
 void plat_outside_touch(entity this, entity toucher)
@@ -121,7 +121,7 @@ void plat_outside_touch(entity this, entity toucher)
                return;
 #endif
 
-       if (this.enemy.state == 1) {
+       if (this.enemy.state == STATE_TOP) {
            entity e = this.enemy;
                plat_go_down(e);
     }
@@ -137,10 +137,10 @@ void plat_trigger_use(entity this, entity actor, entity trigger)
 
 void plat_crush(entity this, entity blocker)
 {
-       if((this.spawnflags & 4) && (blocker.takedamage != DAMAGE_NO))
+       if((this.spawnflags & CRUSH) && (blocker.takedamage != DAMAGE_NO))
        { // KIll Kill Kill!!
 #ifdef SVQC
-               Damage (blocker, this, this, 10000, DEATH_HURTTRIGGER.m_id, blocker.origin, '0 0 0');
+               Damage (blocker, this, this, 10000, DEATH_HURTTRIGGER.m_id, DMG_NOWEP, blocker.origin, '0 0 0');
 #endif
        }
        else
@@ -148,16 +148,16 @@ void plat_crush(entity this, entity blocker)
 #ifdef SVQC
                if((this.dmg) && (blocker.takedamage != DAMAGE_NO))
                {   // Shall we bite?
-                       Damage (blocker, this, this, this.dmg, DEATH_HURTTRIGGER.m_id, blocker.origin, '0 0 0');
+                       Damage (blocker, this, this, this.dmg, DEATH_HURTTRIGGER.m_id, DMG_NOWEP, blocker.origin, '0 0 0');
                        // Gib dead/dying stuff
                        if(IS_DEAD(blocker))
-                               Damage (blocker, this, this, 10000, DEATH_HURTTRIGGER.m_id, blocker.origin, '0 0 0');
+                               Damage (blocker, this, this, 10000, DEATH_HURTTRIGGER.m_id, DMG_NOWEP, blocker.origin, '0 0 0');
                }
 #endif
 
-               if (this.state == 4)
+               if (this.state == STATE_UP)
                        plat_go_down (this);
-               else if (this.state == 3)
+               else if (this.state == STATE_DOWN)
                        plat_go_up (this);
        // when in other states, then the plat_crush event came delayed after
        // plat state already had changed
@@ -168,11 +168,13 @@ void plat_crush(entity this, entity blocker)
 void plat_use(entity this, entity actor, entity trigger)
 {
        this.use = func_null;
-       if (this.state != 4)
+       if (this.state != STATE_UP)
                objerror (this, "plat_use: not in up state");
        plat_go_down(this);
 }
 
+// WARNING: backwards compatibility because people don't use already existing fields :(
+// TODO: Check if any maps use these fields and remove these fields if it doesn't break maps
 .string sound1, sound2;
 
 void plat_reset(entity this)
@@ -180,13 +182,13 @@ void plat_reset(entity this)
        IFTARGETED
        {
                setorigin(this, this.pos1);
-               this.state = 4;
+               this.state = STATE_UP;
                this.use = plat_use;
        }
        else
        {
                setorigin(this, this.pos2);
-               this.state = 2;
+               this.state = STATE_BOTTOM;
                this.use = plat_trigger_use;
        }