Page 1 of 1
[MOD 0.4.x] Factorio Clock
Posted: Sun May 19, 2013 3:28 am
by DexterNemrod
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):
- Factorio_Clock_2.jpg (500.55 KiB) Viewed 15183 times
- Factorio_Clock_2b.jpg (8.68 KiB) Viewed 15183 times
Re: [Mod 1.0]Factorio Clock
Posted: Sun May 19, 2013 3:31 am
by metzyn
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.
Re: [Mod 0.4.x]Factorio Clock
Posted: Sun May 19, 2013 12:06 pm
by kovarex
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.
Re: [Mod 0.4.x]Factorio Clock
Posted: Sun May 19, 2013 8:03 pm
by DexterNemrod
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
Re: [Mod 0.4.x]Factorio Clock
Posted: Thu May 23, 2013 4:44 pm
by metzyn
I'm just going to leave this here...
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)
What does it do? Displays the time in HH:MM format with AM/PM.
Re: [Mod 0.4.x]Factorio Clock
Posted: Thu May 23, 2013 4:59 pm
by ficolas
what about checking if the player haves a clock item in the inv?
Re: [Mod 0.4.x]Factorio Clock
Posted: Thu May 23, 2013 5:55 pm
by metzyn
ficolas wrote:what about checking if the player haves a clock item in the inv?
That's a great idea!
Re: [Mod 0.4.x]Factorio Clock
Posted: Mon Jun 03, 2013 10:49 am
by zlosynus
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
Posted: Tue Jun 04, 2013 10:07 pm
by kovarex
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
Code: Select all
game.onevent(defines.events, function(event)
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
Code: Select all
game.onevent(defines.events.ontick, function(event)
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:
Code: Select all
game.player.gui.left.dn_clock.style.font = "default-bold"
Re: [MOD 0.4.x] Factorio Clock
Posted: Wed Jun 26, 2013 4:30 pm
by DexterNemrod
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
Re: [MOD 0.4.x] Factorio Clock
Posted: Fri Jun 27, 2014 9:08 pm
by orion420
Hey cool mod kinda should be Vanilla. Totally BUMPing this
Re: [MOD 0.4.x] Factorio Clock
Posted: Sat Aug 23, 2014 9:47 am
by DaveMcW
Here is a version compatible with Factorio 0.10.8.
Re: [MOD 0.4.x] Factorio Clock
Posted: Sat Aug 23, 2014 3:04 pm
by Turtle
DaveMcW wrote:Here is a version compatible with Factorio 0.10.8.
This mod still works fine in 0.10.8. It'll probably break in 0.11.0 when version numbers are required though.
Re: [MOD 0.4.x] Factorio Clock
Posted: Sat Aug 23, 2014 10:12 pm
by NicoH
Turtle wrote:DaveMcW wrote:Here is a version compatible with Factorio 0.10.8.
This mod still works fine in 0.10.8. It'll probably break in 0.11.0 when version numbers are required though.
Versionnumbers are already required in 0.10.8. I can't install a mod without having the version number in the foldername.
Re: [MOD 0.4.x] Factorio Clock
Posted: Sat Aug 23, 2014 10:24 pm
by Turtle
NicoH wrote:Turtle wrote:DaveMcW wrote:Here is a version compatible with Factorio 0.10.8.
This mod still works fine in 0.10.8. It'll probably break in 0.11.0 when version numbers are required though.
Versionnumbers are already required in 0.10.8. I can't install a mod without having the version number in the foldername.
From
https://forums.factorio.com/forum/vie ... =14&t=5364:
"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.
Re: [MOD 0.4.x] Factorio Clock
Posted: Sat Aug 23, 2014 10:36 pm
by OBAMA MCLAMA
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.