Get Force from Entity
Posted: Thu Sep 29, 2016 6:14 pm
Sorry, I don't get it, searching now for more than 3 hours, maybe I'm too stupid.
Due to pure curiosity I want to know how I can get the force from an entity.
For example:
Will add all entities of that force to the list. But how could I write it so:
How to write the ??????
There is LuaControl as the "control" between entity, player (and so the force), but I don't understand, how I can get an instance of LuaControl from the entity.
Due to pure curiosity I want to know how I can get the force from an entity.
For example:
Code: Select all
entities = Surface.find_all_entities({
type = entityType,
force = force
})
for _, entity in pairs(entities) do
table.insert(global[mappedName][force.name], entity)
log("[RT] added " .. entity.name .. " force " .. force.name)
end
Code: Select all
entities = Surface.find_all_entities({
type = entityType
-- no force !!!
})
for _, entity in pairs(entities) do
force = entity.???????.name
table.insert(global[mappedName][force.name], entity)
log("[RT] added " .. entity.name .. " force " .. force.name)
end
There is LuaControl as the "control" between entity, player (and so the force), but I don't understand, how I can get an instance of LuaControl from the entity.