Add no_change_anim group
This commit is contained in:
parent
d2408a9324
commit
d12f19fabf
@ -1708,6 +1708,8 @@ to games.
|
|||||||
|
|
||||||
### Node, item and tool groups
|
### Node, item and tool groups
|
||||||
|
|
||||||
|
* `no_change_anim`: Disables the wielditem changing animation when switching
|
||||||
|
to the item in the hotbar.
|
||||||
* `not_in_creative_inventory`: (*) Special group for inventory mods to indicate
|
* `not_in_creative_inventory`: (*) Special group for inventory mods to indicate
|
||||||
that the item should be hidden in item lists.
|
that the item should be hidden in item lists.
|
||||||
|
|
||||||
|
@ -648,17 +648,22 @@ void Camera::setDigging(s32 button)
|
|||||||
m_digging_button = button;
|
m_digging_button = button;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Camera::wield(const ItemStack &item)
|
void Camera::wield(const ItemStack &item, const bool no_change_anim)
|
||||||
{
|
{
|
||||||
if (item.name != m_wield_item_next.name ||
|
if (item.name != m_wield_item_next.name ||
|
||||||
item.metadata != m_wield_item_next.metadata) {
|
item.metadata != m_wield_item_next.metadata) {
|
||||||
m_wield_item_next = item;
|
m_wield_item_next = item;
|
||||||
if (m_wield_change_timer > 0)
|
if (no_change_anim) {
|
||||||
|
// Change items immediately
|
||||||
|
m_wieldnode->setItem(item, m_client);
|
||||||
|
m_wield_change_timer = 0.125f;
|
||||||
|
} else if (m_wield_change_timer > 0) {
|
||||||
m_wield_change_timer = -m_wield_change_timer;
|
m_wield_change_timer = -m_wield_change_timer;
|
||||||
else if (m_wield_change_timer == 0)
|
} else if (m_wield_change_timer == 0) {
|
||||||
m_wield_change_timer = -0.001;
|
m_wield_change_timer = -0.001;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Camera::drawWieldedTool(irr::core::matrix4* translation)
|
void Camera::drawWieldedTool(irr::core::matrix4* translation)
|
||||||
{
|
{
|
||||||
|
@ -154,7 +154,7 @@ public:
|
|||||||
void setDigging(s32 button);
|
void setDigging(s32 button);
|
||||||
|
|
||||||
// Replace the wielded item mesh
|
// Replace the wielded item mesh
|
||||||
void wield(const ItemStack &item);
|
void wield(const ItemStack &item, const bool no_change_anim);
|
||||||
|
|
||||||
// Draw the wielded tool.
|
// Draw the wielded tool.
|
||||||
// This has to happen *after* the main scene is drawn.
|
// This has to happen *after* the main scene is drawn.
|
||||||
|
@ -3948,7 +3948,8 @@ void Game::updateFrame(ProfilerGraph *graph, RunStats *stats, f32 dtime,
|
|||||||
// Update wielded tool
|
// Update wielded tool
|
||||||
ItemStack selected_item, hand_item;
|
ItemStack selected_item, hand_item;
|
||||||
ItemStack &tool_item = player->getWieldedItem(&selected_item, &hand_item);
|
ItemStack &tool_item = player->getWieldedItem(&selected_item, &hand_item);
|
||||||
camera->wield(tool_item);
|
const ItemDefinition &item_def = tool_item.getDefinition(itemdef_manager);
|
||||||
|
camera->wield(tool_item, itemgroup_get(item_def.groups, "no_change_anim") > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user