Skip to content

Commit 2ba5773

Browse files
authored
Merge pull request #2 from Peppie84/development
Release v1.0.0.0
2 parents c7d2820 + 63fb04b commit 2ba5773

26 files changed

Lines changed: 428 additions & 1 deletion

.editorconfig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# top-most EditorConfig file
2+
root = true
3+
4+
[*]
5+
end_of_line = lf
6+
insert_final_newline = true
7+
trim_trailing_whitespace = true
8+
indent_style = space
9+
indent_size = 4
10+
charset = utf-8
11+
12+
[*.{xml,xsd}]
13+
max_line_length = off
14+
indent_size = 2
15+
16+
[*.md]
17+
trim_trailing_whitespace = false
18+
insert_final_newline = false

.github/FUNDING.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# These are supported funding model platforms
2+
3+
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4+
patreon: # Replace with a single Patreon username
5+
open_collective: # Replace with a single Open Collective username
6+
ko_fi: # Replace with a single Ko-fi username
7+
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9+
liberapay: # Replace with a single Liberapay username
10+
issuehunt: # Replace with a single IssueHunt username
11+
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
12+
polar: # Replace with a single Polar username
13+
buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
14+
thanks_dev: # Replace with a single thanks.dev username
15+
custom: ['https://www.paypal.com/paypalme/peppie84'] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

.gitignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Compiled Lua sources
2+
luac.out
3+
4+
# luarocks build files
5+
*.src.rock
6+
7+
# archiv files
8+
*.zip
9+
*.tar.gz
10+
11+
# repo specific
12+
.testrunner/
13+
14+
# Giants debugger
15+
*.gdpu
16+
*.gdp
17+
*.gspu

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5+
6+
## [Unreleased]
7+
8+
9+
## [v1.0.0.0] - 2025-01-09
10+
- Ported from LS22 to LS25
11+
- Initial release

