]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/triggers/func/door_rotating.qc
Properly support team field on trigger_multiple
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / triggers / func / door_rotating.qc
index fbe579c1361805da9d34027a20040c9df64f59aa..c61a02686650eb56ae3a138d3cace85fed2a99b0 100644 (file)
@@ -1,3 +1,4 @@
+#include "door_rotating.qh"
 #ifdef SVQC
 /*QUAKED spawnfunc_func_door_rotating (0 .5 .8) ? START_OPEN BIDIR DOOR_DONT_LINK BIDIR_IN_DOWN x TOGGLE X_AXIS Y_AXIS
 if two doors touch, they are assumed to be connected and operate as a unit.
@@ -27,100 +28,101 @@ START_OPEN causes the door to move to its destination when spawned, and operate
 FIXME: only one sound set available at the time being
 */
 
-void door_rotating_reset()
-{SELFPARAM();
-       self.angles = self.pos1;
-       self.avelocity = '0 0 0';
-       self.state = STATE_BOTTOM;
-       self.think = func_null;
-       self.nextthink = 0;
+void door_rotating_reset(entity this)
+{
+       this.angles = this.pos1;
+       this.avelocity = '0 0 0';
+       this.state = STATE_BOTTOM;
+       setthink(this, func_null);
+       this.nextthink = 0;
 }
 
-void door_rotating_init_startopen()
-{SELFPARAM();
-       self.angles = self.movedir;
-       self.pos2 = '0 0 0';
-       self.pos1 = self.movedir;
+void door_rotating_init_startopen(entity this)
+{
+       this.angles = this.movedir;
+       this.pos2 = '0 0 0';
+       this.pos1 = this.movedir;
 }
 
 
-void spawnfunc_func_door_rotating()
-{SELFPARAM();
+spawnfunc(func_door_rotating)
+{
 
-       //if (!self.deathtype) // map makers can override this
-       //      self.deathtype = " got in the way";
+       //if (!this.deathtype) // map makers can override this
+       //      this.deathtype = " got in the way";
 
        // I abuse "movedir" for denoting the axis for now
-       if (self.spawnflags & 64) // X (untested)
-               self.movedir = '0 0 1';
-       else if (self.spawnflags & 128) // Y (untested)
-               self.movedir = '1 0 0';
+       if (this.spawnflags & 64) // X (untested)
+               this.movedir = '0 0 1';
+       else if (this.spawnflags & 128) // Y (untested)
+               this.movedir = '1 0 0';
        else // Z
-               self.movedir = '0 1 0';
+               this.movedir = '0 1 0';
 
-       if (self.angles_y==0) self.angles_y = 90;
+       if (this.angles_y==0) this.angles_y = 90;
 
-       self.movedir = self.movedir * self.angles_y;
-       self.angles = '0 0 0';
+       this.movedir = this.movedir * this.angles_y;
+       this.angles = '0 0 0';
 
-       self.max_health = self.health;
-       self.avelocity = self.movedir;
-       if (!InitMovingBrushTrigger())
+       this.max_health = this.health;
+       this.avelocity = this.movedir;
+       if (!InitMovingBrushTrigger(this))
                return;
-       self.velocity = '0 0 0';
-       //self.effects |= EF_LOWPRECISION;
-       self.classname = "door_rotating";
+       this.velocity = '0 0 0';
+       //this.effects |= EF_LOWPRECISION;
+       this.classname = "door_rotating";
 
-       self.blocked = door_blocked;
-       self.use = door_use;
+       setblocked(this, door_blocked);
+       this.use = door_use;
 
-    if(self.spawnflags & 8)
-        self.dmg = 10000;
+    if(this.spawnflags & 8)
+        this.dmg = 10000;
 
-    if(self.dmg && (self.message == ""))
-               self.message = "was squished";
-    if(self.dmg && (self.message2 == ""))
-               self.message2 = "was squished by";
+    if(this.dmg && (this.message == ""))
+               this.message = "was squished";
+    if(this.dmg && (this.message2 == ""))
+               this.message2 = "was squished by";
 
-    if (self.sounds > 0)
+    if (this.sounds > 0)
        {
                precache_sound ("plats/medplat1.wav");
                precache_sound ("plats/medplat2.wav");
-               self.noise2 = "plats/medplat1.wav";
-               self.noise1 = "plats/medplat2.wav";
+               this.noise2 = "plats/medplat1.wav";
+               this.noise1 = "plats/medplat2.wav";
        }
 
-       if (!self.speed)
-               self.speed = 50;
-       if (!self.wait)
-               self.wait = 1;
-       self.lip = 0; // self.lip is used to remember reverse opening direction for door_rotating
+       if (!this.speed)
+               this.speed = 50;
+       if (!this.wait)
+               this.wait = 1;
+       this.lip = 0; // this.lip is used to remember reverse opening direction for door_rotating
 
-       self.pos1 = '0 0 0';
-       self.pos2 = self.movedir;
+       this.pos1 = '0 0 0';
+       this.pos2 = this.movedir;
 
 // DOOR_START_OPEN is to allow an entity to be lighted in the closed position
 // but spawn in the open position
-       if (self.spawnflags & DOOR_START_OPEN)
-               InitializeEntity(self, door_rotating_init_startopen, INITPRIO_SETLOCATION);
+       if (this.spawnflags & DOOR_START_OPEN)
+               InitializeEntity(this, door_rotating_init_startopen, INITPRIO_SETLOCATION);
 
-       self.state = STATE_BOTTOM;
+       this.state = STATE_BOTTOM;
 
-       if (self.health)
+       if (this.health)
        {
-               self.takedamage = DAMAGE_YES;
-               self.event_damage = door_damage;
+               //this.canteamdamage = true; // TODO
+               this.takedamage = DAMAGE_YES;
+               this.event_damage = door_damage;
        }
 
-       if (self.items)
-               self.wait = -1;
+       if (this.items)
+               this.wait = -1;
 
-       self.touch = door_touch;
+       settouch(this, door_touch);
 
 // LinkDoors can't be done until all of the doors have been spawned, so
 // the sizes can be detected properly.
-       InitializeEntity(self, LinkDoors, INITPRIO_LINKDOORS);
+       InitializeEntity(this, LinkDoors, INITPRIO_LINKDOORS);
 
-       self.reset = door_rotating_reset;
+       this.reset = door_rotating_reset;
 }
 #endif