refactor: resources

This commit is contained in:
cha0s 2024-09-17 01:25:39 -05:00
parent b137b91ced
commit c24adc47a8
100 changed files with 110 additions and 105 deletions

View File

@ -71,7 +71,6 @@ module.exports = {
'.eslintrc.cjs', '.eslintrc.cjs',
'server.js', 'server.js',
'vite.config.js', 'vite.config.js',
'public/assets/tileset.js',
], ],
env: { env: {
node: true, node: true,
@ -81,7 +80,7 @@ module.exports = {
// Assets // Assets
{ {
files: [ files: [
'public/assets/**/*.js', 'resources/**/*.js',
], ],
rules: { rules: {
'no-undef': 0, 'no-undef': 0,

View File

@ -44,7 +44,7 @@ export default class Alive extends Component {
} }
static properties = { static properties = {
deathScript: { deathScript: {
defaultValue: '/assets/misc/death-default.js', defaultValue: '/resources/misc/death-default.js',
type: 'string', type: 'string',
}, },
health: {type: 'uint32'}, health: {type: 'uint32'},

View File

@ -18,7 +18,7 @@ const TileLayerInternal = PixiComponent('TileLayer', {
}, },
applyProps: (container, {tileLayer: oldTileLayer}, props) => { applyProps: (container, {tileLayer: oldTileLayer}, props) => {
const {asset, group, renderer, tileLayer} = props; const {asset, group, renderer, tileLayer} = props;
const extless = tileLayer.source.slice('/assets/'.length, -'.json'.length); const extless = tileLayer.source.slice('/resources/'.length, -'.json'.length);
const {textures} = asset; const {textures} = asset;
if (tileLayer === oldTileLayer) { if (tileLayer === oldTileLayer) {
return; return;

View File

@ -29,10 +29,10 @@ body {
@font-face { @font-face {
font-family: "Cookbook"; font-family: "Cookbook";
src: url("/assets/fonts/Cookbook.woff"); src: url("/fonts/Cookbook.woff");
} }
@font-face { @font-face {
font-family: "Joystix"; font-family: "Joystix";
src: url("/assets/fonts/Joystix.woff"); src: url("/fonts/Joystix.woff");
} }

View File

@ -122,7 +122,7 @@ export default function PlaySpecific() {
// let source = true; // let source = true;
// async function play() { // async function play() {
// const ctx = new AudioContext(); // const ctx = new AudioContext();
// const response = await fetch(new URL('/assets/yuff.wav', window.location.origin)); // const response = await fetch(new URL('/resources/yuff.wav', window.location.origin));
// const buffer = await ctx.decodeAudioData(await response.arrayBuffer()); // const buffer = await ctx.decodeAudioData(await response.arrayBuffer());
// if (!source) { // if (!source) {
// return; // return;

View File

@ -78,7 +78,7 @@ function Gen() {
), ),
compute: (x, y) => ({ compute: (x, y) => ({
anchor:{x: 0.5, y: 0.875}, anchor:{x: 0.5, y: 0.875},
image: '/assets/ambient/tree.png', image: '/resources/ambient/tree.png',
x: x * 16, x: x * 16,
y: y * 16, y: y * 16,
}), }),
@ -91,7 +91,7 @@ function Gen() {
), ),
compute: (x, y, noise) => ({ compute: (x, y, noise) => ({
anchor:{x: 0.5, y: 0.7}, anchor:{x: 0.5, y: 0.7},
image: '/assets/ambient/flower.png', image: '/resources/ambient/flower.png',
x: x * 16 + (noise(x, y) * 8 - 4), x: x * 16 + (noise(x, y) * 8 - 4),
y: y * 16 + (noise(y, x) * 8 - 4), y: y * 16 + (noise(y, x) * 8 - 4),
}), }),
@ -104,7 +104,7 @@ function Gen() {
), ),
compute: (x, y, noise) => ({ compute: (x, y, noise) => ({
anchor:{x: 0.5, y: 0.7}, anchor:{x: 0.5, y: 0.7},
image: '/assets/ambient/shrub.png', image: '/resources/ambient/shrub.png',
x: x * 16 + (noise(x, y) * 8 - 4), x: x * 16 + (noise(x, y) * 8 - 4),
y: y * 16 + (noise(y, x) * 8 - 4), y: y * 16 + (noise(y, x) * 8 - 4),
}), }),
@ -117,7 +117,7 @@ function Gen() {
Math.ceil(area.x / CHUNK_SIZE) * Math.ceil(area.y / CHUNK_SIZE) Math.ceil(area.x / CHUNK_SIZE) * Math.ceil(area.y / CHUNK_SIZE)
).fill(0).map(() => ({})), ).fill(0).map(() => ({})),
data: Array(area.x * area.y).fill(1), data: Array(area.x * area.y).fill(1),
source: '/assets/tileset.json', source: '/resources/tileset.json',
tileSize: {x: 16, y: 16}, tileSize: {x: 16, y: 16},
}; };
const tileGenerator = new Generator({ const tileGenerator = new Generator({

View File

@ -63,13 +63,13 @@ export default async function createForest() {
{ {
area, area,
data: Array(w * h).fill(0), data: Array(w * h).fill(0),
source: '/assets/tileset.json', source: '/resources/tileset.json',
tileSize: {x: 16, y: 16}, tileSize: {x: 16, y: 16},
}, },
{ {
area, area,
data: Array(w * h).fill(0), data: Array(w * h).fill(0),
source: '/assets/tileset.json', source: '/resources/tileset.json',
tileSize: {x: 16, y: 16}, tileSize: {x: 16, y: 16},
}, },
], ],
@ -113,7 +113,7 @@ export default async function createForest() {
Position: entityPosition(x, y), Position: entityPosition(x, y),
Sprite: { Sprite: {
anchorY: 0.7, anchorY: 0.7,
source: '/assets/ambient/shrub.json', source: '/resources/ambient/shrub.json',
}, },
VisibleAabb: {}, VisibleAabb: {},
}); });
@ -123,7 +123,7 @@ export default async function createForest() {
Position: entityPosition(x, y), Position: entityPosition(x, y),
Sprite: { Sprite: {
anchorY: 0.875, anchorY: 0.875,
source: '/assets/ambient/tree.json', source: '/resources/ambient/tree.json',
}, },
VisibleAabb: {}, VisibleAabb: {},
}); });
@ -134,7 +134,7 @@ export default async function createForest() {
Position: entityPosition(x, y), Position: entityPosition(x, y),
Sprite: { Sprite: {
anchorY: 0.7, anchorY: 0.7,
source: '/assets/ambient/flower.json', source: '/resources/ambient/flower.json',
}, },
VisibleAabb: {}, VisibleAabb: {},
}); });

View File

@ -33,13 +33,13 @@ export default async function createHomestead(id) {
{ {
area, area,
data, data,
source: '/assets/tileset.json', source: '/resources/tileset.json',
tileSize: {x: 16, y: 16}, tileSize: {x: 16, y: 16},
}, },
{ {
area, area,
data: Array(area.x * area.y).fill(0), data: Array(area.x * area.y).fill(0),
source: '/assets/tileset.json', source: '/resources/tileset.json',
tileSize: {x: 16, y: 16}, tileSize: {x: 16, y: 16},
}, },
], ],
@ -68,7 +68,7 @@ export default async function createHomestead(id) {
Sprite: { Sprite: {
anchorX: 0.5, anchorX: 0.5,
anchorY: 0.8, anchorY: 0.8,
source: '/assets/shit-shack/shit-shack.json', source: '/resources/shit-shack/shit-shack.json',
}, },
Ticking: {}, Ticking: {},
VisibleAabb: {}, VisibleAabb: {},
@ -135,19 +135,19 @@ export default async function createHomestead(id) {
slots: { slots: {
2: { 2: {
qty: 1, qty: 1,
source: '/assets/watering-can/watering-can.json', source: '/resources/watering-can/watering-can.json',
}, },
3: { 3: {
qty: 1, qty: 1,
source: '/assets/tomato-seeds/tomato-seeds.json', source: '/resources/tomato-seeds/tomato-seeds.json',
}, },
4: { 4: {
qty: 1, qty: 1,
source: '/assets/hoe/hoe.json', source: '/resources/hoe/hoe.json',
}, },
5: { 5: {
qty: 1, qty: 1,
source: '/assets/brush/brush.json', source: '/resources/brush/brush.json',
}, },
}, },
}, },
@ -155,7 +155,7 @@ export default async function createHomestead(id) {
Sprite: { Sprite: {
anchorX: 0.5, anchorX: 0.5,
anchorY: 0.7, anchorY: 0.7,
source: '/assets/chest/chest.json', source: '/resources/chest/chest.json',
}, },
Ticking: {}, Ticking: {},
VisibleAabb: {}, VisibleAabb: {},
@ -166,7 +166,7 @@ export default async function createHomestead(id) {
...animalJson, ...animalJson,
Behaving: { Behaving: {
routines: { routines: {
initial: '/assets/kitty/initial.js', initial: '/resources/kitty/initial.js',
}, },
}, },
Collider: { Collider: {
@ -209,7 +209,7 @@ export default async function createHomestead(id) {
...animalJson.Sprite, ...animalJson.Sprite,
anchorX: 0.5, anchorX: 0.5,
anchorY: 0.7, anchorY: 0.7,
source: '/assets/kitty/kitty.json', source: '/resources/kitty/kitty.json',
speed: 0.115, speed: 0.115,
}, },
Tags: {tags: ['kittan']}, Tags: {tags: ['kittan']},
@ -220,7 +220,7 @@ export default async function createHomestead(id) {
...animalJson, ...animalJson,
Behaving: { Behaving: {
routines: { routines: {
initial: '/assets/farm/animals/cow-adult/initial.js', initial: '/resources/farm/animals/cow-adult/initial.js',
}, },
}, },
Collider: { Collider: {
@ -260,7 +260,7 @@ export default async function createHomestead(id) {
...animalJson.Sprite, ...animalJson.Sprite,
anchorX: 0.5, anchorX: 0.5,
anchorY: 0.8, anchorY: 0.8,
source: '/assets/farm/animals/cow-adult/cow-adult.json', source: '/resources/farm/animals/cow-adult/cow-adult.json',
speed: 0.25, speed: 0.25,
}, },
}); });
@ -270,7 +270,7 @@ export default async function createHomestead(id) {
...animalJson, ...animalJson,
Behaving: { Behaving: {
routines: { routines: {
initial: '/assets/farm/animals/goat-white/initial.js', initial: '/resources/farm/animals/goat-white/initial.js',
}, },
}, },
Collider: { Collider: {
@ -309,7 +309,7 @@ export default async function createHomestead(id) {
...animalJson.Sprite, ...animalJson.Sprite,
anchorX: 0.5, anchorX: 0.5,
anchorY: 0.8, anchorY: 0.8,
source: '/assets/farm/animals/goat-white/goat-white.json', source: '/resources/farm/animals/goat-white/goat-white.json',
speed: 0.25, speed: 0.25,
}, },
}); });

