13#include <unordered_map>
56 void add(
const std::string &name, std::function<
void(sol::state &)> bindFunc);
99 const std::vector<ComponentBinding> &
getBindings()
const;
108 std::unordered_map<std::string, std::function<sol::object(
ecs::wrapper::Entity &, sol::this_state)>>
115 template <
typename T>
120 sol::state_view lua(L);
124 return sol::make_object(lua, &e.
get<T>());
145 template <
typename T>
149 sol::state_view lua(L);
153 return sol::make_object(lua, &e.
get<T>());
High-level ECS manager providing clean server-side API.
High-level entity wrapper providing fluent interface.
bool has() const
Check if this entity has a specific component.
Entity & remove()
Remove a component from this entity.
T & get()
Get a component from this entity.
Helper to simplify component registration.
void applyComponentBindings(sol::state &lua)
Apply all component bindings to the Lua state.
std::unordered_map< std::string, std::function< void(ecs::wrapper::Entity &)> > _removers
std::unordered_map< std::string, std::function< sol::object(ecs::wrapper::Entity &, sol::this_state)> > _getters
void applyRemoveFunction(sol::state &lua, ecs::wrapper::ECSWorld *world)
Create the global removeComponent function for all components.
std::unordered_map< std::string, std::function< bool(ecs::wrapper::Entity &)> > _hasCheckers
std::vector< ComponentBinding > _bindings
const std::vector< ComponentBinding > & getBindings() const
Get the list of registered components.
void applyEntityMethods(sol::usertype< ecs::wrapper::Entity > &entityType)
Apply get/has methods on Entity for all components.
void registerComponent(const std::string &name)
Register a component that's already been bound to Lua.
void clear()
Clear all registered components (for testing/reinitialization)
void add(const std::string &name, std::function< void(sol::state &)> bindFunc)
Information about a registered component.
std::function< void(sol::state &)> bindFunc