Skip to content

Commit

Permalink
Merge pull request #7 from VertexDezign/fs22
Browse files Browse the repository at this point in the history
Fs22
  • Loading branch information
Grisu118 authored Jan 21, 2022
2 parents 92434bb + 8a242c3 commit 43fd87c
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 89 deletions.
7 changes: 4 additions & 3 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# RealClock

[![ModHub Download](https://img.shields.io/badge/%5BFS17%5D%20ModHub-2.0.1.0-green.svg?style=flat-square)](https://farming-simulator.com/mod.php?lang=de&country=ch&mod_id=51459&title=fs2017)
[![ModHub Download](https://img.shields.io/badge/%5BFS19%5D%20ModHub-1.1.1.0-blue.svg?style=flat-square)](https://farming-simulator.com/mod.php?lang=de&country=ch&mod_id=117935&title=fs2019)
[![ModHub Download](https://img.shields.io/badge/%5BFS19%5D%20ModHub-1.1.1.0-green.svg?style=flat-square)](https://farming-simulator.com/mod.php?lang=de&country=ch&mod_id=117935&title=fs2019)
[![ModHub Download](https://img.shields.io/badge/%5BFS22%5D%20ModHub-1.0.0.0-blue.svg?style=flat-square)](https://farming-simulator.com/mod.php?mod_id=224748)

A small script, which shows the actual time in the upper right corner.

Expand All @@ -27,8 +28,8 @@ A small script, which shows the actual time in the upper right corner.
* Slivicon (config file)

# LICENSE
Copyright (c) 2017-2018 VertexDezign All rights reserved.
Copyright (c) 2017-2018 Benjamin Leber All rights reserved.
Copyright (c) 2017-2022 VertexDezign All rights reserved.
Copyright (c) 2017-2022 Benjamin Leber All rights reserved.

This copyright does not impugn any trademarks or copyrights owned by Giants

Expand Down
10 changes: 6 additions & 4 deletions RealClock.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
-- v2.0.1 - 2018-01-13 - Do not render clock when renderTime is false
-- v2.1 - 2019-01-14 - Move settings file to modSettings folder, do not draw when showTime is false
-- v2.1.1 - 2019-04-01 - Create modSettings folder
-- v3.0 - 2021-11-19 - FS22
-- @descripion: Shows the real time clock in the upper right corner
-- @web: http://grisu118.ch or http://vertexdezign.net
-- Copyright (C) Grisu118, All Rights Reserved.
Expand Down Expand Up @@ -57,7 +58,7 @@ function RealClock:loadMap(name)
if g_dedicatedServerInfo == nil then
local xmlFile = g_modsDirectory .. "/" .. RealClock.configFileName
if not fileExists(xmlFile) then
local modSettingsDir = getUserProfileAppPath() .. "modsSettings"
local modSettingsDir = getUserProfileAppPath() .. "modSettings"
local newXmlFile = modSettingsDir .. "/" .. RealClock.configFileName
if not fileExists(newXmlFile) then
createFolder(modSettingsDir)
Expand Down Expand Up @@ -96,12 +97,13 @@ function RealClock:update(dt)
end

function RealClock:draw()
if g_dedicatedServerInfo ~= nil or not g_currentMission.renderTime or not g_currentMission.hud.showTime then
if g_dedicatedServerInfo ~= nil or not g_currentMission.hud.showTime then
return
end

local r, g, b, a = self:getColor(self.rendering.color)
setTextColor(r, g, b, a)
setTextBold(false)
local fontSize = g_gameSettings:getValue("uiScale") * self.rendering.fontSize
local date = getDate(self.timeFormat)
local posX = self.position.x
Expand All @@ -123,7 +125,7 @@ function RealClock:getColor(source)
elseif color == "black" then
return 0, 0, 0, 1
else
local splitted = StringUtil.splitString(",", color)
local splitted = color:split(",")
local colors = {}
for _, v in pairs(splitted) do
table.insert(colors, tonumber(v))
Expand Down Expand Up @@ -200,7 +202,7 @@ function RealClock:setValuesFromXML(fileName)
local color = Utils.getNoNil(getXMLString(xml, "RealClock.rendering#color"), RealClock.d.rendering.color)
-- validate color
if color:lower() ~= "white" and color:lower() ~= "black" then
local c = StringUtil.splitString(",", color)
local c = color:split(",")
if table.getn(c) == 4 then
local valid = true
for _, v in pairs(c) do
Expand Down
4 changes: 2 additions & 2 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh

ZIPNAME="FS19_real_clock.zip"
MOD_DIR="C:\Users\benjamin\Documents\My Games\FarmingSimulator2019\mods"
ZIPNAME="FS22_real_clock.zip"
MOD_DIR="C:\Users\benjamin\Documents\My Games\FarmingSimulator2022\mods"

if [ -f $ZIPNAME ]; then
echo "Remove old zip"
Expand Down
19 changes: 0 additions & 19 deletions formats_de.txt

This file was deleted.

19 changes: 0 additions & 19 deletions formats_en.txt

This file was deleted.

106 changes: 64 additions & 42 deletions modDesc.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" standalone="no" ?>
<modDesc descVersion="43">
<modDesc descVersion="61">
<author>VertexDezign and Slivicon</author>
<version>1.1.2.0</version>
<version>1.0.0.0</version>
<title>
<en>RealClock Mod</en>
<de>Echte Uhrzeit Mod</de>
Expand All @@ -10,53 +10,75 @@
<en>
<![CDATA[Shows the current real time in the upper right corner.
This script creates a configuration xml at first startup in your modfolder. There you can adjust the following:
* Position <position isDynamic="bool" x="[0,1]" y="[0,1]"/>
* isDynamic
true: automatically position the text in the upper right corner considering his dimensions, ignore x and y
false: Use x and y ignoring text dimension
* x, y: the position on the screen, see small illustration below for details
1,0 .. 1,1
0,0 .. 1,0
* Color and size of text <rendering color="black|white|r,g,b,a" fontSize="[0,1]"/>
* color: supports the following text values: black, white and all rgba colors seperated by comma in the range [0..1] example king blue "0.25,0.41,0.88,1"
* fontSize: the size of the font to display, a value in the range [0..1], default 0.015. UI Scale is used for calculating the font size to display
* Format of datetime string (placeholders see formats_en.txt)
This script creates a configuration xml at first startup in your modSettings folder. There you can adjust the following:
* Position <position isDynamic="bool" x="[0,1]" y="[0,1]"/>
* isDynamic
true: automatically position the text in the upper right corner considering his dimensions, ignore x and y
false: Use x and y ignoring text dimension
* x, y: the position on the screen, see small illustration below for details
1,0 .. 1,1
0,0 .. 1,0
* Color and size of text <rendering color="black|white|r,g,b,a" fontSize="[0,1]"/>
* color: supports the following text values: black, white and all rgba colors seperated by comma in the range [0..1] example king blue "0.25,0.41,0.88,1"
* fontSize: the size of the font to display, a value in the range [0..1], default 0.015. UI Scale is used for calculating the font size to display
* Format of datetime string (see list below)
Changelog 1.1.2.0:
- Fix settings file save place
Changelog 1.1.1.0:
- Create modSettings folder if not existent
Changelog 1.1.0.0:
- Improve description
- Move settings xml to modSettings folder
- Hide clock if huds hidden (gsToggleNoHudAndFlightMode)
Possible Formats:
%a abbreviated weekday name (e.g., Wed)
%A full weekday name (e.g., Wednesday)
%b abbreviated month name (e.g., Sep)
%B full month name (e.g., September)
%c date and time (e.g., 09/16/98 23:48:10)
%d day of the month (16) [01-31]
%H hour, using a 24-hour clock (23) [00-23]
%I hour, using a 12-hour clock (11) [01-12]
%M minute (48) [00-59]
%m month (09) [01-12]
%p either "am" or "pm" (pm)
%S second (10) [00-61]
%w weekday (3) [0-6 = Sunday-Saturday]
%x date (e.g., 09/16/98)
%X time (e.g., 23:48:10)
%Y full year (1998)
%y two-digit year (98) [00-99]
%% the character `%´
]]>
</en>
<de>
<![CDATA[Zeigt die aktuelle echte Uhrzeit oben rechts im Spiel an.
Das Script erstellt beim ersten Start eine xml Datei im Mod Ordner. Dort könnt ihr folgende dinge anpassen:
* Position <position isDynamic="bool" x="[0,1]" y="[0,1]"/>
* isDynamic
true: automatische positionierung unter berücksichtigung der Text Breite und Höhe im oberen rechten Ecken. X und Y werden ignoriert.
false: Nutze x und y, Text Höhe und Breite werden ignoriert
* x, y: Die Position auf dem Bildschirm, welche Ecken welche werte haben könnt ihr der Illustration unten entnehmen.
1,0 .. 1,1
0,0 .. 1,0
* Farbe und Grösse vom Text <rendering color="black|white|r,g,b,a" fontSize="[0,1]"/>
* color: Unterstüzt die folgenden beiden Text Werte: black, white und rgba Farben getrennt durch ein Komma im Bereich [0..1] Beispiel Königsblau "0.25,0.41,0.88,1"
* fontSize: Die grösse der Schrift, ein wert im Bereich [0..1], Standart ist 0.015. UI Skalierung wird mit einbezogen bei der Darstellung!
* Format des Strings (Formatierungsmöglichkeiten siehe formats_de.txt)
Das Script erstellt beim ersten Start eine xml Datei im modSettings Ordner. Dort könnt ihr folgende dinge anpassen:
* Position <position isDynamic="bool" x="[0,1]" y="[0,1]"/>
* isDynamic
true: automatische positionierung unter berücksichtigung der Text Breite und Höhe im oberen rechten Ecken. X und Y werden ignoriert.
false: Nutze x und y, Text Höhe und Breite werden ignoriert
* x, y: Die Position auf dem Bildschirm, welche Ecken welche werte haben könnt ihr der Illustration unten entnehmen.
1,0 .. 1,1
0,0 .. 1,0
* Farbe und Grösse vom Text <rendering color="black|white|r,g,b,a" fontSize="[0,1]"/>
* color: Unterstüzt die folgenden beiden Text Werte: black, white und rgba Farben getrennt durch ein Komma im Bereich [0..1] Beispiel Königsblau "0.25,0.41,0.88,1"
* fontSize: Die grösse der Schrift, ein wert im Bereich [0..1], Standart ist 0.015. UI Skalierung wird mit einbezogen bei der Darstellung!
* Format des Strings (siehe Liste unten)
Changelog 1.1.2.0:
- Korrigiere settings xml speicher ort.
Changelog 1.1.1.0:
- modSettings Ordner wird erstellt, falls er noch nicht existiert
Changelog 1.1.0.0:
- Verbesserte Beschreibung
- Verschieben der settings xml in den modSettings Ordner
- Die Uhr wird nicht mehr angezeigt wenn der noHud modus aktiv ist (via Konsole)
Mögliche Formate
%a Wochentag abgekürzt (z.B., Wed)
%A Wochentag ausgeschrieben (z.B., Wednesday)
%b Monat abgekürzt (z.B., Sep)
%B Monat ausgeschrieben (z.B., September)
%c Tag und zeit (z.B., 09/16/98 23:48:10)
%d Tag des monats (16) [01-31]
%H Stunde, 24h modus (23) [00-23]
%I Stunde, 12h modus (11) [01-12]
%M Minute (48) [00-59]
%m Monat (09) [01-12]
%p entweder "am" oder "pm" (pm)
%S Sekunde (10) [00-61]
%w Wochentag (3) [0-6 = Sunday-Saturday]
%x Datum (e.g., 09/16/98)
%X Zeit (e.g., 23:48:10)
%Y volles Jahr (1998)
%y zweistelliges Jahr (98) [00-99]
%% Das Zeichen `%´
]]>
</de>
</description>
Expand Down
Binary file modified store_clock.dds
Binary file not shown.

0 comments on commit 43fd87c

Please sign in to comment.