[MOD 0.11.19+] Increments
Re: [MOD 0.11.19+] Increments
I've just updated the mod, awesome work, thanks !!
one problem though - with my save not everything is fine, e.g. there is day/night cycle but there's no technology for night vision or lights, also i don't see any gui for activating handcrafting.
please tell me what i have to do to have full functionality when loading a saved game.
btw, if you wanna encourage machine crafting - just make handcrafting a lot slower. like 4 times slower. that way people will be able to craft a chest or a tool without trouble but for complex stuff it'll be a pain to craft everything by hand.
one problem though - with my save not everything is fine, e.g. there is day/night cycle but there's no technology for night vision or lights, also i don't see any gui for activating handcrafting.
please tell me what i have to do to have full functionality when loading a saved game.
btw, if you wanna encourage machine crafting - just make handcrafting a lot slower. like 4 times slower. that way people will be able to craft a chest or a tool without trouble but for complex stuff it'll be a pain to craft everything by hand.
-
- Inserter
- Posts: 28
- Joined: Wed Feb 04, 2015 12:07 pm
- Contact:
Re: [MOD 0.11.19+] Increments
ya i just noticed that migration wasnt working for saves... working on it
Re: [MOD 0.11.19+] Increments
thank you very much
-
- Inserter
- Posts: 28
- Joined: Wed Feb 04, 2015 12:07 pm
- Contact:
Re: [MOD 0.11.19+] Increments
well im having difficulty finding out how to reload in a save, it doesnt look like any mode does it (that ive checked so far) and the wiki is no help as usual.... IF anyone with the knowhow is reading this let me know how to update in a save specific files like control.lua
-
- Inserter
- Posts: 28
- Joined: Wed Feb 04, 2015 12:07 pm
- Contact:
Re: [MOD 0.11.19+] Increments
Unless someone wants to go over my files and figure it out, v1.2 breaks saves. You will have to start over. Unfortunately I'm too new to this to figure it out at the moment.
Re: [MOD 0.11.19+] Increments
I think treefarm had no problems with saved games. But i'm not 100% sure, it was a while ago.
-
- Inserter
- Posts: 28
- Joined: Wed Feb 04, 2015 12:07 pm
- Contact:
Re: [MOD 0.11.19+] Increments
im still looking on a way to fix, it involves changing the structure of my code. I have to do it anyways for the planned eclipse events and whatnot, but it might be a while like next week unless I magically figure it out.
i mean to be specific the gui code is created when a player is first created, and it should prolly be on load. Unfortunately im not sure of what commands to use on load so it will be a while
i mean to be specific the gui code is created when a player is first created, and it should prolly be on load. Unfortunately im not sure of what commands to use on load so it will be a while
Re: [MOD 0.11.19+] Increments
If i understand correctly the problem is that in old saves the gui isn't created?
Add the following function in your control.lua, remove the corresponding code from onplayercreated/oninit/onload and add the function call to oninit/onload
For a simple toggle i would only add a console command though (Script interfaces) or even just have the player change a value in a config.lua (depending on how often you expect the player wanting to change modes)
Sort of a handmade migration for glob. If it starts to get too messy you can remove old stuff and the player then has to first upgrade to the older version and then to the latest (for really old saves you even have to do it for vanilla Factorio)
Add the following function in your control.lua, remove the corresponding code from onplayercreated/oninit/onload and add the function call to oninit/onload
Code: Select all
function initGlob()
--day/night extender cycle code
glob.counter = glob.counter or 0
counter = glob.counter
glob.freeze_state = (type(glob.freeze_state) == "nil" ) and false or glob.freeze_state
freeze_state = glob.freeze_state
for pi, player in pairs(game.players) do
if not player.gui.top.label1 then
--hand crafting toggle
player.gui.top.add{name= "label1", type = "label", caption = "Machine Crafting Only"}
local button = player.gui.top.add{name = "toggle", type = "button", caption = "ON"}
button.style.fontcolor = {r = 0, g = 1, b = 0}
end
end
end
In my mods i use a initGlob() function, that gets called oninit and onload, looks like thisJustin Festa wrote:well im having difficulty finding out how to reload in a save, it doesnt look like any mode does it (that ive checked so far) and the wiki is no help as usual.... IF anyone with the knowhow is reading this let me know how to update in a save specific files like control.lua
Code: Select all
function initGLob()
if glob.version == nil or glob.version < "0.1.1" then
glob = {}
glob.settings = {}
glob.version = "0.1.1"
end
--snipped stuff (glob.something = glob.something or defaultValue, etc)
if glob.version < "0.1.8" then
glob.settings.poleDistance = nil
glob.settings.poleSide = nil
if glob.medium then
glob.settings.straight = defaultsMediumStraight
glob.settings.diagonal = defaultsMediumDiagonal
else
glob.settings.straight = defaultsStraight
glob.settings.diagonal = defaultsDiagonal
end
glob.version = "0.1.8"
end
GUI.init()
glob.version = "0.2.4"
end
-
- Inserter
- Posts: 28
- Joined: Wed Feb 04, 2015 12:07 pm
- Contact:
Re: [MOD 0.11.19+] Increments
ok ill see if this helps, thanks alot
Re: [MOD 0.11.19+] Increments
Hey i wanna make a mod for a couple of electricity-related things, would it be ok if i took 1 of your files to be a part of my mod? I only want an upgraded substation and yours would fit perfectly so i can't be bothered writing basically the same code from scratch. What do you think?
-
- Inserter
- Posts: 28
- Joined: Wed Feb 04, 2015 12:07 pm
- Contact:
Re: [MOD 0.11.19+] Increments
by all means =)
Re: [MOD 0.11.19+] Increments
Thank you very much! )
-
- Burner Inserter
- Posts: 12
- Joined: Tue Mar 29, 2016 11:45 pm
- Contact:
Re: [MOD 0.11.19+] Increments
DL just for the truck, NO MOAR TRAINS! Now to make an autopilot.. FACTORIO UBERS