4 Commits

Author SHA1 Message Date
322fb2fea0 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.
2026-08-05 15:42:53 +08:00
277aab1b81 feat: add --direct-enter option to skip to world scene
Support a new CLI flag that launches the app directly into the world scene. If no IP is provided, it starts a local server on the specified port and connects to 127.0.0.1; otherwise it connects to the given IP. With this flag enabled, a port must be specified via -p. Also expose SceneManager::push as public so scenes can be pushed immediately when bypassing the normal menu flow.
2026-08-05 15:30:14 +08:00
30b4060fb5 perf(render): skip entities outside loaded chunks 2026-08-05 15:15:01 +08:00
0ffa2804d1 refactor(gameplay): update systems per entity with chunk check
Refactor server entity update flow to process entities individually,
skipping those whose chunk is not loaded. System update methods now
accept a single entity instead of iterating the full registry view,
and `ServerWorld::get_chunk_ref_count` is added to determine if an
entity's chunk is active.
2026-08-05 10:00:52 +08:00
36 changed files with 245 additions and 191 deletions

View File

@@ -8,5 +8,4 @@ is_passable = true
is_transitional = false
is_transparent = true
name = 'air'
name_key = 'block.air'
roughness = 1.0

View File

@@ -8,5 +8,4 @@ is_passable = false
is_transitional = true
is_transparent = false
name = 'dirt'
name_key = 'block.dirt'
roughness = 1.0

View File

@@ -8,5 +8,4 @@ is_passable = true
is_transitional = false
is_transparent = true
name = 'grass'
name_key = 'block.grass'
roughness = 0.90000000000000002

View File

@@ -8,5 +8,4 @@ is_passable = false
is_transitional = true
is_transparent = false
name = 'grass_block'
name_key = 'block.grass_block'
roughness = 0.90000000000000002

View File

@@ -8,5 +8,4 @@ is_passable = false
is_transitional = false
is_transparent = true
name = 'leaf'
name_key = 'block.leaf'
roughness = 0.69999999999999996

View File

@@ -8,5 +8,4 @@ is_passable = false
is_transitional = false
is_transparent = false
name = 'log'
name_key = 'block.log'
roughness = 0.69999999999999996

View File

@@ -8,5 +8,4 @@ is_passable = false
is_transitional = true
is_transparent = false
name = 'sand'
name_key = 'block.sand'
roughness = 0.80000000000000004

View File

@@ -8,5 +8,4 @@ is_passable = false
is_transitional = true
is_transparent = false
name = 'snowy_grass_block'
name_key = 'block.snowy_grass_block'
roughness = 0.90000000000000002

View File

@@ -8,5 +8,4 @@ is_passable = false
is_transitional = true
is_transparent = false
name = 'stone'
name_key = 'block.stone'
roughness = 0.75

View File

@@ -9,4 +9,3 @@ is_discard = false
is_blend = false
is_transitional = false
roughness = 1.0
name_key = "block.template"

View File

@@ -8,5 +8,4 @@ is_passable = true
is_transitional = false
is_transparent = true
name = 'water'
name_key = 'block.water'
roughness = 0.02

View File

@@ -36,14 +36,15 @@
"joingame.server_ip": "Server Ip",
"joingame.join_world": "Join World",
"error.disable_voice": "Server Disable Voice Chat",
"block.air": "air",
"block.dirt": "dirt",
"block.grass_block": "grass block",
"block.grass": "grass",
"block.leaf": "leaf",
"block.log": "log",
"block.sand": "sand",
"block.snowy_grass_block": "snowy grass block",
"block.stone": "stone",
"block.water": "water"
"item.air.name": "air",
"item.dirt.name": "dirt",
"item.grass_block.name": "grass block",
"item.grass.name": "grass",
"item.leaf.name": "leaf",
"item.log.name": "log",
"item.sand.name": "sand",
"item.snowy_grass_block.name": "snowy grass block",
"item.stone.name": "stone",
"item.water.name": "water",
"item.pig_spawn_egg.name": "pig spawn egg"
}

