| @@ -33,10 +33,17 @@ function updateExploreCompass() { | |||||
| button.classList.add("inactive-button"); | button.classList.add("inactive-button"); | ||||
| button.innerHTML = ""; | button.innerHTML = ""; | ||||
| } else { | } else { | ||||
| button.disabled = false; | |||||
| button.classList.remove("inactive-button"); | |||||
| button.classList.add("active-compass-button"); | |||||
| button.innerHTML = currentRoom.exits[i].name; | |||||
| if (currentRoom.exits[i].conditions.reduce((result, test) => result && test(prefs), true)) { | |||||
| button.disabled = false; | |||||
| button.classList.remove("inactive-button"); | |||||
| button.classList.add("active-compass-button"); | |||||
| button.innerHTML = currentRoom.exits[i].name; | |||||
| } else { | |||||
| button.disabled = true; | |||||
| button.classList.add("inactive-button"); | |||||
| button.classList.remove("active-compass-button"); | |||||
| button.innerHTML = currentRoom.exits[i].name; | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -72,8 +72,6 @@ function Fen() { | |||||
| this.struggles.push(new rub(this)); | this.struggles.push(new rub(this)); | ||||
| this.conditions = []; | this.conditions = []; | ||||
| this.conditions.push(function(prefs) { return prefs.player.prey; } ); | |||||
| } | } | ||||
| function Micro() { | function Micro() { | ||||
| @@ -165,7 +165,7 @@ let locationsSrc = [ | |||||
| { | { | ||||
| "name": "SUPER DANGER ZONE", | "name": "SUPER DANGER ZONE", | ||||
| "dir": NORTH, | "dir": NORTH, | ||||
| "desc": "Getting eaten is fun!" | |||||
| "desc": "Getting eaten is fun!", | |||||
| } | } | ||||
| ], | ], | ||||
| "hooks": [ | "hooks": [ | ||||
| @@ -188,6 +188,9 @@ let locationsSrc = [ | |||||
| function() { | function() { | ||||
| startCombat(new Fen()); | startCombat(new Fen()); | ||||
| } | } | ||||
| ], | |||||
| "conditions": [ | |||||
| function(prefs) { return prefs.player.prey; } | |||||
| ] | ] | ||||
| } | } | ||||
| ]; | ]; | ||||
| @@ -199,6 +202,7 @@ function Location(name="Nowhere",desc="Nada") { | |||||
| this.exitDescs = [null,null,null,null,null,null,null,null]; | this.exitDescs = [null,null,null,null,null,null,null,null]; | ||||
| this.objects = []; | this.objects = []; | ||||
| this.hooks = []; | this.hooks = []; | ||||
| this.conditions = []; | |||||
| this.visit = function() { | this.visit = function() { | ||||
| this.hooks.forEach(function (x) { | this.hooks.forEach(function (x) { | ||||
| @@ -240,6 +244,11 @@ function createWorld() { | |||||
| location.hooks.push(hook); | location.hooks.push(hook); | ||||
| }); | }); | ||||
| } | } | ||||
| if (src.conditions != undefined) { | |||||
| src.conditions.forEach(function (cond) { | |||||
| location.conditions.push(cond); | |||||
| }); | |||||
| } | |||||
| } | } | ||||