Skip to content

Commit

Permalink
Update to 1.4.2
Browse files Browse the repository at this point in the history
1.4.2 - Factorio Extended
-autofill text surface fix - MagmaMcFry
-Factorio Extended, Nucular added to default sets
-Remote interface for turning autofill on or off explicity
-Hotkey for turning group item division on or off (default Ctrl + Alt + F)
  • Loading branch information
Nexela committed Aug 6, 2016
1 parent 5b0c717 commit dda1b30
Show file tree
Hide file tree
Showing 9 changed files with 76 additions and 88 deletions.
19 changes: 13 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,18 @@ Autofill
=====

The Autofill mod by rk84 updated for .13 by Jakimfett and more default sets added by Nexela

###Please report any problems to the forum post, or to Github. The mod portal does not notify me about new posts.
https://forums.factorio.com/viewtopic.php?f=92&t=1612
https://github.com/Nexela/autofill/issues

Autofill Automaticly fills fuel (like coal) and ammo from your main inventory to entities when you create them. Including Trains, Planes, and Automobiles. Oh and Turrets, boilers, burner inserters, burner assemblers, overpower nuclear weapon launchers just to name a few more!
Autofill Automatically fills fuel (like coal) and ammo from your main inventory to entities when you create them. Including Trains, Planes, and Automobiles. Oh and Turrets, boilers, burner inserters, burner assemblers, and overpowered nuclear weapon launchers just to name a few more!

##Now with HOTKEY support!
All these keys are configurable in your Factorio - Controls - Mods menu.
Hover over an entity in the field and CTRL-F to fill it based on your ruleset!
Toggle filling limits on or off with CTRL-SHIFT-F for those times when you want to Fill something without limits!
Toggle filling limits on or off with CTRL-SHIFT-F for those times when you want to Fill something without limits.
Toggle dividing fuel/ammo amongst groups of items with CTRL-ALT-F

Current Mods with a set enabled by default:

Expand Down Expand Up @@ -50,8 +55,10 @@ If a mod you like doesn't work out of the box let me know and I will see about a
---

####Change Log
##Please see the changelog.txt file for more details

1.4.1 - The NotEnoughTanks Release - More safety checks for when mods are removed, Added Tankwerks, MoCombat, Supertank, KSpower, Military5, IncindiaryMunitions, Artillery.
1.4.0 - The No Limits release - More Hotkeys, more mods supported by default, General improvements, Advanced Tanks.
1.3.18 - The Tap, tap, tap release -Hotkeys!, Added some more of Bob's Stuff, Temporary fix for mods being removed causing crash.
1.3.17 - Added Bulldozer and Combat Drones. Might have to do /c remote.call("af", "resetMod") if adding to an existing save.
* 1.4.2 - Factorio Extended - Remote interface changes, Factorio Extended and Nucular added, cleaned up the sets a bit. squashed a few biters, Hotkey for toggling groups.
* 1.4.1 - The NotEnoughTanks Release - More safety checks for when mods are removed, Added Tankwerks, MoCombat, Supertank, KSpower, Military5, IncindiaryMunitions, Artillery.
* 1.4.0 - The No Limits release - More Hotkeys, more mods supported by default, General improvements, Advanced Tanks.
* 1.3.18 - The Tap, tap, tap release -Hotkeys!, Added some more of Bob's Stuff, Temporary fix for mods being removed causing crash.
* 1.3.17 - Added Bulldozer and Combat Drones. Might have to do /c remote.call("af", "resetMod") if adding to an existing save.
7 changes: 7 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
1.4.2 - Factorio Extended
-autofill text surface fix - MagmaMcFry
-Factorio Extended, Nucular added to default sets
-Remote interface for turning autofill on or off explicity
-Hotkey for turning group item division on or off (default Ctrl + Alt + F)


