From: Przemysław Grzywacz Date: Mon, 17 Oct 2011 14:39:25 +0000 (+0200) Subject: removed debug messages, now on a player can pickup the key X-Git-Tag: xonotic-v0.6.0~40^2~17^2~2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=35cead54720591ea1770c63104e53bde54f2c240;p=xonotic%2Fxonotic-data.pk3dir.git removed debug messages, now on a player can pickup the key --- diff --git a/qcsrc/server/item_key.qc b/qcsrc/server/item_key.qc index e26d6fe80..fb783ee44 100644 --- a/qcsrc/server/item_key.qc +++ b/qcsrc/server/item_key.qc @@ -17,25 +17,18 @@ item_key1 / item_key2 Key touch handler. */ void item_key_touch(void) { - local entity p; - - if (other.owner) - p = other.owner; - else - p = other; - - if (p.classname != "player") + if (other.classname != "player") return; // player already picked up this key - if (p.itemkeys & self.itemkeys) + if (other.itemkeys & self.itemkeys) return; - p.itemkeys |= self.itemkeys; + other.itemkeys |= self.itemkeys; play2(other, self.noise); if (self.message) { - centerprint(p, self.message); + centerprint(other, self.message); } }; @@ -181,27 +174,21 @@ void trigger_keylock_kill(string s) { void trigger_keylock_touch(void) { local float key_used, silver_key_missing, gold_key_missing, started_delay; - local entity p; key_used = FALSE; silver_key_missing = FALSE; gold_key_missing = FALSE; started_delay = FALSE; - if (other.owner) - p = other.owner; - else - p = other; - // only player may trigger the lock - if (p.classname != "player") + if (other.classname != "player") return; // check silver key if (self.itemkeys & KEYS_SILVER_KEY) { // lock still requires the SILVER key - if (p.itemkeys & KEYS_SILVER_KEY) { + if (other.itemkeys & KEYS_SILVER_KEY) { self.itemkeys &~= KEYS_SILVER_KEY; key_used = TRUE; } else { @@ -212,7 +199,7 @@ void trigger_keylock_touch(void) { // check gold key if (self.itemkeys & KEYS_GOLD_KEY) { // lock still requires the GOLD key - if (p.itemkeys & KEYS_GOLD_KEY) { + if (other.itemkeys & KEYS_GOLD_KEY) { self.itemkeys &~= KEYS_GOLD_KEY; key_used = TRUE; } else { @@ -256,12 +243,12 @@ void trigger_keylock_touch(void) { centerprint(other, "You also need the silver key!"); else if (gold_key_missing) centerprint(other, "You also need the gold key!"); - p.key_door_messagetime = time + 2; + other.key_door_messagetime = time + 2; } else { - if (p.key_door_messagetime <= time) { + if (other.key_door_messagetime <= time) { play2(other, self.noise2); centerprint(other, self.message2); - p.key_door_messagetime = time + 2; + other.key_door_messagetime = time + 2; } } diff --git a/qcsrc/server/t_plats.qc b/qcsrc/server/t_plats.qc index 8cb876782..e0d1ca6f5 100644 --- a/qcsrc/server/t_plats.qc +++ b/qcsrc/server/t_plats.qc @@ -895,7 +895,7 @@ ACTIVATION FUNCTIONS */ float door_check_keys(void) { - local entity door, p; + local entity door; if (self.owner) @@ -903,24 +903,19 @@ float door_check_keys(void) { else door = self; - if (other.owner) - p = other.owner; - else - p = other; - if (door.spawnflags & (SPAWNFLAGS_GOLD_KEY | SPAWNFLAGS_SILVER_KEY)) { // this door require a key // only a player can have a key - if (p.classname != "player") + if (other.classname != "player") return FALSE; // check gold key if (self.owner.spawnflags & SPAWNFLAGS_GOLD_KEY) { if (!(other.itemkeys & KEYS_GOLD_KEY)) { - if (p.key_door_messagetime <= time) { + if (other.key_door_messagetime <= time) { play2(other, "misc/talk.wav"); centerprint(other, "You don't have the gold key!"); - p.key_door_messagetime = time + 2; + other.key_door_messagetime = time + 2; } return FALSE; } else { @@ -931,10 +926,10 @@ float door_check_keys(void) { // check silver key if (self.owner.spawnflags & SPAWNFLAGS_SILVER_KEY) { if (!(other.itemkeys & KEYS_SILVER_KEY)) { - if (p.key_door_messagetime <= time) { + if (other.key_door_messagetime <= time) { play2(other, "misc/talk.wav"); centerprint(other, "You don't have the silver key!"); - p.key_door_messagetime = time + 2; + other.key_door_messagetime = time + 2; } return FALSE; } else { @@ -1387,9 +1382,9 @@ void door_reset() void spawnfunc_func_door() { - print("spawnfunc_func_door() spawnflags=", ftos(self.spawnflags)); - print(", gold_key=", ftos(self.spawnflags & SPAWNFLAGS_GOLD_KEY)); - print(", silver_key=", ftos(self.spawnflags & SPAWNFLAGS_SILVER_KEY), "\n"); + //dprint("spawnfunc_func_door() spawnflags=", ftos(self.spawnflags)); + //dprint(", gold_key=", ftos(self.spawnflags & SPAWNFLAGS_GOLD_KEY)); + //dprint(", silver_key=", ftos(self.spawnflags & SPAWNFLAGS_SILVER_KEY), "\n"); //if (!self.deathtype) // map makers can override this // self.deathtype = " got in the way";