35 lines
843 B
C
35 lines
843 B
C
#pragma once
|
|
|
|
#include <stdint.h>
|
|
|
|
#include "flecs.h"
|
|
|
|
#include "Components/Misc.hpp"
|
|
#include "Util/Span.h"
|
|
|
|
struct Support
|
|
{
|
|
uint8_t MaxSupport{};
|
|
uint8_t SupportsAvailable{};
|
|
};
|
|
|
|
struct GroundedSupport {};
|
|
struct RequiresSupport {};
|
|
|
|
flecs::entity GetSupport(flecs::world& world, Vector2 pos);
|
|
|
|
void RecalculateSupport(flecs::world& world,
|
|
tcb::span<const Vector2> skip = {},
|
|
tcb::span<const Vector2> unground = {});
|
|
|
|
bool CanRemove(flecs::world& world, tcb::span<const Vector2> positions);
|
|
|
|
void Flecs_Support(flecs::world& world);
|
|
|
|
inline void Support_Helper(const flecs::entity& entity, Vector2 pos, uint8_t maxSupport, bool grounded = false)
|
|
{
|
|
entity.set<TilePosition>({ pos });
|
|
if (grounded) entity.add<GroundedSupport>(); // before set<Support> so OnAdd fires with grounded state visible
|
|
entity.set<Support>({ maxSupport });
|
|
}
|