Merge branch 'master' into tzork/ents-onoff
authorJakob MG <jakob_mg@hotmail.com>
Tue, 28 Sep 2010 09:54:21 +0000 (11:54 +0200)
committerJakob MG <jakob_mg@hotmail.com>
Tue, 28 Sep 2010 09:54:21 +0000 (11:54 +0200)
Conflicts:
qcsrc/server/defs.qh

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

index d4ee31d..f452e51 100644 (file)
@@ -636,4 +636,12 @@ string deathmessage;
 
 .float ballistics_density; // wall piercing factor, larger = bullet can pass through more
 
+#define ACTIVE_NOT             0
+#define ACTIVE_ACTIVE  1
+#define ACTIVE_IDLE    2
+#define ACTIVE_BUSY    2
+#define ACTIVE_TOGGLE  3
+.float active;
+.float (float act_state) setactive;
+=======
 .entity realowner;
index 0896465..cecca06 100644 (file)
@@ -1932,3 +1932,46 @@ void spawnfunc_trigger_magicear()
        // target:
        //   what to trigger
 }
+
+void relay_activateors_use()
+{
+       entity trg, os;
+       
+       os = self;
+       
+       for(trg = world; (trg = find(trg, targetname, os.target)); )
+       {
+               self = trg;
+               if (trg.setactive)
+                       trg.setactive(os.cnt);
+               else
+               {
+                       if(os.cnt == ACTIVE_TOGGLE)
+                               if(trg.active)
+                                       trg.active = ACTIVE_NOT;
+                               else    
+                                       trg.active = ACTIVE_ACTIVE;
+                       else
+                               trg.active = os.cnt;
+               }               
+       }
+       self = os;
+}
+
+void spawnfunc_relay_activate()
+{
+       self.cnt = ACTIVE_ACTIVE;
+       self.use = relay_activateors_use;
+}
+
+void spawnfunc_relay_deactivate()
+{
+       self.cnt = ACTIVE_NOT;
+       self.use = relay_activateors_use;       
+}
+
+void spawnfunc_relay_activatetoggle()
+{
+       self.cnt = ACTIVE_TOGGLE;
+       self.use = relay_activateors_use;       
+}
index 9bb8f7c..606f3b3 100644 (file)
@@ -127,6 +127,9 @@ vector trigger_push_calculatevelocity(vector org, entity tgt, float ht)
 
 void trigger_push_touch()
 {
+       if (self.active == ACTIVE_NOT) 
+               return;         
+               
        // FIXME: add a .float for whether an entity should be tossed by jumppads
        if (!other.iscreature)
        if (other.classname != "corpse")
@@ -228,8 +231,26 @@ void trigger_push_touch()
        }
 };
 
-.vector dest;
+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()
 {
        local entity e;
@@ -287,7 +308,9 @@ void spawnfunc_trigger_push()
                SetMovedir ();
 
        EXACTTRIGGER_INIT;
-
+       
+       self.active = ACTIVE_ACTIVE;    
+       self.setactive = trigger_push_setactive;
        self.use = trigger_push_use;
        self.touch = trigger_push_touch;
 
index ad80e7f..8dac99e 100644 (file)
@@ -327,6 +327,25 @@ void spawnfunc_func_train()
        // TODO make a reset function for this one
 };
 
+void func_rotating_setactive(float astate)
+{
+       
+       if (astate == ACTIVE_TOGGLE)
+       {
+               if(self.active)
+                       self.active = ACTIVE_NOT;
+               else
+                       self.active = ACTIVE_ACTIVE;
+       }
+       else
+               self.active = astate;
+               
+       if(astate == ACTIVE_NOT)                
+               self.avelocity = '0 0 0';
+       else
+               self.avelocity = self.pos1;
+}
+
 /*QUAKED spawnfunc_func_rotating (0 .5 .8) ? - - X_AXIS Y_AXIS
 Brush model that spins in place on one axis (default Z).
 speed   : speed to rotate (in degrees per second)
@@ -342,6 +361,10 @@ void spawnfunc_func_rotating()
                precache_sound(self.noise);
                ambientsound(self.origin, self.noise, VOL_BASE, ATTN_IDLE);
        }
+       
+       self.active = ACTIVE_ACTIVE;
+       self.setactive = func_rotating_setactive;
+       
        if (!self.speed)
                self.speed = 100;
        // FIXME: test if this turns the right way, then remove this comment (negate as needed)
@@ -353,7 +376,9 @@ void spawnfunc_func_rotating()
        // FIXME: test if this turns the right way, then remove this comment (negate as needed)
        else // Z
                self.avelocity = '0 1 0' * self.speed;
-
+       
+       self.pos1 = self.avelocity;
+    
     if(self.dmg & (!self.message))
         self.message = " was squished";
     if(self.dmg && (!self.message2))