Skip to content

Commit 7e27779

Browse files
committed
fix error wiht nil stack
hide metaitems
1 parent 185f75b commit 7e27779

File tree

4 files changed

+25
-21
lines changed

4 files changed

+25
-21
lines changed

control.lua

+22-20
Original file line numberDiff line numberDiff line change
@@ -59,27 +59,29 @@ script.on_event(defines.events.on_marked_for_deconstruction, function(event)
5959
-- player has a upgrade planner and other has deconstruction planner,
6060
-- we can't determine it, so we have to discard deconstruction order.
6161
for _, p in pairs(game.players) do
62-
local stack = p.cursor_stack
63-
if stack.valid_for_read then
64-
if stack.name == "upgrade-planner" then
65-
if upgrade or deconstruction or module then
66-
--debugDump("Upgrade planner used", true)
67-
return
68-
end
69-
upgrade = true
70-
elseif stack.name == "deconstruction-planner" then
71-
if upgrade or module then
72-
--debugDump("Deconstruction/Module planner used", true)
73-
return
74-
end
75-
deconstruction = true
76-
elseif stack.name == "module-inserter" then
77-
if upgrade or deconstruction then
78-
--debugDump("Deconstruction/Upgrade planner used", true)
79-
return
62+
if p.connected then
63+
local stack = p.cursor_stack
64+
if stack and stack.valid_for_read then
65+
if stack.name == "upgrade-planner" then
66+
if upgrade or deconstruction or module then
67+
--debugDump("Upgrade planner used", true)
68+
return
69+
end
70+
upgrade = true
71+
elseif stack.name == "deconstruction-planner" then
72+
if upgrade or module then
73+
--debugDump("Deconstruction/Module planner used", true)
74+
return
75+
end
76+
deconstruction = true
77+
elseif stack.name == "module-inserter" then
78+
if upgrade or deconstruction then
79+
--debugDump("Deconstruction/Upgrade planner used", true)
80+
return
81+
end
82+
player = p
83+
module = true
8084
end
81-
player = p
82-
module = true
8385
end
8486
end
8587
end

data-final-fixes.lua

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ require "lib"
33
local types = {["mining-drill"]=true,["assembling-machine"]=true,lab=true,["rocket-silo"]=true, furnace=true, beacon=true}
44

55
local metaitem = copyPrototype("deconstruction-item", "deconstruction-planner", "mi-meta")
6+
table.insert(metaitem.flags, "hidden")
67
local metarecipe = copyPrototype("recipe", "deconstruction-planner", "mi-meta")
78
metarecipe.ingredients = {}
89
metarecipe.enabled = false

info.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ModuleInserter",
3-
"version": "0.1.32",
3+
"version": "0.1.33",
44
"title": "Module Inserter",
55
"author": "Choumiko",
66
"homepage": "",

prototypes/item.lua

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ mi_proxy.collision_box = {{-0.1,-0.1},{0.1,0.1}}
1010
mi_proxy.collision_mask = {"doodad-layer", "not-colliding-with-itself"}
1111

1212
local mi_proxy_i = copyPrototype("item","wooden-chest","module-inserter-proxy")
13+
table.insert(mi_proxy_i.flags, "hidden")
1314
mi_proxy_i.icon = "__ModuleInserter__/graphics/module-inserter-icon.png"
1415
mi_proxy_i.stack_size = 1000
1516

0 commit comments

Comments
 (0)