Skip to content

Commit

Permalink
drop the modules on the ground if your inventory is full
Browse files Browse the repository at this point in the history
  • Loading branch information
notnotmelon committed Nov 20, 2023
1 parent 74583ba commit cea8f12
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion scripts/slaughterhouse/slaughterhouse.lua
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,10 @@ end

function Slaughterhouse.set_recipe(player, entity, recipe)
for item, count in pairs(entity.set_recipe(recipe)) do
player.insert{name = item, count = count}
count = count - player.insert{name = item, count = count}
if count > 0 then
player.surface.spill_item_stack(player.position, {name = item, count = count}, true)
end
end
player.opened = entity
end
Expand Down

0 comments on commit cea8f12

Please sign in to comment.