1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-06 00:23:49 +02:00
ComfyFactorio/maps/fish_defender/vehicle_nanobots.lua
Gerkiz 2d338ca3e3 refactor fish defender
removed globals
added soft-reset
removed spidertron from tech tree
added spidertron to market 
added endgoal
2020-10-10 20:36:07 +02:00

30 lines
838 B
Lua

local Event = require 'utils.event'
local FDT = require 'maps.fish_defender.table'
local function on_player_changed_position(event)
local vehicle_nanobots_unlocked = FDT.get('vehicle_nanobots_unlocked')
if not 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
end
Event.add(defines.events.on_player_changed_position, on_player_changed_position)