]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into Mario/use1
authorMario <mario@smbclan.net>
Sun, 27 Mar 2016 11:53:07 +0000 (21:53 +1000)
committerMario <mario@smbclan.net>
Sun, 27 Mar 2016 11:53:07 +0000 (21:53 +1000)
# Conflicts:
# qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc
# qcsrc/common/triggers/target/spawn.qc
# qcsrc/common/triggers/trigger/gamestart.qc
# qcsrc/lib/defer.qh
# qcsrc/server/mutators/mutator/gamemode_assault.qc

22 files changed:
1  2 
qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc
qcsrc/common/t_items.qc
qcsrc/common/t_items.qh
qcsrc/common/triggers/func/door.qc
qcsrc/common/triggers/func/door_rotating.qc
qcsrc/common/triggers/func/plat.qc
qcsrc/common/triggers/func/train.qc
qcsrc/common/triggers/misc/laser.qc
qcsrc/common/triggers/target/spawn.qc
qcsrc/common/triggers/teleporters.qh
qcsrc/common/triggers/trigger/jumppads.qc
qcsrc/common/triggers/trigger/jumppads.qh
qcsrc/common/turrets/turret/walker.qc
qcsrc/lib/self.qh
qcsrc/server/cheats.qc
qcsrc/server/g_lights.qc
qcsrc/server/g_models.qc
qcsrc/server/g_subs.qh
qcsrc/server/miscfunctions.qc
qcsrc/server/mutators/mutator/gamemode_assault.qc
qcsrc/server/mutators/mutator/gamemode_domination.qc
qcsrc/server/race.qc

index 212420753dc1170498025cdcaa0eaac0a719ee1a,5271beba1fe51290edeb9fc4a0deba0373f7b9a2..056d33a03d679882abd344aced5c7fe5e5280236
@@@ -414,8 -414,8 +414,8 @@@ void ons_Link_CheckUpdate(
        self.nextthink = time;
  }
  
