implement player entity
This commit is contained in:
@@ -273,7 +273,7 @@ dynamic::Value scripting::get_component_value(const scriptenv& env, const std::s
|
||||
}
|
||||
|
||||
void scripting::on_entity_spawn(
|
||||
const EntityDef& def,
|
||||
const EntityDef&,
|
||||
entityid_t eid,
|
||||
const std::vector<std::unique_ptr<UserComponent>>& components,
|
||||
dynamic::Value args,
|
||||
@@ -285,9 +285,12 @@ void scripting::on_entity_spawn(
|
||||
lua::pushinteger(L, eid);
|
||||
lua::call(L, 1);
|
||||
}
|
||||
for (size_t i = 0; i < components.size()-1; i++) {
|
||||
lua::pushvalue(L, -1);
|
||||
if (components.size() > 1) {
|
||||
for (int i = 0; i < components.size()-1; i++) {
|
||||
lua::pushvalue(L, -1);
|
||||
}
|
||||
}
|
||||
std::cout << "entity duplicated " << (components.size()-1) << " times" << std::endl;
|
||||
for (auto& component : components) {
|
||||
auto compenv = create_component_environment(get_root_environment(), -1,
|
||||
component->name);
|
||||
|
||||
Reference in New Issue
Block a user