1.4.1 - Even More Tanks
-More safety checks for when mods are removed
-Oooops fixed and some temporary logic.
Expand Down
29 changes: 23 additions & 6 deletions control.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ local order = {
--

script.on_configuration_changed(function()
initMod(false,true) --TODO needs to be changed to only update sets
initMod(false,true)
end)

script.on_init(function()
Expand All @@ -46,7 +46,7 @@ end)

script.on_event(defines.events.on_built_entity, function(event)
local player = game.players[event.player_index]
if global.personalsets[player.name].uselimits == nil then global.personalsets[player.name].uselimits=true end
--if global.personalsets[player.name] and global.personalsets[player.name].uselimits == nil then global.personalsets[player.name].uselimits=true end
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]
Expand Down Expand Up @@ -90,6 +90,20 @@ script.on_event("autofill-toggle-limits", function(event)
end
end)

script.on_event("autofill-toggle-groups", function(event)
local player = game.players[event.player_index]
local afplayer = global.personalsets[player.name]
if afplayer then
afplayer.usegroups = not afplayer.usegroups
if afplayer.usegroups then
player.print({"autofill.toggle-groups-on"})
elseif not afplayer.usegroups then
player.print({"autofill.toggle-groups-off"})
end
global.personalsets[player.name].usegroups=afplayer.usegroups
end
end)

--
--Funtions
--
Expand Down Expand Up @@ -183,7 +197,10 @@ function autoFill(entity, player, fillset)
end
else
-- Divide stack between group (only items in quickbar are part of group)
if fillset.group then
local usegroups = global.personalsets[player.name].usegroups
if usegroups == nil then usegroups = true end

if fillset.group and usegroups then
if player.cursor_stack.valid_for_read then
groupsize = player.cursor_stack.count + 1
else
Expand Down Expand Up @@ -325,9 +342,9 @@ function initMod(reset,update)
loader.loadBackup()

if not update or reset then
global.personalsets = {}
for k, player in pairs(game.players) do
global.personalsets[player.name] = { active = true, uselimits=true }
if reset then global.personalsets = {} end
for k, player in pairs(game.players) do
global.personalsets[player.name] = { active = true, uselimits=true, usegroups=true}
end
end

Expand Down
23 changes: 14 additions & 9 deletions data.lua
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
data:extend({
{
type = "custom-input",
name = "autofill-entity",
key_sequence = "CONTROL + F",
consuming = "all"
type = "custom-input",
name = "autofill-entity",
key_sequence = "CONTROL + F",
consuming = "all"
},
{
type = "custom-input",
name = "autofill-toggle-limits",
key_sequence = "CONTROL + SHIFT + F",
consuming = "script-only"
},
{
type = "custom-input",
name = "autofill-toggle-limits",
key_sequence = "CONTROL + SHIFT + F",
consuming = "script-only"
type = "custom-input",
name = "autofill-toggle-groups",
key_sequence = "CONTROL + ALT + F",
consuming = "script-only"
}

})
2 changes: 1 addition & 1 deletion info.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "autofill",
"version": "1.4.1",
"version": "1.4.2",
"factorio_version": "0.13",
"title": "Autofill",
"author": "rk84, Nexela",
Expand Down
3 changes: 3 additions & 0 deletions locale/en/autofill.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ invalid-form=Array with array(s) or string(s) expected.
reset=Autofill reset.
toggle-limits-on=Autofill is now using limits when filling items with limits.
toggle-limits-off=Autofill is no longer using limits when filling an item.
toggle-groups-on=Autofill will now use group rules to divide items into sets.
toggle-groups-off=Autofill is no longer using group rules to divide items into sets.
[controls]
autofill-entity=Autofill an existing entity
autofill-toggle-limits=Turn autofill limits on or off
autofill-toggle-groups=Turn autofill groups on or off
4 changes: 2 additions & 2 deletions settings/at-items.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ return {
--advanced Tanks
["ammo-shotgun"] = {"piercing-shotgun-shell-brick"},
["ammo-bullets"] = {"ap-bullet-brick"},
["ammo-shells"] = {"cannon-shell-2"},
["ammo-shells"] = {"cannon-shell-2", "ap-cannon-shell", "hiex-cannon-shell"},

--Tankwerkz
["ammo-shells"] = {"ap-cannon-shell", "hiex-cannon-shell"}
--["ammo-shells"] = {"ap-cannon-shell", "hiex-cannon-shell"}

}
62 changes: 4 additions & 58 deletions settings/generic-items.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,84 +7,30 @@

local tbl = {
bullets = {
"uranium-bullet-magazine", --Uranium Power
"uranium-bullet-magazine", --Uranium Power, Nucular
"basic-bullet-ammo-box", "piercing-bullet-ammo-box", --Ammobox
"nanobot-bullet-magazine", --GImprovments Mod
"super-piercing-bullet-magazine", --Supertank -- Not Working?
"incendiary-rounds-magazine", --IncendiaryMunitions -- Not working?
"incendiary-bullet-ammo-box", --IncendiaryMunitions, with ammobox
"explosive-bullet-magazine", --Mil5
"shattering-bullet-magazine", --Factorio Extended
},
shells = {
"artilleryshell", --Artillery
"super-explosive-cannon-shell", --Supertank
"uranium-small-nuke-shell", "uranium-cannon-shell", --Uranium Power
"uranium-small-nuke-shell", "uranium-cannon-shell", --Uranium Power --Nucular
"high-explosive-cannon-shell", --Aircraft
},
shotgun= {
"explosive-shotgun-shell", --Mi-5, Incendiary ammo
"shattering-shotgun-shel", --Factorio Extended
},
}

--log("START DATA")
--if game then log("GAME") end
--if data then log("DATA1") end
--if data and data.raw then log("DATA2") end
--if data and data.raw and data.raw.items then log("DATA3") end
--if game then log("GAME") end

--[[
for j, item in pairs(tbl["bullets"]) do
if data.raw["items"][item] then
newBullets[#newBullets + 1] = bullets
log("added ".. i)
else
log("skipped ".. i)
end
end
for j, item in pairs(tbl["shells"]) do
if data.raw["items"][item] then
newShells[#newShells + 1] = item
log("added ".. i)
else
log("skipped ".. i)
end
end
for j, item in pairs(tbl["shotgun"]) do
if data.raw["items"][item] then
newShotgun[#newNewShotgun + 1] = item
log("added ".. i)
else
log("skipped ".. i)
end
end
--]]



return {
["ammo-bullets"] = tbl.bullets,
["ammo-shells"] = tbl.shells,
["ammo-shotgun"] = tbl.shotgun,
--[[
["ammo-bullets"] = {"uranium-bullet-magazine"}, --Uranium Power
["ammo-bullets"+1] = {"basic-bullet-ammo-box", "piercing-bullet-ammo-box"}, --Ammobox
["ammo-bullets"+1] = {"nanobot-bullet-magazine"}, --GImprovments Mod
["ammo-bullets"+1] = {"super-piercing-bullet-magazine"}, --Supertank -- Not Working?
["ammo-bullets"+1] = {"incendiary-rounds-magazine"}, --IncendiaryMunitions -- Not working?
["ammo-bullets"+1] = {"incendiary-bullet-ammo-box"}, --IncendiaryMunitions, with ammobox
["ammo-bullets"]+1 = {"explosive-bullet-magazine"}, --Mil5
["ammo-shells"] = {"artilleryshell"}, --Artillery
["ammo-shells"+1] = {"super-explosive-cannon-shell"}, --Supertank
["ammo-shells"+1] = {"uranium-small-nuke-shell", "uranium-cannon-shell"}, --Uranium Power
["ammo-shells"+1] = {"high-explosive-cannon-shell"}, --Aircraft
["ammo-shotgun"]= {"explosive-shotgun-shell"}, --Mi-5, Incendiary ammo
--]]
}
15 changes: 9 additions & 6 deletions settings/generic-sets.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,18 @@
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
["burner-ore-crusher"] = {group="burners", limits={10}, "fuels-high"}, --Angels
["hvmg-turret"] = {priority=3, group="turrets", limits={10}, "ammo-bullets"}, --Gimprovments
["farl"] = {group="locomotives", "fuels-high"}, --FARL
["shuttleTrain"] = {group="locomotives", slots={3}, "fuels-high"}, --ShuttleTrain
["ammobox-gun-turret-2"] = {group="turrets", limits= {10}, "ammo-bullets" }, --Ammobox
["burner-ore-crusher"] = {group="burners", limits={10}, "fuels-high"}, --Angels
["hvmg-turret"] = {priority=3, group="turrets", limits={10}, "ammo-bullets"}, --Gimprovments
["buggy"] = {priority=3, slots={1,1}, "fuels-all", "ammo-bullets"}, --Gimprovments
["artillery"] = {priority=3, "ammo-shells"}, -- Artillery
["artillery"] = {priority=3, "ammo-shells"}, -- Artillery
["burner-generator"] = {group="burners", slots={2}, limits={10}, "fuels-all"}, -- Kspower
["mega-tank"] = {priority=3, slots={3,1,1}, "fuels-all", "mo-ammo-goliath", "ammo-bullets"}, --MoMods
["supertank"] = {priority=3, slots={2,1,1}, "fuels-all", "ammo-shells" ,"ammo-bullets"}, --SuperTank
["diesel-locomotive-mk2"] = {group="locomotives", slots={3}, "fuels-high"}, --Factorio Extended
["diesel-locomotive-mk3"] = {group="locomotives", slots={3}, "fuels-high"}, --Factorio Extended
["gun-turret-mk2"] = {priority=3, group="turrets", limits={10}, "ammo-bullets"}, --Factorio Extended

}

0 comments on commit dda1b30

Please sign in to comment.