- void ons_DelayedLinkSetup()
- {SELFPARAM();
+ void ons_DelayedLinkSetup(entity this)
+ {
        self.goalentity = find(world, targetname, self.target);
        self.enemy = find(world, targetname, self.target2);
        if(!self.goalentity) { objerror("can not find target\n"); }
@@@ -546,7 -546,10 +546,7 @@@ void ons_ControlPoint_Icon_Damage(entit
                onslaught_updatelinks();
  
                // Use targets now (somebody make sure this is in the right place..)
 -              setself(this.owner);
 -              activator = this;
 -              WITHSELF(this, SUB_UseTargets());
 -              setself(this);
 +              SUB_UseTargets(this.owner, this, NULL);
  
                this.owner.waslinked = this.owner.islinked;
                if(this.owner.model != "models/onslaught/controlpoint_pad.md3")
@@@ -608,7 -611,10 +608,7 @@@ void ons_ControlPoint_Icon_Think(
                if(!self.owner.islinked)
                        self.owner.team = 0;
  
 -              setself(self.owner);
 -              activator = self;
 -              SUB_UseTargets ();
 -              setself(this);
 +              SUB_UseTargets(self.owner, self, NULL);
  
                self.owner.team = t;
  
@@@ -670,7 -676,10 +670,7 @@@ void ons_ControlPoint_Icon_BuildThink(
                onslaught_updatelinks();
  
                // Use targets now (somebody make sure this is in the right place..)
 -              setself(self.owner);
 -              activator = self;
 -              SUB_UseTargets ();
 -              setself(this);
 +              SUB_UseTargets(self.owner, self, NULL);
  
                self.SendFlags |= CPSF_SETUP;
        }
@@@ -840,13 -849,14 +840,13 @@@ void ons_ControlPoint_Reset(entity this
  
        onslaught_updatelinks();
  
 -      activator = this;
 -      SUB_UseTargets(); // to reset the structures, playerspawns etc.
 +      SUB_UseTargets(this, this, NULL); // to reset the structures, playerspawns etc.
  
        CSQCMODEL_AUTOUPDATE(this);
  }
  
- void ons_DelayedControlPoint_Setup()
- {SELFPARAM();
+ void ons_DelayedControlPoint_Setup(entity this)
+ {
        onslaught_updatelinks();
  
        // captureshield setup
@@@ -1071,8 -1081,8 +1071,8 @@@ void ons_GeneratorReset(entity this
        onslaught_updatelinks();
  }
  
- void ons_DelayedGeneratorSetup()
- {SELFPARAM();
+ void ons_DelayedGeneratorSetup(entity this)
+ {
        // bot waypoints
        waypoint_spawnforitem_force(self, self.origin);
        self.nearestwaypointtimeout = 0; // activate waypointing again
@@@ -1941,24 -1951,25 +1941,24 @@@ MUTATOR_HOOKFUNCTION(ons, MonsterMove
        return false;
  }
  
- void ons_MonsterSpawn_Delayed()
- {SELFPARAM();
-       entity own = this.owner;
+ void ons_MonsterSpawn_Delayed(entity this)
+ {
 -      entity e, own = self.owner;
++      entity own = self.owner;
  
 -      if(!own) { remove(self); return; }
 +      if(!own) { remove(this); return; }
  
        if(own.targetname)
        {
 -              e = find(world, target, own.targetname);
 +              entity e = find(world, target, own.targetname);
                if(e != world)
                {
                        own.team = e.team;
  
 -                      activator = e;
 -                      own.use();
 +                      own.use1(own, e, NULL);
                }
        }
  
 -      remove(self);
 +      remove(this);
  }
  
  MUTATOR_HOOKFUNCTION(ons, MonsterSpawn)
        return false;
  }
  
- void ons_TurretSpawn_Delayed()
- {SELFPARAM();
+ void ons_TurretSpawn_Delayed(entity this)
+ {
 -      entity e, own = self.owner;
 +      entity own = self.owner;
  
        if(!own) { remove(self); return; }
  
        if(own.targetname)
        {
 -              e = find(world, target, own.targetname);
 +              entity e = find(world, target, own.targetname);
                if(e != world)
                {
                        own.team = e.team;
                        own.active = ACTIVE_NOT;
  
 -                      activator = e;
 -                      own.use();
 +                      own.use1(own, e, NULL);
                }
        }
  
@@@ -2241,7 -2253,7 +2241,7 @@@ void ons_ScoreRules(
        ScoreRules_basics_end();
  }
  
- void ons_DelayedInit() // Do this check with a delay so we can wait for teams to be set up
+ void ons_DelayedInit(entity this) // Do this check with a delay so we can wait for teams to be set up
  {
        ons_ScoreRules();
  
diff --combined qcsrc/common/t_items.qc
index 8467576275a0e33ce0837c00e97bd16b4c1c9f60,87623da3630d62f7a98e1e20bea14cbf960accf6..2c1b2a8ddae23bca2b08d410db17196863afe040
@@@ -863,8 -863,8 +863,8 @@@ void Item_Reset(entity this
  }
  void Item_Reset_self() { SELFPARAM(); Item_Reset(this); }
  
- void Item_FindTeam()
- {SELFPARAM();
+ void Item_FindTeam(entity this)
+ {
        entity e;
  
        if(self.effects & EF_NODRAW)
@@@ -1421,31 -1421,29 +1421,31 @@@ spawnfunc(item_invincible
  // compatibility:
  spawnfunc(item_quad) { this.classname = "item_strength";spawnfunc_item_strength(this);}
  
 -void target_items_use()
 -{SELFPARAM();
 -      if(activator.classname == "droppedweapon")
 +void target_items_use(entity this, entity actor, entity trigger)
 +{
 +      other = trigger; // TODO
 +
 +      if(actor.classname == "droppedweapon")
        {
                EXACTTRIGGER_TOUCH;
 -              remove(activator);
 +              remove(actor);
                return;
        }
  
 -      if (!IS_PLAYER(activator))
 +      if (!IS_PLAYER(actor))
                return;
 -      if(IS_DEAD(activator))
 +      if(IS_DEAD(actor))
                return;
        EXACTTRIGGER_TOUCH;
  
 -      FOREACH_ENTITY_ENT(enemy, activator,
 +      FOREACH_ENTITY_ENT(enemy, actor,
        {
                if(it.classname == "droppedweapon")
                        remove(it);
        });
  
 -      if(GiveItems(activator, 0, tokenize_console(self.netname)))
 -              centerprint(activator, self.message);
 +      if(GiveItems(actor, 0, tokenize_console(this.netname)))
 +              centerprint(actor, this.message);
  }
  
  spawnfunc(target_items)
        float n, i;
        string s;
  
 -      self.use = target_items_use;
 +      self.use1 = target_items_use;
        if(!self.strength_finished)
                self.strength_finished = autocvar_g_balance_powerup_strength_time;
        if(!self.invincible_finished)
diff --combined qcsrc/common/t_items.qh
index 2259ead630a663ac3d350a1b2a995baf2f5783b9,1eb4b182dee07359b7fd7d0baf8b2948c877071a..ce8307821ca11b0faea0811529e153eb2614661c
@@@ -92,7 -92,7 +92,7 @@@ void Item_Touch()
  
  void Item_Reset(entity this);
  
- void Item_FindTeam();
+ void Item_FindTeam(entity this);
  // Savage: used for item garbage-collection
  
  bool ItemSend(entity this, entity to, int sf);
@@@ -114,6 -114,8 +114,6 @@@ float commodity_pickupevalfunc(entity p
  void _StartItem(entity this, entity def, float defaultrespawntime, float defaultrespawntimejitter);
  
  
 -void target_items_use ();
 -
  float GiveWeapon(entity e, float wpn, float op, float val);
  
  float GiveBit(entity e, .float fld, float bit, float op, float val);
index af7cd8e268e4950e3a46a2bc58c3ce5e4b165b2e,1e19dfafc7205e3e74d9c1aad7daa23f34adf567..0546b2eae009f83316d4b83448dc8aa09bcad15e
@@@ -141,7 -141,7 +141,7 @@@ void door_go_up(
        string oldmessage;
        oldmessage = self.message;
        self.message = "";
 -      SUB_UseTargets();
 +      SUB_UseTargets(self, NULL, NULL);
        self.message = oldmessage;
  }
  
@@@ -206,15 -206,16 +206,15 @@@ bool door_check_keys(entity door, entit
        return false;
  }
  
 -void door_fire()
 -{SELFPARAM();
 -      entity  starte;
 -
 -      if (self.owner != self)
 -              objerror ("door_fire: self.owner != self");
 +void door_fire(entity this, entity actor, entity trigger)
 +{
 +      entity starte;
 +      if (this.owner != this)
 +              objerror ("door_fire: this.owner != this");
  
 -      if (self.spawnflags & DOOR_TOGGLE)
 +      if (this.spawnflags & DOOR_TOGGLE)
        {
 -              if (self.state == STATE_UP || self.state == STATE_TOP)
 +              if (this.state == STATE_UP || this.state == STATE_TOP)
                {
                        starte = self;
                        do
        setself(this);
  }
  
 -void door_use()
 -{SELFPARAM();
 +void door_use(entity this, entity actor, entity trigger)
 +{
        //dprint("door_use (model: ");dprint(self.model);dprint(")\n");
  
 -      if (self.owner)
 -      {
 -              WITHSELF(self.owner, door_fire());
 -      }
 +      if (this.owner)
 +              WITHSELF(this.owner, door_fire(this.owner, actor, trigger));
  }
  
  void door_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
        {
                this.owner.health = this.owner.max_health;
                this.owner.takedamage = DAMAGE_NO;      // wil be reset upon return
 -              WITHSELF(this.owner, door_use());
 +              door_use(this.owner, NULL, NULL);
        }
  }
  
@@@ -412,7 -415,7 +412,7 @@@ void door_rotating_go_up(
        string oldmessage;
        oldmessage = self.message;
        self.message = "";
 -      SUB_UseTargets();
 +      SUB_UseTargets(self, NULL, other); // TODO: is other needed here?
        self.message = oldmessage;
  }
  
@@@ -444,7 -447,10 +444,7 @@@ void door_trigger_touch(
  
        self.door_finished = time + 1;
  
 -      activator = other;
 -
 -      setself(self.owner);
 -      door_use ();
 +      door_use(this.owner, other, NULL);
  }
  
  void door_spawnfield(vector fmins, vector fmaxs)
@@@ -500,8 -506,8 +500,8 @@@ bool LinkDoors_isconnected(entity e1, e
  #ifdef SVQC
  void door_link();
  #endif
- void LinkDoors()
- {SELFPARAM();
+ void LinkDoors(entity this)
+ {
        entity  t;
        vector  cmins, cmaxs;
  
@@@ -687,8 -693,8 +687,8 @@@ void door_link(
  }
  #endif
  
- void door_init_startopen()
- {SELFPARAM();
+ void door_init_startopen(entity this)
+ {
        SUB_SETORIGIN(self, self.pos2);
        self.pos2 = self.pos1;
        self.pos1 = self.origin;
@@@ -738,7 -744,7 +738,7 @@@ spawnfunc(func_door
        precache_sound(self.noise3);
  
        self.blocked = door_blocked;
 -      self.use = door_use;
 +      self.use1 = door_use;
  
        if(self.dmg && (self.message == ""))
                self.message = "was squished";
@@@ -842,12 -848,12 +842,12 @@@ NET_HANDLE(ENT_CLIENT_DOOR, bool isnew
                this.trigger_touch = door_touch;
                this.draw = door_draw;
                this.drawmask = MASK_NORMAL;
 -              this.use = door_use;
 +              this.use1 = door_use;
  
-               LinkDoors();
+               LinkDoors(this);
  
                if(this.spawnflags & DOOR_START_OPEN)
-                       door_init_startopen();
+                       door_init_startopen(this);
  
                this.move_time = time;
                this.move_origin = this.origin;
index d729c9339a37b3904b9695fd2c2b81ae585ada54,4c97fe6a8aa7c1d7584c4fb63d7c024a247c968e..f552090e9a23116b7009def40029c0b61f960e57
@@@ -36,8 -36,8 +36,8 @@@ void door_rotating_reset(entity this
        this.nextthink = 0;
  }
  
- void door_rotating_init_startopen()
- {SELFPARAM();
+ void door_rotating_init_startopen(entity this)
+ {
        self.angles = self.movedir;
        self.pos2 = '0 0 0';
        self.pos1 = self.movedir;
@@@ -72,7 -72,7 +72,7 @@@ spawnfunc(func_door_rotating
        self.classname = "door_rotating";
  
        self.blocked = door_blocked;
 -      self.use = door_use;
 +      self.use1 = door_use;
  
      if(self.spawnflags & 8)
          self.dmg = 10000;
index fcdc6518b314e9ae8eacc96bf9ffb0a220b21987,14cfa564134b74e0c6633ac53d5862a05c4db6d7..badddf4cc626a75ee4c075fcfb29a4f0437367ab
@@@ -3,7 -3,7 +3,7 @@@ REGISTER_NET_LINKED(ENT_CLIENT_PLAT
  #ifdef SVQC
  void plat_link();
  
- void plat_delayedinit()
+ void plat_delayedinit(entity this)
  {
        plat_link();
        plat_spawn_inside_trigger(); // the "start moving" trigger
@@@ -171,7 -171,7 +171,7 @@@ NET_HANDLE(ENT_CLIENT_PLAT, bool isnew
                this.movetype = MOVETYPE_PUSH;
                this.drawmask = MASK_NORMAL;
                this.draw = plat_draw;
 -              this.use = plat_use;
 +              this.use1 = plat_use;
                this.entremove = trigger_remove_generic;
  
                plat_reset(this); // also called here
index 2a5a702117afc5be5d2abf9268416e46d7f3c87e,2b27c7355ce5b814bc1ceac5dff541aacee79a4e..0fa3ed60126fb8567a0d3853c7779848760453a5
@@@ -1,11 -1,11 +1,11 @@@
  .float train_wait_turning;
  void() train_next;
  #ifdef SVQC
 -void train_use();
 +void train_use(entity this, entity actor, entity trigger);
  #endif
  void train_wait()
  {SELFPARAM();
 -      WITHSELF(self.enemy, SUB_UseTargets());
 +      SUB_UseTargets(this.enemy, NULL, NULL);
        self.enemy = world;
  
        // if turning is enabled, the train will turn toward the next point while waiting
@@@ -43,7 -43,7 +43,7 @@@
        entity tg = find(world, targetname, self.target);
        if(tg.spawnflags & 4)
        {
 -              self.use = train_use;
 +              self.use1 = train_use;
                self.SUB_THINK = func_null;
                self.SUB_NEXTTHINK = 0;
        }
@@@ -176,15 -176,16 +176,15 @@@ void train_link(
        //Net_LinkEntity(self, 0, false, train_send);
  }
  
 -void train_use()
 +void train_use(entity this, entity actor, entity trigger)
  {
 -    SELFPARAM();
 -      self.SUB_NEXTTHINK = self.SUB_LTIME + 1;
 -      self.SUB_THINK = train_next;
 -      self.use = func_null; // not again
 +      this.SUB_NEXTTHINK = this.SUB_LTIME + 1;
 +      this.SUB_THINK = train_next;
 +      this.use1 = func_null; // not again
  }
  
- void func_train_find()
- {SELFPARAM();
+ void func_train_find(entity this)
+ {
        entity targ;
        targ = find(world, targetname, self.target);
        self.target = targ.target;
@@@ -224,7 -225,7 +224,7 @@@ spawnfunc(func_train
        self.effects |= EF_LOWPRECISION;
  
        if(self.spawnflags & 4)
 -              self.use = train_use;
 +              self.use1 = train_use;
  
        if (self.spawnflags & 2)
        {
index 6ef45922fb6b0a8f4a1cff97ec7629fd8bcec376,48e23a287d68de3c00eeeb1af9bf9a1531da0882..9c388f6fc5ecbea418557657e5820972381c16a8
@@@ -10,47 -10,47 +10,47 @@@ REGISTER_NET_LINKED(ENT_CLIENT_LASER
  
  #ifdef SVQC
  .float modelscale;
 -void misc_laser_aim()
 -{SELFPARAM();
 +void misc_laser_aim(entity this)
 +{
        vector a;
 -      if(self.enemy)
 +      if(this.enemy)
        {
 -              if(self.spawnflags & 2)
 +              if(this.spawnflags & 2)
                {
 -                      if(self.enemy.origin != self.mangle)
 +                      if(this.enemy.origin != this.mangle)
                        {
 -                              self.mangle = self.enemy.origin;
 -                              self.SendFlags |= 2;
 +                              this.mangle = this.enemy.origin;
 +                              this.SendFlags |= 2;
                        }
                }
                else
                {
 -                      a = vectoangles(self.enemy.origin - self.origin);
 +                      a = vectoangles(this.enemy.origin - this.origin);
                        a_x = -a_x;
 -                      if(a != self.mangle)
 +                      if(a != this.mangle)
                        {
 -                              self.mangle = a;
 -                              self.SendFlags |= 2;
 +                              this.mangle = a;
 +                              this.SendFlags |= 2;
                        }
                }
        }
        else
        {
 -              if(self.angles != self.mangle)
 +              if(this.angles != this.mangle)
                {
 -                      self.mangle = self.angles;
 -                      self.SendFlags |= 2;
 +                      this.mangle = this.angles;
 +                      this.SendFlags |= 2;
                }
        }
 -      if(self.origin != self.oldorigin)
 +      if(this.origin != this.oldorigin)
        {
 -              self.SendFlags |= 1;
 -              self.oldorigin = self.origin;
 +              this.SendFlags |= 1;
 +              this.oldorigin = this.origin;
        }
  }
  
- void misc_laser_init()
- {SELFPARAM();
+ void misc_laser_init(entity this)
+ {
        if(self.target != "")
                self.enemy = find(world, targetname, self.target);
  }
@@@ -67,7 -67,7 +67,7 @@@ void misc_laser_think(
        if(!self.state)
                return;
  
 -      misc_laser_aim();
 +      misc_laser_aim(this);
  
        if(self.enemy)
        {
@@@ -97,7 -97,8 +97,7 @@@
                        {
                                self.count = 1;
  
 -                              activator = self.enemy.pusher;
 -                              WITHSELF(self.enemy, SUB_UseTargets());
 +                              SUB_UseTargets(self.enemy, self.enemy.pusher, NULL);
                        }
                }
                else
                        {
                                self.count = 0;
  
 -                              activator = self.enemy.pusher;
 -                              WITHSELF(self.enemy, SUB_UseTargets());
 +                              SUB_UseTargets(self.enemy, self.enemy.pusher, NULL);
                        }
                }
        }
@@@ -186,11 -188,11 +186,11 @@@ Keys
  "dmg"
   damage per second (-1 for a laser that kills immediately)
  */
 -void laser_use()
 -{SELFPARAM();
 -      self.state = !self.state;
 -      self.SendFlags |= 4;
 -      misc_laser_aim();
 +void laser_use(entity this, entity actor, entity trigger)
 +{
 +      this.state = !this.state;
 +      this.SendFlags |= 4;
 +      misc_laser_aim(this);
  }
  
  void laser_reset(entity this)
@@@ -244,7 -246,7 +244,7 @@@ spawnfunc(misc_laser
        {
                this.reset = laser_reset;
                this.reset(this);
 -              this.use = laser_use;
 +              this.use1 = laser_use;
        }
        else
                this.state = 1;
index f02b2962573700803eab808837a1661aa51f8fdd,82793c9367f969c04b4ecc6a7361e84cc89d9923..e6114a520a97bad61dd1564227bf2fd95595ad36
@@@ -31,12 -31,13 +31,12 @@@ void target_spawn_helper_setsize(
        setsize(self, self.mins, self.maxs);
  }
  
 -void target_spawn_edit_entity(entity e, string msg, entity kt, entity t2, entity t3, entity t4, entity act)
 -{SELFPARAM();
 +void target_spawn_edit_entity(entity this, entity e, string msg, entity kt, entity t2, entity t3, entity t4, entity act, entity trigger)
 +{
        float i, n, valuefieldpos;
        string key, value, valuefield, valueoffset, valueoffsetrandom;
        entity valueent;
        vector data, data2;
 -      entity oldactivator;
  
        n = tokenize_console(msg);
  
@@@ -96,7 -97,7 +96,7 @@@
  
                                if(value == "self")
                                {
 -                                      valueent = self;
 +                                      valueent = this;
                                        value = "";
                                }
                                else if(value == "activator")
                                }
                                else if(value == "other")
                                {
 -                                      valueent = other;
 +                                      valueent = trigger;
                                        value = "";
                                }
                                else if(value == "pusher")
                                value = strcat("target_spawn_helper", value);
                        putentityfieldstring(target_spawn_spawnfunc_field, e, value);
  
 -                      oldactivator = activator;
 -
 -                      activator = act;
                        WITHSELF(e, e.target_spawn_spawnfunc(e));
 -                      activator = oldactivator;
  
                        // We called an external function, so we have to re-tokenize msg.
                        n = tokenize_console(msg);
        }
  }
  
 -void target_spawn_useon(entity e)
 -{SELFPARAM();
 -      self.target_spawn_activator = activator;
 +void target_spawn_useon(entity e, entity this, entity actor, entity trigger)
 +{
 +      this.target_spawn_activator = actor;
        target_spawn_edit_entity(
 +              this,
                e,
 -              self.message,
 -              find(world, targetname, self.killtarget),
 -              find(world, targetname, self.target2),
 -              find(world, targetname, self.target3),
 -              find(world, targetname, self.target4),
 -              activator
 +              this.message,
 +              find(world, targetname, this.killtarget),
 +              find(world, targetname, this.target2),
 +              find(world, targetname, this.target3),
 +              find(world, targetname, this.target4),
 +              actor,
 +              trigger
        );
  }
  
 -float target_spawn_cancreate()
 -{SELFPARAM();
 +bool target_spawn_cancreate(entity this)
 +{
        float c;
        entity e;
  
 -      c = self.count;
 +      c = this.count;
        if(c == 0) // no limit?
 -              return 1;
 +              return true;
  
        ++c; // increase count to not include MYSELF
 -      for(e = world; (e = findfloat(e, target_spawn_id, self.target_spawn_id)); --c)
 +      for(e = world; (e = findfloat(e, target_spawn_id, this.target_spawn_id)); --c)
                ;
  
        // if c now is 0, we have AT LEAST the given count (maybe more), so don't spawn any more
        if(c == 0)
 -              return 0;
 -      return 1;
 +              return false;
 +      return true;
  }
  
 -void target_spawn_use()
 -{SELFPARAM();
 -      entity e;
 -
 -      if(self.target == "")
 +void target_spawn_use(entity this, entity actor, entity trigger)
 +{
 +      if(this.target == "")
        {
                // spawn new entity
 -              if(!target_spawn_cancreate())
 +              if(!target_spawn_cancreate(this))
                        return;
 -              e = spawn();
 +              entity e = spawn();
                e.spawnfunc_checked = true;
 -              target_spawn_useon(e);
 -              e.target_spawn_id = self.target_spawn_id;
 +              target_spawn_useon(e, this, actor, trigger);
 +              e.target_spawn_id = this.target_spawn_id;
        }
 -      else if(self.target == "*activator")
 +      else if(this.target == "*activator")
        {
                // edit entity
 -              if(activator)
 -                      target_spawn_useon(activator);
 +              if(actor)
 +                      target_spawn_useon(actor, this, actor, trigger);
        }
        else
        {
                // edit entity
 -              for(e = world; (e = find(e, targetname, self.target)); )
 -                      target_spawn_useon(e);
 +              for(entity e = world; (e = find(e, targetname, this.target)); )
 +                      target_spawn_useon(e, this, actor, trigger);
        }
  }
  
- void target_spawn_spawnfirst()
- {SELFPARAM();
-       entity act = self.target_spawn_activator;
-       if(self.spawnflags & 2)
+ void target_spawn_spawnfirst(entity this)
+ {
 -      activator = self.target_spawn_activator;
 -      if(self.spawnflags & 2)
 -              target_spawn_use();
++      entity act = this.target_spawn_activator;
++      if(this.spawnflags & 2)
 +              target_spawn_use(this, act, NULL);
  }
  
  void initialize_field_db()
  spawnfunc(target_spawn)
  {
        initialize_field_db();
 -      self.use = target_spawn_use;
 +      self.use1 = target_spawn_use;
        self.message = strzone(strreplace("'", "\"", self.message));
        self.target_spawn_id = ++target_spawn_count;
        InitializeEntity(self, target_spawn_spawnfirst, INITPRIO_LAST);
index 6f2fa28a4a1e2338efddadac175c674a86cd352c,b0571dc310b4e2c333d8dab4142b62bf0a425f15..9366678b15c50dd79db5f194dcc3aadfec7d6a57
@@@ -19,7 -19,7 +19,7 @@@ entity Simple_TeleportPlayer(entity tel
  
  void Teleport_Touch ();
  
- void teleport_findtarget();
+ void teleport_findtarget(entity this);
  
  entity Teleport_Find(vector mi, vector ma);
  
@@@ -30,7 -30,7 +30,7 @@@ entity teleport_first
  
  #ifdef SVQC
  
 -void trigger_teleport_use();
 +void trigger_teleport_use(entity this, entity actor, entity trigger);
  
  #define TDEATHLOOP(o) \
        entity head; \
index e90f0bfc30bcb07a54c69a6ae61ef69be83f4329,556fe66358ed00fae0eda7d5bd4786824b43f8d1..db3905b64206af487a0b469051d3d7b1ee264512
@@@ -3,12 -3,12 +3,12 @@@
  #include "jumppads.qh"
  #include <common/physics/movetypes/movetypes.qh>
  
 -void trigger_push_use()
 -{SELFPARAM();
 +void trigger_push_use(entity this, entity actor, entity trigger)
 +{
        if(teamplay)
        {
 -              self.team = activator.team;
 -              self.SendFlags |= 2;
 +              this.team = actor.team;
 +              this.SendFlags |= 2;
        }
  }
  #endif
@@@ -235,7 -235,10 +235,7 @@@ void trigger_push_touch(
        }
  
        if(this.enemy.target)
 -      {
 -              activator = other;
 -              WITHSELF(this.enemy, SUB_UseTargets());
 -      }
 +              SUB_UseTargets(this.enemy, other, other); // TODO: do we need other as trigger too?
  
        if (other.flags & FL_PROJECTILE)
        {
  
  #ifdef SVQC
  void trigger_push_link();
- void trigger_push_updatelink();
+ void trigger_push_updatelink(entity this);
  #endif
- void trigger_push_findtarget()
- {SELFPARAM();
+ void trigger_push_findtarget(entity this)
+ {
        entity t;
        vector org;
  
@@@ -351,8 -354,8 +351,8 @@@ float trigger_push_send(entity this, en
        return true;
  }
  
- void trigger_push_updatelink()
- {SELFPARAM();
+ void trigger_push_updatelink(entity this)
+ {
        this.SendFlags |= 1;
  }
  
@@@ -381,7 -384,7 +381,7 @@@ spawnfunc(trigger_push
        trigger_init(this);
  
        this.active = ACTIVE_ACTIVE;
 -      this.use = trigger_push_use;
 +      this.use1 = trigger_push_use;
        this.touch = trigger_push_touch;
  
        // normal push setup
index 5744c66d43e3a0623d3bd78c9d315303f3db3032,07973614b88a23ae9a24ed8a6a70030706ede592..6fd61dc9da7561fb0bd684d30e50f95113267917
@@@ -15,8 -15,8 +15,8 @@@ const int NUM_JUMPPADSUSED = 3
  float trigger_push_calculatevelocity_flighttime;
  
  #ifdef SVQC
 -void() SUB_UseTargets;
 -void trigger_push_use();
 +void SUB_UseTargets(entity this, entity actor, entity trigger);
 +void trigger_push_use(entity this, entity actor, entity trigger);
  #endif
  
  /*
@@@ -38,7 -38,7 +38,7 @@@ vector trigger_push_calculatevelocity(v
  void trigger_push_touch();
  
  .vector dest;
- void trigger_push_findtarget();
+ void trigger_push_findtarget(entity this);
  
  /*
   * ENTITY PARAMETERS:
index fb6d496bfe6bd3968fdb10884da6237f8dbb5ef4,918ce4ca3a1bbc91c1c14de41af6595399379855..d99479cb180a7efcfb8419e73f7c6fd80bb2c35c
@@@ -73,8 -73,8 +73,8 @@@ float walker_firecheck(
      return turret_firecheck();
  }
  
- void walker_melee_do_dmg()
- {SELFPARAM();
+ void walker_melee_do_dmg(entity this)
+ {
      vector where;
      entity e;
  
@@@ -92,8 -92,8 +92,8 @@@
      }
  }
  
- void walker_setnoanim()
- {SELFPARAM();
+ void walker_setnoanim(entity this)
+ {
      turrets_setframe(ANIM_NO, false);
      self.animflag = self.frame;
  }
@@@ -109,7 -109,7 +109,7 @@@ void walker_rocket_damage(entity this, 
      this.velocity = this.velocity + vforce;
  
      if (this.health <= 0)
 -        WITHSELF(this, W_PrepareExplosionByDamage(this.owner, walker_rocket_explode));
 +        W_PrepareExplosionByDamage(this, this.owner, walker_rocket_explode);
  }
  
  #define WALKER_ROCKET_MOVE movelib_move_simple(self, newdir, (autocvar_g_turrets_unit_walker_rocket_speed), (autocvar_g_turrets_unit_walker_rocket_turnrate)); UpdateCSQCProjectile(self)
@@@ -312,8 -312,8 +312,8 @@@ void walker_move_path(
  
              if (self.pathgoal)
              {
 -                if (self.pathgoal.use)
 -                    self.pathgoal.use();
 +                if (self.pathgoal.use1)
 +                    self.pathgoal.use1(self, NULL, NULL);
  
                  if (self.pathgoal.enemy)
                  {
diff --combined qcsrc/lib/self.qh
index 5d53694c72294ed2c5b077f586ad1ee0e0ad422e,31d7d07c80db730f1db4f376a71c3f6f6dae1de9..092a8945b7a25faf0286cef3a7234c315b837772
  #endif
  
  // Step 6: Remove SELFPARAM in favor of a parameter
 -.void(entity this) selfuse;
 -void use_self() { SELFPARAM(); this.selfuse(this); }
 -#define setuse(e, f) (e.use = use_self, e.selfuse = f)
+ .void(entity this) selftouch;
+ void touch_self() { SELFPARAM(); this.selftouch(this); }
+ #define settouch(e, f) (e.touch = touch_self, e.selftouch = f)
++//.void(entity this) selfuse;
++//void use_self() { SELFPARAM(); this.selfuse(this); }
++//#define setuse(e, f) (e.use = use_self, e.selfuse = f)
+ .void(entity this) selfthink;
+ void think_self() { SELFPARAM(); this.selfthink(this); }
+ #define setthink(e, f) (e.think = think_self, e.selfthink = f)
diff --combined qcsrc/server/cheats.qc
index 362f7aa8ef6073c92b41ae05224c02355f911dee,e13678dce5995e6381c3dd248cdb275aecc174a8..add6d535564b5e9bd4a855cfede7582678436c24
@@@ -104,8 -104,8 +104,8 @@@ float CheatsAllowed(float i, float argc
                break
  
  float num_autoscreenshot;
- void info_autoscreenshot_findtarget()
- {SELFPARAM();
+ void info_autoscreenshot_findtarget(entity this)
+ {
        entity e;
        e = find(world, targetname, self.target);
        if(!e)
@@@ -675,7 -675,8 +675,7 @@@ float CheatCommand(float argc
                        IS_CHEAT(0, argc, 0);
                        setself(spawn());
                        self.target = argv(1);
 -                      activator = this;
 -                      SUB_UseTargets();
 +                      SUB_UseTargets(self, this, NULL);
                        remove(self);
                        setself(this);
                        DID_CHEAT();
                        IS_CHEAT(0, argc, 0);
                        setself(spawn());
                        self.killtarget = argv(1);
 -                      activator = this;
 -                      SUB_UseTargets();
 +                      SUB_UseTargets(self, this, NULL);
                        remove(self);
                        setself(this);
                        DID_CHEAT();
                        setself(new(cheattriggerteleport));
                        setorigin(self, self.origin);
                        self.target = argv(1);
-                       teleport_findtarget();
+                       teleport_findtarget(self);
                        if(!wasfreed(self))
                        {
                                Simple_TeleportPlayer(self, this);
diff --combined qcsrc/server/g_lights.qc
index 68be5df137b16186b0227fc31e40e6fbedb60723,5e9273f7cd43702f62592c461ea8ecabefe9ab66..218f219645d8faa43a5e49746f74c7345b2bdce9
@@@ -42,9 -42,8 +42,8 @@@ void dynlight_think(
  
        self.nextthink = time + 0.1;
  }
- void dynlight_find_aiment()
+ void dynlight_find_aiment(entity this)
  {
-     SELFPARAM();
        entity targ;
        if (!self.target)
                objerror ("dynlight: no target to follow");
@@@ -59,9 -58,8 +58,8 @@@
        self.think = dynlight_think;
        self.nextthink = time + 0.1;
  }
- void dynlight_find_path()
+ void dynlight_find_path(entity this)
  {
-     SELFPARAM();
        entity targ;
        if (!self.target)
                objerror ("dynlight: no target to follow");
@@@ -72,9 -70,8 +70,8 @@@
        self.think = train_next;
        self.nextthink = time + 0.1;
  }
- void dynlight_find_target()
+ void dynlight_find_target(entity this)
  {
-     SELFPARAM();
        entity targ;
        if (!self.target)
                objerror ("dynlight: no target to follow");
        self.think = dynlight_think;
        self.nextthink = time + 0.1;
  }
 -void dynlight_use()
 +void dynlight_use(entity this, entity actor, entity trigger)
  {
 -    SELFPARAM();
 -      if (self.light_lev == 0)
 -              self.light_lev = self.lefty;
 +      if (this.light_lev == 0)
 +              this.light_lev = this.lefty;
        else
 -              self.light_lev = 0;
 +              this.light_lev = 0;
  }
  spawnfunc(dynlight)
  {
@@@ -99,7 -97,7 +96,7 @@@
        if (!self.color)
                self.color = '1 1 1';
        self.lefty = self.light_lev;
 -      self.use = dynlight_use;
 +      self.use1 = dynlight_use;
        setsize (self, '0 0 0', '0 0 0');
        setorigin (self, self.origin);
        //self.pflags = PFLAGS_FULLDYNAMIC;
diff --combined qcsrc/server/g_models.qc
index 4f75e7beb87093ac7374cfc09c38016be05226d8,baca561786a00bcf9da35e7883100fd622242951..003b2efa97bede28379f45d50f84c7eaa163ded1
@@@ -16,43 -16,43 +16,43 @@@ class(BGMScript) .float bgmscriptreleas
  
  .float modelscale;
  
 -void g_model_setcolormaptoactivator ()
 -{SELFPARAM();
 +void g_model_setcolormaptoactivator(entity this, entity actor, entity trigger)
 +{
        if(teamplay)
        {
 -              if(activator.team)
 -                      self.colormap = (activator.team - 1) * 0x11;
 +              if(actor.team)
 +                      this.colormap = (actor.team - 1) * 0x11;
                else
 -                      self.colormap = 0x00;
 +                      this.colormap = 0x00;
        }
        else
 -              self.colormap = floor(random() * 256);
 -      self.colormap |= BIT(10); // RENDER_COLORMAPPED
 +              this.colormap = floor(random() * 256);
 +      this.colormap |= BIT(10); // RENDER_COLORMAPPED
  }
  
 -void g_clientmodel_setcolormaptoactivator ()
 -{SELFPARAM();
 -      g_model_setcolormaptoactivator();
 -      self.SendFlags |= (BIT(3) | BIT(0));
 +void g_clientmodel_setcolormaptoactivator(entity this, entity actor, entity trigger)
 +{
 +      g_model_setcolormaptoactivator(this, actor, trigger);
 +      this.SendFlags |= (BIT(3) | BIT(0));
  }
  
 -void g_clientmodel_use()
 -{SELFPARAM();
 -      if (self.antiwall_flag == 1)
 +void g_clientmodel_use(entity this, entity actor, entity trigger)
 +{
 +      if (this.antiwall_flag == 1)
        {
 -              self.inactive = 1;
 -              self.solid = SOLID_NOT;
 +              this.inactive = 1;
 +              this.solid = SOLID_NOT;
        }
 -      else if (self.antiwall_flag == 2)
 +      else if (this.antiwall_flag == 2)
        {
 -              self.inactive = 0;
 -              self.solid = self.default_solid;
 +              this.inactive = 0;
 +              this.solid = this.default_solid;
        }
 -      g_clientmodel_setcolormaptoactivator();
 +      g_clientmodel_setcolormaptoactivator(this, actor, trigger);
  }
  
- void g_model_dropbyspawnflags()
- {SELFPARAM();
+ void g_model_dropbyspawnflags(entity this)
+ {
        if((self.spawnflags & 3) == 1) // ALIGN_ORIGIN
        {
                traceline(self.origin, self.origin - '0 0 4096', MOVE_NOMONSTERS, self);
        }
  }
  
- void g_clientmodel_dropbyspawnflags()
- {SELFPARAM();
+ void g_clientmodel_dropbyspawnflags(entity this)
+ {
        vector o0;
        o0 = self.origin;
-       g_model_dropbyspawnflags();
+       g_model_dropbyspawnflags(self);
        if(self.origin != o0)
                self.SendFlags |= 2;
  }
@@@ -168,7 -168,7 +168,7 @@@ bool g_clientmodel_genericsendentity(en
        if(self.geomtype) if(autocvar_physics_ode && checkextension("DP_PHYSICS_ODE")) self.movetype = MOVETYPE_PHYSICS; \
        if(!self.scale) self.scale = self.modelscale; \
        SetBrushEntityModel(); \
 -      self.use = g_model_setcolormaptoactivator; \
 +      self.use1 = g_model_setcolormaptoactivator; \
        InitializeEntity(self, g_model_dropbyspawnflags, INITPRIO_DROPTOFLOOR); \
        if(!self.solid) self.solid = (sol); else if(self.solid < 0) self.solid = SOLID_NOT;
  
        if(self.geomtype) if(autocvar_physics_ode && checkextension("DP_PHYSICS_ODE")) self.movetype = MOVETYPE_PHYSICS; \
        if(!self.scale) self.scale = self.modelscale; \
        SetBrushEntityModel(); \
 -      self.use = g_clientmodel_use; \
 +      self.use1 = g_clientmodel_use; \
        InitializeEntity(self, g_clientmodel_dropbyspawnflags, INITPRIO_DROPTOFLOOR); \
        if(!self.solid) self.solid = (sol); else if(self.solid < 0) self.solid = SOLID_NOT; \
        if(!self.bgmscriptsustain) self.bgmscriptsustain = 1; else if(self.bgmscriptsustain < 0) self.bgmscriptsustain = 0; \
diff --combined qcsrc/server/g_subs.qh
index fe32e09e84d85fd50bb93b975f1268796a2eabf4,49bcd8904f86e7bf07a9e791d9835a4ef145aa4f..dc8ffe8c0dc875a4004cd99b7a568f2334fdf437
@@@ -4,6 -4,7 +4,6 @@@ void SUB_NullThink()
  
  void()  SUB_CalcMoveDone;
  void() SUB_CalcAngleMoveDone;
 -//void() SUB_UseTargets;
  
  spawnfunc(info_null);
  
@@@ -142,7 -143,7 +142,7 @@@ float LOD_customize()
  
  void LOD_uncustomize();
  
- void LODmodel_attach();
+ void LODmodel_attach(entity this);
  
  void ApplyMinMaxScaleAngles(entity e);
  
index 09837f20de5e6cc0816957de68a7713a20583647,72747037dee0c8739223fe5f2ca1744351138841..ab3c204a3676222efb07416e274f85bcc13e5038
@@@ -851,7 -851,7 +851,7 @@@ void remove_safely(entity e
      builtin_remove(e);
  }
  
- void InitializeEntity(entity e, void() func, float order)
+ void InitializeEntity(entity e, void(entity this) func, float order)
  {
      entity prev, cur;
  
      }
  }
  void InitializeEntitiesRun()
- {SELFPARAM();
+ {
      entity startoflist = initialize_entity_first;
      initialize_entity_first = NULL;
      remove = remove_except_protected;
          e.initialize_entity_order = 0;
        entity next = e.initialize_entity_next;
          e.initialize_entity_next = NULL;
-         var void() func = e.initialize_entity;
+         var void(entity this) func = e.initialize_entity;
          e.initialize_entity = func_null;
          if (e.classname == "initialize_entity")
          {
          //dprint("Delayed initialization: ", e.classname, "\n");
          if (func)
          {
-               WITHSELF(e, func());
+               WITHSELF(e, func(e));
          }
          else
          {
@@@ -969,20 -969,26 +969,20 @@@ void adaptor_think2touch(
  
  void adaptor_think2use()
  {SELFPARAM();
 -    entity o, a;
 -    o = other;
 -    a = activator;
 -    activator = world;
 -    other = world;
 -    self.use();
 -    other = o;
 -    activator = a;
 +      if(this.use1)
 +      this.use1(this, NULL, NULL);
  }
  
  void adaptor_think2use_hittype_splash() // for timed projectile detonation
  {SELFPARAM();
 -      if(!(IS_ONGROUND(self))) // if onground, we ARE touching something, but HITTYPE_SPLASH is to be networked if the damage causing projectile is not touching ANYTHING
 -              self.projectiledeathtype |= HITTYPE_SPLASH;
 -      adaptor_think2use();
 +      if(!(IS_ONGROUND(this))) // if onground, we ARE touching something, but HITTYPE_SPLASH is to be networked if the damage causing projectile is not touching ANYTHING
 +              this.projectiledeathtype |= HITTYPE_SPLASH;
 +      WITHSELF(this, adaptor_think2use());
  }
  
  // deferred dropping
- void DropToFloor_Handler()
- {SELFPARAM();
+ void DropToFloor_Handler(entity this)
+ {
      builtin_droptofloor();
      self.dropped_origin = self.origin;
  }
index c2d5ed3b905771ec30d5d98e141e9c9a59acdf9e,34c19d425178a0d9c02e3f844d1aa6edb6730034..e358f8fba71629318d2ca471542851221da4f716
@@@ -62,27 -62,29 +62,27 @@@ const float ST_ASSAULT_OBJECTIVES = 1
  const float SP_ASSAULT_OBJECTIVES = 4;
  
  // predefined spawnfuncs
 -void target_objective_decrease_activate();
 +void target_objective_decrease_activate(entity this);
  #endif
  
  #ifdef IMPLEMENTATION
  .entity sprite;
  
  // random functions
 -void assault_objective_use()
 -{SELFPARAM();
 +void assault_objective_use(entity this, entity actor, entity trigger)
 +{
        // activate objective
 -      self.health = 100;
 -      //print("^2Activated objective ", self.targetname, "=", etos(self), "\n");
 -      //print("Activator is ", activator.classname, "\n");
 +      this.health = 100;
 +      //print("^2Activated objective ", this.targetname, "=", etos(this), "\n");
 +      //print("Activator is ", actor.classname, "\n");
  
        for (entity e = world; (e = find(e, target, this.targetname)); )
        {
                if (e.classname == "target_objective_decrease")
                {
 -                      WITHSELF(e, target_objective_decrease_activate());
 +                      target_objective_decrease_activate(e);
                }
        }
 -
 -      setself(this);
  }
  
  vector target_objective_spawn_evalfunc(entity player, entity spot, vector current)
@@@ -100,9 -102,9 +100,9 @@@ void assault_objective_reset(entity thi
  }
  
  // decrease the health of targeted objectives
 -void assault_objective_decrease_use()
 -{SELFPARAM();
 -      if(activator.team != assault_attacker_team)
 +void assault_objective_decrease_use(entity this, entity actor, entity trigger)
 +{
 +      if(actor.team != assault_attacker_team)
        {
                // wrong team triggered decrease
                return;
        {
                if(self.enemy.health - self.dmg > 0.5)
                {
 -                      PlayerTeamScore_Add(activator, SP_SCORE, ST_SCORE, self.dmg);
 +                      PlayerTeamScore_Add(actor, SP_SCORE, ST_SCORE, self.dmg);
                        self.enemy.health = self.enemy.health - self.dmg;
                }
                else
                {
 -                      PlayerTeamScore_Add(activator, SP_SCORE, ST_SCORE, self.enemy.health);
 -                      PlayerTeamScore_Add(activator, SP_ASSAULT_OBJECTIVES, ST_ASSAULT_OBJECTIVES, 1);
 +                      PlayerTeamScore_Add(actor, SP_SCORE, ST_SCORE, self.enemy.health);
 +                      PlayerTeamScore_Add(actor, SP_ASSAULT_OBJECTIVES, ST_ASSAULT_OBJECTIVES, 1);
                        self.enemy.health = -1;
  
 -                      entity oldactivator;
 +                      if(this.enemy.message)
 +                              FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(centerprint(it, this.enemy.message)));
  
 -                      setself(this.enemy);
 -                      if(self.message)
 -                              FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(centerprint(it, self.message)));
 -
 -                      oldactivator = activator;
 -                      activator = this;
 -                      SUB_UseTargets();
 -                      activator = oldactivator;
 -                      setself(this);
 +                      SUB_UseTargets(this.enemy, this, trigger);
                }
        }
  }
  
- void assault_setenemytoobjective()
- {SELFPARAM();
+ void assault_setenemytoobjective(entity this)
+ {
        entity objective;
        for(objective = world; (objective = find(objective, targetname, self.target)); )
        {
@@@ -169,11 -178,11 +169,11 @@@ float assault_decreaser_sprite_visible(
        return true;
  }
  
 -void target_objective_decrease_activate()
 -{SELFPARAM();
 +void target_objective_decrease_activate(entity this)
 +{
        entity ent, spr;
 -      self.owner = world;
 -      for(ent = world; (ent = find(ent, target, self.targetname)); )
 +      this.owner = world;
 +      for(ent = world; (ent = find(ent, target, this.targetname)); )
        {
                if(ent.assault_sprite != world)
                {
                }
  
                spr = WaypointSprite_SpawnFixed(WP_Assault, 0.5 * (ent.absmin + ent.absmax), ent, assault_sprite, RADARICON_OBJECTIVE);
 -              spr.assault_decreaser = self;
 +              spr.assault_decreaser = this;
                spr.waypointsprite_visible_for_player = assault_decreaser_sprite_visible;
                spr.classname = "sprite_waypoint";
                WaypointSprite_UpdateRule(spr, assault_attacker_team, SPRITERULE_TEAMPLAY);
        }
  }
  
- void target_objective_decrease_findtarget()
+ void target_objective_decrease_findtarget(entity this)
  {
-       assault_setenemytoobjective();
+       assault_setenemytoobjective(this);
  }
  
  void target_assault_roundend_reset(entity this)
        this.winning = false; // up round
  }
  
 -void target_assault_roundend_use()
 -{SELFPARAM();
 -      self.winning = 1; // round has been won by attackers
 +void target_assault_roundend_use(entity this, entity actor, entity trigger)
 +{
 +      this.winning = 1; // round has been won by attackers
  }
  
 -void assault_roundstart_use(entity this)
 +void assault_roundstart_use(entity this, entity actor, entity trigger)
  {
 -      activator = self;
 -      SUB_UseTargets();
 +      SUB_UseTargets(this, this, trigger);
  
        //(Re)spawn all turrets
        FOREACH_ENTITY_CLASS("turret_main", true, LAMBDA(
                WITHSELF(it, turret_respawn());
        ));
  }
 -    assault_roundstart_use(this);
+ void assault_roundstart_use_self()
+ {
+     SELFPARAM();
++    assault_roundstart_use(this, NULL, NULL);
+ }
  
  void assault_wall_think()
  {SELFPARAM();
@@@ -352,7 -367,7 +357,7 @@@ spawnfunc(target_objective
        if (!g_assault) { remove(this); return; }
  
        this.classname = "target_objective";
 -      this.use = assault_objective_use;
 +      this.use1 = assault_objective_use;
        this.reset = assault_objective_reset;
        this.reset(this);
        this.spawn_evalfunc = target_objective_spawn_evalfunc;
@@@ -367,7 -382,7 +372,7 @@@ spawnfunc(target_objective_decrease
        if(!self.dmg)
                self.dmg = 101;
  
 -      self.use = assault_objective_decrease_use;
 +      self.use1 = assault_objective_decrease_use;
        self.health = ASSAULT_VALUE_INACTIVE;
        self.max_health = ASSAULT_VALUE_INACTIVE;
        self.enemy = world;
@@@ -411,7 -426,7 +416,7 @@@ spawnfunc(target_assault_roundend
  
        self.winning = 0; // round not yet won by attackers
        self.classname = "target_assault_roundend";
 -      self.use = target_assault_roundend_use;
 +      self.use1 = target_assault_roundend_use;
        self.cnt = 0; // first round
        self.reset = target_assault_roundend_reset;
  }
@@@ -422,9 -437,9 +427,9 @@@ spawnfunc(target_assault_roundstart
  
        assault_attacker_team = NUM_TEAM_1;
        self.classname = "target_assault_roundstart";
-       self.use1 = assault_roundstart_use;
-       self.reset2 = adaptor_think2use;
-       InitializeEntity(self, adaptor_think2use, INITPRIO_FINDTARGET);
 -      self.use = assault_roundstart_use_self;
++      self.use = assault_roundstart_use;
+       self.reset2 = assault_roundstart_use_self;
 -      InitializeEntity(self, assault_roundstart_use, INITPRIO_FINDTARGET);
++      InitializeEntity(self, assault_roundstart_use_self, INITPRIO_FINDTARGET);
  }
  
  // legacy bot code
index 4954be26a70bee292778263fd2a4fc728cd116ba,01f17ec9feee1d09cd86b2e02bf000eba020b89d..18ca2f9dc4dcdec7220c03728a0e378d0f2d99bd
@@@ -150,7 -150,8 +150,7 @@@ void dompoint_captured (
        old_team = self.team;
        self.team = real_team;
        self.delay = 0;
 -      activator = self;
 -      SUB_UseTargets ();
 +      SUB_UseTargets (self, self, NULL);
        self.delay = old_delay;
        self.team = old_team;
  
@@@ -680,7 -681,7 +680,7 @@@ void dom_spawnteams(int teams
        dom_spawnteam("", 0, "models/domination/dom_unclaimed.md3", 0, SND_Null, "", "");
  }
  
- void dom_DelayedInit() // Do this check with a delay so we can wait for teams to be set up.
+ void dom_DelayedInit(entity this) // Do this check with a delay so we can wait for teams to be set up.
  {
        // if no teams are found, spawn defaults
        if(find(world, classname, "dom_team") == world || autocvar_g_domination_teams_override >= 2)
diff --combined qcsrc/server/race.qc
index b32463c78c202a5d17797b5b2f42309697ed94bb,9fd6ca7b3f9d2f0db732ebcd6a673d7c9b0ea30a..5a023a1dcc8224cecfdc6a4368bbd27761779c70
@@@ -580,9 -580,10 +580,9 @@@ void checkpoint_passed(
         */
        if (!((self.spawnflags & 2) && (IS_PLAYER(other))))
        {
 -              activator = other;
                oldmsg = self.message;
                self.message = "";
 -              SUB_UseTargets();
 +              SUB_UseTargets(self, other, other); // TODO: should we be using other for the trigger here?
                self.message = oldmsg;
        }
  
                 */
                if(self.spawnflags & 2)
                {
 -                      activator = other;
                        oldmsg = self.message;
                        self.message = "";
 -                      SUB_UseTargets();
 +                      SUB_UseTargets(self, other, other); // TODO: should we be using other for the trigger here?
                        self.message = oldmsg;
                }
  
@@@ -705,12 -707,12 +705,12 @@@ void checkpoint_touch(
        checkpoint_passed();
  }
  
 -void checkpoint_use()
 +void checkpoint_use(entity this, entity actor, entity trigger)
  {
 -      if(other.classname == "info_player_deathmatch") // a spawn, a spawn
 +      if(trigger.classname == "info_player_deathmatch") // a spawn, a spawn
                return;
  
 -      other = activator;
 +      other = actor;
        checkpoint_passed();
  }
  
@@@ -724,67 -726,58 +724,58 @@@ float race_waypointsprite_visible_for_p
                return false;
  }
  
- float have_verified;
- void trigger_race_checkpoint_verify()
- {SELFPARAM();
-       entity cp;
-       float i, p;
-       float qual;
-       if(have_verified)
-               return;
-       have_verified = 1;
+ void trigger_race_checkpoint_verify(entity this)
+ {
+     static bool have_verified;
+       if (have_verified) return;
+       have_verified = true;
  
-       qual = g_race_qualifying;
+       bool qual = g_race_qualifying;
  
-       setself(spawn());
-       TRANSMUTE(Player, self);
+       int pl_race_checkpoint = 0;
+       int pl_race_place = 0;
  
-       if(g_race)
-       {
-               for(i = 0; i <= race_highest_checkpoint; ++i)
-               {
-                       self.race_checkpoint = race_NextCheckpoint(i);
+       if (g_race) {
+               for (int i = 0; i <= race_highest_checkpoint; ++i) {
+                       pl_race_checkpoint = race_NextCheckpoint(i);
  
                        // race only (middle of the race)
-                       g_race_qualifying = 0;
-                       self.race_place = 0;
-                       if(!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), 0, false))
-                               error(strcat("Checkpoint ", ftos(i), " misses a spawnpoint with race_place==", ftos(self.race_place), " (used for respawning in race) - bailing out"));
+                       g_race_qualifying = false;
+                       pl_race_place = 0;
+                       if (!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), 0, false)) {
+                               error(strcat("Checkpoint ", ftos(i), " misses a spawnpoint with race_place==", ftos(pl_race_place), " (used for respawning in race) - bailing out"));
+             }
  
-                       if(i == 0)
-                       {
+                       if (i == 0) {
                                // qualifying only
                                g_race_qualifying = 1;
-                               self.race_place = race_lowest_place_spawn;
-                               if(!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), 0, false))
-                                       error(strcat("Checkpoint ", ftos(i), " misses a spawnpoint with race_place==", ftos(self.race_place), " (used for qualifying) - bailing out"));
+                               pl_race_place = race_lowest_place_spawn;
+                               if (!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), 0, false)) {
+                                       error(strcat("Checkpoint ", ftos(i), " misses a spawnpoint with race_place==", ftos(pl_race_place), " (used for qualifying) - bailing out"));
+                 }
  
                                // race only (initial spawn)
                                g_race_qualifying = 0;
-                               for(p = 1; p <= race_highest_place_spawn; ++p)
-                               {
-                                       self.race_place = p;
-                                       if(!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), 0, false))
-                                               error(strcat("Checkpoint ", ftos(i), " misses a spawnpoint with race_place==", ftos(self.race_place), " (used for initially spawning in race) - bailing out"));
+                               for (int p = 1; p <= race_highest_place_spawn; ++p) {
+                                       pl_race_place = p;
+                                       if (!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), 0, false)) {
+                                               error(strcat("Checkpoint ", ftos(i), " misses a spawnpoint with race_place==", ftos(pl_race_place), " (used for initially spawning in race) - bailing out"));
+                     }
                                }
                        }
                }
-       }
-       else if(!defrag_ents)
-       {
+       } else if (!defrag_ents) {
                // qualifying only
-               self.race_checkpoint = race_NextCheckpoint(0);
+               pl_race_checkpoint = race_NextCheckpoint(0);
                g_race_qualifying = 1;
-               self.race_place = race_lowest_place_spawn;
-               if(!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), 0, false))
-                       error(strcat("Checkpoint 0 misses a spawnpoint with race_place==", ftos(self.race_place), " (used for qualifying) - bailing out"));
-       }
-       else
-       {
-               self.race_checkpoint = race_NextCheckpoint(0);
+               pl_race_place = race_lowest_place_spawn;
+               if (!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), 0, false)) {
+                       error(strcat("Checkpoint 0 misses a spawnpoint with race_place==", ftos(pl_race_place), " (used for qualifying) - bailing out"));
+         }
+       } else {
+               pl_race_checkpoint = race_NextCheckpoint(0);
                g_race_qualifying = 1;
-               self.race_place = 0; // there's only one spawn on defrag maps
+               pl_race_place = 0; // there's only one spawn on defrag maps
  
                // check if a defragcp file already exists, then read it and apply the checkpoint order
                float fh;
                string l;
  
                defragcpexists = fh = fopen(strcat("maps/", GetMapname(), ".defragcp"), FILE_READ);
-               if(fh >= 0)
-               {
-                       while((l = fgets(fh)))
-                       {
+               if (fh >= 0) {
+                       while ((l = fgets(fh))) {
                                len = tokenize_console(l);
-                               if(len != 2)
-                               {
+                               if (len != 2) {
                                        defragcpexists = -1; // something's wrong in the defrag cp file, set defragcpexists to -1 so that it will be rewritten when someone finishes
                                        continue;
                                }
-                               for(cp = world; (cp = find(cp, classname, "target_checkpoint"));)
-                                       if(argv(0) == cp.targetname)
+                               for (entity cp = world; (cp = find(cp, classname, "target_checkpoint"));) {
+                                       if (argv(0) == cp.targetname) {
                                                cp.race_checkpoint = stof(argv(1));
+                     }
+                 }
                        }
                        fclose(fh);
                }
  
        g_race_qualifying = qual;
  
-       if(race_timed_checkpoint)
-       {
-               if(defrag_ents)
-               {
-                       for(cp = world; (cp = find(cp, classname, "target_startTimer"));)
+       if (race_timed_checkpoint) {
+               if (defrag_ents) {
+                       for (entity cp = world; (cp = find(cp, classname, "target_startTimer"));) {
                                WaypointSprite_UpdateSprites(cp.sprite, WP_RaceStart, WP_Null, WP_Null);
-                       for(cp = world; (cp = find(cp, classname, "target_stopTimer"));)
+             }
+                       for (entity cp = world; (cp = find(cp, classname, "target_stopTimer"));) {
                                WaypointSprite_UpdateSprites(cp.sprite, WP_RaceFinish, WP_Null, WP_Null);
-                       for(cp = world; (cp = find(cp, classname, "target_checkpoint"));)
-                       {
-                               if(cp.race_checkpoint == -2) // something's wrong with the defrag cp file or it has not been written yet, set defragcpexists to -1 so that it will be rewritten when someone finishes
+             }
+                       for (entity cp = world; (cp = find(cp, classname, "target_checkpoint"));) {
+                               if (cp.race_checkpoint == -2) { // something's wrong with the defrag cp file or it has not been written yet, set defragcpexists to -1 so that it will be rewritten when someone finishes
                                        defragcpexists = -1;
+                 }
                        }
-                       if(defragcpexists != -1)
-                       {
+                       if (defragcpexists != -1) {
                                float largest_cp_id = 0;
-                               for(cp = world; (cp = find(cp, classname, "target_checkpoint"));)
-                                       if(cp.race_checkpoint > largest_cp_id)
+                               for (entity cp = world; (cp = find(cp, classname, "target_checkpoint"));) {
+                                       if (cp.race_checkpoint > largest_cp_id) {
                                                largest_cp_id = cp.race_checkpoint;
-                               for(cp = world; (cp = find(cp, classname, "target_stopTimer"));)
+                     }
+                 }
+                               for (entity cp = world; (cp = find(cp, classname, "target_stopTimer"));) {
                                        cp.race_checkpoint = largest_cp_id + 1; // finish line
+                 }
                                race_highest_checkpoint = largest_cp_id + 1;
                                race_timed_checkpoint = largest_cp_id + 1;
-                       }
-                       else
-                       {
-                               for(cp = world; (cp = find(cp, classname, "target_stopTimer"));)
+                       } else {
+                               for (entity cp = world; (cp = find(cp, classname, "target_stopTimer"));) {
                                        cp.race_checkpoint = 255; // finish line
+                 }
                                race_highest_checkpoint = 255;
                                race_timed_checkpoint = 255;
                        }
-               }
-               else
-               {
-                       for(cp = world; (cp = find(cp, classname, "trigger_race_checkpoint")); )
-                               if(cp.sprite)
-                               {
-                                       if(cp.race_checkpoint == 0)
+               } else {
+                       for (entity cp = world; (cp = find(cp, classname, "trigger_race_checkpoint")); ) {
+                               if (cp.sprite) {
+                                       if (cp.race_checkpoint == 0) {
                                                WaypointSprite_UpdateSprites(cp.sprite, WP_RaceStart, WP_Null, WP_Null);
-                                       else if(cp.race_checkpoint == race_timed_checkpoint)
+                     } else if (cp.race_checkpoint == race_timed_checkpoint) {
                                                WaypointSprite_UpdateSprites(cp.sprite, WP_RaceFinish, WP_Null, WP_Null);
+                     }
                                }
+             }
                }
        }
  
-       if(defrag_ents)
-       {
-               entity trigger, targ;
-               for(trigger = world; (trigger = find(trigger, classname, "trigger_multiple")); )
-                       for(targ = world; (targ = find(targ, targetname, trigger.target)); )
-                               if (targ.classname == "target_checkpoint" || targ.classname == "target_startTimer" || targ.classname == "target_stopTimer")
-                               {
+       if (defrag_ents) {
+               for (entity trigger = world; (trigger = find(trigger, classname, "trigger_multiple")); ) {
+                       for (entity targ = world; (targ = find(targ, targetname, trigger.target)); ) {
+                               if (targ.classname == "target_checkpoint" || targ.classname == "target_startTimer" || targ.classname == "target_stopTimer") {
                                        trigger.wait = 0;
                                        trigger.delay = 0;
                                        targ.wait = 0;
                                        //setorigin(targ, trigger.origin);
                                        //remove(trigger);
                                }
+             }
+         }
        }
-       remove(self);
-       setself(this);
  }
  
  vector trigger_race_checkpoint_spawn_evalfunc(entity player, entity spot, vector current)
@@@ -927,7 -914,7 +912,7 @@@ spawnfunc(trigger_race_checkpoint
  
        EXACTTRIGGER_INIT;
  
 -      self.use = checkpoint_use;
 +      self.use1 = checkpoint_use;
        if (!(self.spawnflags & 1))
                self.touch = checkpoint_touch;
  
@@@ -976,7 -963,7 +961,7 @@@ spawnfunc(target_checkpoint) // defrag 
  
        EXACTTRIGGER_INIT;
  
 -      self.use = checkpoint_use;
 +      self.use1 = checkpoint_use;
        if (!(self.spawnflags & 1))
                self.touch = checkpoint_touch;
  
@@@ -1120,9 -1107,9 +1105,9 @@@ void penalty_touch(
        }
  }
  
 -void penalty_use()
 -{SELFPARAM();
 -      race_ImposePenaltyTime(activator, self.race_penalty, self.race_penalty_reason);
 +void penalty_use(entity this, entity actor, entity trigger)
 +{
 +      race_ImposePenaltyTime(actor, this.race_penalty, this.race_penalty_reason);
  }
  
  spawnfunc(trigger_race_penalty)
  
        EXACTTRIGGER_INIT;
  
 -      self.use = penalty_use;
 +      self.use1 = penalty_use;
        if (!(self.spawnflags & 1))
                self.touch = penalty_touch;