Page 2 of 2
Re: [MOD 0.11.19+] Increments
Posted: Sat Mar 21, 2015 6:39 pm
by XyLe
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.
Re: [MOD 0.11.19+] Increments
Posted: Sat Mar 21, 2015 6:48 pm
by Justin Festa
ya i just noticed that migration wasnt working for saves... working on it
Re: [MOD 0.11.19+] Increments
Posted: Sat Mar 21, 2015 6:54 pm
by XyLe
thank you very much

Re: [MOD 0.11.19+] Increments
Posted: Sat Mar 21, 2015 7:14 pm
by Justin Festa
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
Re: [MOD 0.11.19+] Increments
Posted: Sat Mar 21, 2015 7:49 pm
by Justin Festa
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
Posted: Sat Mar 21, 2015 8:00 pm
by XyLe
I think treefarm had no problems with saved games. But i'm not 100% sure, it was a while ago.
Re: [MOD 0.11.19+] Increments
Posted: Sat Mar 21, 2015 8:33 pm
by Justin Festa
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

Re: [MOD 0.11.19+] Increments
Posted: Sat Mar 21, 2015 10:13 pm
by Choumiko
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
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
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)
Justin 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
In my mods i use a initGlob() function, that gets called oninit and onload, looks like this
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
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)
Re: [MOD 0.11.19+] Increments
Posted: Sat Mar 21, 2015 10:52 pm
by Justin Festa
ok ill see if this helps, thanks alot
Re: [MOD 0.11.19+] Increments
Posted: Tue Mar 31, 2015 10:55 am
by XyLe
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?
Re: [MOD 0.11.19+] Increments
Posted: Tue Mar 31, 2015 1:11 pm
by Justin Festa
by all means =)
Re: [MOD 0.11.19+] Increments
Posted: Tue Mar 31, 2015 1:18 pm
by XyLe
Thank you very much! )
Re: [MOD 0.11.19+] Increments
Posted: Wed Mar 30, 2016 2:35 pm
by Kelidoskoped
DL just for the truck, NO MOAR TRAINS! Now to make an autopilot.. FACTORIO UBERS