X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fitem_key.qc;h=0230a21cbb4cb6dcef915e62e2436bead1c9942f;hb=db2efd7cabe9d2eb3e09f330d9e5c8f951fbf194;hp=6a1527745e3f368eab3c35715790dffbf216bff7;hpb=a4594d94df1eb60aca616cccd45df07e561ffa01;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/item_key.qc b/qcsrc/server/item_key.qc index 6a1527745..0230a21cb 100644 --- a/qcsrc/server/item_key.qc +++ b/qcsrc/server/item_key.qc @@ -1,11 +1,10 @@ #include "item_key.qh" -#include "_all.qh" #include "../common/triggers/subs.qh" #include "../common/monsters/all.qh" -#include "../common/notifications.qh" +#include "../common/notifications/all.qh" #include "../common/util.qh" -#include "../warpzonelib/util_server.qh" +#include "../lib/warpzone/util_server.qh" /* TODO: @@ -40,7 +39,7 @@ string item_keys_keylist(float keylist) { return ""; // one key - if ((keylist & (keylist-1)) != 0) + if ((keylist & (keylist-1)) == 0) return strcat("the ", item_keys_names[lowestbit(keylist)]); string n = ""; @@ -82,6 +81,12 @@ void item_key_touch() play2(other, self.noise); centerprint(other, self.message); + + string oldmsg = self.message; + self.message = ""; + activator = other; + SUB_UseTargets(); + self.message = oldmsg; }; /** @@ -148,8 +153,8 @@ This is the only correct way to put keys on the map! itemkeys MUST always have exactly one bit set. */ -void spawnfunc_item_key() -{SELFPARAM(); +spawnfunc(item_key) +{ string _netname; vector _colormod; @@ -162,32 +167,32 @@ void spawnfunc_item_key() // find default netname and colormod switch(self.itemkeys) { - case 1: + case BIT(0): _netname = "GOLD key"; _colormod = '1 .9 0'; break; - case 2: + case BIT(1): _netname = "SILVER key"; _colormod = '.9 .9 .9'; break; - case 4: + case BIT(2): _netname = "BRONZE key"; _colormod = '.6 .25 0'; break; - case 8: + case BIT(3): _netname = "RED keycard"; _colormod = '.9 0 0'; break; - case 16: + case BIT(4): _netname = "BLUE keycard"; _colormod = '0 0 .9'; break; - case 32: + case BIT(5): _netname = "GREEN keycard"; _colormod = '0 .9 0'; break; @@ -234,7 +239,7 @@ void spawnfunc_item_key() self.message = strzone(strcat("You've picked up the ", self.netname, "!")); if (self.noise == "") - self.noise = "misc/itempickup.wav"; + self.noise = strzone(SND(ITEMPICKUP)); // save the name for later item_keys_names[lowestbit(self.itemkeys)] = self.netname; @@ -255,11 +260,11 @@ FLOATING: the item will float in air, instead of aligning to the floor by fallin ---------NOTES---------- Don't use this entity on new maps! Use item_key instead. */ -void spawnfunc_item_key1(void) -{SELFPARAM(); - self.classname = "item_key"; - self.itemkeys = ITEM_KEY_BIT(1); - spawnfunc_item_key(); +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 @@ -274,9 +279,9 @@ FLOATING: the item will float in air, instead of aligning to the floor by fallin ---------NOTES---------- Don't use this entity on new maps! Use item_key instead. */ -void spawnfunc_item_key2(void) -{SELFPARAM(); - self.classname = "item_key"; - self.itemkeys = ITEM_KEY_BIT(0); - spawnfunc_item_key(); +spawnfunc(item_key2) +{ + this.classname = "item_key"; + this.itemkeys = ITEM_KEY_BIT(0); + spawnfunc_item_key(this); };