]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Make relay_activate and co work for thise ents:
authorJakob MG <jakob_mg@hotmail.com>
Tue, 28 Sep 2010 19:08:28 +0000 (21:08 +0200)
committerJakob MG <jakob_mg@hotmail.com>
Tue, 28 Sep 2010 19:08:28 +0000 (21:08 +0200)
trigger_hurt
trigger_heal
trigger_impulse
trigger_push
func_rotating
func_bobbing
func_button
func_fourier
func_vectormamamam
trigger_teleport

qcsrc/server/defs.qh
qcsrc/server/g_triggers.qc
qcsrc/server/t_jumppads.qc
qcsrc/server/t_plats.qc
qcsrc/server/t_teleporters.qc

index f452e5110678cdf184e231ae3f00421ad03e03bc..f084e18d4b0b69f6a92b5009321e419e583145c5 100644 (file)
@@ -643,5 +643,4 @@ string deathmessage;
 #define ACTIVE_TOGGLE  3
 .float active;
 .float (float act_state) setactive;
-=======
 .entity realowner;
index cecca06d2e030fe96375326099fdedb9f3948472..44782894424346d5a5cfa4e2ff5f834dc15f87d0 100644 (file)
@@ -413,6 +413,9 @@ void spawnfunc_trigger_counter()
 .float triggerhurttime;
 void trigger_hurt_touch()
 {
+       if (self.active != ACTIVE_ACTIVE) 
+               return;
+
        // only do the EXACTTRIGGER_TOUCH checks when really needed (saves some cpu)
        if (other.iscreature)
        {
@@ -455,6 +458,7 @@ entity trigger_hurt_first;
 void spawnfunc_trigger_hurt()
 {
        EXACTTRIGGER_INIT;
+       self.active = ACTIVE_ACTIVE;
        self.touch = trigger_hurt_touch;
        if (!self.dmg)
                self.dmg = 1000;
@@ -493,6 +497,9 @@ float tracebox_hits_trigger_hurt(vector start, vector mi, vector ma, vector end)
 .float triggerhealtime;
 void trigger_heal_touch()
 {
+       if (self.active != ACTIVE_ACTIVE) 
+               return;
+       
        // only do the EXACTTRIGGER_TOUCH checks when really needed (saves some cpu)
        if (other.iscreature)
        {
@@ -514,6 +521,8 @@ void trigger_heal_touch()
 
 void spawnfunc_trigger_heal()
 {
+       self.active = ACTIVE_ACTIVE;
+       
        EXACTTRIGGER_INIT;
        self.touch = trigger_heal_touch;
        if (!self.health)
@@ -1207,6 +1216,9 @@ void trigger_impulse_touch1()
     float pushdeltatime;
     float str;
 
+       if (self.active != ACTIVE_ACTIVE) 
+               return;
+
        // FIXME: Better checking for what to push and not.
        if not(other.iscreature)
        if (other.classname != "corpse")
@@ -1258,6 +1270,9 @@ void trigger_impulse_touch2()
 {
     float pushdeltatime;
 
+       if (self.active != ACTIVE_ACTIVE) 
+               return;
+
        // FIXME: Better checking for what to push and not.
        if not(other.iscreature)
        if (other.classname != "corpse")
@@ -1295,6 +1310,9 @@ void trigger_impulse_touch3()
     float pushdeltatime;
     float str;
 
+       if (self.active != ACTIVE_ACTIVE) 
+               return;
+
        // FIXME: Better checking for what to push and not.
        if not(other.iscreature)
        if (other.classname != "corpse")
@@ -1356,6 +1374,8 @@ in directional and sperical mode. For damper/accelerator mode this is not nesses
 
 void spawnfunc_trigger_impulse()
 {
+       self.active = ACTIVE_ACTIVE;
+
        EXACTTRIGGER_INIT;
     if(self.radius)
     {
@@ -1933,7 +1953,7 @@ void spawnfunc_trigger_magicear()
        //   what to trigger
 }
 
-void relay_activateors_use()
+void relay_activators_use()
 {
        entity trg, os;
        
@@ -1946,8 +1966,9 @@ void relay_activateors_use()
                        trg.setactive(os.cnt);
                else
                {
+                       bprint("Not using setactive\n");
                        if(os.cnt == ACTIVE_TOGGLE)
-                               if(trg.active)
+                               if(trg.active == ACTIVE_ACTIVE)
                                        trg.active = ACTIVE_NOT;
                                else    
                                        trg.active = ACTIVE_ACTIVE;
@@ -1961,17 +1982,17 @@ void relay_activateors_use()
 void spawnfunc_relay_activate()
 {
        self.cnt = ACTIVE_ACTIVE;
-       self.use = relay_activateors_use;
+       self.use = relay_activators_use;
 }
 
 void spawnfunc_relay_deactivate()
 {
        self.cnt = ACTIVE_NOT;
-       self.use = relay_activateors_use;       
+       self.use = relay_activators_use;        
 }
 
 void spawnfunc_relay_activatetoggle()
 {
        self.cnt = ACTIVE_TOGGLE;
-       self.use = relay_activateors_use;       
+       self.use = relay_activators_use;        
 }
index 606f3b3dec4ce63d70b35ffecf4b259672a0a9cc..df5788f4c3a0ff251854b2fd9d5235b23b99a073 100644 (file)
@@ -231,25 +231,6 @@ void trigger_push_touch()
        }
 };
 
-void trigger_push_setactive(float astate)
-{
-       self.active = astate;
-               
-       if(astate == ACTIVE_NOT)
-               self.touch = SUB_Null;
-       else if (astate == ACTIVE_TOGGLE)
-       {
-               if(self.active)
-                       self.active = ACTIVE_NOT;
-               else
-                       self.active = ACTIVE_ACTIVE;
-       }
-       else
-               self.touch = trigger_push_touch;
-}
-
-
-
 .vector dest;
 void trigger_push_findtarget()
 {
@@ -310,7 +291,6 @@ void spawnfunc_trigger_push()
        EXACTTRIGGER_INIT;
        
        self.active = ACTIVE_ACTIVE;    
-       self.setactive = trigger_push_setactive;
        self.use = trigger_push_use;
        self.touch = trigger_push_touch;
 
index 8dac99e41c6079fa50f2aebc4e6026357c399985..583fc735966d68c1de4b22cce08c6fc084f4c295 100644 (file)
@@ -331,8 +331,8 @@ void func_rotating_setactive(float astate)
 {
        
        if (astate == ACTIVE_TOGGLE)
-       {
-               if(self.active)
+       {               
+               if(self.active == ACTIVE_ACTIVE)
                        self.active = ACTIVE_NOT;
                else
                        self.active = ACTIVE_ACTIVE;
@@ -340,7 +340,7 @@ void func_rotating_setactive(float astate)
        else
                self.active = astate;
                
-       if(astate == ACTIVE_NOT)                
+       if(self.active  == ACTIVE_NOT)          
                self.avelocity = '0 0 0';
        else
                self.avelocity = self.pos1;
@@ -408,6 +408,13 @@ void func_bobbing_controller_think()
 {
        local vector v;
        self.nextthink = time + 0.1;
+       
+       if not (self.owner.active == ACTIVE_ACTIVE)
+       {
+               self.owner.velocity = '0 0 0';          
+               return;
+       }
+               
        // calculate sinewave using makevectors
        makevectors((self.nextthink * self.owner.cnt + self.owner.phase * 360) * '0 1 0');
        v = self.owner.destvec + self.owner.movedir * v_forward_y;
@@ -447,6 +454,8 @@ void spawnfunc_func_bobbing()
        // time scale to get degrees
        self.cnt = 360 / self.speed;
 
+       self.active = ACTIVE_ACTIVE;
+
        // damage when blocked
        self.blocked = bobbing_blocked;
        if(self.dmg & (!self.message))
@@ -551,6 +560,10 @@ void button_use()
 //             dprint(activator.classname);
 //             dprint(" triggered a button\n");
 //     }
+
+       if not (self.active == ACTIVE_ACTIVE)
+               return;
+
        self.enemy = activator;
        button_fire ();
 };
@@ -640,6 +653,8 @@ void spawnfunc_func_button()
     if(self.noise != "")
         precache_sound(self.noise);
 
+       self.active = ACTIVE_ACTIVE;
+
        self.pos1 = self.origin;
        self.pos2 = self.pos1 + self.movedir*(fabs(self.movedir*self.size) - self.lip);
     self.flags |= FL_NOTARGET;
@@ -1661,6 +1676,12 @@ void func_fourier_controller_think()
        float n, i, t;
 
        self.nextthink = time + 0.1;
+       if not (self.owner.active == ACTIVE_ACTIVE)
+       {
+               self.owner.velocity = '0 0 0';          
+               return;
+       }
+
 
        n = floor((tokenize_console(self.owner.netname)) / 5);
        t = self.nextthink * self.owner.cnt + self.owner.phase * 360;
@@ -1708,6 +1729,8 @@ void spawnfunc_func_fourier()
        if not(InitMovingBrushTrigger())
                return;
 
+       self.active = ACTIVE_ACTIVE;
+
        // wait for targets to spawn
        controller = spawn();
        controller.classname = "func_fourier_controller";
@@ -1784,6 +1807,13 @@ vector func_vectormamamam_origin(entity o, float t)
 void func_vectormamamam_controller_think()
 {
        self.nextthink = time + 0.1;
+
+       if not (self.owner.active == ACTIVE_ACTIVE)
+       {
+               self.owner.velocity = '0 0 0';          
+               return;
+       }
+
        self.owner.velocity = (self.owner.destvec + func_vectormamamam_origin(self.owner, 0.1) - self.owner.origin) * 10;
 }
 
@@ -1868,5 +1898,7 @@ void spawnfunc_func_vectormamamam()
        // Savage: Reduce bandwith, critical on e.g. nexdm02
        self.effects |= EF_LOWPRECISION;
 
+       self.active = ACTIVE_ACTIVE;
+
        InitializeEntity(self, func_vectormamamam_findtarget, INITPRIO_FINDTARGET);
 }
index 26acf7f0ead9d4f59a5d2f5c1d8770afbf0ba3f3..eba0ea0681b3ee22edfcc378e7ca1c23f1027b17 100644 (file)
@@ -154,6 +154,9 @@ void Teleport_Touch (void)
        float p;
        string s;
 
+       if (self.active != ACTIVE_ACTIVE)
+               return;
+       
        if (other.health < 1)
                return;
        if not(other.flags & FL_CLIENT) // FIXME: Make missiles firable through the teleport too
@@ -292,7 +295,9 @@ void spawnfunc_trigger_teleport (void)
        self.angles = '0 0 0';
 
        EXACTTRIGGER_INIT;
-
+       
+       self.active = ACTIVE_ACTIVE;    
+       
        self.use = trigger_teleport_use;
 
        // this must be called to spawn the teleport waypoints for bots