]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/mapobjects/triggers.qc
Add a function to skip certain target fields when using an entity's targets so they...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mapobjects / triggers.qc
index 6a20959997b34439e24d3fc7ceae7cbef35cb1fa..27ffead9c7582bed0e81d63e1c99c926dc0d7980 100644 (file)
@@ -10,17 +10,6 @@ void DelayThink(entity this)
        delete(this);
 }
 
-void FixSize(entity e)
-{
-       e.mins_x = rint(e.mins_x);
-       e.mins_y = rint(e.mins_y);
-       e.mins_z = rint(e.mins_z);
-
-       e.maxs_x = rint(e.maxs_x);
-       e.maxs_y = rint(e.maxs_y);
-       e.maxs_z = rint(e.maxs_z);
-}
-
 #ifdef SVQC
 void generic_setactive(entity this, int act)
 {
@@ -246,7 +235,7 @@ match (string)this.target and call their .use function
 ==============================
 */
 
-void SUB_UseTargets_Ex(entity this, entity actor, entity trigger, bool preventReuse)
+void SUB_UseTargets_Ex(entity this, entity actor, entity trigger, bool preventReuse, int skiptargets)
 {
 //
 // check for a delay
@@ -260,10 +249,10 @@ void SUB_UseTargets_Ex(entity this, entity actor, entity trigger, bool preventRe
                t.enemy = actor;
                t.message = this.message;
                t.killtarget = this.killtarget;
-               t.target = this.target;
-               t.target2 = this.target2;
-               t.target3 = this.target3;
-               t.target4 = this.target4;
+               if(!(skiptargets & BIT(1))) t.target = this.target;
+               if(!(skiptargets & BIT(2))) t.target2 = this.target2;
+               if(!(skiptargets & BIT(3))) t.target3 = this.target3;
+               if(!(skiptargets & BIT(4))) t.target4 = this.target4;
                t.antiwall_flag = this.antiwall_flag;
                return;
        }
@@ -303,6 +292,8 @@ void SUB_UseTargets_Ex(entity this, entity actor, entity trigger, bool preventRe
 
        for(int i = 0; i < 4; ++i)
        {
+               if(skiptargets & BIT(i + 1))
+                       continue;
                switch(i)
                {
                        default:
@@ -313,12 +304,9 @@ void SUB_UseTargets_Ex(entity this, entity actor, entity trigger, bool preventRe
                }
                if (s != "")
                {
-                       // Flag to set func_clientwall state
-                       // 1 == deactivate, 2 == activate, 0 == do nothing
-                       int aw_flag = this.antiwall_flag;
                        for(entity t = NULL; (t = find(t, targetname, s)); )
                        {
-                               if(t.use && (t.sub_target_used != time || !preventReuse))
+                               if(t != this && t.use && (t.sub_target_used != time || !preventReuse))
                                {
                                        if(this.target_random)
                                        {
@@ -326,9 +314,6 @@ void SUB_UseTargets_Ex(entity this, entity actor, entity trigger, bool preventRe
                                        }
                                        else
                                        {
-                                               if (t.classname == "func_clientwall" || t.classname == "func_clientillusionary")
-                                                       t.antiwall_flag = aw_flag;
-
                                                t.use(t, actor, this);
                                                if(preventReuse)
                                                        t.sub_target_used = time;
@@ -346,5 +331,6 @@ void SUB_UseTargets_Ex(entity this, entity actor, entity trigger, bool preventRe
        }
 }
 
-void SUB_UseTargets(entity this, entity actor, entity trigger) { SUB_UseTargets_Ex(this, actor, trigger, false); }
-void SUB_UseTargets_PreventReuse(entity this, entity actor, entity trigger) { SUB_UseTargets_Ex(this, actor, trigger, true); }
+void SUB_UseTargets(entity this, entity actor, entity trigger) { SUB_UseTargets_Ex(this, actor, trigger, false, 0); }
+void SUB_UseTargets_PreventReuse(entity this, entity actor, entity trigger) { SUB_UseTargets_Ex(this, actor, trigger, true, 0); }
+void SUB_UseTargets_SkipTargets(entity this, entity actor, entity trigger, int skiptargets) { SUB_UseTargets_Ex(this, actor, trigger, false, skiptargets); }