-
-
Notifications
You must be signed in to change notification settings - Fork 99
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
Timestamp fixer - potential issues and improvements #422
Comments
The list of all fields that store a tick timestamp with an additional comment from me is below. It's likely not all of those would need the fixer, and would likely need extra investigation to verify.
|
And to finish this off, pinging @Zetrith. Any thoughts on the 4 points I've brought up? I assume the 1st point is going to be important. I'm not sure how you'd want to handle changes there. The 4th point is something I plan to investigate deeper myself as well to check what is and isn't needed, so it'll just be as adding a few lines of code. And for the points 2nd and 3rd points, I've just dropped them in here as something that was on my mind. Are those something that you believe we should touch upon, or just leave as-is? Overall, it won't have a significant difference if they are implemented or not. |
Thanks a lot for making the issue.
|
Been thinking a bit more about this the past couple of days.
One thing that will be important will be to double check if it's a timestamp, or a counter - there was at least 1I found while looking through the code.
I assume that in some situations we could do something along the lines of: Also, one final thought - |
Working on an unrelated mod I've noticed another field that would likely need a timestamp fix - |
I was testing the timestamp fixer a bit today, and may have noticed another issue. The timestamp fixer seems to not work properly when using drop pods or the Royalty shuttle. What seems to happen is that the timestamp fixer only runs once - when a pawn leaves the map, it changes the timestamps from previous map to world. However, when they arrive the timestamp fixer doesn't run at all. I'll just add it to the list in the original message to keep track of. |
I've created this github issue to discuss the timestamp fixer. I've looked through it, how it works, and noticed a potential issue with default values, started wondering if we need to fix all the timestamps, and was thinking about potential changes to better handle compat patches with other mods.
First, an issue with some fields (including most of the ones currently handled by timestamp fixer) is that they have an uninitialized, "not set" value like -1, or -99999. However, currently the timestamp fixer doesn't consider this at all, which could end up messing with those fields, either "initializing" them or setting them to some other negative value which RimWorld may not handle properly - fixing this would require a slightly different implementation of the timestamp fixed (having the fixes be optional).
Second, do we need to fix all of the timestamps? Why not just reset some of them to their default, uninitialized values? Setting
Pawn_MindState.canSleepTick
to -99999 would just reset it, and the pawns should be able to safely handle it themselves. After all, this is what RimWorld does inside ofPawn.ExitMap()
, where it callsPawn_MindState.Reset
. This is obviously not going to work for all fields, but for some there's not much benefit to actually keeping a proper value for.Third, a minor thing with compat, and not fully needed (mostly a convenience feature). The timestamp fixer uses a dictionary, but doesn't allow to register implicit ones. This means that it'll require registering one timestamp fixer for each subtype. For example, this will be the case for MP Compat fixing Vanilla Expanded Framework abilities - the
Ability
type is abstract, and so each of its subtypes will have to be registered to properly handle it, each one with an identical getter.Fourth - to avoid clutter in this message I'll post the list in a second one. It is a list of fields (that I could find) that store specific tick timestamp, and what will/may happen (some were tested, some based on analyzing code) when moving from a map with much higher current tick to a map with much lower one (unless we fix it). The issue will (usually) persist until the ticks catch up to their previous map. In some cases it's possible to manually fix those values. There were some fields that were countdowns, and those were excluded.
Fifth - the timestamp fixer doesn't seem to run when a drop pod or a royal shuttle land. However, it runs fine when they launch (changing the timestamps from map to world).
The text was updated successfully, but these errors were encountered: