From 83dbcc3c50aa8a21831db46b2092bbbea59a8a21 Mon Sep 17 00:00:00 2001 From: Piotr Rogowski Date: Tue, 11 Feb 2020 12:58:39 +0100 Subject: [PATCH] fix(processor): use data object in EVENT_OBJECT_DESTROYED Every other event uses data subobject for keeping details about event except EVENT_OBJECT_DESTROYED This change makes that consistent with other events --- src/processor/intents/_damage.js | 4 +++- src/processor/intents/creeps/_die.js | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/processor/intents/_damage.js b/src/processor/intents/_damage.js index f94e1f1f..27d22672 100644 --- a/src/processor/intents/_damage.js +++ b/src/processor/intents/_damage.js @@ -48,7 +48,9 @@ module.exports = function(object, target, damage, attackType, scope) { require('./structures/_destroy')(target, scope, attackType); - eventLog.push({event: C.EVENT_OBJECT_DESTROYED, objectId: target._id, type: object.type}); + eventLog.push({event: C.EVENT_OBJECT_DESTROYED, objectId: target._id, data: { + type: object.type + }}); } } else { diff --git a/src/processor/intents/creeps/_die.js b/src/processor/intents/creeps/_die.js index 8cc5c087..3b8dd346 100644 --- a/src/processor/intents/creeps/_die.js +++ b/src/processor/intents/creeps/_die.js @@ -94,7 +94,7 @@ module.exports = function(object, dropRate, violentDeath, {roomObjects, bulk, st bulk.insert(tombstone); } - eventLog.push({event: C.EVENT_OBJECT_DESTROYED, objectId: object._id, type: 'creep'}); + eventLog.push({event: C.EVENT_OBJECT_DESTROYED, objectId: object._id, data: {type: 'creep'}}); if (violentDeath && stats && object.user != '3' && object.user != '2') { stats.inc('creepsLost', object.user, object.body.length);