I have this very short component which basically should make the entity who has it float at the water surface.
local Point3 = _radiant.csg.Point3
local ArchipelagoFloat = class()
function ArchipelagoFloat:post_activate()
local location = radiant.entities.get_world_location(self._entity)
local intersected_entities = radiant.terrain.get_entities_at_point(location)
for id, entity in pairs(intersected_entities) do
local water_component = entity:get_component('stonehearth:water')
if water_component then
local water_level = water_component:get_water_level()
radiant.terrain.place_entity_at_exact_location(self._entity,location+Point3(0,water_level,0))
break
end
end
end
return ArchipelagoFloat
But it is giving error because for some reason it canât get a location. The location variable is always nilâŚ
When the object is placed the game throw this error message:
2017-05-13 13:25:33.382504 | server | 0 | lua.code | -- Script Error (lua) Begin -------------------------------
2017-05-13 13:25:33.383001 | server | 0 | lua.code | No matching overload found, candidates:
2017-05-13 13:25:33.383001 | server | 0 | lua.code | void __init(luabind::argument const&,Point3 const&,Point3 const&,int)
2017-05-13 13:25:33.383001 | server | 0 | lua.code | void __init(luabind::argument const&,Point3 const&,Point3 const&)
2017-05-13 13:25:33.383001 | server | 0 | lua.code | void __init(luabind::argument const&,Point3 const&,int)
2017-05-13 13:25:33.383001 | server | 0 | lua.code | void __init(luabind::argument const&,Point3 const&)
2017-05-13 13:25:33.383001 | server | 0 | lua.code | void __init(luabind::argument const&,Cube3 const&)
2017-05-13 13:25:33.383001 | server | 0 | lua.code | void __init(luabind::argument const&)
2017-05-13 13:25:33.383001 | server | 0 | lua.code | stack traceback:
2017-05-13 13:25:33.383504 | server | 0 | lua.code | [C]: ?
2017-05-13 13:25:33.383504 | server | 0 | lua.code | [C]: ?
2017-05-13 13:25:33.383504 | server | 0 | lua.code | [C]: in function 'Cube3'
2017-05-13 13:25:33.383504 | server | 0 | lua.code | radiant/modules/terrain.lua:258: in function 'get_entities_at_point'
2017-05-13 13:25:33.383504 | server | 0 | lua.code | archipelago_biome/components/float/float.lua:6: in function <archipelago_biome/components/float/float.lua:4>
2017-05-13 13:25:33.383504 | server | 0 | lua.code | -- Lua Error End -------------------------------