]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/triggers/triggers.qc
Merge branch 'master' into 'terencehill/bot_waypoints'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / triggers / triggers.qc
index 0957699b37ad4ef9594e33f930c95b26397030e9..9db38a10b9478a6f9b53272ed21d2dc6e7353dc4 100644 (file)
@@ -21,6 +21,63 @@ void FixSize(entity e)
 }
 
 #ifdef SVQC
+void generic_setactive(entity this, int act)
+{
+       if(act == ACTIVE_TOGGLE)
+       {
+               if(this.active == ACTIVE_ACTIVE)
+               {
+                       this.active = ACTIVE_NOT;
+               }
+               else
+               {
+                       this.active = ACTIVE_ACTIVE;
+               }
+       }
+       else
+       {
+               this.active = act;
+       }
+}
+
+void generic_netlinked_setactive(entity this, int act)
+{
+       int old_status = this.active;
+       generic_setactive(this, act);
+
+       if (this.active != old_status)
+       {
+               this.SendFlags |= SF_TRIGGER_UPDATE;
+       }
+}
+
+void generic_netlinked_reset(entity this)
+{
+       IFTARGETED
+       {
+               if(this.spawnflags & START_ENABLED)
+               {
+                       this.active = ACTIVE_ACTIVE;
+               }
+               else
+               {
+                       this.active = ACTIVE_NOT;
+               }
+       }
+       else
+       {
+               this.active = ACTIVE_ACTIVE;
+       }
+
+       this.SendFlags |= SF_TRIGGER_UPDATE;
+}
+
+// Compatibility with old maps
+void generic_netlinked_legacy_use(entity this, entity actor, entity trigger)
+{
+       LOG_WARNF("Entity %s was (de)activated by a trigger, please update map to use relays", this.targetname);
+       this.setactive(this, ACTIVE_TOGGLE);
+}
 
 bool autocvar_g_triggers_debug = true;