mirror of
https://github.com/danbulant/flying-squid
synced 2026-07-07 20:20:50 +00:00
Items now stack
This commit is contained in:
parent
06eda4e2fc
commit
c01c0b9cb4
1 changed files with 5 additions and 2 deletions
|
|
@ -264,9 +264,12 @@ module.exports.entity=function(entity,serv){
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add it to a stack already in the player's inventory if possible
|
// 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){
|
if(item.type == collectEntity.itemId){
|
||||||
item.stackSize += 1
|
item.count += 1
|
||||||
|
entity.inventory.updateSlot(itemKey, item)
|
||||||
collectEntity._writeOthersNearby('collect', {
|
collectEntity._writeOthersNearby('collect', {
|
||||||
collectedEntityId: collectEntity.id,
|
collectedEntityId: collectEntity.id,
|
||||||
collectorEntityId: entity.id
|
collectorEntityId: entity.id
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue