mirror of
https://github.com/thepaperpilot/Planar-Pioneers.git
synced 2024-11-22 00:21:31 +00:00
Removed social resource and added make bed action
plus some stuff I forgot to add in the last commit
This commit is contained in:
parent
f516a3a092
commit
fdfccefb67
6 changed files with 61 additions and 24 deletions
|
@ -16,7 +16,7 @@
|
|||
<svg class="stage" width="100%" height="100%">
|
||||
<g id="g1">
|
||||
<transition-group name="link" appear>
|
||||
<g v-for="(link, index) in board.links || []" :key="index">
|
||||
<g v-for="link in board.links || []" :key="link">
|
||||
<BoardLink :link="link" />
|
||||
</g>
|
||||
</transition-group>
|
||||
|
|
|
@ -229,7 +229,22 @@ export default defineComponent({
|
|||
return this.board.selectedAction;
|
||||
},
|
||||
actions(): BoardNodeAction[] | null | undefined {
|
||||
return getNodeTypeProperty(this.nodeType, this.node, "actions");
|
||||
const actions = getNodeTypeProperty(this.nodeType, this.node, "actions") as
|
||||
| BoardNodeAction[]
|
||||
| null
|
||||
| undefined;
|
||||
if (actions) {
|
||||
return actions.filter(action => {
|
||||
if (action.enabled == null) {
|
||||
return true;
|
||||
}
|
||||
if (typeof action.enabled === "function") {
|
||||
return action.enabled();
|
||||
}
|
||||
return action.enabled;
|
||||
});
|
||||
}
|
||||
return null;
|
||||
},
|
||||
draggable(): boolean {
|
||||
return getNodeTypeProperty(this.nodeType, this.node, "draggable");
|
||||
|
@ -363,17 +378,17 @@ export default defineComponent({
|
|||
transform: rotate(-90deg);
|
||||
}
|
||||
|
||||
.action:hover circle,
|
||||
.action.selected circle {
|
||||
.action:not(.boardnode):hover circle,
|
||||
.action:not(.boardnode).selected circle {
|
||||
r: 25;
|
||||
}
|
||||
|
||||
.action:hover text,
|
||||
.action.selected text {
|
||||
.action:not(.boardnode):hover text,
|
||||
.action:not(.boardnode).selected text {
|
||||
font-size: 187.5%; /* 150% * 1.25 */
|
||||
}
|
||||
|
||||
.action text {
|
||||
.action:not(.boardnode) text {
|
||||
text-anchor: middle;
|
||||
dominant-baseline: central;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<template>
|
||||
<div v-if="devSpeed === 0">Game Paused</div>
|
||||
<div v-else-if="devSpeed && devSpeed !== 1">Dev Speed: {{ formattedDevSpeed }}x</div>
|
||||
<div>Day {{ day }}</div>
|
||||
<Board id="main" />
|
||||
<Modal :show="showModal" @close="closeModal">
|
||||
<template v-slot:header v-if="title">
|
||||
|
@ -70,7 +71,9 @@ export default defineComponent(function Main() {
|
|||
const devSpeed = computed(() => player.devSpeed);
|
||||
const formattedDevSpeed = computed(() => player.devSpeed && format(player.devSpeed));
|
||||
|
||||
return { title, body, footer, showModal, closeModal, devSpeed, formattedDevSpeed };
|
||||
const day = computed(() => player.day);
|
||||
|
||||
return { title, body, footer, showModal, closeModal, devSpeed, formattedDevSpeed, day };
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -82,4 +85,8 @@ export default defineComponent(function Main() {
|
|||
.entry:not(:last-child) {
|
||||
border-bottom: solid 4px var(--separator);
|
||||
}
|
||||
|
||||
.boardnode.action .progressDiamond {
|
||||
transition-duration: 0s;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -60,11 +60,9 @@ type Resource = {
|
|||
|
||||
const resources = {
|
||||
time: createResource("time", "#3EB489", 24 * 60 * 60, 24 * 60 * 60, [
|
||||
{ resource: "social", amount: 1 / (60 * 60), linkType: LinkType.LossOnly },
|
||||
{ resource: "mental", amount: 1 / (120 * 60), linkType: LinkType.LossOnly }
|
||||
]),
|
||||
energy: createResource("energy", "#FFA500", 100, 100),
|
||||
social: createResource("social", "#800080", 100, 100),
|
||||
mental: createResource("mental", "#32CD32", 100, 100),
|
||||
focus: createResource("focus", "#0000FF", 100, 0)
|
||||
} as Record<string, Resource>;
|
||||
|
@ -159,6 +157,7 @@ type Action = {
|
|||
amount: DecimalSource;
|
||||
assign?: boolean;
|
||||
}>;
|
||||
enabled?: boolean | (() => boolean);
|
||||
};
|
||||
|
||||
const actions = {
|
||||
|
@ -190,7 +189,7 @@ const actions = {
|
|||
]
|
||||
},
|
||||
sleep: {
|
||||
icon: "bed",
|
||||
icon: "mode_night",
|
||||
tooltip: "Sleep",
|
||||
events: [
|
||||
{
|
||||
|
@ -309,6 +308,28 @@ const actions = {
|
|||
{ resource: "energy", amount: 30 },
|
||||
{ resource: "mental", amount: -5 }
|
||||
]
|
||||
},
|
||||
makeBed: {
|
||||
icon: "king_bed",
|
||||
tooltip: "Make Bed",
|
||||
enabled: () =>
|
||||
Decimal.lt(player.lastDayBedMade as DecimalSource, player.day as DecimalSource),
|
||||
events: [
|
||||
{
|
||||
event: () => {
|
||||
player.lastDayBedMade = player.day;
|
||||
return {
|
||||
description: `It's a small thing, but you feel better after making your bed`
|
||||
};
|
||||
},
|
||||
weight: 1
|
||||
}
|
||||
],
|
||||
baseChanges: [
|
||||
{ resource: "time", amount: -10 * 60 },
|
||||
{ resource: "energy", amount: -5 },
|
||||
{ resource: "mental", amount: 5 }
|
||||
]
|
||||
}
|
||||
} as Record<string, Action>;
|
||||
|
||||
|
@ -352,7 +373,7 @@ const actionNodes = {
|
|||
display: "Web"
|
||||
},
|
||||
bed: {
|
||||
actions: ["sleep", "rest"],
|
||||
actions: ["sleep", "rest", "makeBed"],
|
||||
display: "Bed"
|
||||
}
|
||||
} as Record<string, ActionNode>;
|
||||
|
@ -618,7 +639,8 @@ const actionNodeType = {
|
|||
} as BoardNodeLink;
|
||||
})
|
||||
];
|
||||
}
|
||||
},
|
||||
enabled: action.enabled
|
||||
} as BoardNodeAction;
|
||||
})
|
||||
];
|
||||
|
@ -720,14 +742,6 @@ export default {
|
|||
amount: new Decimal(100)
|
||||
} as ResourceNodeData
|
||||
},
|
||||
{
|
||||
position: { x: 150, y: 0 },
|
||||
type: "resource",
|
||||
data: {
|
||||
resourceType: "social",
|
||||
amount: new Decimal(100)
|
||||
} as ResourceNodeData
|
||||
},
|
||||
{
|
||||
position: { x: -150, y: 0 },
|
||||
type: "resource",
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import { RawLayer } from "@/typings/layer";
|
||||
import { PlayerData } from "@/typings/player";
|
||||
import Decimal from "@/util/bignum";
|
||||
import { hardReset } from "@/util/save";
|
||||
import { computed } from "vue";
|
||||
import main from "./layers/main";
|
||||
|
||||
|
@ -12,7 +11,9 @@ export const getInitialLayers = (
|
|||
|
||||
export function getStartingData(): Record<string, unknown> {
|
||||
return {
|
||||
points: new Decimal(10)
|
||||
points: new Decimal(10),
|
||||
day: new Decimal(1),
|
||||
lastDayBedMade: new Decimal(0)
|
||||
};
|
||||
}
|
||||
|
||||
|
|
2
src/typings/player.d.ts
vendored
2
src/typings/player.d.ts
vendored
|
@ -1,7 +1,7 @@
|
|||
import { Themes } from "@/data/themes";
|
||||
import { DecimalSource } from "@/lib/break_eternity";
|
||||
import Decimal from "@/util/bignum";
|
||||
import { BoardData, BoardNode } from "./features/board";
|
||||
import { BoardData } from "./features/board";
|
||||
import { MilestoneDisplay } from "./features/milestone";
|
||||
import { State } from "./state";
|
||||
|
||||
|
|
Loading…
Reference in a new issue