Skip to content

Commit

Permalink
0.3.7
Browse files Browse the repository at this point in the history
  Features:
    - barrels updated to changes in 0.16.8
    - increased default barreling recipes to more ups friendly 10 barrels/2s
  Removed:
    - fluid wagon tweaks
  • Loading branch information
0ptera authored Dec 30, 2017
1 parent 1b83f76 commit c42ab25
Show file tree
Hide file tree
Showing 13 changed files with 677 additions and 0 deletions.
7 changes: 7 additions & 0 deletions License.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Copyright <2017> <Optera>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
108 changes: 108 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
---------------------------------------------------------------------------------------------------
Version: 0.3.7
Date: 30.12.2017
Features:
- barrels updated to changes in 0.16.8
- increased default barreling recipes to more ups friendly 10 barrels/2s
Removed:
- fluid wagon tweaks
---------------------------------------------------------------------------------------------------
Version: 0.3.6
Date: 26.12.2017
Features:
- barrel capacities < 250l result in barreling recipes processing multiple barrels at once
- in game changelog
---------------------------------------------------------------------------------------------------
Version: 0.3.5
Date: 23.12.2017
Features:
- added science packs
- added option to skip rocket launch products
Bugfixes:
- setting categories should now also work on item types other than "item"
---------------------------------------------------------------------------------------------------
Version: 0.3.4
Date: ???
Features:
- added rails
Bugfixes:
- fixed stone-bricks where overwritten by smelting stack size
---------------------------------------------------------------------------------------------------
Version: 0.3.3
Date: 20.12.2017
Features:
- added rails, combinators and wires
---------------------------------------------------------------------------------------------------
Version: 0.3.2
Date: 16.12.2017
Features:
- added magazines, shotgun shells, flamethrower ammo, cannon shells and artillery shells
Changes:
- split into modules
- moved all action from data-final-fixes to data-update
- removed fix for recipes with result amount > stack size as it's part of 0.16.x
---------------------------------------------------------------------------------------------------
Version: 0.3.1
Date: 15.12.2017
Features:
- added barrel stack size and capacity
- added toggle for lighter fluid wagons with less capacity
Changes:
- moved u-235 and u-238 to their own uranium category
- removed partial localization of item names from setting description
Bugfixes:
- fixed plate stack size being applied to nuclear fuel
---------------------------------------------------------------------------------------------------
Version: 0.3.0
Date: 13.12.2017
Features:
- updated to Factorio 0.16
---------------------------------------------------------------------------------------------------
Version: 0.2.5
Date: ???
Features:
- supported items: inserter
---------------------------------------------------------------------------------------------------
Version: 0.2.4
Date: ???
Features:
- supported items: rocket fuel, rocket control unit, low density structure, belt, underground belt, splitter, loader, pipe, pipe to ground
---------------------------------------------------------------------------------------------------
Version: 0.2.3
Date: ???
Features:
- supported item: wood
- added option to force tile stack size for ore/plate/wood (requires mods adding tiles for those items e.g. Dectorio)
Bugfixes:
- stone brick will always use tile stack size rather than plate stack size
- fixed spelling
---------------------------------------------------------------------------------------------------
Version: 0.2.2
Date: ???
Changes:
- apply plate stack size to all smelting and centrifuging results
Bugfixes:
- recipes with min-amount and max-amount no longer crash recipe fix
---------------------------------------------------------------------------------------------------
Version: 0.2.1
Date: ???
Changes:
- apply recipe fix to all recipes
---------------------------------------------------------------------------------------------------
Version: 0.2.0
Date: ???
Features:
- supports items added by mods
- supported items: tiles
---------------------------------------------------------------------------------------------------
Version: 0.1.1
Date: ???
Features:
- grouped similar items under one setting
- supported items: assembling machines, chemical plant, centrifuge, beacon, reactor, roboport, ores, plates, uranium
---------------------------------------------------------------------------------------------------
Version: 0.1.0 - Initial release
Date: ???
Features:
- supported items: uranium-fuel-cell, used-up-uranium-fuel-cell
- recipe fix preventing stuck assembler when stack size < result.amount
42 changes: 42 additions & 0 deletions data-updates.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
ReStack_Items = {} -- list of item names to apply new stack size
Launch_Products = {} -- launch products should be skipped

Tile_Whitelist = { -- always apply tile stack size
["stone-brick"] = true,
}

-- modules filling ReStack_Items
require("modules.logistic")
require("modules.production")
require("modules.intermediate")
require("modules.science_pack")
-- require("modules.combat")

