mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-02-09 13:37:02 +02:00
Update show_health.lua
Fixed to it doesn't trigger when the player dies.
This commit is contained in:
parent
cedffd65a8
commit
a55f882b7c
@ -3,6 +3,7 @@ local game = require 'utils.game'
|
||||
event.add(defines.events.on_entity_damaged, function(event)
|
||||
if event.entity.name ~= 'character' then return end
|
||||
local player = game.get_player(event.entity.player)
|
||||
if not player.character then return end
|
||||
if player.character then
|
||||
if player.character.health == nil then return end
|
||||
local index = player.index
|
||||
@ -23,4 +24,4 @@ event.add(defines.events.on_entity_damaged, function(event)
|
||||
global.player_health[index] = health
|
||||
end
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
Loading…
x
Reference in New Issue
Block a user