1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2025-01-18 03:21:47 +02:00

killing self no longer spawns fish

This commit is contained in:
grilledham 2018-07-01 14:19:19 +01:00
parent 51c4d77cdf
commit 4a2b24a6f6

View File

@ -61,7 +61,7 @@ local function teleport_location(cmd)
game.player.teleport(pos)
end
local function do_fish_kill(player)
local function do_fish_kill(player, suicide)
local c = player.character
if not c then
return false
@ -70,6 +70,11 @@ local function do_fish_kill(player)
local e = player.surface.create_entity {name = 'fish', position = player.position}
c.die(player.force, e)
-- Don't want people killing themselves for free fish.
if suicide then
e.destroy()
end
return true
end
@ -86,12 +91,12 @@ local function kill(cmd)
end
if not target and player then
if not do_fish_kill(player) then
if not do_fish_kill(player, true) then
player_print("Sorry, you don't have a character to kill.")
end
elseif player then
if target == player then
if not do_fish_kill(player) then
if not do_fish_kill(player, true) then
player_print("Sorry, you don't have a character to kill.")
end
elseif target and player.admin then