-- modules setting stacks themself
require("modules.barrel")
require("modules.ammo")


-- get rocket_launch_product list
for _, group in pairs(data.raw) do
for item_name, item in pairs(group) do
if item.rocket_launch_product then
Launch_Products[item.rocket_launch_product[1]] = item.rocket_launch_product[2]
end
end
end

-- apply new stack_size to anything with matching name
for _, group in pairs(data.raw) do
for item_name, stack_data in pairs(ReStack_Items) do
local item = group[item_name]
if item and item.stack_size then
if settings.startup["ReStack-include-launch-products"].value or not Launch_Products[item_name] then
item.stack_size = ReStack_Items[item_name].stack_size
log("[RS] Setting "..tostring(stack_data.type).."."..tostring(item_name)..".stack_size "..stack_data.stack_size)
else
log("[RS] Skipping rocket launch produkt "..tostring(stack_data.type).."."..tostring(item_name))
end
end
end
end
11 changes: 11 additions & 0 deletions info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "ReStack",
"version": "0.3.7",
"title": "ReStack",
"author": "Optera",
"contact": "https://forums.factorio.com/memberlist.php?mode=viewprofile&u=21729",
"homepage": "",
"description": "Adds settings to set stack sizes for ores, plates, fuel cells, crafting machines and ammo for base and mod added variants.",
"factorio_version": "0.16",
"dependencies": ["base >= 0.16.8", "?PickerExtended >= 3.0.2", "?Dectorio >= 0.8.0"]
}
59 changes: 59 additions & 0 deletions locale/en/settings.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
[mod-setting-name]
ReStack-roboport=Roboport stack size
ReStack-reactor=Reactor stack size
ReStack-crafting-machine=Production machine stack size
ReStack-furnace=Furnace stack size
ReStack-beacon=Beacon stack size
ReStack-tiles=Tile stack size
ReStack-tiles-priority=Prioritize tile stack size
ReStack-wood=Wood stack size.
ReStack-ores=Ore stack size
ReStack-plates=Plate stack size
ReStack-uranium=Uranium stack size
ReStack-fuel-cell=Fuel cell stack size
ReStack-rocket-parts=Rocket components stack size
ReStack-belt=Belt stack size
ReStack-belt2x=Double belt stack size
ReStack-pipe=Pipe stack size
ReStack-inserter=Inserter stack size
ReStack-rail=Rail stack size
ReStack-barrel-stack=Barrel stack size
ReStack-barrel-fill=Barrel capacity
ReStack-ammo-bullet=Magazine stack size
ReStack-ammo-shotgun=Shotgun shell stack size
ReStack-ammo-flamethrower=Flamethrower ammo stack size
ReStack-ammo-rocket=Rocket stack size
ReStack-ammo-cannon=Cannon shell stack size
ReStack-ammo-artillery=Artillery shell stack size
ReStack-science-pack=Science pack stack size
ReStack-include-launch-products=Apply to launch products

