Giter VIP home page Giter VIP logo

Comments (10)

credomane avatar credomane commented on June 12, 2024

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.

Afforess avatar Afforess commented on June 12, 2024

@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.

credomane avatar credomane commented on June 12, 2024

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.

Afforess avatar Afforess commented on June 12, 2024

Ah okay. Yeah your edit makes sense to me!

from factorio-stdlib.

credomane avatar credomane commented on June 12, 2024

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.

Afforess avatar Afforess commented on June 12, 2024

@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.

credomane avatar credomane commented on June 12, 2024

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.

Afforess avatar Afforess commented on June 12, 2024

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.

credomane avatar credomane commented on June 12, 2024

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.

Afforess avatar Afforess commented on June 12, 2024

Lame.

from factorio-stdlib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.