diff --git a/control.lua b/control.lua index 09e964d..3528ac3 100644 --- a/control.lua +++ b/control.lua @@ -5,21 +5,17 @@ MOD = { NAME = "Autofill", IF = "af" } require "loader" loader.addItemArray "settings/vanilla-items" loader.addSets "settings/vanilla-sets" +loader.extendItemArray "settings/generic-items" +loader.addItemArray "settings/generic-newitems" +loader.addSets "settings/generic-sets" loader.addItemArray "settings/bob-newitems" --bobwarfare added Artillery and Laser Ammo loader.extendItemArray "settings/bob-items" -- Bob Warfare Bullets, Cannon Shells - TODO have it prio extended items loader.addSets "settings/bob-sets" -- Bobwarfare added tanks 2 and 3 -loader.addSets "settings/farl-sets" -loader.extendItemArray "settings/ammobox-items" -loader.addSets "settings/ammobox-sets" loader.addItemArray "settings/yuoki-ind-newitems" --New Ammo Catergories for YI loader.extendItemArray "settings/yuoki-ind-items" -- YI Bullets loader.addSets "settings/yuoki-ind-sets" -- YI Item Sets -loader.addSets "settings/shuttle-train-sets" -- Autofill for shuttle trains -loader.extendItemArray "settings/aircraft-items" loader.addSets "settings/aircraft-sets" loader.addSets "settings/5dim-sets" -loader.extendItemArray "settings/up-items" -- Uranium Power Bullets and Cannon Shells -UNTESTED but based on the same concepts as the other additions so it should work. - --flying text colors @@ -38,7 +34,7 @@ local order = { -- script.on_configuration_changed(function() - initMod(true) + initMod() end) script.on_init(function() @@ -49,10 +45,11 @@ script.on_event(defines.events.on_built_entity, function(event) local player = game.players[event.player_index] local global = global if global.personalsets[player.name] and global.personalsets[player.name].active then - local fillset = global.personalsets[player.name][event.created_entity.name] or global.defaultsets[event.created_entity.name] + --globalPrint(global.defaultsets[event.created_entity.name]) + local fillset = global.personalsets[player.name][event.created_entity.name] or global.defaultsets[event.created_entity.name] if fillset ~= 0 and fillset ~= nil then autoFill(event.created_entity, player, fillset) - end + end end end) @@ -278,12 +275,20 @@ end function globalPrint(msg) local players = game.players - msg = { "autofill.msg-template", msg } + if type(msg) == "string" then + output= msg + else + output=serpent.dump(msg, {name="var", comment=false, sparse=false, sortkeys=true}) + end + --msg = { "autofill.msg-template", msg } for i=1, #players do - players[i].print(msg) + players[i].print(output) end + printToFile(output) end + + function initMod(reset) if not global.defaultsets or not global.personalsets or not global.item_arrays or reset then global = {} -- Clears global @@ -374,7 +379,7 @@ end function printToFile(line, path) path = path or "log" path = table.concat({ MOD.IF, "/", path, ".txt" }) - game.makefile( path, line) + game.write_file( path, line.."\n\n", true) end --]] diff --git a/info.json b/info.json index c6a1a6c..1317d1a 100644 --- a/info.json +++ b/info.json @@ -1,6 +1,6 @@ { "name": "autofill", - "version": "1.3.16", + "version": "1.3.17", "factorio_version": "0.13", "title": "Autofill", "author": "rk84", diff --git a/loader.lua b/loader.lua index 5ff2d07..78cbe75 100644 --- a/loader.lua +++ b/loader.lua @@ -217,4 +217,4 @@ loader = { table.sort(all, fuelHighToLow) table.sort(high, fuelHighToLow) end -} +} \ No newline at end of file diff --git a/settings/aircraft-items.lua b/settings/aircraft-items.lua deleted file mode 100644 index 733ce6d..0000000 --- a/settings/aircraft-items.lua +++ /dev/null @@ -1,4 +0,0 @@ - -return { - ["ammo-shells"] = {"high-explosive-cannon-shell"} -} diff --git a/settings/ammobox-items.lua b/settings/ammobox-items.lua deleted file mode 100644 index a03c28b..0000000 --- a/settings/ammobox-items.lua +++ /dev/null @@ -1,9 +0,0 @@ --- --- Disclaimer: mp warranty void if edited. --- - - - -return { - ["ammo-bullets"] = {"basic-bullet-ammo-box", "piercing-bullet-ammo-box"} -} diff --git a/settings/ammobox-sets.lua b/settings/ammobox-sets.lua deleted file mode 100644 index a713732..0000000 --- a/settings/ammobox-sets.lua +++ /dev/null @@ -1,7 +0,0 @@ --- --- Disclaimer: mp warranty void if edited. --- - -return { - ["ammobox-gun-turret-2"]= {group="turrets", limits= {10}, "ammo-bullets" } -} diff --git a/settings/farl-sets.lua b/settings/farl-sets.lua deleted file mode 100644 index 7fd65e9..0000000 --- a/settings/farl-sets.lua +++ /dev/null @@ -1,3 +0,0 @@ -return { - ["farl"] = {group="locomotives", "fuels-high"} -} diff --git a/settings/generic-items.lua b/settings/generic-items.lua new file mode 100644 index 0000000..611a7d5 --- /dev/null +++ b/settings/generic-items.lua @@ -0,0 +1,10 @@ +-- +-- Disclaimer: mp warranty void if edited. +-- + +return { + ["ammo-bullets"] = {"uranium-bullet-magazine"}, --Uranium Power + ["ammo-bullets"] = {"basic-bullet-ammo-box", "piercing-bullet-ammo-box"}, --Ammobox + ["ammo-shells"] = {"uranium-small-nuke-shell", "uranium-cannon-shell"}, --Uranium Power + ["ammo-shells"] = {"high-explosive-cannon-shell"} --Aircraft +} \ No newline at end of file diff --git a/settings/generic-newitems.lua b/settings/generic-newitems.lua new file mode 100644 index 0000000..0ec1125 --- /dev/null +++ b/settings/generic-newitems.lua @@ -0,0 +1,7 @@ +-- +-- Disclaimer: mp warranty void if edited. +-- + +return { +["combat-units"] = {"destroyer-unit-ammo", "defender-unit-ammo", "distractor-unit-ammo"} --Combat Units +} \ No newline at end of file diff --git a/settings/generic-sets.lua b/settings/generic-sets.lua new file mode 100644 index 0000000..d6232bd --- /dev/null +++ b/settings/generic-sets.lua @@ -0,0 +1,11 @@ +-- +-- Disclaimer: mp warranty void if edited. +-- + +return { +["bulldozer"] = {slots={2}, "fuels-all"}, --Bulldozer +["unit-launcher"] = {priority=1, slots={1}, group="combatunitlauncher", "combat-units"}, --Combat Units +["farl"] = {group="locomotives", "fuels-high"}, --FARL +["shuttleTrain"] = {group="locomotives", "fuels-high"}, --ShuttleTrain +["ammobox-gun-turret-2"]= {group="turrets", limits= {10}, "ammo-bullets" } --Ammobox +} \ No newline at end of file diff --git a/settings/shuttle-train-sets.lua b/settings/shuttle-train-sets.lua deleted file mode 100644 index 8057465..0000000 --- a/settings/shuttle-train-sets.lua +++ /dev/null @@ -1,3 +0,0 @@ -return { - ["shuttleTrain"] = {group="locomotives", slots={1}, "fuels-high"} -} \ No newline at end of file diff --git a/settings/up-items.lua b/settings/up-items.lua deleted file mode 100644 index 25aa3ac..0000000 --- a/settings/up-items.lua +++ /dev/null @@ -1,10 +0,0 @@ --- --- Disclaimer: mp warranty void if edited. --- - - - -return { - ["ammo-bullets"] = {"uranium-bullet-magazine"}, - ["ammo-shells"] = {"uranium-small-nuke-shell", "uranium-cannon-shell"} -}