warptorio 2 expansion

This commit is contained in:
Brevven 2023-02-10 15:52:42 -08:00
parent 56ae2c839d
commit 0be084dc42
3 changed files with 43 additions and 1 deletions

View file

@ -1,4 +1,10 @@
---------------------------------------------------------------------------------------------------
Version: 0.4.21
Date: 2023-02-03
Features:
- Compatibility with Warptorio2Expansion, can now repair broken lab to unlock research.
No copper cable or circuits required.
---------------------------------------------------------------------------------------------------
Version: 0.4.20
Date: 2023-01-17
Features:

View file

@ -30,3 +30,39 @@ script.on_init(
end
)
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=20},
}
local entities = game.surfaces[1].find_entities_filtered{area = {{-100, -100}, {100, 100}}, name = "wpe_broken_lab"}
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

View file

@ -1,6 +1,6 @@
{
"name": "bzaluminum",
"version": "0.4.20",
"version": "0.4.21",
"factorio_version": "1.1",
"title": "Aluminum",
"author": "Brevven",