[mod-setting-description]
ReStack-roboport=Set stack size for roboports.\nDefault: 20\nVanilla: 5
ReStack-reactor=Set stack size for nuclear reactors.\nDefault: 10\nVanilla: 50
ReStack-furnace=Set stack size for furnaces.\nDefault: 20\nVanilla: 50
ReStack-crafting-machine=Set stack size for crafting machines like assembling machines, chemical plants or centrifuges.\nDefault: 20\nVanilla: 10-50
ReStack-beacon=Set stack size for beacons.\nDefault: 20\nVanilla: 10
ReStack-tiles=Set stack size for placeable tiles.\nDefault: 500\nVanilla: 100
ReStack-tiles-priority=Overwrite ore, wood, plate stack size with tile stack size if item is tile able.\nDefault: disabled
ReStack-wood=Set stack size for raw wood.\nDefault: 100\nVanilla: 100
ReStack-ores=Set stack size for mine able ores.\nDefault: 100\nVanilla: 50
ReStack-plates=Set stack size for smelting products.\nStone brick stack size is set by tile stack size.\nDefault: 100\nVanilla: 100
ReStack-uranium=Set stack size for uranium-235 and uranium-238.\nDefault: 100\nVanilla: 100
ReStack-fuel-cell=Set stack size for uranium fuel cell and used up uranium fuel cell.\nDefault: 5\nVanilla: 50
ReStack-rocket-parts=Set stack size for low density structure, rocket fuel and rocket control unit.\nDefault: 10\nVanilla: 10
ReStack-belt=Set stack size for belts, underground belts, splitter and loader.\nDefault: 100\nVanilla: 50-100
ReStack-belt2x=Stack size for normal belts is doubled like in vanilla.\nDefault: disabled
ReStack-pipe=Set stack size for pipes and pipe to ground.\nDefault: 100\nVanilla: 50-100
ReStack-inserter=Set stack size for inserter.\nDefault: 50\nVanilla: 50
ReStack-rail=Set stack size rails.\nDefault: 200\nVanilla: 100
ReStack-barrel-stack=Set stack size for barrels.\nDefault: 5\nVanilla: 10
ReStack-barrel-fill=Set capacity for barrels.\nDefault: 100\nVanilla: 50
ReStack-ammo-bullet=Set stack size for magazines.\nDefault: 200\nVanilla: 200
ReStack-ammo-shotgun=Set stack size for shotgun shells.\nDefault: 200\nVanilla: 200
ReStack-ammo-flamethrower=Set stack size for flamethrower ammo.\nDefault: 100\nVanilla: 100
ReStack-ammo-rocket=Set stack size for rockets.\nDefault: 200\nVanilla: 10-200
ReStack-ammo-cannon=Set stack size for cannon shells.\nDefault: 200\nVanilla: 200
ReStack-ammo-artillery=Set stack size for artillery shells.\nDefault: 10\nVanilla: 1
ReStack-science-pack=Set stack size for any item used in research.\nDefault: 200\nVanilla: 200
ReStack-include-launch-products=Also apply item group stack size to rocket launch products like Space science packs.\nDefault:false
16 changes: 16 additions & 0 deletions modules/ammo.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
-- Get ammo by category and set stack size
local function SetByAmmoCategory(type, stack_size)
for _, ammo in pairs(data.raw.ammo) do
if ammo.ammo_type.category == type then
ammo.stack_size = stack_size
log("[RS] Setting "..tostring(type).."."..tostring(ammo.name)..".stack_size "..stack_size)
end
end
end

SetByAmmoCategory("bullet", settings.startup["ReStack-ammo-bullet"].value)
SetByAmmoCategory("shotgun-shell", settings.startup["ReStack-ammo-shotgun"].value)
SetByAmmoCategory("flamethrower", settings.startup["ReStack-ammo-flamethrower"].value)
SetByAmmoCategory("rocket", settings.startup["ReStack-ammo-rocket"].value)
SetByAmmoCategory("cannon-shell", settings.startup["ReStack-ammo-cannon"].value)
SetByAmmoCategory("artillery-shell", settings.startup["ReStack-ammo-artillery"].value)
69 changes: 69 additions & 0 deletions modules/barrel.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
-- Barrel stack and capacity
-- filled barrels are auto generated from fluids in base\data-updates.lua
local barrel_stack_size = settings.startup["ReStack-barrel-stack"].value
local barrel_capacity = settings.startup["ReStack-barrel-fill"].value
local empty_barrel = "empty-barrel"

-- instead of 1 barrel ever 0.2 we default to 10 barrels every 2
local energy_per_recipe = 2
local recipe_barrel_multiplier = 10
if barrel_capacity < 500 then -- each recipe should at least process the base 50L
recipe_barrel_multiplier = math.ceil(500 / barrel_capacity)
else
energy_per_recipe = math.floor(barrel_capacity / 250)
end
-- log("[RS] barrel capacity: "..barrel_capacity.." (50), barrels per recipe: "..recipe_barrel_multiplier.." (1), energy per recipe: "..energy_per_recipe.." (0.2)")

-- set barrel stack size
data.raw.item[empty_barrel].stack_size = barrel_stack_size
log("[RS] Setting item."..tostring(data.raw.item[empty_barrel].name)..".stack_size "..barrel_stack_size)
for fluid_name, fluid in pairs(data.raw.fluid) do
if (fluid.auto_barrel == nil or fluid.auto_barrel) and (fluid.icon or fluid.icons) then
local barrel_name = fluid_name.."-barrel" -- naming convention is hardcoded in base\data-update.lua
local barrel_item = data.raw.item[barrel_name]
if barrel_item then
barrel_item.stack_size = barrel_stack_size
log("[RS] Setting item."..tostring(barrel_item.name)..".stack_size "..barrel_stack_size)
end

