height dependend visibility on radar

This commit is contained in:
Gundul 2023-10-14 17:56:14 +02:00
parent a91f2e9cb2
commit 343cb555a5
2 changed files with 14 additions and 0 deletions

View File

@ -108,6 +108,18 @@ function airutils.on_step(self,dtime,colinfo)
-- physics comes first -- physics comes first
local vel = self.object:get_velocity() local vel = self.object:get_velocity()
local pos = self.object:get_pos()
local props = self.object:get_properties()
-- handle visibility on radar
if (pos and pos.y < airutils.radarMinHeight and props.show_on_minimap) then
props.show_on_minimap = false
self.object:set_properties(props)
end
if (pos and pos.y >= airutils.radarMinHeight and not props.show_on_minimap) then
props.show_on_minimap = true
self.object:set_properties(props)
end
if colinfo then if colinfo then
self.isonground = colinfo.touching_ground self.isonground = colinfo.touching_ground

View File

@ -3,4 +3,6 @@
-- --
airutils.vector_up = vector.new(0, 1, 0) airutils.vector_up = vector.new(0, 1, 0)
--set min y-pos above which airplanes are seen on radar
airutils.radarMinHeight = 30