[MOD 0.4.x] Factorio Clock
-
- Inserter
- Posts: 31
- Joined: Mon May 13, 2013 12:54 pm
- Contact:
[MOD 0.4.x] Factorio Clock
A tiny mod that displays the hour of day in 24h format in the upper left corner.
Very useful if you want to estimate how much time of night (or day) there is still left.
It begins to darken around 17/19 o`clock and the sun rises again around 4/5 o clock in the morning.
(the game only has 25% of its time as dark hours ... much less than you´ll find in a normal european night ... therefore I skipped a few night hours, to present a clock/cycle that somehow resembles the one we have on earth ... so don´t be astonished if hours pass by very fast during the night )
That´s what it looks like (in upper left corner):
Very useful if you want to estimate how much time of night (or day) there is still left.
It begins to darken around 17/19 o`clock and the sun rises again around 4/5 o clock in the morning.
(the game only has 25% of its time as dark hours ... much less than you´ll find in a normal european night ... therefore I skipped a few night hours, to present a clock/cycle that somehow resembles the one we have on earth ... so don´t be astonished if hours pass by very fast during the night )
That´s what it looks like (in upper left corner):
- Attachments
-
- TimeOfDay.rar
- Unrar the folder and put into mods-folder. You´ll have to start a new game for the mod to take effect
- (734 Bytes) Downloaded 741 times
Re: [Mod 1.0]Factorio Clock
Sweet! I made a clock myself quite similar in the format HH:MM, but the time didn't speed up during the night to resemble Earth-based timing. I do like that you made it resemble our time as it might be easier to use it for tracking day/night cycles.
Factorio Modder
Solar Expansion
Solar Expansion
Re: [Mod 0.4.x]Factorio Clock
The night is shorter to make it less annoying, I think it would be better to not speed it up and just live with the fact that night is 8 hours.
-
- Inserter
- Posts: 31
- Joined: Mon May 13, 2013 12:54 pm
- Contact:
Re: [Mod 0.4.x]Factorio Clock
Well, I am definitely not against the fact that the period of darkness is so short and will support to keep it this way.
But from a human psychology standpoint I for my part definitely find it better to have the night start/end at clock times that I intuitively connect with the start/end of night (instead of the unusual clock times for the start/end of darkness that we get when we divide a 24 hour clock into equidistant chunks). Especially as the skipping of hours only takes place in the (more unimportant) hours of night, while the important day hours (with the exception of noon which takes 2 chunks) are divided into 1 hour chunks
But changing my mod into other hour values (maybe even to AM/PM format) is rather easy ... people just have to change the array content into hour values of their liking and, of course, are free to do so if they wish
But from a human psychology standpoint I for my part definitely find it better to have the night start/end at clock times that I intuitively connect with the start/end of night (instead of the unusual clock times for the start/end of darkness that we get when we divide a 24 hour clock into equidistant chunks). Especially as the skipping of hours only takes place in the (more unimportant) hours of night, while the important day hours (with the exception of noon which takes 2 chunks) are divided into 1 hour chunks
But changing my mod into other hour values (maybe even to AM/PM format) is rather easy ... people just have to change the array content into hour values of their liking and, of course, are free to do so if they wish
Re: [Mod 0.4.x]Factorio Clock
I'm just going to leave this here...
What does it do? Displays the time in HH:MM format with AM/PM.
Code: Select all
require "defines"
game.oninit(function()
-- create label
game.player.gui.left.add {
type="label",
name="label_time",
caption="______"
}
end)
game.onevent(defines.events, function(event)
if event.name == defines.events.ontick then
-- format label
game.player.gui.left.label_time.font = {
color = {r=1, g=1, b=1},
bold = true
}
-- format time
local time = game.getdaytime()
time = time + 0.5
if time > 1 then
time = time - 1
end
-- format hour
local hour = math.floor(time * 24)
local meridiem = "AM"
if hour > 12 then
hour = hour - 12
meridiem = "PM"
end
-- format minute
local minute = math.floor(60 * ((time * 24) - math.floor(time * 24)))
if minute < 10 then
minute = "0" .. minute
end
-- display time
game.player.gui.left.label_time.caption =
hour .. ":" .. minute .. " " .. meridiem
end
end)
Factorio Modder
Solar Expansion
Solar Expansion
Re: [Mod 0.4.x]Factorio Clock
what about checking if the player haves a clock item in the inv?
Re: [Mod 0.4.x]Factorio Clock
That's a great idea!ficolas wrote:what about checking if the player haves a clock item in the inv?
Factorio Modder
Solar Expansion
Solar Expansion
Re: [Mod 0.4.x]Factorio Clock
Cool mod, it is really useful. But it might be nice to add also minutes, so one could have more accurate information how the day progresses.
Re: [Mod 0.4.x]Factorio Clock
Hi, I took a look at your mod.
It is better to register the event only on the type you need, this saves the performance, and also makes the code more simple.
This code registeres the event to all events defined in the devines.events table
If you write it like this, it will only be called for the ontick event, so you can also get rid of the if checking that the event is of type ontick
In 0.5, the font will not work anymore, as the gui appearence is controlled by the style attribute, so the command will have to be written like this:
It is better to register the event only on the type you need, this saves the performance, and also makes the code more simple.
This code registeres the event to all events defined in the devines.events table
Code: Select all
game.onevent(defines.events, function(event)
Code: Select all
game.onevent(defines.events.ontick, function(event)
Code: Select all
game.player.gui.left.dn_clock.style.font = "default-bold"
-
- Inserter
- Posts: 31
- Joined: Mon May 13, 2013 12:54 pm
- Contact:
Re: [MOD 0.4.x] Factorio Clock
Oops, had I looked into my htread a little bit earlier I wouldn´t have had to ask about the font-problem.
Well, new version of the Clock-Mod for version 5.2 of Factorio.
Now, with minutes (as zlosynus wanted) and using the format that kovario suggested (with ontick-specific event requery).
I dropped my former method of putting more hours into the nighttime (i.e. letting minutes/hours pass faster during the night)
therefore we now have the start of dusk around 19:00 and the end of dawn around 4:00 with the darkest time being between 22:30 and 1:00
Well, new version of the Clock-Mod for version 5.2 of Factorio.
Now, with minutes (as zlosynus wanted) and using the format that kovario suggested (with ontick-specific event requery).
I dropped my former method of putting more hours into the nighttime (i.e. letting minutes/hours pass faster during the night)
therefore we now have the start of dusk around 19:00 and the end of dawn around 4:00 with the darkest time being between 22:30 and 1:00
- Attachments
-
- TimeOfDay.rar
- Unpack into your mod-folder ... only use if you have Factorio version >= 5.2
- (747 Bytes) Downloaded 466 times
Re: [MOD 0.4.x] Factorio Clock
Hey cool mod kinda should be Vanilla. Totally BUMPing this
Re: [MOD 0.4.x] Factorio Clock
Here is a version compatible with Factorio 0.10.8.
- Attachments
-
- TimeOfDay_0.10.8.zip
- (837 Bytes) Downloaded 294 times
Last edited by DaveMcW on Sat Aug 23, 2014 6:39 pm, edited 1 time in total.
Re: [MOD 0.4.x] Factorio Clock
This mod still works fine in 0.10.8. It'll probably break in 0.11.0 when version numbers are required though.DaveMcW wrote:Here is a version compatible with Factorio 0.10.8.
Re: [MOD 0.4.x] Factorio Clock
Versionnumbers are already required in 0.10.8. I can't install a mod without having the version number in the foldername.Turtle wrote:This mod still works fine in 0.10.8. It'll probably break in 0.11.0 when version numbers are required though.DaveMcW wrote:Here is a version compatible with Factorio 0.10.8.
Re: [MOD 0.4.x] Factorio Clock
From https://forums.factorio.com/forum/vie ... =14&t=5364:NicoH wrote:Versionnumbers are already required in 0.10.8. I can't install a mod without having the version number in the foldername.Turtle wrote:This mod still works fine in 0.10.8. It'll probably break in 0.11.0 when version numbers are required though.DaveMcW wrote:Here is a version compatible with Factorio 0.10.8.
"The filename format without version number is deprecated since 0.10.7 and will eventually (in 0.11.0, probably) be completely disabled."
Mods without version numbers work for me.
-
- Filter Inserter
- Posts: 337
- Joined: Fri May 30, 2014 4:23 am
- Contact:
Re: [MOD 0.4.x] Factorio Clock
Currently in 0.10.8 it just requires all the modnames to be lowercase, in 0.11.0 it will be required to include the version with the name.
When i stream twitch i always answer questions and try to help, come visit me.