Items now stack

This commit is contained in:
C109 2015-11-23 18:21:13 -05:00
parent 06eda4e2fc
commit c01c0b9cb4

View file

@ -264,9 +264,12 @@ module.exports.entity=function(entity,serv){
}
// Add it to a stack already in the player's inventory if possible
for(var item in entity.inventory.items()){
for(var itemKey in entity.inventory.slots){
var item = entity.inventory.slots[itemKey]
if(item == undefined) continue;
if(item.type == collectEntity.itemId){
item.stackSize += 1
item.count += 1
entity.inventory.updateSlot(itemKey, item)
collectEntity._writeOthersNearby('collect', {
collectedEntityId: collectEntity.id,
collectorEntityId: entity.id