Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REQUEST] Pregnancy test time display changes #148

Open
jaypaw549 opened this issue Nov 28, 2024 · 4 comments
Open

[REQUEST] Pregnancy test time display changes #148

jaypaw549 opened this issue Nov 28, 2024 · 4 comments
Labels
Request Request for new feature or changes

Comments

@jaypaw549
Copy link

Describe the bug

A clear and concise description of what the bug is. What is happening, under what circumstances is it happening, what are you expecting to happen, how can one reproduce this issue? No detail is too small.

The pregnancy test displays the incorrect due date. I began on my starting world to run some tests, and invited a friend to help get my character pregnant. Immediately after receiving the book, we used a test and it displayed 309 days until it was due. Now either the config file wasn't being read, which is highly unlikely, or the pregnancy test was incorrect. We traveled around a bit and discovered the due date varied by planet, going up or down based on where we went.

Being a programmer, I wanted to set the config values correctly, so I dived into the code myself, and discovered the pregnancy code was calculated based on script delta times. This means that travel shouldn't affect it unlike the old code which ran on world time. Suspecting the issue wasn't the pregnancy itself, but the pregnancy test item itself, I dug into the code for pregnancy and the pregnancy test again.

I quickly re-confirmed that the pregnancy code works off script delta time, and the pregnancy test utilizes world time, causing the results to not match. Checking the rest of the code, I found that the code can likely be fixed by removing line 90 from the pregnancy test code.


Log File

Attach your starbound.log file for the game session in which the error occured.
The logfile is found in <Starbound install folder>/storage/starbound.log
When file extensions are disabled, it's a text file simply called "starbound".

Since you asked: starbound.log

Make sure info and debug level logging is enabled in your main sexbound config.
When playing on a server, the server log will be needed.
In order to make tracing potential errors easier, use log files where you did as little as possible other than triggering the error.

I didn't have debug level logging enabled, sorry.


Additional context

Add any other context about the problem here.

/scripts/plugins/pregnant/pregnant.lua line 102 decreases the birthWorldTime by the delta time each time its run, however /items/active/lox_pregnancytest/pregnancytest.lua line 90 adjusts the birthWorldTime by the current date on the world you're currently in, making the test results very misleading.


@ErinaSugino
Copy link
Owner

I can look into thing in more detail later, but for now you're pointing out two different systems. It is correct that the player uses script delta instead of world time in SBR to fix the time travel pregnancy issues - as the world time differs per planet, and the shipworld hijacks the time of the world it orbits around I think. Player pregnancies also support an initial delay. That's the side of the pregnancy logic that uses script delta and applies only to players.

NPCs still use the old system, as NPCs are intended to only ever stay on a single world regardless, allowing time to tick based on universe time even if the player isn't present to load the chunks in. That's why the pregnancy test handles both systems. In pregnancytest.lua line 183+ you can see the different time calculation methods to be used based on OS time setting and mother entity type.

@jaypaw549
Copy link
Author

I did notice NPCs utilized the world time, which makes sense as you can't update them all the time. However I missed the function name being slightly different for players abs chucked the wrong one. I'll look again and let you know if I find anything, save you some effort hopefully.

@jaypaw549
Copy link
Author

jaypaw549 commented Nov 28, 2024

I think I've maybe found it. I do have a mod called Frackin Universe installed at the same time, which may cause the day length to vary by planet (assuming that's not already a base game feature). This would explain why it's inconsistent in a consistent way, specific planets always putting out the same value. While it's inconsistent across different planets.

The test calculates based on the length of the day of the world you're currently on here. Now as a role-player I love that it does that, however until I discovered this it was definitely very confusing.

With that in mind, I understand this will turn into more of a request than a bug, however I thought of a few ways to account for it. In order of preference (even better if you can choose in the config file):

  1. Specify <planet> days in the output, or cycles if not on a planet.
  2. Specify the length of time in absolute time, in cycles of 840 seconds
  3. Don't specify the length of time.
  4. Specify the length of time by OS time.

Let me know what you think, and if you want me to open a new request for this.

@ErinaSugino
Copy link
Owner

Frackin' Universe has (for once) actually nothing to do with it. Variable day length per planet size is a vanilla feature. That's why I went and accounted for that in the text output for players - while the actual time of the pregnancy is calculated based on a fixed, averaged day length of 840 seconds, the time it tells you is translated into the current time of your planet/orbit.

I'll think about the option to rephrase it to "planet days", the only problem I can think about is the limited amount options in determining what kinda world you're in. The player shipworld can be checked - space stations and other, temporary-ish space encounters however not to my knowledge.

@ErinaSugino ErinaSugino changed the title [BUG] Pregnancy test shows inaccurate timing [REQUEST] Pregnancy test time display changes Nov 29, 2024
@ErinaSugino ErinaSugino added the Request Request for new feature or changes label Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Request Request for new feature or changes
Projects
None yet
Development

No branches or pull requests

2 participants