diff --git a/feast.js b/feast.js index 1e23036..d9a54d0 100644 --- a/feast.js +++ b/feast.js @@ -33,10 +33,17 @@ function updateExploreCompass() { button.classList.add("inactive-button"); button.innerHTML = ""; } 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; + } } } } diff --git a/vore.js b/vore.js index 4536a9f..6a624bd 100644 --- a/vore.js +++ b/vore.js @@ -72,8 +72,6 @@ function Fen() { this.struggles.push(new rub(this)); this.conditions = []; - - this.conditions.push(function(prefs) { return prefs.player.prey; } ); } function Micro() { diff --git a/world.js b/world.js index 882d3eb..29e7a0a 100644 --- a/world.js +++ b/world.js @@ -165,7 +165,7 @@ let locationsSrc = [ { "name": "SUPER DANGER ZONE", "dir": NORTH, - "desc": "Getting eaten is fun!" + "desc": "Getting eaten is fun!", } ], "hooks": [ @@ -188,6 +188,9 @@ let locationsSrc = [ function() { 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.objects = []; this.hooks = []; + this.conditions = []; this.visit = function() { this.hooks.forEach(function (x) { @@ -240,6 +244,11 @@ function createWorld() { location.hooks.push(hook); }); } + if (src.conditions != undefined) { + src.conditions.forEach(function (cond) { + location.conditions.push(cond); + }); + } }