mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-27 17:28:41 +00:00
Add wear bar color API (#13328)
--------- Co-authored-by: Muhammad Rifqi Priyo Susanto <muhammadrifqipriyosusanto@gmail.com> Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com> Co-authored-by: grorp <gregor.parzefall@posteo.de>
This commit is contained in:
parent
e10d8080ba
commit
176e674a51
19 changed files with 598 additions and 26 deletions
|
@ -131,6 +131,15 @@ struct ItemStack
|
|||
return metadata.getToolCapabilities(*item_cap); // Check for override
|
||||
}
|
||||
|
||||
const std::optional<WearBarParams> &getWearBarParams(
|
||||
const IItemDefManager *itemdef) const
|
||||
{
|
||||
auto &meta_override = metadata.getWearBarParamOverride();
|
||||
if (meta_override.has_value())
|
||||
return meta_override;
|
||||
return itemdef->get(name).wear_bar_params;
|
||||
}
|
||||
|
||||
// Wear out (only tools)
|
||||
// Returns true if the item is (was) a tool
|
||||
bool addWear(s32 amount, const IItemDefManager *itemdef)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue