self.message = "";
SUB_UseTargets();
self.message = oldmessage;
- };
+ }
+
/*
=============================================================================
=============================================================================
*/
+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");
void door_use()
{
- local entity oself;
+ entity oself;
//dprint("door_use (model: ");dprint(self.model);dprint(")\n");
+
if (self.owner)
{
oself = self;
}
} 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.