mirror of
https://github.com/zhenyan121/Cubed.git
synced 2026-08-08 17:57:02 +08:00
refactor(localization): switch block translations to item naming
Remove the `name_key` field from block definitions and use item-based localization keys (`item.*.name`) for inventory display. Item data now stores the localized name at load time.
This commit is contained in:
@@ -42,7 +42,6 @@ struct LookBlock {
|
||||
|
||||
struct BlockData {
|
||||
std::string name;
|
||||
std::string name_key;
|
||||
BlockType id = 0;
|
||||
|
||||
bool is_liquid = false;
|
||||
@@ -56,17 +55,14 @@ struct BlockData {
|
||||
bool is_blend = false;
|
||||
bool is_transitional = false;
|
||||
float roughness = 1.0f;
|
||||
BlockData(std::string_view b_name, std::string_view name_k, BlockType b_id,
|
||||
bool liquid, bool passable, bool cross_plane, bool transparent,
|
||||
bool gas, bool discard, bool blend, bool transitional, float r)
|
||||
: name(b_name), name_key(name_k), id(b_id), is_liquid(liquid),
|
||||
is_gas(gas), is_passable(passable), is_cross_plane(cross_plane),
|
||||
BlockData(std::string_view b_name, BlockType b_id, bool liquid,
|
||||
bool passable, bool cross_plane, bool transparent, bool gas,
|
||||
bool discard, bool blend, bool transitional, float r)
|
||||
: name(b_name), id(b_id), is_liquid(liquid), is_gas(gas),
|
||||
is_passable(passable), is_cross_plane(cross_plane),
|
||||
is_transparent(transparent), is_discard(discard), is_blend(blend),
|
||||
is_transitional(transitional), roughness(r) {}
|
||||
BlockData() {
|
||||
name = "";
|
||||
name_key = "";
|
||||
}
|
||||
BlockData() { name = ""; }
|
||||
};
|
||||
|
||||
} // namespace Cubed
|
||||
@@ -11,7 +11,6 @@ public:
|
||||
static unsigned sums();
|
||||
static unsigned cross_plane_sum();
|
||||
static const std::string& name_form_id(BlockType id);
|
||||
static std::string local_name(BlockType id);
|
||||
static bool is_gas(BlockType id);
|
||||
static bool is_liquid(BlockType id);
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ using ItemProperty = std::variant<BlockType, std::string>;
|
||||
struct ItemData {
|
||||
ItemID id = 0;
|
||||
std::string name;
|
||||
std::string local_name;
|
||||
std::string description;
|
||||
std::string path;
|
||||
ItemKind kind = ItemKind::NONE;
|
||||
|
||||
Reference in New Issue
Block a user