Skip to content

Commit

Permalink
Merge pull request #1 from Peppie84/pre-release/v1.0.0.0
Browse files Browse the repository at this point in the history
Pre-Release v1.0.0.0
  • Loading branch information
Peppie84 authored Jan 9, 2025
2 parents 2e07efd + 58d9837 commit 63fb04b
Show file tree
Hide file tree
Showing 25 changed files with 413 additions and 1 deletion.
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# top-most EditorConfig file
root = true

[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 4
charset = utf-8

[*.{xml,xsd}]
max_line_length = off
indent_size = 2

[*.md]
trim_trailing_whitespace = false
insert_final_newline = false
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Compiled Lua sources
luac.out

# luarocks build files
*.src.rock

# archiv files
*.zip
*.tar.gz

# repo specific
.testrunner/

# Giants debugger
*.gdpu
*.gdp
*.gspu
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Changelog

All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [Unreleased]


## [v1.0.0.0] - 2025-01-09
- Ported from LS22 to LS25
- Initial release
16 changes: 16 additions & 0 deletions FS25_ExtendedGameInfoDisplay.gsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="iso-8859-1" standalone="no" ?>
<giantsStudioProject version="1" connectionPort="61407" listeningPort="61408" builtInTableWriteProtection="true">
<projectName>FS25_ExtendedGameInfoDisplay</projectName>
<projectSources>
<source path="C:/Users/Peppie/Documents/FarmingSimulator25 - Entwicklung/mods/FS25_ExtendedGameInfoDisplay/FS25_ExtendedGameInfoDisplay/" />
</projectSources>
<excludePaths></excludePaths>
<gameUserProfileAppDirectory>%gameuserprofile%/FarmingSimulator2025/</gameUserProfileAppDirectory>
<gameSourceDirectory>D:/Steam/steamapps/common/Farming Simulator 25/</gameSourceDirectory>
<scriptBinding>D:/Steam/steamapps/common/Farming Simulator 25/sdk/debugger/scriptBinding.xml</scriptBinding>
<launchWorkingDirectory>D:/Steam/steamapps/common/Farming Simulator 25/</launchWorkingDirectory>
<launchExecutable>D:/Steam/steamapps/common/Farming Simulator 25/x64/FarmingSimulator2025Game.exe</launchExecutable>
<launchProfiles>
<launchProfile name="default" parameters="" />
</launchProfiles>
</giantsStudioProject>
Binary file not shown.
27 changes: 27 additions & 0 deletions FS25_ExtendedGameInfoDisplay/modDesc.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<modDesc descVersion="92">
<author>Peppie84</author>
<version>1.0.0.0</version>
<title>
<en>Extended Game Infodisplay</en>
<de>Erweiterte Spiel-Infodarstellung</de>
</title>
<description>
<en><![CDATA[
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.
For more information, help and reporting issues please visit <a href='https://github.com/Peppie84/FS25_ExtendedGameInfoDisplay'>GitHub</a>.
]]></en>
<de><![CDATA[
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.
Weitere Informationen, Hilfe und Probleme melden findest Du unter <a href='https://github.com/Peppie84/FS25_ExtendedGameInfoDisplay'>GitHub</a>.
]]></de>
</description>
<iconFilename>icon_ExGameInfoDisp.dds</iconFilename>
<multiplayer supported="true" />
<extraSourceFiles>
<sourceFile filename="src/extendedgameinfodisplay.lua" />
</extraSourceFiles>
<l10n filenamePrefix="translations/l10n" />
</modDesc>
147 changes: 147 additions & 0 deletions FS25_ExtendedGameInfoDisplay/src/extendedgameinfodisplay.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
---
-- ExtendedGameInfoDisplay
--
-- Main class to extend the default gameInfoDisplay with year info
-- and temperature + trend and current/min/max temperatur.
--
-- Copyright (c) Peppie84, 2024
-- https://github.com/Peppie84/FS25_ExtendedGameInfoDisplay
--

ExtendedGameInfoDisplay = {
STRECH_GAME_INFO_DISPLAY = 95,
TEMPERATURE_ICON_SIZE = 40,
L10N_SYMBOLS = {
YEAR_TEXT = "yearinfo_current_year"
},
CURRENT_MOD = g_currentModName or 'unknown',
DIRECTORY_MOD = g_currentModDirectory or '',
WEATHER_HOURS_FORECAST = 3600000*6,
HOURS_A_DAY = 3600000*24
}

---Overwritten HUD.createDisplayComponents()
---@param overwrittenFunc function
---@param uiScale number
function ExtendedGameInfoDisplay:hud__createDisplayComponents(overwrittenFunc, uiScale)
overwrittenFunc(self, uiScale)
-- Set some offsets to move the hud to the left
self.gameInfoDisplay.calendarTextOffsetY = self.gameInfoDisplay.calendarTextOffsetY + self.gameInfoDisplay:scalePixelToScreenHeight(7)
self.gameInfoDisplay.infoBgLeft.offsetX = -self.gameInfoDisplay:scalePixelToScreenWidth(ExtendedGameInfoDisplay.STRECH_GAME_INFO_DISPLAY)
self.gameInfoDisplay.weatherIcon.offsetX = -self.gameInfoDisplay:scalePixelToScreenWidth(ExtendedGameInfoDisplay.STRECH_GAME_INFO_DISPLAY)
self.gameInfoDisplay.weatherNextIcon.offsetX = -self.gameInfoDisplay:scalePixelToScreenWidth(ExtendedGameInfoDisplay.STRECH_GAME_INFO_DISPLAY)

local posX, posY = self.gameInfoDisplay:getPosition()
local temperaturePositionY = posY - self.gameInfoDisplay:scalePixelToScreenHeight(ExtendedGameInfoDisplay.TEMPERATURE_ICON_SIZE + 12)
local temperatureIconWidth = self.gameInfoDisplay:scalePixelToScreenWidth(ExtendedGameInfoDisplay.TEMPERATURE_ICON_SIZE)
local temperatureIconHeight = self.gameInfoDisplay:scalePixelToScreenHeight(ExtendedGameInfoDisplay.TEMPERATURE_ICON_SIZE)

self.gameInfoDisplay.temperature = g_overlayManager:createOverlay("ui_elements.thermometer", 0, temperaturePositionY, temperatureIconWidth, temperatureIconHeight)
self.gameInfoDisplay.temperature:setColor(unpack(HUD.COLOR.ACTIVE))
self.gameInfoDisplay.temperatureUp = g_overlayManager:createOverlay("ui_elements.thermometerUp", 0, temperaturePositionY, temperatureIconWidth, temperatureIconHeight)
self.gameInfoDisplay.temperatureUp:setColor(unpack(HUD.COLOR.ACTIVE))
self.gameInfoDisplay.temperatureDown = g_overlayManager:createOverlay("ui_elements.thermometerDown", 0, temperaturePositionY, temperatureIconWidth, temperatureIconHeight)
self.gameInfoDisplay.temperatureDown:setColor(unpack(HUD.COLOR.ACTIVE))
end

---Overwrite GameInfoDisplay.draw()
---@param overwrittenFunc function
function ExtendedGameInfoDisplay:gameinfodisplay__draw(overwrittenFunc)
overwrittenFunc(self)

local weatherType = g_currentMission.environment.weather:getCurrentWeatherType()
local forcastDayTime = math.floor(g_currentMission.environment.dayTime + ExtendedGameInfoDisplay.WEATHER_HOURS_FORECAST )
local forcastDay = g_currentMission.environment.currentDay
if forcastDayTime > ExtendedGameInfoDisplay.HOURS_A_DAY then
forcastDayTime = forcastDayTime - ExtendedGameInfoDisplay.HOURS_A_DAY
forcastDay = forcastDay + 1
end

local nextWeatherType = g_currentMission.environment.weather:getNextWeatherType(forcastDay, forcastDayTime )

-- Strech the background and render new!
self.infoBgScale.width = self:scalePixelToScreenWidth(ExtendedGameInfoDisplay.STRECH_GAME_INFO_DISPLAY)
self.infoBgScale.offsetX = -self:scalePixelToScreenWidth(ExtendedGameInfoDisplay.STRECH_GAME_INFO_DISPLAY)
self.infoBgScale:render()

-- ReRender to bring it back to top
self.weatherIcon:render()
self.weatherNextIcon:render()
self.weatherNextIcon:setVisible(weatherType ~= nextWeatherType)

ExtendedGameInfoDisplay:setTemperaturePosition(self)
ExtendedGameInfoDisplay:setTemperatureTrendAndDraw(self)
ExtendedGameInfoDisplay:drawYearText(self)
ExtendedGameInfoDisplay:drawTemperatureText(self)
end

function ExtendedGameInfoDisplay:setTemperaturePosition(gameInfoDisplay)
local referencePositionX = gameInfoDisplay.calendarIcon.x - gameInfoDisplay:scalePixelToScreenHeight(65)
gameInfoDisplay.temperature.x = referencePositionX
gameInfoDisplay.temperatureUp.x = referencePositionX
gameInfoDisplay.temperatureDown.x = referencePositionX
end

function ExtendedGameInfoDisplay:setTemperatureTrendAndDraw(gameInfoDisplay)
local temperaturTrend = g_currentMission.environment.weather:getCurrentTemperatureTrend()

gameInfoDisplay.temperature:setVisible(temperaturTrend == 0)
gameInfoDisplay.temperatureUp:setVisible(temperaturTrend > 0)
gameInfoDisplay.temperatureDown:setVisible(temperaturTrend < 0)

gameInfoDisplay.temperature:draw()
gameInfoDisplay.temperatureUp:draw()
gameInfoDisplay.temperatureDown:draw()

local seperatorPosX = gameInfoDisplay.temperature.x - gameInfoDisplay:scalePixelToScreenWidth(5)
local seperatorPosYStart = gameInfoDisplay.temperature.y + gameInfoDisplay:scalePixelToScreenHeight(ExtendedGameInfoDisplay.TEMPERATURE_ICON_SIZE-1)
local seperatorPosYEnd = gameInfoDisplay.temperature.y + gameInfoDisplay:scalePixelToScreenHeight(4)

drawLine2D(seperatorPosX, seperatorPosYStart, seperatorPosX, seperatorPosYEnd, gameInfoDisplay.separatorWidth, 1,1,1,0.2)
end

function ExtendedGameInfoDisplay:drawTemperatureText(gameInfoDisplay)
local minTemperatureInC, maxTemperatureInC = g_currentMission.environment.weather:getCurrentMinMaxTemperatures()
local currentTemperatureInC = g_currentMission.environment.weather:getCurrentTemperature()

local minTemperatureExpanded = g_i18n:getTemperature(minTemperatureInC)
local maxTemperatureExpanded = g_i18n:getTemperature(maxTemperatureInC)
local currentTemperatureExpanded = g_i18n:getTemperature(currentTemperatureInC)

local scaledTextSizeForCurrentTemperature = gameInfoDisplay:scalePixelToScreenHeight(19)
local scaledTextSizeForTemperature = gameInfoDisplay:scalePixelToScreenHeight(14)

local temperatureTextX = gameInfoDisplay.temperature.x + gameInfoDisplay.temperature.width + gameInfoDisplay:scalePixelToScreenWidth(40)
local temperatureTextY = gameInfoDisplay.temperature.y + gameInfoDisplay.temperature.height + gameInfoDisplay:scalePixelToScreenHeight(2)

setTextBold(false)
setTextAlignment(RenderText.ALIGN_RIGHT)

renderText(temperatureTextX, temperatureTextY - gameInfoDisplay:scalePixelToScreenHeight(22), scaledTextSizeForCurrentTemperature, string.format('%d°', currentTemperatureExpanded))
renderText(temperatureTextX, temperatureTextY - gameInfoDisplay:scalePixelToScreenHeight(38), scaledTextSizeForTemperature, string.format('%d°/%d°', maxTemperatureExpanded, minTemperatureExpanded))
end

function ExtendedGameInfoDisplay:drawYearText(gameInfoDisplay)
local monthTextSize = gameInfoDisplay:scalePixelToScreenHeight(10)
local scaledTextSizeForYear = gameInfoDisplay:scalePixelToScreenHeight(12)

local gameInfoDisplayPosX, gameInfoDisplayPosY = gameInfoDisplay:getPosition()
local posX = gameInfoDisplay.calendarIcon.x + gameInfoDisplay.calendarIcon.width + gameInfoDisplay:scalePixelToScreenWidth(2)
local posY = gameInfoDisplayPosY - gameInfoDisplay.calendarTextOffsetY - monthTextSize

local l10nTextYear = g_i18n:getText(ExtendedGameInfoDisplay.L10N_SYMBOLS.YEAR_TEXT, ExtendedGameInfoDisplay.CURRENT_MOD)

setTextBold(false)
setTextAlignment(RenderText.ALIGN_LEFT)

renderText(posX, posY, scaledTextSizeForYear, string.format('%s %s', l10nTextYear, g_currentMission.environment.currentYear))
end

--- Initialize the mod
local function init()
--HUD.new = Utils.prependedFunction(HUD.new, newHud)
HUD.createDisplayComponents = Utils.overwrittenFunction(HUD.createDisplayComponents, ExtendedGameInfoDisplay.hud__createDisplayComponents)
GameInfoDisplay.draw = Utils.overwrittenFunction(GameInfoDisplay.draw, ExtendedGameInfoDisplay.gameinfodisplay__draw)
end

init()
8 changes: 8 additions & 0 deletions FS25_ExtendedGameInfoDisplay/translations/l10n_cz.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8" standalone="no" ?>
<l10n>
<translationContributors>SniperKittenCz</translationContributors>
<elements>
<e k="mod_title" v="Rozšířený herní info displej"/>
<e k="yearinfo_current_year" v="Rok"/>
</elements>
</l10n>
8 changes: 8 additions & 0 deletions FS25_ExtendedGameInfoDisplay/translations/l10n_de.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8" standalone="no" ?>
<l10n>
<translationContributors>Peppie84</translationContributors>
<elements>
<e k="mod_title" v="Erweiterte Spiel-Infodarstellung"/>
<e k="yearinfo_current_year" v="Jahr"/>
</elements>
</l10n>
8 changes: 8 additions & 0 deletions FS25_ExtendedGameInfoDisplay/translations/l10n_en.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8" standalone="no" ?>
<l10n>
<translationContributors>Peppie84</translationContributors>
<elements>
<e k="mod_title" v="Extended Game Infodisplay"/>
<e k="yearinfo_current_year" v="Year"/>
</elements>
</l10n>
8 changes: 8 additions & 0 deletions FS25_ExtendedGameInfoDisplay/translations/l10n_es.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8" standalone="no" ?>
<l10n>
<translationContributors>Ferchu425</translationContributors>
<elements>
<e k="mod_title" v="Extended Game Infodisplay"/>
<e k="yearinfo_current_year" v="Año"/>
</elements>
</l10n>
8 changes: 8 additions & 0 deletions FS25_ExtendedGameInfoDisplay/translations/l10n_fr.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8" standalone="no" ?>
<l10n>
<translationContributors>Rudolfet</translationContributors>
<elements>
<e k="mod_title" v="Affichage étendu des informations sur le jeu"/>
<e k="yearinfo_current_year" v="Année"/>
</elements>
</l10n>
8 changes: 8 additions & 0 deletions FS25_ExtendedGameInfoDisplay/translations/l10n_hu.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8" standalone="no" ?>
<l10n>
<translationContributors>Petrovics Zsombor</translationContributors>
<elements>
<e k="mod_title" v="Kibővített Információs Sáv"/>
<e k="yearinfo_current_year" v="Év"/>
</elements>
</l10n>
8 changes: 8 additions & 0 deletions FS25_ExtendedGameInfoDisplay/translations/l10n_it.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8" standalone="no" ?>
<l10n>
<translationContributors>Rudolfet</translationContributors>
<elements>
<e k="mod_title" v="Visualizzazione estesa delle informazioni sul gioco"/>
<e k="yearinfo_current_year" v="Anno"/>
</elements>
</l10n>
8 changes: 8 additions & 0 deletions FS25_ExtendedGameInfoDisplay/translations/l10n_pl.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8" standalone="no" ?>
<l10n>
<translationContributors>dexus</translationContributors>
<elements>
<e k="mod_title" v="Extended Game Infodisplay"/>
<e k="yearinfo_current_year" v="Rok"/>
</elements>
</l10n>
8 changes: 8 additions & 0 deletions FS25_ExtendedGameInfoDisplay/translations/l10n_ru.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8" standalone="no" ?>
<l10n>
<translationContributors>nagor</translationContributors>
<elements>
<e k="mod_title" v="Extended Game Infodisplay"/>
<e k="yearinfo_current_year" v="Год"/>
</elements>
</l10n>
File renamed without changes.
40 changes: 39 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,39 @@
# FS25_ExtendedGameInfoDisplay
<a name="readme-top"></a>

<div align="center">

[![FarmingSimulator-25](https://img.shields.io/badge/FarmingSimulator-25-73A302?style=flat-square)](https://www.farming-simulator.com/mods.php?title=fs2025)
[![Last commit](https://img.shields.io/github/last-commit/Peppie84/FS25_ExtendedGameInfoDisplay?style=flat-square&color=important)](https://github.com/Peppie84/FS25_ExtendedGameInfoDisplay/commits/development)
[![Modhub Version](https://img.shields.io/badge/Modhub-v1.0.0.0-green?style=flat-square)](https://www.farming-simulator.com/mod.php?mod_id=306015&title=fs2025)
[![GitHub issues](https://img.shields.io/github/issues/Peppie84/FS25_ExtendedGameInfoDisplay?style=flat-square)](https://github.com/Peppie84/FS25_ExtendedGameInfoDisplay/issues)
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue?style=flat-square)](https://www.gnu.org/licenses/gpl-3.0)
[![Top language](https://img.shields.io/github/languages/top/Peppie84/FS25_ExtendedGameInfoDisplay?style=flat-square&color=blueviolet)](https://github.com/search?q=repo%3APeppie84%FS25_ExtendedGameInfoDisplay++language%3ALua&type=code)


<br />

<a href="waiting-for-modhub">
<img src="documents/icon_ExGameInfoDisp.png" style="width: 250px;">
</a>

<h3 align="center"><u>FS25_ExtendedGameInfoDisplay</u></h3>

<p align="center">
Expands the current GameInfoDisplay in the upper right corner by displaying the current year under the date and activates 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.
</p>

</div>

<div align='center'>
<img src="documents/screen2-v1.0.0.0.png" style="width: 50%;">
</div>

## Credits
* Woeller ([Youtube](https://www.youtube.com/@woeller))
* Sqeep

# Copyright
Copyright (c) 2024 [Dennis Schmitt](https://github.com/peppie84).
All rights reserved.

<p align="right">(<a href="#readme-top">back to top</a>)</p>
Binary file added documents/Screens.afdesign
Binary file not shown.
Binary file added documents/icon_ExGameInfoDisp.afdesign
Binary file not shown.
Binary file added documents/icon_ExGameInfoDisp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added documents/screen1-v1.0.0.0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added documents/screen2-v1.0.0.0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added documents/screen3-v1.0.0.0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 63fb04b

Please sign in to comment.