Skip to content

Commit

Permalink
fix(processor): fix spawning npc drop containers
Browse files Browse the repository at this point in the history
  • Loading branch information
artch committed Oct 4, 2017
1 parent 60e4336 commit 14ddd4a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
5 changes: 0 additions & 5 deletions src/processor/intents/containers/tick.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@ var _ = require('lodash'),

module.exports = function(object, roomObjects, roomTerrain, bulk, bulkUsers, roomController, gameTime) {

if(!object._id) {
bulk.insert(object);
return;
}

if(!object.nextDecayTime || gameTime >= object.nextDecayTime-1) {
object.hits = object.hits || 0;
object.hits -= C.CONTAINER_DECAY;
Expand Down
7 changes: 3 additions & 4 deletions src/processor/intents/creeps/_create-energy.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ module.exports = function(x, y, room, amount, roomObjects, bulk, resourceType, d
hits: C.CONTAINER_HITS,
hitsMax: 0
};
roomObjects['_dropContainer'+Date.now()] = container;
container._id = bulk.insert(container);
roomObjects[container._id] = container;
}

if(container && container.hits > 0) {
Expand All @@ -37,9 +38,7 @@ module.exports = function(x, y, room, amount, roomObjects, bulk, resourceType, d
if(toContainerAmount > 0) {
container[resourceType] = container[resourceType] || 0;
container[resourceType] += toContainerAmount;
if(container._id) {
bulk.update(container, {[resourceType]: container[resourceType]});
}
bulk.update(container, {[resourceType]: container[resourceType]});
amount -= toContainerAmount;
}
}
Expand Down

0 comments on commit 14ddd4a

Please sign in to comment.