Jump to content

sun and moon preview under horizon


buur

Recommended Posts

Hallo folks,

we have in the mission editor the possibility to show the position of sun and moon over horizon.

But when you want to set up a cool lightning in dusk or dawn you need also the position below the horizon.

I have attached a picture which shows the different kind of darkness referring to the degree below the horizon.

I think it would be a easy improvement to show also the -90° vertical axis in mission editor.

sunmoon.PNG

dawn.PNG

  • Like 4
  • Thanks 1
Link to comment
Share on other sites

  • 2 weeks later...

if someone wants to help themselves:

Go into the file D:\SteamLibrary\steamapps\common\DCSWorld\MissionEditor\modules\me_weather.lua

Go to line 1505. There you find 

if degELEV > 0 then 

Change the line to

if degELEV > -90 then 

Then the elevation of the sun is also shown under the horizon.

 

Com on ED, that is simple. Please change it.

image.png

  • Thanks 1
Link to comment
Share on other sites

Just for documentation: Here the steps to modify the sun and moon chart.

1. Change the picture of the chart by coping the attached coordinate_axes.png to D:\SteamLibrary\steamapps\common\DCSWorld\dxgui\skins\skinME\images\window\weather

2. Override me_weather_panel.dlg in D:\SteamLibrary\steamapps\common\DCSWorld\MissionEditor\modules\dialogs
    In this file in the lines 7828, 7934 and 8108 the position of the cardinals E,S and W are changed.

3. Override me_weather.lua in D:\SteamLibrary\steamapps\common\DCSWorld\MissionEditor\modules
   the function updateSunMoon starts from line 1443. There you can change the position and when sun and moon are shown. 
 

function updateSunMoon()
	local player = mod_mission.getPlayerUnit()
	local x,y
	
	if player then
		x,y = player.x, player.y
	else
		x,y = centerWeather.x, centerWeather.y 
	end
	
	local lat, long = MapWindow.convertMetersToLatLon(x,y)
	
	local coordDisplay = OptionsData.getMiscellaneous('Coordinate_Display')
	local SummerTimeDelta = Terrain.GetTerrainConfig('SummerTimeDelta')
	
	if coordDisplay == "Lat Long" then
		eCoords:setText(U.text_coords_LatLong('lat', U.toRadians(lat)).."   "..U.text_coords_LatLong('long', U.toRadians(long)))
	elseif coordDisplay == "Lat Long Decimal" then
		eCoords:setText(U.text_coords_LatLongD('lat', U.toRadians(lat)).."   "..U.text_coords_LatLongD('long', U.toRadians(long)))
	elseif coordDisplay == "Precise Lat Long" then
		eCoords:setText(U.text_coords_LatLongHornet('lat', U.toRadians(lat)).."   "..U.text_coords_LatLongHornet('long', U.toRadians(long)))
	elseif coordDisplay == "Metric" then
		eCoords:setText(U.text_coords_Metric(x,y))
	else
		eCoords:setText(Terrain.GetMGRScoordinates(x,y))
	end


	local lastELEV = nil
	local sunRiseSec = nil
	local sunSetSec = nil

	for i=0, 23 do	
		local degAZ, degELEV = DCS.getSunAzimuthElevation(lat, long, 
										mod_mission.mission.date.Year,
										mod_mission.mission.date.Month,
										mod_mission.mission.date.Day,
										(i-SummerTimeDelta) *3600)										
		
		if lastELEV ~= nil and lastELEV < 0 and  degELEV > 0 then
			sunRiseSec = (i - degELEV/(degELEV - lastELEV))*3600
		end
		
		if lastELEV ~= nil and lastELEV > 0 and  degELEV < 0 then
			sunSetSec = (i + degELEV/(lastELEV - degELEV))*3600
		end
		lastELEV = degELEV
	end
	
	--позиция солнца
	local degAZ,degELEV = DCS.getSunAzimuthElevation(lat, long, 
										mod_mission.mission.date.Year,
										mod_mission.mission.date.Month,
										mod_mission.mission.date.Day,
										base.module_mission.mission.start_time - (SummerTimeDelta * 3600))
										
	local timeIndex = 18  
	local x,y = chart:getPosition()
	
	local xSun = x-16+degAZ/360*332
	local ySun = y-16+(73-((degELEV*2)/180)*73) -- -16 140
