]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/triggers/trigger/impulse.qc
Introduce touch accessors
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / triggers / trigger / impulse.qc
index b4b146c7f315292c3e7a44968b280e8e3821e7ac..02c253eb78758cebe3f9e0c40eaa98709896915b 100644 (file)
@@ -179,63 +179,62 @@ bool trigger_impulse_send(entity this, entity to, int sf)
        return true;
 }
 
-void trigger_impulse_link()
+void trigger_impulse_link(entity this)
 {
-    SELFPARAM();
-       trigger_link(self, trigger_impulse_send);
+       trigger_link(this, trigger_impulse_send);
 }
 
 spawnfunc(trigger_impulse)
 {
-       self.active = ACTIVE_ACTIVE;
+       this.active = ACTIVE_ACTIVE;
 
-       trigger_init(self);
+       trigger_init(this);
 
-       if(self.radius)
+       if(this.radius)
        {
-               if(!self.strength) self.strength = 2000 * autocvar_g_triggerimpulse_radial_multiplier;
-               setorigin(self, self.origin);
-               setsize(self, '-1 -1 -1' * self.radius,'1 1 1' * self.radius);
-               self.touch = trigger_impulse_touch3;
+               if(!this.strength) this.strength = 2000 * autocvar_g_triggerimpulse_radial_multiplier;
+               setorigin(this, this.origin);
+               setsize(this, '-1 -1 -1' * this.radius,'1 1 1' * this.radius);
+               settouch(this, trigger_impulse_touch3);
        }
        else
        {
-               if(self.target)
+               if(this.target)
                {
-                       if(!self.strength) self.strength = 950 * autocvar_g_triggerimpulse_directional_multiplier;
-                       self.touch = trigger_impulse_touch1;
+                       if(!this.strength) this.strength = 950 * autocvar_g_triggerimpulse_directional_multiplier;
+                       settouch(this, trigger_impulse_touch1);
                }
                else
                {
-                       if(!self.strength) self.strength = 0.9;
-                       self.strength = pow(self.strength, autocvar_g_triggerimpulse_accel_power) * autocvar_g_triggerimpulse_accel_multiplier;
-                       self.touch = trigger_impulse_touch2;
+                       if(!this.strength) this.strength = 0.9;
+                       this.strength = pow(this.strength, autocvar_g_triggerimpulse_accel_power) * autocvar_g_triggerimpulse_accel_multiplier;
+                       settouch(this, trigger_impulse_touch2);
                }
        }
 
-       trigger_impulse_link();
+       trigger_impulse_link(this);
 }
 #elif defined(CSQC)
 NET_HANDLE(ENT_CLIENT_TRIGGER_IMPULSE, bool isnew)
 {
-       self.spawnflags = ReadInt24_t();
-       self.radius = ReadCoord();
-       self.strength = ReadCoord();
-       self.falloff = ReadByte();
-       self.active = ReadByte();
+       this.spawnflags = ReadInt24_t();
+       this.radius = ReadCoord();
+       this.strength = ReadCoord();
+       this.falloff = ReadByte();
+       this.active = ReadByte();
 
-       trigger_common_read(true);
+       trigger_common_read(this, true);
        return = true;
 
-       self.classname = "trigger_impulse";
-       self.solid = SOLID_TRIGGER;
-       self.entremove = trigger_remove_generic;
-       //self.draw = trigger_draw_generic;
-       self.drawmask = MASK_NORMAL;
-       self.move_time = time;
+       this.classname = "trigger_impulse";
+       this.solid = SOLID_TRIGGER;
+       this.entremove = trigger_remove_generic;
+       //this.draw = trigger_draw_generic;
+       this.drawmask = MASK_NORMAL;
+       this.move_time = time;
 
-       if(self.radius) { self.move_touch = trigger_impulse_touch3; }
-       else if(self.target) { self.move_touch = trigger_impulse_touch1; }
-       else { self.move_touch = trigger_impulse_touch2; }
+       if(this.radius) { this.move_touch = trigger_impulse_touch3; }
+       else if(this.target) { this.move_touch = trigger_impulse_touch1; }
+       else { this.move_touch = trigger_impulse_touch2; }
 }
 #endif