CC: Tweaked

CC: Tweaked

42M Downloads

Settings do not load upon computer restart, possible fix?

fatboychummy opened this issue ยท 1 comments

commented

Running CC:Tweaked 1.12.2-1.88.0

After doing some searching through the code to see what is the problem, I've found the following:

https://github.com/SquidDev-CC/CC-Tweaked/blob/d50a08a5491cdede71cf8e83c33dd8f39c31612f/src/main/resources/assets/computercraft/lua/rom/apis/settings.lua#L75-L88

Seems this may be the cause, in particular this section here:

https://github.com/SquidDev-CC/CC-Tweaked/blob/master/src/main/resources/assets/computercraft/lua/rom/apis/settings.lua#L78-L81

I'm unsure fully of how it works as I've only traced a bit of the code, but it seems that with the new way of setting values in the settings api the values are only defined at first but not set. Since they aren't set, when someone attempts to set them again (such as when they are set in the load function), it sees the current value is nil and then sets it to it's default (instead of setting it to what the value supplied is).

Perhaps removing the four lines altogether will be the fix? I don't have a testing setup with me on my laptop to test this, however.

commented

I believe this may be a problem as well:
https://github.com/SquidDev-CC/CC-Tweaked/blob/d50a08a5491cdede71cf8e83c33dd8f39c31612f/src/main/resources/assets/computercraft/lua/rom/apis/settings.lua#L208

I've already submitted one PR for settings.load (#427), and now there may be another bug to fix. (What even happened to this function?)

I fixed this in a local copy of the ROM on another computer; I gotta go diff it because I can't remember if I fixed anything else in it.