Page 1 of 1

Allow mod zip files to have version numbers

Posted: Sat Mar 08, 2014 2:47 pm
by sparr
The game seems to expect a mod's zip file to have the same name as the mod's directory would have. This is annoying when mods have different versions available for download. For example, right now in my downloads folder I have "testingmode.zip" and "testingmode (1).zip" and "testingmode (2).zip" because I've downloaded three different versions of the mod all named testingmode.zip. I named the downloads for my own mod something_0.1.zip but this confuses the game because it can't match up __something__/ to that zip file.

If there was some standard schema for version numbering on mod zip files then the game might just ignore that schema at the end of zip/directory names.

Re: Allow mod zip files to have version numbers

Posted: Mon Mar 10, 2014 5:09 pm
by kovarex
That is a good point.
Do you have some advice about the notation? :)

Re: Allow mod zip files to have version numbers

Posted: Mon Mar 10, 2014 5:24 pm
by slay_mithos
How about 'MODNAME[0.1.2].zip' ?

Using such characters makes it easy for both a program and the users to identify the verison numbers

Re: Allow mod zip files to have version numbers

Posted: Mon Mar 10, 2014 5:26 pm
by kovarex
Yes, that is a good one, we use it already on the forums, I put this as an issue into our inernal tracker.
Thank you for the idea :)

Re: Allow mod zip files to have version numbers

Posted: Tue Mar 11, 2014 12:25 pm
by SilverWarior
Are square brackets alowed characters that can be used in file names on all suported platforms? I'm not sure they are but I may be wrong.

Re: Allow mod zip files to have version numbers

Posted: Mon Mar 17, 2014 8:56 pm
by slpwnd
Square brackets are tricky. I think something like name_version will be safer ...

Re: Allow mod zip files to have version numbers

Posted: Tue Mar 18, 2014 3:05 pm
by ficolas
What about if the game ignores the zip name, and only takes the name of a folder that should be inside the zip?
So:
Modfolder can be used in the mods folder.
Modzip that contains modfolder can also be used in the mods folder, and the game ignores the name Modzip haves.

This way, zip files can be used compressed or non compressed, so when the we need to upload our mod, we dont need to compress the files inside Modfolder, we just compress the whole folder, and the whole folder can be used for us, modders to be able to edit easily the mod.

Re: Allow mod zip files to have version numbers

Posted: Tue Mar 18, 2014 7:25 pm
by sparr
good idea, ficolas.

how do you propose handling two zips with the same folder inside them?

Re: Allow mod zip files to have version numbers

Posted: Tue Mar 18, 2014 7:33 pm
by ficolas
sparr wrote:good idea, ficolas.

how do you propose handling two zips with the same folder inside them?
Error?
Two versions of the same mod shouldnt exist in the same place.
Or reading the info.json file to see what version is higher.

Re: Allow mod zip files to have version numbers

Posted: Wed Mar 19, 2014 6:06 am
by AlexPhoenix
just make folder name just folder name, not mod name.
so any info must come from json.

Re: Allow mod zip files to have version numbers

Posted: Wed Mar 19, 2014 9:08 am
by drs9999
AlexPhoenix wrote:just make folder name just folder name, not mod name.
so any info must come from json.
+1

Also if the mod folder contains 2 or more versions of the same mod, I would like the following:

If both mod-version are enabled then use the most recent version (and notify the player about it) otherwise use the version that is enabled

Re: Allow mod zip files to have version numbers

Posted: Thu Jul 17, 2014 8:45 am
by Dark
Bump. What if Factorio ignored both folder name, zip names, any file system names. But instead used "name" property from the info.json?
Right now mod naming is still crippled, zip-file-name == mod-folder-name or you gonna have a bad time.

Re: Allow mod zip files to have version numbers

Posted: Thu Jul 17, 2014 2:04 pm
by SHiRKiT
Makes total sense to use "name" as the identifier, since it should be unique anyways. Just do a split on the version and check

Code: Select all

table loadTheseMods
foreach mod in allModsFound do
  if loadTheseMods contains mod.name then
    currentVersion = loadTheseMods.getValue1(mod.name).version
    split1[] = string.split(currentVersion)
    split2[] = string.split(mod.version)
    higher = true
    for index = 0 up to max(split1.length, split2.length) do
      if split1[index] = nil and split2[index] != nil then
        do nothing
      elseif split1[index] != nil and split2[index] = nil then
        higher = false
      elseif int.parse(split1[index]) > int.parse(split2[index]) then
        higher = false
      endif
    endfor
    if higher then
      loadTheseMods.overwrite(mod.name, mod)
    endif
  elseif
    loadTheseMods.put(mod.name, mod)
  endif
endforeach

Re: Allow mod zip files to have version numbers

Posted: Sat Aug 09, 2014 9:55 am
by kovarex
This will be done for 0.10.7

We decided to force one unified system to be used to make it organised.
So the mod zip package (and the folder inside) needs to have format "<Mod name>_<Mod version>" it will be checked if the format matches the version and the mod game at the start of the game.

This will invalidated all existing mods, but since the fix is very simple it shouldn't be so huge problem. We believe that it is better to do these kind of changes while it is in alpha.