mirror of
https://github.com/Refactorio/RedMew.git
synced 2025-09-16 09:16:22 +02:00
Fixed well bug, where the scenario would crash if you entered ips < 1 #38
This commit is contained in:
@@ -316,8 +316,12 @@ local function well(cmd)
|
||||
for param in string.gmatch(cmd.parameter, "%S+") do table.insert(params, param) end
|
||||
if game.item_prototypes[params[1]] and params[2] and tonumber(params[2]) then
|
||||
local ips = tonumber(params[2])
|
||||
if ips < 1 then
|
||||
game.player.print("Items per second must be at least 1.")
|
||||
return
|
||||
end
|
||||
local chest = game.surfaces[1].create_entity({name = "steel-chest", force = game.player.force, position = game.player.position})
|
||||
table.insert(global.wells, {chest = chest, item = params[1], items_per_second = ips})
|
||||
table.insert(global.wells, {chest = chest, item = params[1], items_per_second = math.floor(ips)})
|
||||
refill_well()
|
||||
else
|
||||
game.player.print("Usage: /well <item> <items per second>.")
|
||||
@@ -341,5 +345,5 @@ commands.add_command("afktime", 'Shows how long players have been afk.', afk)
|
||||
commands.add_command("tag", '<player> <tag> Sets a players tag. (Admins only)', tag)
|
||||
commands.add_command("follow", '<player> makes you follow the player. Use /unfollow to stop following a player.', follow)
|
||||
commands.add_command("unfollow", 'stops following a player.', unfollow)
|
||||
commands.add_command("well", '<item> <items per second> (Admins only)', well)
|
||||
commands.add_command("well", '<item> <items per second> Spawns an item well. (Admins only)', well)
|
||||
|
||||
|
Reference in New Issue
Block a user