X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fitem_key.qc;h=8c5a06b320725657b56f0f54d4d3801c43a68adf;hb=21307f327df5609b82d90496c1c6156d636d1c8d;hp=1518151f2c85b457fff515b37634030b68f838b0;hpb=1e85850478a0174700ab365d6a642a2a420d78f8;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/item_key.qc b/qcsrc/server/item_key.qc index 1518151f2..8c5a06b32 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/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 = ""; @@ -69,7 +68,8 @@ item_key /** * Key touch handler. */ -void item_key_touch(void) { +void item_key_touch() +{SELFPARAM(); if (!IS_PLAYER(other)) return; @@ -81,12 +81,19 @@ void item_key_touch(void) { play2(other, self.noise); centerprint(other, self.message); + + string oldmsg = self.message; + self.message = ""; + activator = other; + SUB_UseTargets(); + self.message = oldmsg; }; /** * Spawn a key with given model, key code and color. */ -void spawn_item_key() { +void spawn_item_key() +{SELFPARAM(); precache_model(self.model); if (self.spawnflags & 1) // FLOATING @@ -101,7 +108,7 @@ void spawn_item_key() { self.mdl = self.model; self.effects = EF_LOWPRECISION; - setmodel(self, self.model); + _setmodel(self, self.model); //setsize(self, '-16 -16 -24', '16 16 32'); setorigin(self, self.origin + '0 0 32'); setsize(self, '-16 -16 -56', '16 16 0'); @@ -146,7 +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() { +spawnfunc(item_key) +{ string _netname; vector _colormod; @@ -231,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 = SND(ITEMPICKUP); // save the name for later item_keys_names[lowestbit(self.itemkeys)] = self.netname; @@ -252,10 +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) { - 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 @@ -270,8 +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) { - 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); };