FS25_ExtendedGameInfoDisplay.gsp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="iso-8859-1" standalone="no" ?>
2+
<giantsStudioProject version="1" connectionPort="61407" listeningPort="61408" builtInTableWriteProtection="true">
3+
<projectName>FS25_ExtendedGameInfoDisplay</projectName>
4+
<projectSources>
5+
<source path="C:/Users/Peppie/Documents/FarmingSimulator25 - Entwicklung/mods/FS25_ExtendedGameInfoDisplay/FS25_ExtendedGameInfoDisplay/" />
6+
</projectSources>
7+
<excludePaths></excludePaths>
8+
<gameUserProfileAppDirectory>%gameuserprofile%/FarmingSimulator2025/</gameUserProfileAppDirectory>
9+
<gameSourceDirectory>D:/Steam/steamapps/common/Farming Simulator 25/</gameSourceDirectory>
10+
<scriptBinding>D:/Steam/steamapps/common/Farming Simulator 25/sdk/debugger/scriptBinding.xml</scriptBinding>
11+
<launchWorkingDirectory>D:/Steam/steamapps/common/Farming Simulator 25/</launchWorkingDirectory>
12+
<launchExecutable>D:/Steam/steamapps/common/Farming Simulator 25/x64/FarmingSimulator2025Game.exe</launchExecutable>
13+
<launchProfiles>
14+
<launchProfile name="default" parameters="" />
15+
</launchProfiles>
16+
</giantsStudioProject>
128 KB
Binary file not shown.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0" encoding="utf-8" standalone="no"?>
2+
<modDesc descVersion="92">
3+
<author>Peppie84</author>
4+
<version>1.0.0.0</version>
5+
<title>
6+
<en>Extended Game Infodisplay</en>
7+
<de>Erweiterte Spiel-Infodarstellung</de>
8+
</title>
9+
<description>
10+
<en><![CDATA[
11+
Expands the current GameInfoDisplay in the upper right corner by displaying the current year under the date and a temperature feature with an indicator of whether the temperature is falling, staying constant or rising, the display of the current temperature. I also added the min/max temperature of the day.
12+
13+
For more information, help and reporting issues please visit <a href='https://github.com/Peppie84/FS25_ExtendedGameInfoDisplay'>GitHub</a>.
14+
]]></en>
15+
<de><![CDATA[
16+
Erweitert die aktuelle GameInfoDisplay oben rechts um die Anzeige des aktuellen Jahres unter dem Datum und einem Temperaturfeature mit einem Indikator ob die Temepratur fällt, gleich bleibt oder steigt, die Anzeige der aktuellen Temperatur und der min/max Temperatur des Tages.
17+
18+
Weitere Informationen, Hilfe und Probleme melden findest Du unter <a href='https://github.com/Peppie84/FS25_ExtendedGameInfoDisplay'>GitHub</a>.
19+
]]></de>
20+
</description>
21+
<iconFilename>icon_ExGameInfoDisp.dds</iconFilename>
22+
<multiplayer supported="true" />
23+
<extraSourceFiles>
24+
<sourceFile filename="src/extendedgameinfodisplay.lua" />
25+
</extraSourceFiles>
26+
<l10n filenamePrefix="translations/l10n" />
27+
</modDesc>
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
---
2+
-- ExtendedGameInfoDisplay
3+
--
4+
-- Main class to extend the default gameInfoDisplay with year info
5+
-- and temperature + trend and current/min/max temperatur.
6+
--
7+
-- Copyright (c) Peppie84, 2024
8+
-- https://github.com/Peppie84/FS25_ExtendedGameInfoDisplay
9+
--
10+
11+
ExtendedGameInfoDisplay = {
12+
STRECH_GAME_INFO_DISPLAY = 95,
13+
TEMPERATURE_ICON_SIZE = 40,
14+
L10N_SYMBOLS = {
15+
YEAR_TEXT = "yearinfo_current_year"
16+
},
17+
CURRENT_MOD = g_currentModName or 'unknown',
18+
DIRECTORY_MOD = g_currentModDirectory or '',
19+
WEATHER_HOURS_FORECAST = 3600000*6,
20+
HOURS_A_DAY = 3600000*24
21+
}
22+
23+
---Overwritten HUD.createDisplayComponents()
24+
---@param overwrittenFunc function
25+
---@param uiScale number
26+
function ExtendedGameInfoDisplay:hud__createDisplayComponents(overwrittenFunc, uiScale)
27+
overwrittenFunc(self, uiScale)
28+
-- Set some offsets to move the hud to the left
29+
self.gameInfoDisplay.calendarTextOffsetY = self.gameInfoDisplay.calendarTextOffsetY + self.gameInfoDisplay:scalePixelToScreenHeight(7)
30+
self.gameInfoDisplay.infoBgLeft.offsetX = -self.gameInfoDisplay:scalePixelToScreenWidth(ExtendedGameInfoDisplay.STRECH_GAME_INFO_DISPLAY)
31+
self.gameInfoDisplay.weatherIcon.offsetX = -self.gameInfoDisplay:scalePixelToScreenWidth(ExtendedGameInfoDisplay.STRECH_GAME_INFO_DISPLAY)
32+
self.gameInfoDisplay.weatherNextIcon.offsetX = -self.gameInfoDisplay:scalePixelToScreenWidth(ExtendedGameInfoDisplay.STRECH_GAME_INFO_DISPLAY)
33+
34+
local posX, posY = self.gameInfoDisplay:getPosition()
35+
local temperaturePositionY = posY - self.gameInfoDisplay:scalePixelToScreenHeight(ExtendedGameInfoDisplay.TEMPERATURE_ICON_SIZE + 12)
36+
local temperatureIconWidth = self.gameInfoDisplay:scalePixelToScreenWidth(ExtendedGameInfoDisplay.TEMPERATURE_ICON_SIZE)
37+
local temperatureIconHeight = self.gameInfoDisplay:scalePixelToScreenHeight(ExtendedGameInfoDisplay.TEMPERATURE_ICON_SIZE)
38+
39+
self.gameInfoDisplay.temperature = g_overlayManager:createOverlay("ui_elements.thermometer", 0, temperaturePositionY, temperatureIconWidth, temperatureIconHeight)
40+
self.gameInfoDisplay.temperature:setColor(unpack(HUD.COLOR.ACTIVE))
41+
self.gameInfoDisplay.temperatureUp = g_overlayManager:createOverlay("ui_elements.thermometerUp", 0, temperaturePositionY, temperatureIconWidth, temperatureIconHeight)
42+
self.gameInfoDisplay.temperatureUp:setColor(unpack(HUD.COLOR.ACTIVE))
43+
self.gameInfoDisplay.temperatureDown = g_overlayManager:createOverlay("ui_elements.thermometerDown", 0, temperaturePositionY, temperatureIconWidth, temperatureIconHeight)
44+
self.gameInfoDisplay.temperatureDown:setColor(unpack(HUD.COLOR.ACTIVE))
45+
end
46+
47+
---Overwrite GameInfoDisplay.draw()
48+
---@param overwrittenFunc function
49+
function ExtendedGameInfoDisplay:gameinfodisplay__draw(overwrittenFunc)
50+
overwrittenFunc(self)
51+
52+
local weatherType = g_currentMission.environment.weather:getCurrentWeatherType()
53+
local forcastDayTime = math.floor(g_currentMission.environment.dayTime + ExtendedGameInfoDisplay.WEATHER_HOURS_FORECAST )
54+
local forcastDay = g_currentMission.environment.currentDay
55+
if forcastDayTime > ExtendedGameInfoDisplay.HOURS_A_DAY then
56+
forcastDayTime = forcastDayTime - ExtendedGameInfoDisplay.HOURS_A_DAY
57+
forcastDay = forcastDay + 1
58+
end
59+
60+
local nextWeatherType = g_currentMission.environment.weather:getNextWeatherType(forcastDay, forcastDayTime )
61+
62+
-- Strech the background and render new!
63+
self.infoBgScale.width = self:scalePixelToScreenWidth(ExtendedGameInfoDisplay.STRECH_GAME_INFO_DISPLAY)
64+
self.infoBgScale.offsetX = -self:scalePixelToScreenWidth(ExtendedGameInfoDisplay.STRECH_GAME_INFO_DISPLAY)
65+
self.infoBgScale:render()
66+
67+
-- ReRender to bring it back to top
68+
self.weatherIcon:render()
69+
self.weatherNextIcon:render()
70+
self.weatherNextIcon:setVisible(weatherType ~= nextWeatherType)
71+
72+
ExtendedGameInfoDisplay:setTemperaturePosition(self)
73+
ExtendedGameInfoDisplay:setTemperatureTrendAndDraw(self)
74+
ExtendedGameInfoDisplay:drawYearText(self)
75+
ExtendedGameInfoDisplay:drawTemperatureText(self)
76+
end
77+
78+
function ExtendedGameInfoDisplay:setTemperaturePosition(gameInfoDisplay)
79+
local referencePositionX = gameInfoDisplay.calendarIcon.x - gameInfoDisplay:scalePixelToScreenHeight(65)
80+
gameInfoDisplay.temperature.x = referencePositionX
81+
gameInfoDisplay.temperatureUp.x = referencePositionX
82+
gameInfoDisplay.temperatureDown.x = referencePositionX
83+
end
84+
85+
function ExtendedGameInfoDisplay:setTemperatureTrendAndDraw(gameInfoDisplay)
86+
local temperaturTrend = g_currentMission.environment.weather:getCurrentTemperatureTrend()
87+
88+
gameInfoDisplay.temperature:setVisible(temperaturTrend == 0)
89+
gameInfoDisplay.temperatureUp:setVisible(temperaturTrend > 0)
90+
gameInfoDisplay.temperatureDown:setVisible(temperaturTrend < 0)
91+
92+
gameInfoDisplay.temperature:draw()
93+
gameInfoDisplay.temperatureUp:draw()
94+
gameInfoDisplay.temperatureDown:draw()
95+
96+
local seperatorPosX = gameInfoDisplay.temperature.x - gameInfoDisplay:scalePixelToScreenWidth(5)
97+
local seperatorPosYStart = gameInfoDisplay.temperature.y + gameInfoDisplay:scalePixelToScreenHeight(ExtendedGameInfoDisplay.TEMPERATURE_ICON_SIZE-1)
98+
local seperatorPosYEnd = gameInfoDisplay.temperature.y + gameInfoDisplay:scalePixelToScreenHeight(4)
99+
100+
drawLine2D(seperatorPosX, seperatorPosYStart, seperatorPosX, seperatorPosYEnd, gameInfoDisplay.separatorWidth, 1,1,1,0.2)
101+
end
102+
103+
function ExtendedGameInfoDisplay:drawTemperatureText(gameInfoDisplay)
104+
local minTemperatureInC, maxTemperatureInC = g_currentMission.environment.weather:getCurrentMinMaxTemperatures()
105+
local currentTemperatureInC = g_currentMission.environment.weather:getCurrentTemperature()
106+
107+
local minTemperatureExpanded = g_i18n:getTemperature(minTemperatureInC)
108+
local maxTemperatureExpanded = g_i18n:getTemperature(maxTemperatureInC)
109+
local currentTemperatureExpanded = g_i18n:getTemperature(currentTemperatureInC)
110+
111+
local scaledTextSizeForCurrentTemperature = gameInfoDisplay:scalePixelToScreenHeight(19)
112+
local scaledTextSizeForTemperature = gameInfoDisplay:scalePixelToScreenHeight(14)
113+
114+
local temperatureTextX = gameInfoDisplay.temperature.x + gameInfoDisplay.temperature.width + gameInfoDisplay:scalePixelToScreenWidth(40)
115+
local temperatureTextY = gameInfoDisplay.temperature.y + gameInfoDisplay.temperature.height + gameInfoDisplay:scalePixelToScreenHeight(2)
116+
117+
setTextBold(false)
118+
setTextAlignment(RenderText.ALIGN_RIGHT)
119+
120+
renderText(temperatureTextX, temperatureTextY - gameInfoDisplay:scalePixelToScreenHeight(22), scaledTextSizeForCurrentTemperature, string.format('%d°', currentTemperatureExpanded))
121+
renderText(temperatureTextX, temperatureTextY - gameInfoDisplay:scalePixelToScreenHeight(38), scaledTextSizeForTemperature, string.format('%d°/%d°', maxTemperatureExpanded, minTemperatureExpanded))
122+
end
123+
124+
function ExtendedGameInfoDisplay:drawYearText(gameInfoDisplay)
125+
local monthTextSize = gameInfoDisplay:scalePixelToScreenHeight(10)
126+
local scaledTextSizeForYear = gameInfoDisplay:scalePixelToScreenHeight(12)
127+
128+
local gameInfoDisplayPosX, gameInfoDisplayPosY = gameInfoDisplay:getPosition()
129+
local posX = gameInfoDisplay.calendarIcon.x + gameInfoDisplay.calendarIcon.width + gameInfoDisplay:scalePixelToScreenWidth(2)
130+
local posY = gameInfoDisplayPosY - gameInfoDisplay.calendarTextOffsetY - monthTextSize
131+
132+
local l10nTextYear = g_i18n:getText(ExtendedGameInfoDisplay.L10N_SYMBOLS.YEAR_TEXT, ExtendedGameInfoDisplay.CURRENT_MOD)
133+
134+
setTextBold(false)
135+
setTextAlignment(RenderText.ALIGN_LEFT)
136+
137+
renderText(posX, posY, scaledTextSizeForYear, string.format('%s %s', l10nTextYear, g_currentMission.environment.currentYear))
138+
end
139+
140+
--- Initialize the mod
141+
local function init()
142+
--HUD.new = Utils.prependedFunction(HUD.new, newHud)
143+
HUD.createDisplayComponents = Utils.overwrittenFunction(HUD.createDisplayComponents, ExtendedGameInfoDisplay.hud__createDisplayComponents)
144+
GameInfoDisplay.draw = Utils.overwrittenFunction(GameInfoDisplay.draw, ExtendedGameInfoDisplay.gameinfodisplay__draw)
145+
end
146+
147+
init()
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="utf-8" standalone="no" ?>
2+
<l10n>
3+
<translationContributors>SniperKittenCz</translationContributors>
4+
<elements>
5+
<e k="mod_title" v="Rozšířený herní info displej"/>
6+
<e k="yearinfo_current_year" v="Rok"/>
7+
</elements>
8+
</l10n>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="utf-8" standalone="no" ?>
2+
<l10n>
3+
<translationContributors>Peppie84</translationContributors>
4+
<elements>
5+
<e k="mod_title" v="Erweiterte Spiel-Infodarstellung"/>
6+
<e k="yearinfo_current_year" v="Jahr"/>
7+
</elements>
8+
</l10n>

0 commit comments

Comments
 (0)