-- adjust barrel capacity and recipes
local fill_recipe = data.raw.recipe["fill-"..barrel_name]
if fill_recipe then
log("[RS] Setting fill recipe."..tostring(fill_recipe.name).." to "..recipe_barrel_multiplier.."x "..barrel_capacity.."L barrel every "..energy_per_recipe)
fill_recipe.energy_required = energy_per_recipe
for _, ingredient in pairs(fill_recipe.ingredients) do
if ingredient.name == empty_barrel then
ingredient.amount = ingredient.amount * recipe_barrel_multiplier
end
if ingredient.name == fluid_name then
ingredient.amount = barrel_capacity * recipe_barrel_multiplier
end
end
for _, result in pairs(fill_recipe.results) do
if result.name == fluid_name.."-barrel" then
result.amount = result.amount * recipe_barrel_multiplier
end
end
end

local empty_recipe = data.raw.recipe["empty-"..barrel_name]
if empty_recipe then
log("[RS] Setting empty recipe."..tostring(empty_recipe.name).." to "..recipe_barrel_multiplier.."x "..barrel_capacity.."L barrel every "..energy_per_recipe)
empty_recipe.energy_required = energy_per_recipe
for _, ingredient in pairs(empty_recipe.ingredients) do
if ingredient.name == fluid_name.."-barrel" then
ingredient.amount = ingredient.amount * recipe_barrel_multiplier
end
end
for _, result in pairs(empty_recipe.results) do
if result.name == empty_barrel then
result.amount = result.amount * recipe_barrel_multiplier
end
if result.name == fluid_name then
result.amount = barrel_capacity * recipe_barrel_multiplier
end
end
end

end
end
43 changes: 43 additions & 0 deletions modules/intermediate.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
require("lib")

-- Wood
ReStack_Items["raw-wood"] = {stack_size = settings.startup["ReStack-wood"].value, type = "wood"}

-- Ore Stack Size
SelectItemByEntity("resource", settings.startup["ReStack-ores"].value)

-- Plate stack size
local plate_stack_size = settings.startup["ReStack-plates"].value
for _,recipe in pairs(data.raw.recipe) do
if recipe.category == "smelting" then
if recipe.result or (recipe.normal and recipe.normal.result) then
local item = recipe.result or recipe.normal.result
ReStack_Items[item] = {stack_size = settings.startup["ReStack-plates"].value, type = "smelting"}
elseif recipe.results or (recipe.normal and recipe.normal.results) then
local results = recipe.results or recipe.normal.results -- is normal.results even possible?
for _, result in pairs(results) do
ReStack_Items[result.name] = {stack_size = settings.startup["ReStack-plates"].value, type = "smelting"}
end
end
end
end

-- refined Uranium
ReStack_Items["uranium-235"] = {stack_size = settings.startup["ReStack-uranium"].value, type = "uranium"}
ReStack_Items["uranium-238"] = {stack_size = settings.startup["ReStack-uranium"].value, type = "uranium"}

-- Fuel Cell
ReStack_Items["uranium-fuel-cell"] = {stack_size = settings.startup["ReStack-fuel-cell"].value, type = "fuel-cell"}
ReStack_Items["used-up-uranium-fuel-cell"] = {stack_size = settings.startup["ReStack-fuel-cell"].value, type = "fuel-cell"}

--Rocket Parts
ReStack_Items["rocket-fuel"] = {stack_size = settings.startup["ReStack-rocket-parts"].value, type = "rocket-part"}
ReStack_Items["rocket-control-unit"] = {stack_size = settings.startup["ReStack-rocket-parts"].value, type = "rocket-part"}
ReStack_Items["low-density-structure"] = {stack_size = settings.startup["ReStack-rocket-parts"].value, type = "rocket-part"}

-- Tiles - apply last to potentially overwrite
for _, item in pairs(data.raw.item) do
if item.place_as_tile and (Tile_Whitelist[item.name] or (settings.startup["ReStack-tiles-priority"].value or not ReStack_Items[item.name])) then
ReStack_Items[item.name] = {stack_size = settings.startup["ReStack-tiles"].value, type = "tile"}
end
end
18 changes: 18 additions & 0 deletions modules/lib.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

-- sets stacks for items asociated with an entity or resource
function SelectItemByEntity(ent_type, stack_size, category)
category = category or ent_type
for _, entity in pairs(data.raw[ent_type]) do
if entity.minable then
if entity.minable.result then
ReStack_Items[entity.minable.result] = {stack_size = stack_size, type = category}
elseif entity.minable.results then
for _, result in pairs(entity.minable.results) do
ReStack_Items[result.name] = {stack_size = stack_size, type = category}
end
end
end
end
end

return SelectItemByEntity
Loading

0 comments on commit c42ab25

Please sign in to comment.