This commit is contained in:
Brevven 2024-03-15 10:11:11 -07:00
parent fb33e0eaea
commit 65271a969f
5 changed files with 75 additions and 1 deletions

View file

@ -1,4 +1,15 @@
--------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------
Version: 0.1.16
Date: 2024-02-10
Fixes:
- Fix some printspam.
---------------------------------------------------------------------------------------------------
Version: 0.1.15
Date: 2024-02-10
Changes:
- Compatibility fix for Warptorio Expansion to prevent soft lock when used without Aluminum
Note, 0.1.14 deprecated due to possible re-soft-locking bug
---------------------------------------------------------------------------------------------------
Version: 0.1.13 Version: 0.1.13
Date: 2024-01-13 Date: 2024-01-13
Changes: Changes:

View file

@ -26,4 +26,61 @@ function util.force_enable_recipe(event, recipe_name)
end end
end end
function util.warptorio2_expansion_helper()
if script.active_mods["warptorio2_expansion"] then
function check_container_for_items(container,items)
local has_all =true
for k=1,#items do
if container.get_item_count(items[k].name)<items[k].count then has_all=false break end
end
return has_all
end
function remove_items_from_container(container,items)
for k=1,#items do
container.remove_item(items[k])
end
end
script.on_nth_tick(60, function (event)
if global.done then return end
local fix_items={
{name='iron-plate',count=100},
{name='iron-gear-wheel',count=100},
{name='repair-pack',count=50},
}
local entities = {}
for i=1,100 do
if game.surfaces[i] then
local lentities= game.surfaces[i].find_entities_filtered{area = {{-100, -100}, {100, 100}}, name = "wpe_broken_lab"}
for j, entity in pairs(lentities) do
table.insert(entities, entity)
end
end
end
if #entities == 0 then
if global.checking then
-- The lab has already been fixed
global.done = true
else
-- Check that the lab doesn't reappear due to a warp
global.checking = true
end
return
end
if check_container_for_items(entities[1],fix_items) then
remove_items_from_container(entities[1],fix_items)
local lab = entities[1].surface.create_entity({name='wpe_repaired_lab', position=entities[1].position, force = game.forces.player})
lab.destructible=false
lab.minable=false
entities[1].destroy()
global.done = true
end
end)
end
end
return util return util

View file

@ -48,3 +48,5 @@ function on_init()
global.starting_spawn = true global.starting_spawn = true
end end
script.on_init(on_init) script.on_init(on_init)
util.warptorio2_expansion_helper()

View file

@ -1,6 +1,6 @@
{ {
"name": "bzgas", "name": "bzgas",
"version": "0.1.13", "version": "0.1.16",
"factorio_version": "1.1", "factorio_version": "1.1",
"title": "Natural Gas", "title": "Natural Gas",
"author": "Brevven", "author": "Brevven",
@ -15,6 +15,7 @@
"? bztungsten >= 0.6.0", "? bztungsten >= 0.6.0",
"? bzcarbon >= 0.3.0", "? bzcarbon >= 0.3.0",
"? bztin", "? bztin",
"? warptorio2_expansion",
"? space-exploration >= 0.5.100", "? space-exploration >= 0.5.100",
"? aai-industry", "? aai-industry",
"? Krastorio2", "? Krastorio2",

View file

@ -3,6 +3,9 @@ gas=Natural gas
basic-chemical-plant=Basic chemical plant basic-chemical-plant=Basic chemical plant
gas-extractor=Drilling rig gas-extractor=Drilling rig
[entity-description]
wpe_broken_lab=To repair, insert 100[item=iron-plate], 100[item=iron-gear-wheel], 50[item=repair-pack]
[autoplace-control-names] [autoplace-control-names]
gas=[fluid=gas] Natural gas gas=[fluid=gas] Natural gas