]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
removed debug messages, now on a player can pickup the key
authorPrzemysław Grzywacz <nexather@gmail.com>
Mon, 17 Oct 2011 14:39:25 +0000 (16:39 +0200)
committerPrzemysław Grzywacz <nexather@gmail.com>
Mon, 17 Oct 2011 14:39:25 +0000 (16:39 +0200)
qcsrc/server/item_key.qc
qcsrc/server/t_plats.qc

index e26d6fe801830ac6b1c19a523d147e001a73b2a6..fb783ee44cc180d76e804d344c74b1f7f40686f6 100644 (file)
@@ -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;
                        }
                }
                
index 8cb87678223c0c6348c875af14c4d773366997bb..e0d1ca6f55882e3dc9954c08986f07cece7e0e30 100644 (file)
@@ -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";