From: Przemysław Grzywacz Date: Tue, 18 Oct 2011 17:38:00 +0000 (+0200) Subject: Merge commit '6f440770dbdb' into atheros/item_keys X-Git-Tag: xonotic-v0.6.0~40^2~17^2~1 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=74a82a7354648fcc2698c19afc0581f7bdc3b1ca;p=xonotic%2Fxonotic-data.pk3dir.git Merge commit '6f440770dbdb' into atheros/item_keys --- 74a82a7354648fcc2698c19afc0581f7bdc3b1ca diff --cc qcsrc/server/t_plats.qc index e0d1ca6f5,9ac9df289..f116e74a1 --- a/qcsrc/server/t_plats.qc +++ b/qcsrc/server/t_plats.qc @@@ -882,10 -882,9 +882,10 @@@ void door_go_up( self.message = ""; SUB_UseTargets(); self.message = oldmessage; - }; + } + /* ============================================================================= @@@ -894,62 -893,10 +894,62 @@@ ACTIVATION FUNCTION ============================================================================= */ +float door_check_keys(void) { + local entity door; + + + if (self.owner) + door = self.owner; + else + door = self; + + if (door.spawnflags & (SPAWNFLAGS_GOLD_KEY | SPAWNFLAGS_SILVER_KEY)) { + // this door require a key + // only a player can have a key + if (other.classname != "player") + return FALSE; + + // check gold key + if (self.owner.spawnflags & SPAWNFLAGS_GOLD_KEY) { + if (!(other.itemkeys & KEYS_GOLD_KEY)) { + if (other.key_door_messagetime <= time) { + play2(other, "misc/talk.wav"); + centerprint(other, "You don't have the gold key!"); + other.key_door_messagetime = time + 2; + } + return FALSE; + } else { + self.owner.spawnflags &~= SPAWNFLAGS_GOLD_KEY; + } + } + + // check silver key + if (self.owner.spawnflags & SPAWNFLAGS_SILVER_KEY) { + if (!(other.itemkeys & KEYS_SILVER_KEY)) { + if (other.key_door_messagetime <= time) { + play2(other, "misc/talk.wav"); + centerprint(other, "You don't have the silver key!"); + other.key_door_messagetime = time + 2; + } + return FALSE; + } else { + self.owner.spawnflags &~= SPAWNFLAGS_SILVER_KEY; + } + } + + // door is now unlocked + play2(other, "misc/talk.wav"); + centerprint(other, "Door unlocked!"); + } + + return TRUE; +} + + void door_fire() { - local entity oself; - local entity starte; + entity oself; + entity starte; if (self.owner != self) objerror ("door_fire: self.owner != self"); @@@ -1008,10 -955,9 +1008,10 @@@ void door_use() { - local entity oself; + entity oself; //dprint("door_use (model: ");dprint(self.model);dprint(")\n"); + if (self.owner) { oself = self; @@@ -1333,10 -1268,10 +1333,10 @@@ void LinkDoors( } } while (1 ); - }; + } -/*QUAKED spawnfunc_func_door (0 .5 .8) ? START_OPEN x DOOR_DONT_LINK x x TOGGLE +/*QUAKED spawnfunc_func_door (0 .5 .8) ? START_OPEN x DOOR_DONT_LINK GOLD_KEY SILVER_KEY TOGGLE if two doors touch, they are assumed to be connected and operate as a unit. TOGGLE causes the door to wait in both the start and end states for a trigger event.