14 binding.bindFunc(lua);
19 for (
const auto &[name, getter] :
_getters) {
20 std::string getMethodName =
"get" + name;
21 entityType[getMethodName] = getter;
25 std::string hasMethodName =
"has" + name;
26 entityType[hasMethodName] = checker;
31 lua.set_function(
"removeComponent",
32 [
this, world](
ecs::Address addr,
const std::string &componentName) {
35 auto entity = world->getEntity(addr);
36 if (entity.isValid()) {
43 const std::vector<ComponentBinding> &ComponentBindingHelper::getBindings()
const {
47 void ComponentBindingHelper::clear() {
High-level ECS manager providing clean server-side API.
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
void applyEntityMethods(sol::usertype< ecs::wrapper::Entity > &entityType)
Apply get/has methods on Entity for all components.
std::uint32_t Address
Type used to represent an entity address/ID.