w2e
This commit is contained in:
parent
d2d83c0f90
commit
f8ff3472fb
6 changed files with 68 additions and 4 deletions
|
@ -1,4 +1,9 @@
|
|||
---------------------------------------------------------------------------------------------------
|
||||
Version: 0.5.9
|
||||
Date: 2024-02-17
|
||||
Fixes:
|
||||
- Fix possible soft lock on Warptorio 2 Expnasion
|
||||
---------------------------------------------------------------------------------------------------
|
||||
Version: 0.5.8
|
||||
Date: 2023-12-24
|
||||
Localization:
|
||||
|
|
|
@ -26,4 +26,61 @@ function util.force_enable_recipe(event, recipe_name)
|
|||
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
|
||||
|
|
|
@ -15,5 +15,4 @@ function on_console_chat(event)
|
|||
end
|
||||
script.on_event(defines.events.on_console_chat, on_console_chat)
|
||||
|
||||
|
||||
|
||||
util.warptorio2_expansion_helper()
|
||||
|
|
|
@ -173,7 +173,7 @@ function util.k2matter(params)
|
|||
},
|
||||
time = 45,
|
||||
},
|
||||
localised_name = {"technology-name.k2-conversion", {"item-name."..params.k2matter.item_name}},
|
||||
-- (ignore for now) localised_name = {"technology-name.k2-conversion", {"item-name."..params.k2matter.item_name}},
|
||||
},
|
||||
})
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "bzcarbon",
|
||||
"version": "0.5.8",
|
||||
"version": "0.5.9",
|
||||
"factorio_version": "1.1",
|
||||
"title": "Graphite & Diamonds",
|
||||
"author": "Brevven",
|
||||
|
|
|
@ -9,6 +9,9 @@ rough-diamond-patch=__ITEM__rough-diamond__ patch
|
|||
rough-diamond-patch-chunk=__ENTITY__rough-diamond-patch__ chunk
|
||||
rough-diamond-patch-ore=__ENTITY__rough-diamond-patch__ ore
|
||||
|
||||
[entity-description]
|
||||
wpe_broken_lab=To repair, insert 100[item=iron-plate], 100[item=iron-gear-wheel], 50[item=repair-pack]
|
||||
|
||||
[autoplace-control-names]
|
||||
graphite=[item=flake-graphite] Graphite
|
||||
diamond=[item=rough-diamond] Diamond
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue