Comments (10)
I took a quick stab at this. What should we call sunrise and sunset? The exact time brightness leaves/reaches the darkest point or the exact time brightness leaves/reaches the max? Somewhere in the middle?
In my town sunset is currently 8:29PM but doesn't start getting dark until about 9:30pm then around 10pm it is completely dark. The same for sunrise. Sunrise is 6:24am but when I'm up for my daily walk at 6am it is already bright out.
[edit]
I set the sunrise time to be about when the player flashlight clicks off and sunset for when it comes on.
I'll write some tests then push a PR for it to get looked over.
from factorio-stdlib.
@credomane the events are for in-game time, not real life. So an event when the brightness starts increasing from 0.14 -> 1 would be the sunrise event, and the sunset event would be when brightness decreased from 1 -> 0.14.
from factorio-stdlib.
I just finished posting an edit for what I did. I can adjust it to that if you want.
I set the sunrise time to be about when the player flashlight clicks off and sunset for when it comes on.
I'll write some tests then push a PR for it to get looked over.
Mostly used the real life times as a reference point for what I meant. Not sure it helped or made it harder to explain what I meant.
from factorio-stdlib.
Ah okay. Yeah your edit makes sense to me!
from factorio-stdlib.
I really hate writing tests. I feel like right now I'm making the entire Factorio game world just to do a single test.
from factorio-stdlib.
@credomane you can generally get away with only making as many pieces of the game as you actually need. In this case, the script.on_event and a mock surface object is probably all you need.
from factorio-stdlib.
making as many pieces of the game as you actually need.
Which seems like way more than it should be.
I have to build remote.interfaces
to get the daytime from MoWeather if it exists as it likes to play with the surface daytime to simulate lightning as such.
Had to build 2 functions of script
and a decent portion of game
.
That was just to get the test running with out crashing due to a unknown function/table/whatever. Now I'm currently bashing my head against Function was not called with the arguments
. Thanks busted. Now tell me what it was called with so I actually know what my problem is.
I know the issue is my failure in writing the test properly as while debugging the events fired on time every time inside Factorio. :(
Time to myfile:write(serpent.dump(eventtable))
to the rescue. lol
[edit]
and serpent shows my mistake in bright flashing colors.
from factorio-stdlib.
I have to build remote.interfaces to get the daytime from MoWeather if it exists as it likes to play with the surface daytime to simulate lightning as such.
I am not sure this is needed, because Factorio 0.13 split the time of day and 'darkness' of a surface into two separate values. Changing the darkness no longer requires manipulating the time.
from factorio-stdlib.
They did but darkness is marked read-only. Attempting to change it throws an error "LuaSurface::darkness is read-only." :(
I tried to maintain the most compatibility I could by polling MoWeather for the surface time if it is installed since LuaSurface.daytime becomes unreliable.
from factorio-stdlib.
Lame.
from factorio-stdlib.
Related Issues (20)
- Upgrade Readme and Wiki HOT 2
- To Do List
- Data.Util.Duplicate on normal/expensive recipes HOT 6
- Wiki with list of functions and their functionalities HOT 2
- Recipe:clear_ingredients error HOT 5
- Small errors found with trains/events HOT 6
- add_ingredient issue HOT 8
- 0.18 support? HOT 1
- remove_prereq nullifies prerequisites value of technology table.
- errors found with trains/events
- add_ingredient cant find items that are modules
- Event handler filter is ignored if more than one event ID is specified in `register`
- spidertron-remotes aren't checked as "items" so a recipe result (and more) may fail to find one HOT 1
- documentation broken HOT 2
- Event.register not passing pattern to function HOT 1
- Inconsistency of technology pack methods
- Gui events not working HOT 1
- String.contains doesn't work with strings that contain a hyphen.
- Question: Which tool can be used to interpret the code documentation in VSCode
- This does not look right: return (Area.size(Area)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from factorio-stdlib.