Explorar el Código

node now crashes on promise rejections and added mudfish

tags/v0.4^2
Shaun Kichenbrand hace 4 años
padre
commit
a3c2d880e6
Se han modificado 9 ficheros con 70 adiciones y 25 borrados
  1. +2
    -1
      src/server/components/workbench.js
  2. +2
    -2
      src/server/config/herbs.js
  3. +35
    -1
      src/server/config/maps/sewer/map.json
  4. +6
    -0
      src/server/config/maps/sewer/zone.js
  5. +1
    -1
      src/server/config/recipes/recipes.js
  6. +2
    -1
      src/server/index.js
  7. +1
    -1
      src/server/world/map.js
  8. +1
    -1
      src/server/world/resourceSpawner.js
  9. +20
    -17
      src/server/world/worker.js

+ 2
- 1
src/server/components/workbench.js Ver fichero

@@ -87,7 +87,8 @@ module.exports = {

const unlocked = await io.getAsync({
key: obj.name,
table: 'recipes'
table: 'recipes',
isArray: true
});

this.obj.instance.syncer.queue('onOpenWorkbench', {


+ 2
- 2
src/server/config/herbs.js Ver fichero

@@ -26,9 +26,9 @@ module.exports = {
baseWeight: 3,
ttl: 30
},
'Stink Carp': {
Mudfish: {
sheetName: 'objects',
itemSprite: [11, 0],
itemSprite: [11, 3],
baseWeight: 5,
ttl: 30
}


+ 35
- 1
src/server/config/maps/sewer/map.json Ver fichero

@@ -588,6 +588,40 @@
"width":96,
"x":192,
"y":880
},
{
"height":32,
"id":897,
"name":"mudfish school",
"properties":[
{
"name":"resource",
"type":"string",
"value":"Mudfish"
}],
"rotation":0,
"type":"",
"visible":true,
"width":24,
"x":440,
"y":648
},
{
"height":40,
"id":898,
"name":"mudfish school",
"properties":[
{
"name":"resource",
"type":"string",
"value":"Mudfish"
}],
"rotation":0,
"type":"",
"visible":true,
"width":40,
"x":280,
"y":256
}],
"opacity":1,
"type":"objectgroup",
@@ -1058,7 +1092,7 @@
"y":0
}],
"nextlayerid":12,
"nextobjectid":895,
"nextobjectid":899,
"orientation":"orthogonal",
"properties":[
{


+ 6
- 0
src/server/config/maps/sewer/zone.js Ver fichero

@@ -61,6 +61,7 @@ module.exports = {
drops: {
rolls: 1,
noRandom: true,
chance: 100,
alsoRandom: true,
blueprints: [{
chance: 0.5,
@@ -149,6 +150,11 @@ module.exports = {
}
},
objects: {
'mudfish school': {
max: 9,
type: 'fish',
quantity: [6, 12]
},
sewerdoor: {
properties: {
cpnDoor: {


+ 1
- 1
src/server/config/recipes/recipes.js Ver fichero

@@ -21,7 +21,7 @@ module.exports = {
events.emit('onBeforeGetRecipes', recipes);
},

getList: function (type, unlocked = []) {
getList: function (type, unlocked) {
return (recipes[type] || [])
.filter(r => {
let hasUnlocked = (r.default !== false);


+ 2
- 1
src/server/index.js Ver fichero

@@ -23,7 +23,8 @@ let startup = {

onDbReady: async function () {
await fixes.fixDb();

process.on('unhandledRejection', this.onError.bind(this));
process.on('uncaughtException', this.onError.bind(this));

animations.init();


+ 1
- 1
src/server/world/map.js Ver fichero

@@ -388,7 +388,7 @@ module.exports = {
});

room.exits.push(blueprint);
} else if (blueprint.properties.resource)
} else if (blueprint.properties.resource)
resourceSpawner.register(blueprint.properties.resource, blueprint);
else {
blueprint.exits = [];


+ 1
- 1
src/server/world/resourceSpawner.js Ver fichero

@@ -9,7 +9,7 @@ module.exports = {
physics: null,
map: null,

cdMax: 171,
cdMax: 1,

init: function (instance) {
Object.assign(this, {


+ 20
- 17
src/server/world/worker.js Ver fichero

@@ -40,28 +40,31 @@ let onModsReady = function () {
components.init(onCpnsReady);
};

let onDbReady = function () {
require('../misc/random');
const onCrash = async e => {
if (e.toString().indexOf('ERR_IPC_CHANNEL_CLOSED') > -1)
return;

mods.init(onModsReady);
_.log('Error Logged: ' + e.toString());
_.log(e.stack);

process.on('uncaughtException', async function (e) {
if (e.toString().indexOf('ERR_IPC_CHANNEL_CLOSED') > -1)
return;
await io.setAsync({
key: new Date(),
table: 'error',
value: e.toString() + ' | ' + e.stack.toString()
});

process.send({
event: 'onCrashed'
});
};

_.log('Error Logged: ' + e.toString());
_.log(e.stack);
let onDbReady = function () {
require('../misc/random');

await io.setAsync({
key: new Date(),
table: 'error',
value: e.toString() + ' | ' + e.stack.toString()
});
mods.init(onModsReady);

process.send({
event: 'onCrashed'
});
});
process.on('uncaughtException', onCrash);
process.on('unhandledRejection', onCrash);
};

io.init(onDbReady);


Cargando…
Cancelar
Guardar