Or to say it alternatively:
Display of, how many time of Sunlight ( or night ) remains, till the condition changes.
(could also be some kind of graphical display ... maybe a small display of a sun/moon that appears on some horizon on the left, then rises till the middle of the display and finally sinks and vanishes at the right of the display)
I don´t know how the others do it, but I usually prefer to stay/work in the well lit conditions of my base/s during the nighttime and only venture into the wilderness during the night.
Therefore, especially if I am planning long distance voyages into the wilderness, it would be extremly useful for me to know if there is enough daytime remaining (or if I rather should stay at home and do it at the beginning of the next day)
Display of Time of Day
Moderator: ickputzdirwech
-
- Inserter
- Posts: 31
- Joined: Mon May 13, 2013 12:54 pm
- Contact:
Re: Display of Time of Day
Other ways to display it:
- Shadows of the buildings/trees changes
- The light has different colors. Day: White, Morning/Evening: Red, Night: Blue
- Shadows of the buildings/trees changes
- The light has different colors. Day: White, Morning/Evening: Red, Night: Blue
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
Re: Display of Time of Day
I made a quick mod that shows you the time of day. It doesn't look nice or anything as the GUI API seems a bit buggy, however it does work. I used that as a good indicator.
Factorio Modder
Solar Expansion
Solar Expansion
Re: Display of Time of Day
Perhaps one could build such device in-game by observing the power output of a solar panel?
Re: Display of Time of Day
LOL... yup, just look at the power output of a solar panel to get a good indication.MF- wrote:Perhaps one could build such device in-game by observing the power output of a solar panel?
Factorio Modder
Solar Expansion
Solar Expansion
-
- Inserter
- Posts: 31
- Joined: Mon May 13, 2013 12:54 pm
- Contact:
Re: Display of Time of Day
Made ony myself now as well by using getdaytime() and doing an array lookup to convert it into a 24hour timescale, although it is rather rudimentary by now.
Still have to find out how the heck I can change the text color of labels from black to another (white, for example).
At the moment the label is rather difficult to read because of its black color
Still have to find out how the heck I can change the text color of labels from black to another (white, for example).
At the moment the label is rather difficult to read because of its black color
Re: Display of Time of Day
https://forums.factorio.com/wiki/inde ... Properties
https://forums.factorio.com/wiki/index.php/Lua/Font
so, you can write for example:
To have bold white colored label.
https://forums.factorio.com/wiki/index.php/Lua/Font
so, you can write for example:
Code: Select all
mylabel.font={color={r=1, g=1, b=1}, bold=true}
-
- Inserter
- Posts: 31
- Joined: Mon May 13, 2013 12:54 pm
- Contact:
Re: Display of Time of Day
Thanks a lot.
I already tried several approaches but was stumped, as even those approaches that didn´t give me errors didn´t change the color.
And even your approach didn´t change the color (initially).
It turned out that I made 2 errors ... the first one was (in my own approaches) to use round brackets instead of curly ones,
the second (which also affected my first trial with your approach) was, to assume that the changed mod would also affect games that had been saved (under an earlier version of the mod).
After starting a new game, I now have a nice white display of the time of day in the upper left corner
I think I will put it into the mod-library (after some tweaking with the numbers saved in the array ... I divided a 24 hours day into 10 equidistant chunks ... but for some reason the dark hours of the night seem to be rather short (only 0.25 of the total 1 time units) ... tweaking the array so that the distances between the hours in the night are bigger in my array will do the trick)
I already tried several approaches but was stumped, as even those approaches that didn´t give me errors didn´t change the color.
And even your approach didn´t change the color (initially).
It turned out that I made 2 errors ... the first one was (in my own approaches) to use round brackets instead of curly ones,
the second (which also affected my first trial with your approach) was, to assume that the changed mod would also affect games that had been saved (under an earlier version of the mod).
After starting a new game, I now have a nice white display of the time of day in the upper left corner
I think I will put it into the mod-library (after some tweaking with the numbers saved in the array ... I divided a 24 hours day into 10 equidistant chunks ... but for some reason the dark hours of the night seem to be rather short (only 0.25 of the total 1 time units) ... tweaking the array so that the distances between the hours in the night are bigger in my array will do the trick)
Re: Display of Time of Day
This is the code I use to display a digital clock at the top-left of the screen. I put this in "control.lua" file for a new mod I'm working on.
Code: Select all
require "defines"
game.oninit(function()
game.player.gui.left.add{
type="label",
name="label_time",
caption="time"
}
end)
game.onevent(defines.events, function(event)
if event.name == defines.events.ontick then
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) - (time * 24)))
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