1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2024-12-26 22:56:43 +02:00

Mtn v3 - minor fixes

This commit is contained in:
Gerkiz 2023-11-05 16:34:23 +01:00
parent ed27efeaee
commit de7e2e407d
3 changed files with 20 additions and 3 deletions

View File

@ -7,6 +7,7 @@ local Alert = require 'utils.alert'
local Task = require 'utils.task'
local Token = require 'utils.token'
local Color = require 'utils.color_presets'
local ICF = require 'maps.mountain_fortress_v3.ic.functions'
local floor = math.floor
local abs = math.abs
@ -192,6 +193,8 @@ local compare_player_and_train = function(player, entity)
return
end
local car = ICF.get_car(entity.unit_number)
local position = player.position
local locomotive = Public.get('locomotive')
if not locomotive or not locomotive.valid then
@ -220,6 +223,10 @@ local compare_player_and_train = function(player, entity)
if c_y - t_y <= gap_between_zones.neg_gap then
if entity.health then
if car and car.health_pool and car.health_pool.health then
car.health_pool.health = car.health_pool.health - 500
end
entity.health = entity.health - 500
if entity.health <= 0 then
entity.die('enemy')
@ -375,12 +382,14 @@ local function on_player_driving_changed_state(event)
if not (player and player.valid) then
return
end
local entity = event.entity
if not (entity and entity.valid) then
return
end
local s = Public.get('validate_spider')
if entity.name == 'spidertron' then
if player.driving then
if not s[player.index] then
s[player.index] = entity
end

View File

@ -1372,6 +1372,15 @@ function Public.check_entity_healths()
end
end
function Public.get_car(unit_number)
local cars = IC.get('cars')
if not next(cars) then
return
end
return cars[unit_number] or nil
end
function Public.set_damage_health(data)
local entity = data.entity
local final_damage_amount = data.final_damage_amount

View File

@ -486,7 +486,6 @@ local function get_random_research_recipe()
local research_level_list = {
'energy-weapons-damage-7',
'physical-projectile-damage-7',
'refined-flammables-7',
'stronger-explosives-7',
'mining-productivity-4',
'worker-robots-speed-6',
@ -782,7 +781,7 @@ function Public.reset_stateful(refresh_gui, clear_buffs)
required = random(scale(50000), scale(100000))
},
trees_farmed = random(scale(9500, 400000), scale(10500, 400000)),
rocks_farmed = random(scale(45000, 4000000), scale(55000, 4000000)),
rocks_farmed = random(scale(45000, 450000), scale(55000, 450000)),
rockets_launched = random(scale(30, 700), scale(45, 700))
}
end