mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 20:21:32 -06:00
Check if starting item actually exists before trying to give it to player.
This commit is contained in:
@@ -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
|
||||||
|
Reference in New Issue
Block a user