1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-10-30 06:55:33 +01:00

Add inventory image animation API (#16538)

This commit is contained in:
cx384
2025-10-26 18:48:53 +01:00
committed by GitHub
parent dde463635e
commit 93ccb4b355
23 changed files with 606 additions and 227 deletions

View File

@@ -16,6 +16,7 @@
#include "tool.h"
#include "util/pointabilities.h"
#include "util/pointedthing.h"
#include "tileanimation.h"
struct ToolCapabilities;
struct ItemDefinition;
@@ -56,6 +57,28 @@ struct TouchInteraction
void deSerialize(std::istream &is);
};
struct ItemImageDef
{
// May be extended to support meshes in the future
std::string name;
TileAnimationParams animation;
ItemImageDef &operator=(const std::string &other_name)
{
this->name = other_name;
return *this;
}
void reset()
{
animation.type = TileAnimationType::TAT_NONE;
name.clear();
}
void serialize(std::ostream &os, u16 protocol_version) const;
void deSerialize(std::istream &is, u16 protocol_version);
};
struct ItemDefinition
{
/*
@@ -69,10 +92,10 @@ struct ItemDefinition
/*
Visual properties
*/
std::string inventory_image; // Optional for nodes, mandatory for tools/craftitems
std::string inventory_overlay; // Overlay of inventory_image.
std::string wield_image; // If empty, inventory_image or mesh (only nodes) is used
std::string wield_overlay; // Overlay of wield_image.
ItemImageDef inventory_image; // Optional for nodes, mandatory for tools/craftitems
ItemImageDef inventory_overlay; // Overlay of inventory_image.
ItemImageDef wield_image; // If empty, inventory_image or mesh (only nodes) is used
ItemImageDef wield_overlay; // Overlay of wield_image.
std::string palette_image; // If specified, the item will be colorized based on this
video::SColor color; // The fallback color of the node.
v3f wield_scale;