28 lines
1.1 KiB
JavaScript
28 lines
1.1 KiB
JavaScript
import { activateMods } from './src/games/starve/mods/registry.js'
|
|
|
|
const laborRt2 = activateMods(['labor'])
|
|
console.log('berry item =', JSON.stringify(laborRt2.items.berry))
|
|
console.log('wheat item =', !!laborRt2.items.wheat)
|
|
|
|
const office = { type: 'laboroffice', id: 5 }
|
|
laborRt2.entKinds.laboroffice.init(office); office.mx.farmer = 1
|
|
const wh = { type: 'laborwarehouse', x: 0, y: 0, id: 6 }
|
|
laborRt2.entKinds.laborwarehouse.init(wh)
|
|
wh.mx.boxes[0].items.berry = 10
|
|
console.log('boxes[0] =', JSON.stringify(wh.mx.boxes[0].items))
|
|
|
|
const players = [{ x: 0, y: 0, dead: false, seat: 0, slots: [], pack: null }]
|
|
const g = {
|
|
entities: [office, wh],
|
|
monsters: [{ kind: 'laborfarmer', x: 0, y: 0, id: 901, office: 5 }],
|
|
players,
|
|
mon: laborRt2.mon,
|
|
items: laborRt2.items,
|
|
me: () => players[0],
|
|
markDirty() {}, tip() {}, ptip() {},
|
|
}
|
|
const hooks = (laborRt2.hooks.onNewDay || [])
|
|
console.log('onNewDay hooks =', hooks.map((h) => h.id))
|
|
hooks.forEach((h) => h.fn(g))
|
|
console.log('after onNewDay strike =', g.monsters[0].strike, 'berry =', wh.mx.boxes.reduce((n, b) => n + (b.items.berry || 0), 0))
|