Procházet zdrojové kódy

Merge branch '924-destroyed-by' into 'master'

Indicate if objects were destroyed by death or by visibility

Closes #924

See merge request Isleward/isleward!592
tags/v0.11.0
Big Bad Waffle před 2 roky
rodič
revize
9af44401bd
2 změnil soubory, kde provedl 13 přidání a 4 odebrání
  1. +2
    -0
      src/server/components/stats.js
  2. +11
    -4
      src/server/world/syncer.js

+ 2
- 0
src/server/components/stats.js Zobrazit soubor

@@ -436,7 +436,9 @@ module.exports = {
obj.effects.die();
if (this.obj.spellbook)
this.obj.spellbook.die();

obj.destroyed = true;
obj.destructionEvent = 'death';

let deathAnimation = _.getDeepProperty(animations, ['mobs', obj.sheetName, obj.cell, 'death']);
if (deathAnimation) {


+ 11
- 4
src/server/world/syncer.js Zobrazit soubor

@@ -59,7 +59,7 @@ module.exports = {
continue;

let destroyed = o.destroyed;
let sync = null;
let syncSelf = null;
if (!destroyed) {
@@ -69,7 +69,8 @@ module.exports = {
} else {
sync = {
id: o.id,
destroyed: true
destroyed: true,
destructionEvent: o.destructionEvent
};

objects.removeObject(o);
@@ -112,8 +113,14 @@ module.exports = {
}

if (destroyed || !canSee) {
if (!canSee)
queueFunction({ id: oId, destroyed: true }, [ p.serverId ]);
if (!canSee) {
queueFunction({
id: oId,
destroyed: true,
destructionEvent: 'visibility'
},
[ p.serverId ]);
}

p.player.unsee(oId);
}


Načítá se…
Zrušit
Uložit