1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-26 03:52:22 +02:00

Mtn v3 - fix edge cases

This commit is contained in:
Gerkiz 2022-12-26 19:57:09 +01:00
parent d5f9d5a8f6
commit 467dfe93e9

View File

@ -129,6 +129,10 @@ local function hurt_players_outside_of_aura()
return
end
local locomotive = Public.get('locomotive')
if not locomotive or not locomotive.valid then
return
end
local loco = locomotive.position
local upgrades = Public.get('upgrades')
@ -208,6 +212,9 @@ local function give_passive_xp(data)
end
local upgrades = Public.get('upgrades')
local locomotive = Public.get('locomotive')
if not locomotive or not locomotive.valid then
return
end
local rpg = data.rpg
local loco = locomotive.position
@ -387,6 +394,10 @@ local function set_locomotive_health()
local locomotive_max_health = Public.get('locomotive_max_health')
local locomotive = Public.get('locomotive')
if not locomotive or not locomotive.valid then
return
end
local function check_health()
local m = locomotive_health / locomotive_max_health
if locomotive_health > locomotive_max_health then
@ -609,6 +620,9 @@ function Public.render_train_hp()
local locomotive_max_health = Public.get('locomotive_max_health')
local locomotive = Public.get('locomotive')
local upgrades = Public.get('upgrades')
if not locomotive or not locomotive.valid then
return
end
Public.set(
'health_text',