View File

@@ -36,14 +36,15 @@
"joingame.server_ip": "服务器IP",
"joingame.join_world": "加入世界",
"error.disable_voice": "服务器已禁用语音聊天",
"block.air": "空气",
"block.dirt": "泥土",
"block.grass_block": "草方块",
"block.grass": "草",
"block.leaf": "树叶",
"block.log": "原木",
"block.sand": "沙子",
"block.snowy_grass_block": "覆雪草方块",
"block.stone": "石头",
"block.water": "水"
"item.air.name": "空气",
"item.dirt.name": "泥土",
"item.grass_block.name": "草方块",
"item.grass.name": "草",
"item.leaf.name": "树叶",
"item.log.name": "原木",
"item.sand.name": "沙子",
"item.snowy_grass_block.name": "覆雪草方块",
"item.stone.name": "石头",
"item.water.name": "水",
"item.pig_spawn_egg.name": "猪猪刷怪蛋"
}

View File

@@ -13,5 +13,6 @@ struct Argument {
std::optional<int> log_level;
std::optional<bool> enable_filelog;
std::optional<bool> enable_consolelog;
std::optional<bool> direct_enter;
};
} // namespace Cubed

View File

@@ -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

View File

@@ -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);

View File

@@ -94,6 +94,9 @@ public:
void receive_voice_message(VoiceMsg& msg);
bool enable_voice_chat() const;
int get_per_tick_time() const override;
bool is_render(const glm::vec3& pos) const;
template <typename Fn>
void register_timer(std::string_view id, float threshold, Fn&& f) {
m_timers.emplace(std::piecewise_construct,

View File

@@ -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;

View File

@@ -44,9 +44,10 @@ private:
void handle_entity_destory(EntityID id);
void handle_task();
void send_all_entities(std::shared_ptr<Session>& session);
void update_ai();
void update_move();
void update_send();
void update_ai(entt::entity e);
void update_move(entt::entity e);
void update_send(entt::entity e,
std::span<std::shared_ptr<Session>> sessions);
template <typename... Args>
EntityID create_entity_in_factory(Args&&... args) {
auto entity = m_registry.create();

View File

@@ -94,6 +94,8 @@ public:
std::vector<std::shared_ptr<Session>> get_all_session() const;
uint32_t get_chunk_ref_count(const glm::vec3& pos) const;
int get_block(const glm::ivec3& block_pos) const override;
bool is_solid(const glm::ivec3& block_pos) const override;
bool can_pass_block(const glm::ivec3& block_pos) const override;

View File

@@ -8,7 +8,8 @@ class PhysicalSystem {
public:
static glm::vec3 get_move_distance(const TickVelocity& v);
static void update(ServerWorld& world, entt::registry& registry);
static void update(ServerWorld& world, entt::registry& registry,
entt::entity e);
private:
};

View File

@@ -4,7 +4,7 @@
namespace Cubed {
class SpeedSystem {
public:
static void update(float dt, entt::registry& registry);
static void update(float dt, entt::registry& registry, entt::entity e);
private:
};

View File

@@ -6,7 +6,7 @@
namespace Cubed {
class WanderAISystem {
public:
static void update(entt::registry& registry);
static void update(entt::registry& registry, entt::entity e);
private:
static void do_ai(BaseServerCreature& creature, MoveBoost& move_boost);

View File

@@ -36,6 +36,7 @@ public:
App& app();
WorldSceneParam& world_scene_param();
void push(SceneType type);
private:
enum class OperationType { PUSH, POP, CHANGE };
@@ -51,7 +52,7 @@ private:
std::stack<std::unique_ptr<Scene>> m_scenes;
void process_operation();
void change(SceneType type);
void push(SceneType type);
void pop(bool re_enter = true);
std::unique_ptr<Scene> create_scene(SceneType);

View File

@@ -90,7 +90,14 @@ void App::init(int argc, char** argv) {
m_texture_manager.init_texture();
Logger::info("Texture Load Success");
m_scene_manager.request_push(SceneType::MAIN_MENU);
m_scene_manager.push(SceneType::MAIN_MENU);
if (m_argument.direct_enter) {
if (m_argument.port) {
m_scene_manager.request_push(SceneType::WORLD);
} else {
throw std::runtime_error("You need use -p to specify a port");
}
}
last_tick = SDL_GetTicks();
current_tick = SDL_GetTicks();
{
@@ -181,7 +188,9 @@ void App::handle_argument(int argc, char** argv) {
{"--enable-filelog",
[&](ArgParser&) { m_argument.enable_filelog = true; }},
{"--enale-consolelog",
[&](ArgParser&) { m_argument.enable_consolelog = true; }}
[&](ArgParser&) { m_argument.enable_consolelog = true; }},
{"--direct-enter",
[&](ArgParser&) { m_argument.direct_enter = true; }}
};
ArgParser parser(argc, argv);

View File

@@ -1,6 +1,5 @@
#include "Cubed/gameplay/block_manager.hpp"
#include "Cubed/localization.hpp"
#include "Cubed/tools/cubed_assert.hpp"
#include "Cubed/tools/log.hpp"
#include "Cubed/tools/toml.utils.hpp"
@@ -36,14 +35,6 @@ const std::string& BlockManager::name_form_id(BlockType id) {
}
return c->second.name;
}
std::string BlockManager::local_name(BlockType id) {
cacc c;
if (!m_datas.find(c, id)) {
ASSERT(false);
return EMPTY.name_key;
}
return tr(c->second.name_key);
}
bool BlockManager::is_gas(BlockType id) {
cacc c;
if (!m_datas.find(c, id)) {
@@ -160,12 +151,18 @@ void BlockManager::init() {
auto is_blend = safe_get_value(block, "is_blend", false);
auto is_transitional = safe_get_value(block, "is_transitional", false);
auto roughness = safe_get_value(block, "roughness", 1.0);
auto name_key = safe_get_value(block, "name_key", "Unknow_key");
BlockData data{
*name, *name_key, static_cast<BlockType>(*id),
*is_liquid, *is_passable, *is_cross_plane,
*is_transparent, *is_gas, *is_discard,
*is_blend, *is_transitional, static_cast<float>(*roughness)};
BlockData data{*name,
static_cast<BlockType>(*id),
*is_liquid,
*is_passable,
*is_cross_plane,
*is_transparent,
*is_gas,
*is_discard,
*is_blend,
*is_transitional,
static_cast<float>(*roughness)};
if (!m_datas.emplace(static_cast<BlockType>(*id), std::move(data))) {
Logger::error("Block Type {} already exist!", *id);

View File

@@ -725,6 +725,13 @@ void ClientWorld::receive_voice_message(VoiceMsg& msg) {
}
bool ClientWorld::enable_voice_chat() const { return m_voice_chat.load(); }
int ClientWorld::get_per_tick_time() const { return m_per_tick_time; }
bool ClientWorld::is_render(const glm::vec3& pos) const {
ChunkPos p = get_chunk_pos(pos.x, pos.z);
chunk_cacc cacc;
return m_chunks.find(cacc, p);
}
void ClientWorld::send_chat_message(ChatMessage& message) {
Arena arena;
auto msg = Arena::Create<ChatMsg>(&arena);

View File

@@ -1,6 +1,7 @@
#include "Cubed/gameplay/item_manager.hpp"
#include "Cubed/gameplay/block_manager.hpp"
#include "Cubed/localization.hpp"
#include "Cubed/tools/cubed_assert.hpp"
#include "Cubed/tools/log.hpp"
@@ -76,6 +77,7 @@ void ItemManager::add(const std::filesystem::path& path) {
data.property = "cubed:pig";
}
}
data.local_name = tr(std::format("item.{}.name", data.name));
acc a;
if (m_map.emplace(a, data.id, std::move(data))) {
if (!m_id_map.emplace(a->second.name, a->first)) {

View File

@@ -31,37 +31,50 @@ void ServerEntityManager::init() {
}
void ServerEntityManager::update() {
handle_task();
update_ai();
update_move();
update_send();
}
void ServerEntityManager::update_ai() { WanderAISystem::update(m_registry); }
void ServerEntityManager::update_move() {
SpeedSystem::update(
static_cast<float>(m_world.get_per_tick_time()) / 1000.0f, m_registry);
PhysicalSystem::update(m_world, m_registry);
}
void ServerEntityManager::update_send() {
auto view = m_registry.view<BaseServerCreature>();
auto sessions = m_world.get_all_session();
auto view = m_registry.view<Entity, BaseServerCreature>();
for (auto& e : view) {
auto [entity, creature] = view.get<Entity, BaseServerCreature>(e);
Arena arena;
auto* p = Arena::Create<S2CEntityUpdate>(&arena);
p->set_id(entity.id);
Tools::set_net_pos(p, creature.transform.position.value);
Tools::set_net_vec3(p->mutable_direction(),
creature.transform.direction.value);
for (auto& s : sessions) {
s->send(make_packet(p));
for (auto e : view) {
const auto& c = view.get<BaseServerCreature>(e);
if (!m_world.get_chunk_ref_count(c.transform.position.value)) {
continue;
}
update_ai(e);
update_move(e);
update_send(e, sessions);
}
}
void ServerEntityManager::update_ai(entt::entity e) {
WanderAISystem::update(m_registry, e);
}
void ServerEntityManager::update_move(entt::entity e) {
SpeedSystem::update(static_cast<float>(m_world.get_per_tick_time()) /
1000.0f,
m_registry, e);
PhysicalSystem::update(m_world, m_registry, e);
}
void ServerEntityManager::update_send(
entt::entity e, std::span<std::shared_ptr<Session>> sessions) {
if (!m_registry.all_of<Entity, BaseServerCreature>(e)) {
return;
}
const auto [entity, creature] =
m_registry.get<Entity, BaseServerCreature>(e);
Arena arena;
auto* p = Arena::Create<S2CEntityUpdate>(&arena);
p->set_id(entity.id);
Tools::set_net_pos(p, creature.transform.position.value);
Tools::set_net_vec3(p->mutable_direction(),
creature.transform.direction.value);
for (auto& s : sessions) {
s->send(make_packet(p));
}
}

View File

@@ -1020,6 +1020,15 @@ std::vector<std::shared_ptr<Session>> ServerWorld::get_all_session() const {
return sessions;
}
uint32_t ServerWorld::get_chunk_ref_count(const glm::vec3& pos) const {
ChunkPos p = get_chunk_pos(pos.x, pos.z);
chunk_cacc cacc;
if (!m_chunks.find(cacc, p)) {
return 0;
}
return cacc->second.ref_count;
}
int ServerWorld::get_block(const glm::ivec3& block_pos) const {
auto [chunk_x, chunk_z] = get_chunk_pos(block_pos.x, block_pos.z);
chunk_cacc cacc;

View File

@@ -102,61 +102,62 @@ bool update_z(const glm::vec3& pos, const glm::vec3& distance,
} // namespace
void PhysicalSystem::update(ServerWorld& world, entt::registry& registry) {
void PhysicalSystem::update(ServerWorld& world, entt::registry& registry,
entt::entity e) {
auto view = registry.view<BaseServerCreature>();
for (auto e : view) {
auto& creature = view.get<BaseServerCreature>(e);
auto distance = get_move_distance(creature.velocity);
auto box = HitboxManager::hitbox(creature.hitbox);
auto& pos = creature.transform.position.value;
auto& v = creature.velocity;
bool ground =
!update_y(pos, glm::vec3{0.0f, -0.1f, 0.0f}, world, box.box);
bool stepped = false;
if (update_y(pos, distance, world, box.box)) {
pos.y += distance.y;
if (!registry.all_of<BaseServerCreature>(e)) {
return;
}
} else {
v.value.y = 0.0f;
}
if (update_x(pos, distance, world, box.box)) {
pos.x += distance.x;
auto& creature = registry.get<BaseServerCreature>(e);
auto distance = get_move_distance(creature.velocity);
auto box = HitboxManager::hitbox(creature.hitbox);
auto& pos = creature.transform.position.value;
auto& v = creature.velocity;
bool ground = !update_y(pos, glm::vec3{0.0f, -0.1f, 0.0f}, world, box.box);
bool stepped = false;
if (update_y(pos, distance, world, box.box)) {
pos.y += distance.y;
} else {
if (ground && !stepped) {
} else {
v.value.y = 0.0f;
}
if (update_x(pos, distance, world, box.box)) {
pos.x += distance.x;
glm::vec3 step_pos = pos + glm::vec3{0.0f, 1.0f, 0.0f};
if (update_x(step_pos, distance, world, box.box)) {
pos.x += distance.x;
pos.y += 1.0f;
stepped = true;
} else {
v.value.x = 0.0f;
}
} else {
if (ground && !stepped) {
glm::vec3 step_pos = pos + glm::vec3{0.0f, 1.0f, 0.0f};
if (update_x(step_pos, distance, world, box.box)) {
pos.x += distance.x;
pos.y += 1.0f;
stepped = true;
} else {
v.value.x = 0.0f;
}
}
if (update_z(pos, distance, world, box.box)) {
pos.z += distance.z;
} else {
if (ground && !stepped) {
v.value.x = 0.0f;
}
}
glm::vec3 step_pos = pos + glm::vec3{0.0f, 1.0f, 0.0f};
if (update_z(step_pos, distance, world, box.box)) {
pos.z += distance.z;
pos.y += 1.0f;
stepped = true;
if (update_z(pos, distance, world, box.box)) {
pos.z += distance.z;
} else {
if (ground && !stepped) {
glm::vec3 step_pos = pos + glm::vec3{0.0f, 1.0f, 0.0f};
if (update_z(step_pos, distance, world, box.box)) {
pos.z += distance.z;
pos.y += 1.0f;
stepped = true;
} else {
v.value.z = 0.0f;
}
} else {
v.value.z = 0.0f;
}
} else {
v.value.z = 0.0f;
}
}
}

View File

@@ -5,38 +5,38 @@
namespace Cubed {
void SpeedSystem::update(float dt, entt::registry& registry) {
auto view = registry.view<BaseServerCreature, MoveBoost>();
for (auto e : view) {
auto [creature, moveboost] = view.get<BaseServerCreature, MoveBoost>(e);
auto& v = creature.velocity.value;
if (moveboost.count <= moveboost.duration) {
++moveboost.count;
v += creature.transform.direction.value *
creature.movement.acceleration;
} else {
// Decelerated by friction in all directions
auto decay = [](float& c, float d) {
if (c > 0.0f)
c = std::max(0.0f, c - d);
else if (c < 0.0f)
c = std::min(0.0f, c + d);
};
decay(v.x, creature.movement.deceleration);
decay(v.z, creature.movement.deceleration);
}
v.y += -creature.gravity.value * dt;
auto v_clamp = [](float& c, float max) {
if (max < 0.0f) {
return; //-1 = unlimited
}
c = std::clamp(c, -max, max);
};
v_clamp(v.x, creature.velocity.max.x);
v_clamp(v.y, creature.velocity.max.y);
v_clamp(v.z, creature.velocity.max.z);
void SpeedSystem::update(float dt, entt::registry& registry, entt::entity e) {
if (!registry.all_of<BaseServerCreature, MoveBoost>(e)) {
return;
}
auto [creature, moveboost] = registry.get<BaseServerCreature, MoveBoost>(e);
auto& v = creature.velocity.value;
if (moveboost.count <= moveboost.duration) {
++moveboost.count;
v +=
creature.transform.direction.value * creature.movement.acceleration;
} else {
// Decelerated by friction in all directions
auto decay = [](float& c, float d) {
if (c > 0.0f)
c = std::max(0.0f, c - d);
else if (c < 0.0f)
c = std::min(0.0f, c + d);
};
decay(v.x, creature.movement.deceleration);
decay(v.z, creature.movement.deceleration);
}
v.y += -creature.gravity.value * dt;
auto v_clamp = [](float& c, float max) {
if (max < 0.0f) {
return; //-1 = unlimited
}
c = std::clamp(c, -max, max);
};
v_clamp(v.x, creature.velocity.max.x);
v_clamp(v.y, creature.velocity.max.y);
v_clamp(v.z, creature.velocity.max.z);
}
} // namespace Cubed

View File

@@ -10,18 +10,18 @@ constexpr double MOVE_PROBABILITY = 0.01;
} // namespace
namespace Cubed {
void WanderAISystem::update(entt::registry& registry) {
auto view =
registry.view<AIBase, WanderAITag, BaseServerCreature, MoveBoost>();
void WanderAISystem::update(entt::registry& registry, entt::entity e) {
if (!registry.all_of<AIBase, WanderAITag, BaseServerCreature, MoveBoost>(
e)) {
return;
}
for (auto e : view) {
auto [ai, creature, move_boost] =
view.get<AIBase, BaseServerCreature, MoveBoost>(e);
++ai.count;
if (ai.count >= ai.interval) {
ai.count = 0;
do_ai(creature, move_boost);
}
auto [ai, creature, move_boost] =
registry.get<AIBase, BaseServerCreature, MoveBoost>(e);
++ai.count;
if (ai.count >= ai.interval) {
ai.count = 0;
do_ai(creature, move_boost);
}
}

View File

@@ -300,6 +300,10 @@ void WorldRenderer::shadow_entity(ClientWorld& world,
auto view = registry.view<BaseClientCreature, RenderTransform>();
for (auto entity : view) {
auto& creature = view.get<BaseClientCreature>(entity);
auto pos = creature.transform.position.value;
if (!world.is_render(pos)) {
continue;
}
auto& t = view.get<RenderTransform>(entity);
float yaw = std::atan2(t.direction.value.x, t.direction.value.z);
@@ -724,6 +728,10 @@ void WorldRenderer::render_entity(ClientWorld& world) {
auto view = registry.view<BaseClientCreature, RenderTransform>();
for (auto entity : view) {
auto& creature = view.get<BaseClientCreature>(entity);
auto pos = creature.transform.position.value;
if (!world.is_render(pos)) {
continue;
}
auto& t = view.get<RenderTransform>(entity);
float yaw = std::atan2(t.direction.value.x, t.direction.value.z);
m_renderer.model_renderer().render_model(creature.model,

View File

@@ -126,22 +126,34 @@ bool WorldScene::handle_event(const Event& e) {
e);
}
void WorldScene::on_enter() {
auto& param = m_scene_manager.world_scene_param();
load_config();
m_error_ui.init();
if (param.host_game) {
if (param.seed) {
ChunkGenerator::init(*param.seed);
param.seed = std::nullopt;
} else {
ChunkGenerator::init();
}
m_server.start_server(param.port);
}
m_client = std::make_shared<NetworkClient>(m_client_world);
if (m_argument.direct_enter) {
if (!m_argument.ip) {
ChunkGenerator::init();
m_server.start_server(*m_argument.port);
m_client->start("127.0.0.1", *m_argument.port);
} else {
m_client->start(*m_argument.ip, *m_argument.port);
}
} else {
auto& param = m_scene_manager.world_scene_param();
if (param.host_game) {
if (param.seed) {
ChunkGenerator::init(*param.seed);
param.seed = std::nullopt;
} else {
ChunkGenerator::init();
}
m_server.start_server(param.port);
}
m_client->start(param.ip, param.port);
}
m_client->start(param.ip, param.port);
// init will send packet
try {

View File

@@ -109,7 +109,7 @@ void InventoryUI::update_item_info() {
if (type != 0) {
auto& data = ItemManager::get(type);
m_item_info->set_text(data.name).set_visible(true);
m_item_info->set_text(data.local_name).set_visible(true);
return true;
}
}