Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "fix: item usage under players and doors" #3248

Merged
merged 1 commit into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion data/scripts/actions/objects/cask_and_kegs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ local targetIdList = {
local flasks = Action()

function flasks.onUse(player, item, fromPosition, target, toPosition, isHotkey)
if not target or not target:isItem() then
if not target or not target:getItem() then
return false
end

Expand Down
20 changes: 3 additions & 17 deletions src/items/tile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1876,25 +1876,11 @@ std::shared_ptr<Item> Tile::getUseItem(int32_t index) const {
return ground;
}

if (index >= 0 && index < static_cast<int32_t>(items->size())) {
if (const auto &thing = getThing(index)) {
if (auto thingItem = thing->getItem()) {
return thingItem;
}
}
}

if (auto topDownItem = getTopDownItem()) {
return topDownItem;
if (const auto &thing = getThing(index)) {
return thing->getItem();
}

for (auto it = items->rbegin(), end = items->rend(); it != end; ++it) {
if ((*it)->getDoor()) {
return (*it)->getItem();
}
}

return !items->empty() ? *items->begin() : nullptr;
return nullptr;
}

std::shared_ptr<Item> Tile::getDoorItem() const {
Expand Down
Loading