mirror of
https://github.com/danbulant/flying-squid
synced 2026-07-07 12:10:46 +00:00
Merge pull request #237 from FlyingPony/master
Inventory related stuff for #236
This commit is contained in:
commit
fffccdc127
2 changed files with 12 additions and 1 deletions
|
|
@ -67,7 +67,15 @@ module.exports.player = function(player,serv)
|
||||||
if(clickInfo.mouseButton == 0){
|
if(clickInfo.mouseButton == 0){
|
||||||
// Drop one item at slot
|
// Drop one item at slot
|
||||||
// Inventory handles removing one
|
// Inventory handles removing one
|
||||||
return;
|
|
||||||
|
const heldItem = player.inventory.slots[36+player.heldItemSlot];
|
||||||
|
serv.spawnObject(2, player.world, player.position, {
|
||||||
|
velocity: new Vec3(0, 0, 0),
|
||||||
|
itemId: heldItem.type,
|
||||||
|
itemDamage: heldItem.metadata,
|
||||||
|
pickupTime: 500,
|
||||||
|
deathTime: 60 * 5 * 100
|
||||||
|
});
|
||||||
}else{
|
}else{
|
||||||
// Drop full stack at slot
|
// Drop full stack at slot
|
||||||
// Inventory handles removing the whole stack
|
// Inventory handles removing the whole stack
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,9 @@ module.exports.player=function(player,serv)
|
||||||
pitch: 0.8
|
pitch: 0.8
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
player.inventory.slots[36+player.heldItemSlot]--;
|
||||||
|
|
||||||
if(heldItem.blockId!=323){
|
if(heldItem.blockId!=323){
|
||||||
player.changeBlock(position, id, damage);
|
player.changeBlock(position, id, damage);
|
||||||
}else if(direction==1){
|
}else if(direction==1){
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue