Просмотр исходного кода

Merge branch 'master' into mass-vore

mass-vore
Fen Dweller 6 лет назад
Родитель
Сommit
0b5183e0fa
5 измененных файлов: 70 добавлений и 25 удалений
  1. +5
    -20
      game.js
  2. +3
    -2
      satiate.js
  3. +28
    -1
      stories/demo.js
  4. +32
    -2
      stories/fen-snack.js
  5. +2
    -0
      world.js

+ 5
- 20
game.js Просмотреть файл

@@ -77,31 +77,16 @@ function renderTime(time) {
return hours + ":" + minutes + ":" + seconds + " " + ampm;
}

function updateWorldInfo(state) {
Object.entries(state.info).forEach(([key, val]) => {

if (val.type == "meter") {
const field = document.querySelector("#world-info-" + key + " > .stat-bar");
field.style.width = (val.value / val.max * 100) + "%";
} else if (val.type == "counter") {
const field = document.querySelector("#world-info-" + key);
field.innerText = val.name + ": " + val.render;
}

});
}

function updatePlayerInfo(state) {
Object.entries(state.player.stats).forEach(([key, val]) => {
function updateStatDisplay(stats, statType) {
Object.entries(stats).forEach(([key, val]) => {

if (val.type == "meter") {
const field = document.querySelector("#player-info-" + key + " > .stat-bar");
const field = document.querySelector("#" + statType + "-info-" + key + " > .stat-bar");
field.style.width = (val.value / val.max * 100) + "%";
} else if (val.type == "counter") {
const field = document.querySelector("#player-info-" + key);
field.innerText = val.name + ": " + val.value;
const field = document.querySelector("#" + statType + "-info-" + key);
field.innerText = val.name + ": " + (val.render !== undefined ? val.render : val.value);
}

});
}



+ 3
- 2
satiate.js Просмотреть файл

@@ -24,8 +24,9 @@ function print(lines) {

function refresh() {
updateRoom(state);
updateWorldInfo(state);
updatePlayerInfo(state);
updateStatDisplay(state.info, "world");
updateStatDisplay(state.player.stats, "player");
updateStatDisplay(state.world[state.player.location].data.stats, "area");

if (refreshHook) {
refreshHook(state)


+ 28
- 1
stories/demo.js Просмотреть файл

@@ -36,9 +36,25 @@ stories.push({
},
"enter": (room, state) => {
print(["*sound of you entering your house*"]);

startTimer({
id: "room-counter",
func: state => {
state.world["Home"].data.stats.number.value += 1;
return true;
},
delay: 1000,
loop: true,
classes: [
],
room: "Home",
}, state);
},
"exit": (room, state) => {
print(["You are exiting your house"]);

stopRoomTimers("Home", state);
},
"actions": [
{
@@ -95,9 +111,15 @@ stories.push({
"hooks": [
(room, state) => {
print(["This is a test of the hooks"]);
return true;
}
]
],
"data": {
"stats": {
number: {name: "Seconds In Room", type: "counter", value: 0, color: "rgb(255,0,0)"}
}
}
},
"Locked Room": {
"id": "Locked Room",
@@ -134,6 +156,11 @@ stories.push({
}
]
}
},
"data": {
"stats": {
}
}
}
}


+ 32
- 2
stories/fen-snack.js Просмотреть файл

@@ -244,6 +244,11 @@ stories.push({
}
]
}
},
"data": {
"stats": {
}
}
},
intestines: {
@@ -344,7 +349,12 @@ stories.push({
]

}
]
],
"data": {
"stats": {
}
}
},
bowels: {
id: "bowels",
@@ -453,7 +463,12 @@ stories.push({
]

}
]
],
"data": {
"stats": {
}
}
},
"digested-stomach": {
id: "digested-stomach",
@@ -465,6 +480,11 @@ stories.push({
playSfx("sfx/bowels-churn-safe.ogg");
stopClassTimers("alive", state);
print(["You slump down in the acidic pit, curling up as it begins to churn you down to chyme. Fen's stomach snarls and bubbles for the next few minutes...and then you're gone~",newline,"Nothing's left but a bit of padding on your predator's gut..."]);
},
"data": {
"stats": {
}
}
},
"digested-intestines": {
@@ -477,6 +497,11 @@ stories.push({
playSfx("sfx/bowels-churn-safe.ogg");
stopClassTimers("alive", state);
print(["Fen's intestines clench and squeeze, melting you down into slop and soaking you up like a sponge.",newline,"Nothing's left but a bit of padding on your predator's hips..."]);
},
"data": {
"stats": {
}
}
},
"digested-bowels": {
@@ -489,6 +514,11 @@ stories.push({
playSfx("sfx/bowels-churn-danger.ogg");
stopClassTimers("alive", state);
print(["A powerful ripple of muscle pins you in a vice-grip of flesh - and within seconds, you're part of Fen's bowels.",newline,"Nothing's left but a bit of padding on your predator's ass..."]);
},
"data": {
"stats": {
}
}
}
}


+ 2
- 0
world.js Просмотреть файл

@@ -142,6 +142,8 @@ function goToRoom(dest, state) {
function updateRoom(state) {
const name = state.player.location;
const room = state.world[name];
createStatDisplays(room.data.stats, "area");

if (!state.player.rooms[room.id]) {
state.player.rooms[room.id] = {};


Загрузка…
Отмена
Сохранить