View File

@ -11,7 +11,7 @@ export default async function createHouse(Ecs, id) {
{ {
area, area,
data: Array(area.x * area.y).fill(0).map(() => 5 + Math.floor(Math.random() * 2)), data: Array(area.x * area.y).fill(0).map(() => 5 + Math.floor(Math.random() * 2)),
source: '/assets/tileset.json', source: '/resources/tileset.json',
tileSize: {x: 16, y: 16}, tileSize: {x: 16, y: 16},
} }
], ],

View File

@ -24,11 +24,11 @@ export default async function createPlayer(id) {
slots: { slots: {
1: { 1: {
qty: 100, qty: 100,
source: '/assets/potion/potion.json', source: '/resources/potion/potion.json',
}, },
2: { 2: {
qty: 1, qty: 1,
source: '/assets/magic-swords/magic-swords.json', source: '/resources/magic-swords/magic-swords.json',
}, },
}, },
}, },
@ -44,7 +44,7 @@ export default async function createPlayer(id) {
anchorY: 0.9, anchorY: 0.9,
animation: 'moving:down', animation: 'moving:down',
frame: 0, frame: 0,
source: '/assets/dude/dude.json', source: '/resources/dude/dude.json',
speed: 0.115, speed: 0.115,
}, },
Ticking: {}, Ticking: {},

