Преглед изворни кода

Merge branch 'master' into mass-vore

mass-vore
Fen Dweller пре 6 година
родитељ
комит
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; 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") { 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) + "%"; field.style.width = (val.value / val.max * 100) + "%";
} else if (val.type == "counter") { } 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() { function refresh() {
updateRoom(state); 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) { if (refreshHook) {
refreshHook(state) refreshHook(state)


+ 28
- 1
stories/demo.js Прегледај датотеку

@@ -36,9 +36,25 @@ stories.push({
}, },
"enter": (room, state) => { "enter": (room, state) => {
print(["*sound of you entering your house*"]); 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) => { "exit": (room, state) => {
print(["You are exiting your house"]); print(["You are exiting your house"]);

stopRoomTimers("Home", state);
}, },
"actions": [ "actions": [
{ {
@@ -95,9 +111,15 @@ stories.push({
"hooks": [ "hooks": [
(room, state) => { (room, state) => {
print(["This is a test of the hooks"]); print(["This is a test of the hooks"]);
return true; return true;
} }
]
],
"data": {
"stats": {
number: {name: "Seconds In Room", type: "counter", value: 0, color: "rgb(255,0,0)"}
}
}
}, },
"Locked Room": { "Locked Room": {
"id": "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: { intestines: {
@@ -344,7 +349,12 @@ stories.push({
] ]


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


} }
]
],
"data": {
"stats": {
}
}
}, },
"digested-stomach": { "digested-stomach": {
id: "digested-stomach", id: "digested-stomach",
@@ -465,6 +480,11 @@ stories.push({
playSfx("sfx/bowels-churn-safe.ogg"); playSfx("sfx/bowels-churn-safe.ogg");
stopClassTimers("alive", state); 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..."]); 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": { "digested-intestines": {
@@ -477,6 +497,11 @@ stories.push({
playSfx("sfx/bowels-churn-safe.ogg"); playSfx("sfx/bowels-churn-safe.ogg");
stopClassTimers("alive", state); 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..."]); 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": { "digested-bowels": {
@@ -489,6 +514,11 @@ stories.push({
playSfx("sfx/bowels-churn-danger.ogg"); playSfx("sfx/bowels-churn-danger.ogg");
stopClassTimers("alive", state); 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..."]); 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) { function updateRoom(state) {
const name = state.player.location; const name = state.player.location;
const room = state.world[name]; const room = state.world[name];
createStatDisplays(room.data.stats, "area");


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


Loading…
Откажи
Сачувај