refactor: alpha hmr
This commit is contained in:
parent
a7c121bae8
commit
35d77efc4c
|
@ -58,6 +58,9 @@ export default async (room, latus) => {
|
||||||
[0, 0, w, h],
|
[0, 0, w, h],
|
||||||
Plains.children[1].matrix,
|
Plains.children[1].matrix,
|
||||||
);
|
);
|
||||||
|
if (Object.keys(room.layer(3).entities).length > 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
for (let y = 0; y < 64; ++y) {
|
for (let y = 0; y < 64; ++y) {
|
||||||
for (let x = 0; x < 64; ++x) {
|
for (let x = 0; x < 64; ++x) {
|
||||||
let v = noise(Vector.scale([x, y], 5), seed);
|
let v = noise(Vector.scale([x, y], 5), seed);
|
||||||
|
|
|
@ -7,6 +7,11 @@ import UniverseInput from './packets/decorators/universe-input';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
hooks: {
|
hooks: {
|
||||||
|
'@latus/core/hmr': (path, latus) => {
|
||||||
|
if ('@humus/universe/server' === path) {
|
||||||
|
alpha(latus.get('%universe').room('players/cha0s/index.room.json'), latus);
|
||||||
|
}
|
||||||
|
},
|
||||||
'@latus/core/server/up': async (latus) => {
|
'@latus/core/server/up': async (latus) => {
|
||||||
const {root} = latus.get('@humus/universe');
|
const {root} = latus.get('@humus/universe');
|
||||||
const {running} = latus.get('@humus/universe/server');
|
const {running} = latus.get('@humus/universe/server');
|
||||||
|
@ -20,7 +25,6 @@ export default {
|
||||||
try {
|
try {
|
||||||
const {Universe} = latus.get('%resources');
|
const {Universe} = latus.get('%resources');
|
||||||
const universe = await Universe.load({extends: `/universe/${running}/index.universe.json`});
|
const universe = await Universe.load({extends: `/universe/${running}/index.universe.json`});
|
||||||
// alpha gen
|
|
||||||
alpha(universe.room('players/cha0s/index.room.json'), latus);
|
alpha(universe.room('players/cha0s/index.room.json'), latus);
|
||||||
latus.set('%universe', universe);
|
latus.set('%universe', universe);
|
||||||
universe.start();
|
universe.start();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user