View File

@ -11,13 +11,13 @@ export default async function createTown() {
{ {
area, area,
data, data,
source: '/assets/tileset.json', source: '/resources/tileset.json',
tileSize: {x: 16, y: 16}, tileSize: {x: 16, y: 16},
}, },
{ {
area, area,
data: Array(area.x * area.y).fill(0), data: Array(area.x * area.y).fill(0),
source: '/assets/tileset.json', source: '/resources/tileset.json',
tileSize: {x: 16, y: 16}, tileSize: {x: 16, y: 16},
}, },
], ],

View File

@ -1,5 +0,0 @@
{
"icon": "/assets/brush/brush.png",
"label": "Brush",
"start": "/assets/brush/start.js"
}

View File

@ -1,4 +0,0 @@
{
"icon": "/assets/furball/furball.png",
"label": "Fur Ball"
}

View File

@ -1,5 +0,0 @@
{
"icon": "/assets/magic-swords/icon.png",
"label": "Magic swords",
"start": "/assets/magic-swords/start.js"
}

View File

@ -1,5 +0,0 @@
{
"icon": "/assets/potion/icon.png",
"label": "Potion",
"start": "/assets/potion/start.js"
}

View File

@ -1,14 +0,0 @@
{
"icon": "/assets/tomato-seeds/icon.png",
"label": "Tomato Seeds",
"projection": {
"distance": [1, -1],
"grid": [
[1, 1, 1],
[1, 1, 1],
[1, 1, 1]
]
},
"projectionCheck": "/assets/tomato-seeds/projection-check.js",
"start": "/assets/tomato-seeds/start.js"
}

