warp2e fix
This commit is contained in:
parent
e2a9fb5002
commit
23f9b82e12
3 changed files with 6 additions and 39 deletions
|
|
@ -1,6 +1,8 @@
|
|||
---------------------------------------------------------------------------------------------------
|
||||
Version: 0.4.27
|
||||
Date: 2024-02-17
|
||||
Fixes:
|
||||
- Prevent possible soft lock with Warptorio 2 Expansion
|
||||
Changes:
|
||||
- Some improved recipe compatibility for Xenos mods
|
||||
---------------------------------------------------------------------------------------------------
|
||||
|
|
|
|||
40
control.lua
40
control.lua
|
|
@ -30,44 +30,6 @@ 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 #entities == 0 then
|
||||
-- The lab has already been fixed
|
||||
global.done = true
|
||||
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
|
||||
|
||||
util.warptorio2_expansion_helper()
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
[entity-name]
|
||||
aluminum-ore=__ITEM__aluminum_upper__ ore
|
||||
|
||||
[entity-description]
|
||||
wpe_broken_lab=To repair, insert 100[item=iron-plate], 100[item=iron-gear-wheel], 50[item=repair-pack]
|
||||
|
||||
# VTK Deep Core Mining
|
||||
aluminum-ore-patch=__ITEM__aluminum_upper__ ore patch
|
||||
aluminum-ore-patch-chunk=__ENTITY__aluminum-ore-patch__ chunk
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue