move 'player.pick' binding handler to Lua
This commit is contained in:
@@ -341,28 +341,6 @@ static int determine_rotation(
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void pick_block(
|
||||
ContentIndices* indices,
|
||||
const Block& block,
|
||||
Player& player,
|
||||
int x,
|
||||
int y,
|
||||
int z
|
||||
) {
|
||||
itemid_t id = block.rt.pickingItem;
|
||||
auto inventory = player.getInventory();
|
||||
size_t slotid = inventory->findSlotByItem(id, 0, 10);
|
||||
if (slotid == Inventory::npos) {
|
||||
slotid = player.getChosenSlot();
|
||||
} else {
|
||||
player.setChosenSlot(slotid);
|
||||
}
|
||||
ItemStack& stack = inventory->getSlot(slotid);
|
||||
if (stack.getItemId() != id) {
|
||||
stack.set(ItemStack(id, 1));
|
||||
}
|
||||
}
|
||||
|
||||
voxel* PlayerController::updateSelection(float maxDistance) {
|
||||
auto indices = level.content->getIndices();
|
||||
auto& chunks = *player.chunks;
|
||||
@@ -568,10 +546,6 @@ void PlayerController::updateInteraction(float delta) {
|
||||
if (def && rclick) {
|
||||
processRightClick(*def, target);
|
||||
}
|
||||
if (Events::jactive(BIND_PLAYER_PICK)) {
|
||||
auto coord = selection.actualPosition;
|
||||
pick_block(indices, target, player, coord.x, coord.y, coord.z);
|
||||
}
|
||||
}
|
||||
|
||||
Player* PlayerController::getPlayer() {
|
||||
|
||||
Reference in New Issue
Block a user