View File

@ -1,3 +0,0 @@
{
"icon": "/assets/tomato/tomato.png"
}

View File

@ -1,14 +0,0 @@
{
"icon": "/assets/watering-can/icon.png",
"label": "Watering Can",
"projectionCheck": "/assets/watering-can/projection-check.js",
"projection": {
"distance": [3, -1],
"grid": [
[1, 1, 1],
[1, 1, 1],
[1, 1, 1]
]
},
"start": "/assets/watering-can/start.js"
}

View File

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View File

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -0,0 +1,5 @@
{
"icon": "/resources/brush/brush.png",
"label": "Brush",
"start": "/resources/brush/start.js"
}

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -6,7 +6,7 @@ for (const entity of entities) {
Controlled.locked = 1 Controlled.locked = 1
const [, direction] = Sprite.animation.split(':') const [, direction] = Sprite.animation.split(':')
for (let i = 0; i < 2; ++i) { for (let i = 0; i < 2; ++i) {
Sound.play('/assets/brush/brush.wav'); Sound.play('/resources/brush/brush.wav');
Sprite.animation = ['moving', direction].join(':'); Sprite.animation = ['moving', direction].join(':');
await wait(0.3) await wait(0.3)
Sprite.animation = ['idle', direction].join(':'); Sprite.animation = ['idle', direction].join(':');
@ -14,7 +14,7 @@ for (const entity of entities) {
} }
Inventory.give({ Inventory.give({
qty: 1, qty: 1,
source: '/assets/furball/furball.json', source: '/resources/furball/furball.json',
}); });
Controlled.locked = 0; Controlled.locked = 0;
@ -69,7 +69,7 @@ for (const entity of entities) {
{ {
type: 'textureSingle', type: 'textureSingle',
config: { config: {
texture: '/assets/heart/heart.png', texture: '/resources/heart/heart.png',
} }
}, },
], ],

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 9.2 KiB

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

View File

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -0,0 +1,4 @@
{
"icon": "/resources/furball/furball.png",
"label": "Fur Ball"
}

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 570 B

After

Width:  |  Height:  |  Size: 570 B

View File

@ -1,7 +1,7 @@
{ {
"icon": "/assets/hoe/icon.png", "icon": "/resources/hoe/icon.png",
"label": "Hoe", "label": "Hoe",
"projectionCheck": "/assets/hoe/projection-check.js", "projectionCheck": "/resources/hoe/projection-check.js",
"projection": { "projection": {
"distance": [3, -1], "distance": [3, -1],
"grid": [ "grid": [
@ -10,5 +10,5 @@
[1, 1, 1] [1, 1, 1]
] ]
}, },
"start": "/assets/hoe/start.js" "start": "/resources/hoe/start.js"
} }

View File

Before

Width:  |  Height:  |  Size: 247 B

After

Width:  |  Height:  |  Size: 247 B

View File

@ -10,7 +10,7 @@ if (projected?.length > 0) {
const [, direction] = Sprite.animation.split(':') const [, direction] = Sprite.animation.split(':')
for (let i = 0; i < 2; ++i) { for (let i = 0; i < 2; ++i) {
Sound.play('/assets/hoe/dig.wav'); Sound.play('/resources/hoe/dig.wav');
for (const {x, y} of projected) { for (const {x, y} of projected) {
Emitter.emit({ Emitter.emit({
entity: { entity: {

View File

Before

Width:  |  Height:  |  Size: 884 B

After

Width:  |  Height:  |  Size: 884 B

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -0,0 +1,5 @@
{
"icon": "/resources/magic-swords/icon.png",
"label": "Magic swords",
"start": "/resources/magic-swords/start.js"
}

View File

@ -24,7 +24,7 @@ for (let i = 0; i < N; ++i) {
unstoppable: 1, unstoppable: 1,
}, },
], ],
collisionStartScript: '/assets/magic-swords/collision-start.js', collisionStartScript: '/resources/magic-swords/collision-start.js',
}, },
Controlled: {}, Controlled: {},
Direction: {direction: Math.TAU * (i / N)}, Direction: {direction: Math.TAU * (i / N)},
@ -35,7 +35,7 @@ for (let i = 0; i < N; ++i) {
Speed: {}, Speed: {},
Sprite: { Sprite: {
alpha: 0, alpha: 0,
source: '/assets/magic-swords/magic-sword-shot.json', source: '/resources/magic-swords/magic-sword-shot.json',
}, },
Ticking: {}, Ticking: {},
VisibleAabb: {}, VisibleAabb: {},

View File

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -0,0 +1,5 @@
{
"icon": "/resources/potion/icon.png",
"label": "Potion",
"start": "/resources/potion/start.js"
}

View File

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View File

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View File

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

Before

Width:  |  Height:  |  Size: 195 KiB

After

Width:  |  Height:  |  Size: 195 KiB

View File

@ -21,7 +21,7 @@ for (let i = 0; i < 10; ++i) {
'if (other.Inventory) {', 'if (other.Inventory) {',
' other.Inventory.give({', ' other.Inventory.give({',
' qty: 1,', ' qty: 1,',
" source: '/assets/tomato/tomato.json',", " source: '/resources/tomato/tomato.json',",
' })', ' })',
' ecs.destroy(entity.id)', ' ecs.destroy(entity.id)',
'}', '}',
@ -35,7 +35,7 @@ for (let i = 0; i < 10; ++i) {
anchorY: 0.5, anchorY: 0.5,
scaleX: 0.333, scaleX: 0.333,
scaleY: 0.333, scaleY: 0.333,
source: '/assets/tomato/tomato-sprite.json', source: '/resources/tomato/tomato-sprite.json',
}, },
Ticking: {}, Ticking: {},
VisibleAabb: {}, VisibleAabb: {},

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -22,17 +22,17 @@ if (projected?.length > 0) {
], ],
}, },
Interactive: { Interactive: {
interactScript: '/assets/tomato-plant/interact.js', interactScript: '/resources/tomato-plant/interact.js',
}, },
Plant: { Plant: {
growScript: '/assets/tomato-plant/grow.js', growScript: '/resources/tomato-plant/grow.js',
mayGrowScript: '/assets/tomato-plant/may-grow.js', mayGrowScript: '/resources/tomato-plant/may-grow.js',
stages: [0.5, 0.5, 0.5, 0.5, 0.5], stages: [0.5, 0.5, 0.5, 0.5, 0.5],
}, },
Sprite: { Sprite: {
anchorY: 0.75, anchorY: 0.75,
animation: 'stage/0', animation: 'stage/0',
source: '/assets/tomato-plant/tomato-plant.json', source: '/resources/tomato-plant/tomato-plant.json',
}, },
Ticking: {}, Ticking: {},
VisibleAabb: {}, VisibleAabb: {},
@ -60,7 +60,7 @@ if (projected?.length > 0) {
} }
}); });
Sound.play('/assets/sow.wav'); Sound.play('/resources/sow.wav');
Sprite.animation = ['moving', direction].join(':'); Sprite.animation = ['moving', direction].join(':');
const directionMap = {0: 'right', 1: 'down', 2: 'left', 3: 'up'}; const directionMap = {0: 'right', 1: 'down', 2: 'left', 3: 'up'};

View File

@ -0,0 +1,14 @@
{
"icon": "/resources/tomato-seeds/icon.png",
"label": "Tomato Seeds",
"projection": {
"distance": [1, -1],
"grid": [
[1, 1, 1],
[1, 1, 1],
[1, 1, 1]
]
},
"projectionCheck": "/resources/tomato-seeds/projection-check.js",
"start": "/resources/tomato-seeds/start.js"
}

View File

@ -0,0 +1,3 @@
{
"icon": "/resources/tomato/tomato.png"
}

View File

Before

Width:  |  Height:  |  Size: 570 B

After

Width:  |  Height:  |  Size: 570 B

View File

Before

Width:  |  Height:  |  Size: 683 B

After

Width:  |  Height:  |  Size: 683 B

View File

@ -10,7 +10,7 @@ if (projected?.length > 0) {
const [, direction] = Sprite.animation.split(':') const [, direction] = Sprite.animation.split(':')
Sprite.animation = ['idle', direction].join(':'); Sprite.animation = ['idle', direction].join(':');
Sound.play('/assets/watering-can/water.wav'); Sound.play('/resources/watering-can/water.wav');
for (const {x, y} of projected) { for (const {x, y} of projected) {
Emitter.emit({ Emitter.emit({

View File

@ -0,0 +1,14 @@
{
"icon": "/resources/watering-can/icon.png",
"label": "Watering Can",
"projectionCheck": "/resources/watering-can/projection-check.js",
"projection": {
"distance": [3, -1],
"grid": [
[1, 1, 1],
[1, 1, 1],
[1, 1, 1]
]
},
"start": "/resources/watering-can/start.js"
}

View File

@ -85,6 +85,12 @@ else {
); );
} }
// silphius resources
app.use(
'/resources',
express.static('resources', { maxAge: '1h' }),
);
// Everything else (like favicon.ico) is cached for an hour. You may want to be // Everything else (like favicon.ico) is cached for an hour. You may want to be
// more aggressive with this caching. // more aggressive with this caching.
app.use(express.static('build/client', { maxAge: '1h' })); app.use(express.static('build/client', { maxAge: '1h' }));

View File

@ -6,7 +6,7 @@ import Hotbar from '@/react/components/hotbar.jsx';
import DomDecorator from './dom-decorator.jsx'; import DomDecorator from './dom-decorator.jsx';
const slots = Array(10).fill({}); const slots = Array(10).fill({});
slots[2] = {qty: 24, icon: '/assets/potion/icon.png'}; slots[2] = {qty: 24, icon: '/resources/potion/icon.png'};
export default { export default {
title: 'Dom/Inventory/Hotbar', title: 'Dom/Inventory/Hotbar',

View File

@ -31,7 +31,7 @@ export default {
}, },
}, },
args: { args: {
icon: '/assets/potion/icon.png', icon: '/resources/potion/icon.png',
}, },
}; };