Check if starting item actually exists before trying to give it to player.
This commit is contained in:
parent
282e7b4006
commit
d41fce6f91
|
@ -127,6 +127,7 @@ function update_player(index)
|
||||||
for name, count in pairs(samples) do
|
for name, count in pairs(samples) do
|
||||||
stack.name = name
|
stack.name = name
|
||||||
stack.count = count
|
stack.count = count
|
||||||
|
if game.item_prototypes[name] then
|
||||||
if character.can_insert(stack) then
|
if character.can_insert(stack) then
|
||||||
sent = character.insert(stack)
|
sent = character.insert(stack)
|
||||||
else
|
else
|
||||||
|
@ -146,6 +147,10 @@ function update_player(index)
|
||||||
else
|
else
|
||||||
samples[name] = nil -- Remove from the list
|
samples[name] = nil -- Remove from the list
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
player.print("Unable to receive " .. count .. "x [item=" .. name .. "] as this item does not exist.")
|
||||||
|
samples[name] = nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue