move ecs related code to own folder

This commit is contained in:
2026-05-25 08:46:58 +02:00
parent 8ad7530740
commit 25ff3c56c5
54 changed files with 877 additions and 680 deletions

View File

@@ -0,0 +1,36 @@
#pragma once
#include <optional>
#include <vector>
#include <QVector2D>
#include "Tick.h"
#include "entt/entity/entity.hpp"
class EntityAdmin;
struct ScrapInfo
{
entt::entity entity;
QVector2D position;
};
class ScrapSystem
{
public:
explicit ScrapSystem(EntityAdmin& admin);
entt::entity spawn(QVector2D position, int amount, Tick despawnAt);
void tickDespawn(Tick currentTick);
// Removes the scrap and returns its amount, or nullopt if not found.
std::optional<int> consume(entt::entity entity);
// Lightweight snapshot for callers that need to iterate all scrap.
std::vector<ScrapInfo> allScrapInfo() const;
private:
EntityAdmin& m_admin;
};