Game now builds and is using the new dynamic component loading but enemies do not spawn in and device events are really working. Also inventory is a giant bag of fail and needs a rewrite.

This commit is contained in:
Zed A. Shaw 2025-02-08 21:16:25 -05:00
parent 9e91c71125
commit a69be90464
23 changed files with 130 additions and 122 deletions

View file

@ -1,12 +1,11 @@
#pragma once
#include "dinkyecs.hpp"
#include "devices.hpp"
#include "combat.hpp"
#include "inventory.hpp"
#include "components.hpp"
#include "config.hpp"
#include "dinky_components.hpp"
#include "point.hpp"
namespace components {
struct Player {
DinkyECS::Entity entity;
};
@ -61,13 +60,28 @@ namespace components {
struct Curative {
int hp = 10;
};
}
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);
struct Combat {
int hp;
int damage;
/* NOTE: This is used to _mark_ entities as dead, to detect ones that have just died. Don't make attack automatically set it.*/
bool dead = false;
int attack(Combat &target);
};
struct LightSource {
int strength = 0;
float radius = 1.0f;
};
struct Device {
json config;
std::vector<std::string> events;
void configure_events(std::vector<std::string> &event_names);
};
void configure(ComponentMap& component_map);
}