]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/item_key.qc
Merge branch 'master' into terencehill/bot_ai
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / item_key.qc
index cf2b25acff05fb776137775c59ac07f67ce19d63..2bfdc49b767b626aa66e778174914c54ddda9565 100644 (file)
@@ -1,7 +1,8 @@
 #include "item_key.qh"
 
-#include "../common/triggers/subs.qh"
-#include "../common/monsters/all.qh"
+#include "../common/mapobjects/subs.qh"
+#include <common/mapobjects/triggers.qh>
+#include "../common/monsters/_mod.qh"
 #include "../common/notifications/all.qh"
 #include "../common/util.qh"
 #include "../lib/warpzone/util_server.qh"
@@ -17,10 +18,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
@@ -74,10 +75,10 @@ void item_key_touch(entity this, entity toucher)
                return;
 
        // player already picked up this key
-       if (toucher.itemkeys & this.itemkeys)
+       if (PS(toucher).itemkeys & this.itemkeys)
                return;
 
-       toucher.itemkeys |= this.itemkeys;
+       PS(toucher).itemkeys |= this.itemkeys;
        play2(toucher, this.noise);
 
        centerprint(toucher, this.message);
@@ -86,7 +87,7 @@ void item_key_touch(entity this, entity toucher)
        this.message = "";
        SUB_UseTargets(this, toucher, toucher); // TODO: should we be using toucher for the trigger here?
        this.message = oldmsg;
-};
+}
 
 /**
  * Spawn a key with given model, key code and color.
@@ -99,9 +100,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);
 
@@ -123,7 +124,7 @@ void spawn_item_key(entity this)
        }
 
        settouch(this, item_key_touch);
-};
+}
 
 
 /*QUAKED item_key (0 .5 .8) (-16 -16 -24) (16 16 32) FLOATING
@@ -160,7 +161,7 @@ spawnfunc(item_key)
        // reject this entity if more than one key was set!
        if (this.itemkeys>0 && (this.itemkeys & (this.itemkeys-1)) != 0) {
                objerror(this, "item_key.itemkeys must contain only 1 bit set specifying the key it represents!");
-               remove(this);
+               delete(this);
                return;
        }
 
@@ -202,7 +203,7 @@ spawnfunc(item_key)
 
                if (this.netname == "") {
                        objerror(this, "item_key doesn't have a default name for this key and a custom one was not specified!");
-                       remove(this);
+                       delete(this);
                        return;
                }
                break;
@@ -217,7 +218,7 @@ spawnfunc(item_key)
                _model = "models/keys/key.md3"; // FIXME: replace it by a keycard model!
        } else if (this.model == "") {
                objerror(this, "item_key doesn't have a default model for this key and a custom one was not specified!");
-               remove(this);
+               delete(this);
                return;
        }
 
@@ -264,7 +265,7 @@ spawnfunc(item_key1)
        this.classname = "item_key";
        this.itemkeys = ITEM_KEY_BIT(1);
        spawnfunc_item_key(this);
-};
+}
 
 /*QUAKED item_key2 (0 .5 .8) (-16 -16 -24) (16 16 32) FLOATING
 GOLD key.
@@ -283,4 +284,4 @@ spawnfunc(item_key2)
        this.classname = "item_key";
        this.itemkeys = ITEM_KEY_BIT(0);
        spawnfunc_item_key(this);
-};
+}