diff --git a/Script/DCS extensions/World.lua b/Script/DCS extensions/World.lua index 706f5ac..8e5647e 100644 --- a/Script/DCS extensions/World.lua +++ b/Script/DCS extensions/World.lua @@ -12,6 +12,7 @@ -- DCSEx.world.getGroupByID(groupID) -- DCSEx.world.getNextMarkerID() -- DCSEx.world.getSceneriesInZone(center, radius, minHealth) +-- DCSEx.world.getStaticObjectByID(staticID) -- DCSEx.world.getTerrainHeightDiff(coord, searchRadius) -- DCSEx.world.getUnitByID(unitID) -- DCSEx.world.isGroupAlive(g, unitsMustBeInAir) @@ -342,7 +343,7 @@ do local scenerySearchvolume = { id = world.VolumeType.SPHERE, - params = { point = { x = center.x, y = 0, z = center.y }, radius = radius } + params = { point = DCSEx.math.vec2ToVec3(center, "land"), radius = radius } } local function ifSceneryFound(foundScenery, val) @@ -360,6 +361,23 @@ do return sceneries end + ------------------------------------- + -- Searches and return a static object by its ID + -- @param staticID ID of the static object + -- @return An unit, or nil if no static object with this ID was found + ------------------------------------- + function DCSEx.world.getStaticObjectByID(staticID) + for coalitionID = 1, 2 do + for _, s in pairs(coalition.getStaticObjects(coalitionID)) do + if DCSEx.dcs.getObjectIDAsNumber(s) == staticID then + return s + end + end + end + + return nil + end + -- TODO: description, update file header function DCSEx.world.getTerrainHeightDiff(coord, searchRadius) local samples = {}