Factorio: Fix ap-get-technology nil value crashes (#3517)
This commit is contained in:
parent
67f329b96f
commit
ab0903679c
|
@ -660,11 +660,18 @@ commands.add_command("ap-get-technology", "Grant a technology, used by the Archi
|
||||||
end
|
end
|
||||||
local tech
|
local tech
|
||||||
local force = game.forces["player"]
|
local force = game.forces["player"]
|
||||||
|
if call.parameter == nil then
|
||||||
|
game.print("ap-get-technology is only to be used by the Archipelago Factorio Client")
|
||||||
|
return
|
||||||
|
end
|
||||||
chunks = split(call.parameter, "\t")
|
chunks = split(call.parameter, "\t")
|
||||||
local item_name = chunks[1]
|
local item_name = chunks[1]
|
||||||
local index = chunks[2]
|
local index = chunks[2]
|
||||||
local source = chunks[3] or "Archipelago"
|
local source = chunks[3] or "Archipelago"
|
||||||
if index == -1 then -- for coop sync and restoring from an older savegame
|
if index == nil then
|
||||||
|
game.print("ap-get-technology is only to be used by the Archipelago Factorio Client")
|
||||||
|
return
|
||||||
|
elseif index == -1 then -- for coop sync and restoring from an older savegame
|
||||||
tech = force.technologies[item_name]
|
tech = force.technologies[item_name]
|
||||||
if tech.researched ~= true then
|
if tech.researched ~= true then
|
||||||
game.print({"", "Received [technology=" .. tech.name .. "] as it is already checked."})
|
game.print({"", "Received [technology=" .. tech.name .. "] as it is already checked."})
|
||||||
|
|
Loading…
Reference in New Issue