Ver código fonte

Prefs work for entering a room

tags/v0.2.8
Fen Dweller 7 anos atrás
pai
commit
dd19160c03
3 arquivos alterados com 21 adições e 7 exclusões
  1. +11
    -4
      feast.js
  2. +0
    -2
      vore.js
  3. +10
    -1
      world.js

+ 11
- 4
feast.js Ver arquivo

@@ -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;
}
}
}
}


+ 0
- 2
vore.js Ver arquivo

@@ -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() {


+ 10
- 1
world.js Ver arquivo

@@ -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);
});
}

}



Carregando…
Cancelar
Salvar