]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/item_key.qc
Properly support team field on trigger_multiple
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / item_key.qc
index 656eede4c9a81d34a65304533ef19e35ae1308e6..c645c7facdce7515e3021c441bb586fdbfd1375a 100644 (file)
@@ -1,7 +1,7 @@
 #include "item_key.qh"
 
 #include "../common/triggers/subs.qh"
-#include "../common/monsters/all.qh"
+#include "../common/monsters/_mod.qh"
 #include "../common/notifications/all.qh"
 #include "../common/util.qh"
 #include "../lib/warpzone/util_server.qh"
@@ -17,10 +17,10 @@ TODO:
 
 bool item_keys_usekey(entity l, entity p)
 {
-       float valid = l.itemkeys & p.itemkeys;
+       int valid = l.itemkeys & PS(p).itemkeys;
 
        if (!valid) {
-               // other has none of the needed keys
+               // player has none of the needed keys
                return false;
        } else if (l.itemkeys == valid) {
                // ALL needed keys were given
@@ -68,23 +68,23 @@ item_key
 /**
  * Key touch handler.
  */
-void item_key_touch(entity this)
+void item_key_touch(entity this, entity toucher)
 {
-       if (!IS_PLAYER(other))
+       if (!IS_PLAYER(toucher))
                return;
 
        // player already picked up this key
-       if (other.itemkeys & this.itemkeys)
+       if (PS(toucher).itemkeys & this.itemkeys)
                return;
 
-       other.itemkeys |= this.itemkeys;
-       play2(other, this.noise);
+       PS(toucher).itemkeys |= this.itemkeys;
+       play2(toucher, this.noise);
 
-       centerprint(other, this.message);
+       centerprint(toucher, this.message);
 
        string oldmsg = this.message;
        this.message = "";
-       SUB_UseTargets(this, other, other); // TODO: should we be using other for the trigger here?
+       SUB_UseTargets(this, toucher, toucher); // TODO: should we be using toucher for the trigger here?
        this.message = oldmsg;
 };
 
@@ -99,9 +99,9 @@ void spawn_item_key(entity this)
                this.noalign = 1;
 
        if (this.noalign)
-               this.movetype = MOVETYPE_NONE;
+               set_movetype(this, MOVETYPE_NONE);
        else
-               this.movetype = MOVETYPE_TOSS;
+               set_movetype(this, MOVETYPE_TOSS);
 
        precache_sound(this.noise);
 
@@ -159,8 +159,8 @@ spawnfunc(item_key)
 
        // reject this entity if more than one key was set!
        if (this.itemkeys>0 && (this.itemkeys & (this.itemkeys-1)) != 0) {
-               objerror("item_key.itemkeys must contain only 1 bit set specifying the key it represents!");
-               remove(this);
+               objerror(this, "item_key.itemkeys must contain only 1 bit set specifying the key it represents!");
+               delete(this);
                return;
        }
 
@@ -201,8 +201,8 @@ spawnfunc(item_key)
                _colormod = '1 1 1';
 
                if (this.netname == "") {
-                       objerror("item_key doesn't have a default name for this key and a custom one was not specified!");
-                       remove(this);
+                       objerror(this, "item_key doesn't have a default name for this key and a custom one was not specified!");
+                       delete(this);
                        return;
                }
                break;
@@ -216,8 +216,8 @@ spawnfunc(item_key)
        } else if (this.itemkeys >= ITEM_KEY_BIT(3) && this.itemkeys <= ITEM_KEY_BIT(5)) {
                _model = "models/keys/key.md3"; // FIXME: replace it by a keycard model!
        } else if (this.model == "") {
-               objerror("item_key doesn't have a default model for this key and a custom one was not specified!");
-               remove(this);
+               objerror(this, "item_key doesn't have a default model for this key and a custom one was not specified!");
+               delete(this);
                return;
        }