--	base.print("--x,y--", xSun,ySun,degAZ,degELEV )
	if degELEV > -90 then -- 0
		sSun:setPosition(xSun, ySun)
		sText:setText(base.string.format("%.1f°, %.1f°", degELEV, degAZ))
		sSun:setVisible(true)
		sText:setVisible(true)
		
		if xSun < 315 then
			sText:setPosition(xSun+35, ySun-15)	
		else
			sText:setPosition(xSun-110, ySun-15)	
		end	
	else
		sSun:setVisible(false) --false
		sText:setVisible(false) --false
	end
	

	local sunRiseAZ, t2 = DCS.getSunAzimuthElevation(lat, long, 
										mod_mission.mission.date.Year,
										mod_mission.mission.date.Month,
										mod_mission.mission.date.Day,
										sunRiseSec - (SummerTimeDelta *3600))
										
	local sunSetAZ, t4 = DCS.getSunAzimuthElevation(lat, long, 
										mod_mission.mission.date.Year,
										mod_mission.mission.date.Month,
										mod_mission.mission.date.Day,
										sunSetSec - (SummerTimeDelta *3600))										


	eSunrise:setText(U.secToString(sunRiseSec)..base.string.format(" %.1f°",sunRiseAZ))
	eSunset:setText(U.secToString(sunSetSec)..base.string.format(" %.1f°",sunSetAZ))
	
	local tmp1, tmp2, prevMoonPHASE  = DCS.getMoonAzimuthElevationPhase(lat, long, 
										mod_mission.mission.date.Year,
										mod_mission.mission.date.Month,
										mod_mission.mission.date.Day,
										base.module_mission.mission.start_time - ((SummerTimeDelta+1) * 3600))	
										
	local moonAZ, moonELEV, moonPHASE  = DCS.getMoonAzimuthElevationPhase(lat, long, 
										mod_mission.mission.date.Year,
										mod_mission.mission.date.Month,
										mod_mission.mission.date.Day,
										base.module_mission.mission.start_time - (SummerTimeDelta * 3600))	
	local xMoon = x-16+moonAZ/360*332
	local yMoon = y-16+(73-((moonELEV*2)/180)*73) --

--base.print("--moon--",moonAZ, moonELEV,U.secToString(base.module_mission.mission.start_time), moonPHASE)	
	if moonELEV > -90 then  -- 0
		sMoon:setPosition(xMoon, yMoon)
		sMoon:setVisible(true)
	else
		sMoon:setVisible(false)
	end
	
	local bWaningMoon = prevMoonPHASE > moonPHASE
	
	if moonPHASE < 0.02 then
		sMoon:setSkin(sMoon0Skin)
	elseif moonPHASE < 0.33 then
		if bWaningMoon == true then
			sMoon:setSkin(sMoon7Skin)
		else
			sMoon:setSkin(sMoon1Skin)
		end
	elseif moonPHASE < 0.66 then
		if bWaningMoon == true then
			sMoon:setSkin(sMoon6Skin)
		else
			sMoon:setSkin(sMoon2Skin)
		end
	elseif moonPHASE < 0.98 then
		if bWaningMoon == true then
			sMoon:setSkin(sMoon5Skin)
		else
			sMoon:setSkin(sMoon3Skin)
		end
	elseif moonPHASE <= 1 then
		sMoon:setSkin(sMoon4Skin)
	end
	
end

 

coordinate_axes.png

me_weather_panel.dlg me_weather.lua

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...