Skip to content

Commit

Permalink
Merge pull request #4 from VertexDezign/fs19-1.1
Browse files Browse the repository at this point in the history
Fs19 1.1
  • Loading branch information
Grisu118 authored Mar 5, 2019
2 parents ecc10df + 0514465 commit 182c149
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 6 deletions.
16 changes: 13 additions & 3 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
# 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.0.0.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.0.0-blue.svg?style=flat-square)](https://farming-simulator.com/mod.php?lang=de&country=ch&mod_id=117935&title=fs2019)

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

## Features
* Show time on ui
* Customize in xml found in your mod dir after first start
* position
* text color and size
* 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
* datetime format (placeholders like here in os.date -> https://www.lua.org/pil/22.1.html)

## Credits
Expand Down
10 changes: 8 additions & 2 deletions RealClock.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
-- v1.1 - 2017-09-11 - Add use of UI Scale
-- v2.0 - 2017-09-23 - Add config xml
-- 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
-- @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 @@ -53,8 +54,13 @@ function RealClock:loadMap(name)
if g_dedicatedServerInfo == nil then
local xmlFile = g_modsDirectory .. "/" .. RealClock.configFileName;
if not fileExists(xmlFile) then
self:writeDefaultConfig(xmlFile);
local newXmlFile = getUserProfileAppPath() .. "modsSettings/" .. RealClock.configFileName;
if not fileExists(newXmlFile) then
self:writeDefaultConfig(newXmlFile);
end
self:setValuesFromXML(newXmlFile)
else
self.debugger:warn("Loading configuration from mod folder, this is deprecated and will be removed in a furhter version. Move your " .. RealClock.configFileName .. " in the modSettings folder.")
self:setValuesFromXML(xmlFile);
end
end
Expand All @@ -73,7 +79,7 @@ function RealClock:update(dt)
end

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

Expand Down
26 changes: 25 additions & 1 deletion 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="41">
<author>Vertexdezign, Slivicon</author>
<version>1.0.0.0</version>
<version>1.1.0.0</version>
<title>
<en>RealClock Mod</en>
<de>Echte Uhrzeit Mod</de>
Expand All @@ -12,19 +12,43 @@
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)
Changelog 1.1.0.0:
- Improve description
- Move settings xml to modSettings folder
- Hide clock if huds hidden (gsToggleNoHudAndFlightMode)
]]>
</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)
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)
]]>
</de>
</description>
Expand Down

0 comments on commit 182c149

Please sign in to comment.