1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-08 00:39:30 +02:00
ComfyFactorio/maps/fish_defender_v1/vehicle_nanobots.lua

27 lines
722 B
Lua
Raw Normal View History

2021-03-24 20:14:12 +02:00
local Event = require 'utils.event'
2019-09-26 20:07:19 +02:00
local function on_player_changed_position(event)
2021-03-24 17:46:00 +02:00
if not global.vehicle_nanobots_unlocked then
return
end
local player = game.players[event.player_index]
if not player.character then
return
end
if not player.character.driving then
return
end
if not player.vehicle then
return
end
if not player.vehicle.valid then
return
end
if player.vehicle.health == player.vehicle.prototype.max_health then
return
end
player.vehicle.health = player.vehicle.health + player.vehicle.prototype.max_health * 0.005
2019-09-26 20:07:19 +02:00
end
2021-03-24 20:14:12 +02:00
Event.add(defines.events.on_player_changed_position, on_player_changed_position)