shared logic refactor notes
Guide for shared logic refactor notes
Shared Logic Refactor Log
Date: 2026-01-11
Status: Reverted by User Request
Objective
The goal was to move shared map definitions from
loh-game to loh-libs (shared-protocol) to enable server-side parsing of map data and support a headless architecture.Changes Made (and Reverted)
1. Created loh-libs/rust/shared-protocol/src/types/map.rs
Moved the following types from
loh-game to this new module:PrefabType(with new variants likeShield,Structure Sets,Ores)TileType(originallycrate::systems::world::TileType)SpawnPointType(originallycrate::systems::editor::state::SpawnPointType)SavedObject,SavedTile,SavedSpawnPoint(DTOs)MapData
2. Updated shared-protocol
- Added
pub mod map;totypes/mod.rs. - Added
cfg_attr(feature = "bevy", derive(bevy::reflect::Reflect))to shared types to allowloh-game(which depends onbevy) to use them in the Inspector.
3. Modified loh-game
src/systems/map.rs: Removed local definitions ofPrefabType,MapData, etc. Imported them fromshared_protocol::types::map.src/systems/editor/state.rs: RemovedSpawnPointTypedefinition. Imported fromshared_protocol.src/systems/world/tiles.rs: RemovedTileTypedefinition. Imported fromshared_protocol.src/systems/editor/input.rs: FixedSpawnPointinitialization to includerespawn_time(This fix was retained as it is valid for local types too if fields match).src/bin/editor.rs: RestoredRenderPluginconfiguration to fix unstable GPU backend issues (This change was likely beneficial and might be kept if unrelated to refactor, but strict revert applies).
Current State
The codebase has been reverted to defined these types locally in
loh-game to ensure stability and match the user's request. The refactor is documented here for future implementation when the server architecture requires it.