BROKEN: Big refactoring happening, so it compiles but game does not run and the tests fail.

This commit is contained in:
Zed A. Shaw 2025-02-08 14:03:09 -05:00
parent 96efc990c1
commit 9e91c71125
25 changed files with 128 additions and 526 deletions

View file

@ -3,43 +3,38 @@
#include "devices.hpp"
#include "combat.hpp"
#include "inventory.hpp"
#include "tser.hpp"
#include "config.hpp"
namespace components {
struct Player {
DinkyECS::Entity entity;
DEFINE_SERIALIZABLE(Player, entity);
};
struct Position {
Point location;
DEFINE_SERIALIZABLE(Position, location);
};
struct Motion {
int dx;
int dy;
bool random=false;
DEFINE_SERIALIZABLE(Motion, dx, dy);
};
struct Loot {
int amount;
DEFINE_SERIALIZABLE(Loot, amount);
};
struct Tile {
std::string chr;
std::array<uint8_t, 3> foreground;
std::array<uint8_t, 3> background;
uint8_t fg_h = 200;
uint8_t fg_s = 20;
uint8_t fg_v = 200;
uint8_t bg_h = 100;
uint8_t bg_s = 20;
uint8_t bg_v = 0;
DEFINE_SERIALIZABLE(Tile, chr);
};
struct GameConfig {
@ -66,6 +61,13 @@ namespace components {
struct Curative {
int hp = 10;
};
void configure(DinkyECS::World &world, DinkyECS::Entity entity, json& entity_data);
}
DINKY_HAS_COMPONENT(components::Loot, amount);
DINKY_HAS_COMPONENT(Point, x, y);
DINKY_HAS_COMPONENT(components::Position, location);
DINKY_HAS_COMPONENT(components::Weapon, damage);
DINKY_HAS_COMPONENT(components::Curative, hp);
DINKY_HAS_COMPONENT(components::EnemyConfig, hearing_distance);
DINKY_HAS_COMPONENT(components::Tile, chr, foreground, background);
DINKY_HAS_COMPONENT(components::Motion, dx, dy, random);