You've already forked ComfyFactorio
mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-11-25 22:32:18 +02:00
mor changes to mtn fortress
This commit is contained in:
@@ -212,7 +212,7 @@ local function check_health_final_damage(final_damage_amount)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function set_train_final_health(final_damage_amount)
|
local function set_train_final_health(final_damage_amount, repair)
|
||||||
if final_damage_amount == 0 then
|
if final_damage_amount == 0 then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@@ -224,6 +224,8 @@ local function set_train_final_health(final_damage_amount)
|
|||||||
|
|
||||||
local locomotive_health = WPT.get('locomotive_health')
|
local locomotive_health = WPT.get('locomotive_health')
|
||||||
local locomotive_max_health = WPT.get('locomotive_max_health')
|
local locomotive_max_health = WPT.get('locomotive_max_health')
|
||||||
|
|
||||||
|
if not repair then
|
||||||
local poison_deployed = WPT.get('poison_deployed')
|
local poison_deployed = WPT.get('poison_deployed')
|
||||||
local robotics_deployed = WPT.get('robotics_deployed')
|
local robotics_deployed = WPT.get('robotics_deployed')
|
||||||
|
|
||||||
@@ -272,6 +274,7 @@ local function set_train_final_health(final_damage_amount)
|
|||||||
elseif locomotive_health >= locomotive_max_health then
|
elseif locomotive_health >= locomotive_max_health then
|
||||||
WPT.set().poison_deployed = false
|
WPT.set().poison_deployed = false
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if locomotive_health <= 0 then
|
if locomotive_health <= 0 then
|
||||||
check_health_final_damage(final_damage_amount)
|
check_health_final_damage(final_damage_amount)
|
||||||
@@ -332,7 +335,7 @@ local function protect_entities(event)
|
|||||||
if (event.cause and event.cause.valid) then
|
if (event.cause and event.cause.valid) then
|
||||||
if event.cause.force.index == 2 then
|
if event.cause.force.index == 2 then
|
||||||
if units and units[entity.unit_number] then
|
if units and units[entity.unit_number] then
|
||||||
set_train_final_health(dmg)
|
set_train_final_health(dmg, false)
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
entity.health = entity.health - dmg
|
entity.health = entity.health - dmg
|
||||||
@@ -342,7 +345,7 @@ local function protect_entities(event)
|
|||||||
elseif not (event.cause and event.cause.valid) then
|
elseif not (event.cause and event.cause.valid) then
|
||||||
if event.force and event.force.index == 2 then
|
if event.force and event.force.index == 2 then
|
||||||
if units and units[entity.unit_number] then
|
if units and units[entity.unit_number] then
|
||||||
set_train_final_health(dmg)
|
set_train_final_health(dmg, false)
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
entity.health = entity.health - dmg
|
entity.health = entity.health - dmg
|
||||||
@@ -946,10 +949,10 @@ local function on_player_repaired_entity(event)
|
|||||||
local player = game.players[event.player_index]
|
local player = game.players[event.player_index]
|
||||||
local repair_speed = Functions.get_magicka(player)
|
local repair_speed = Functions.get_magicka(player)
|
||||||
if repair_speed <= 0 then
|
if repair_speed <= 0 then
|
||||||
set_train_final_health(-1)
|
set_train_final_health(-1, true)
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
set_train_final_health(-repair_speed)
|
set_train_final_health(-repair_speed, true)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ local Color = require 'utils.color_presets'
|
|||||||
local Task = require 'utils.task'
|
local Task = require 'utils.task'
|
||||||
local Token = require 'utils.token'
|
local Token = require 'utils.token'
|
||||||
local IC_Gui = require 'maps.mountain_fortress_v3.ic.gui'
|
local IC_Gui = require 'maps.mountain_fortress_v3.ic.gui'
|
||||||
local IC = require 'maps.mountain_fortress.ic.table'
|
local IC = require 'maps.mountain_fortress_v3.ic.table'
|
||||||
local WPT = require 'maps.mountain_fortress_v3.table'
|
local WPT = require 'maps.mountain_fortress_v3.table'
|
||||||
|
|
||||||
local Public = {}
|
local Public = {}
|
||||||
|
|||||||
@@ -738,28 +738,25 @@ local damage_player_over_time_token =
|
|||||||
Token.register(
|
Token.register(
|
||||||
function(data)
|
function(data)
|
||||||
local player = data.player
|
local player = data.player
|
||||||
local damage = data.damage
|
|
||||||
if not player.character or not player.character.valid then
|
if not player.character or not player.character.valid then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
player.character.health = player.character.health - damage
|
player.character.health = player.character.health - (player.character.health * 0.05)
|
||||||
player.character.surface.create_entity({name = 'water-splash', position = player.position})
|
player.character.surface.create_entity({name = 'water-splash', position = player.position})
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
--- Damages a player over time.
|
--- Damages a player over time.
|
||||||
function Public.damage_player_over_time(player, amount, damage)
|
function Public.damage_player_over_time(player, amount)
|
||||||
if not player or not player.valid then
|
if not player or not player.valid then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
amount = amount or 5
|
amount = amount or 10
|
||||||
damage = damage or 10
|
|
||||||
local tick = 20
|
local tick = 20
|
||||||
for _ = 1, amount, 1 do
|
for _ = 1, amount, 1 do
|
||||||
Task.set_timeout_in_ticks(tick, damage_player_over_time_token, {player = player, damage = damage})
|
Task.set_timeout_in_ticks(tick, damage_player_over_time_token, {player = player})
|
||||||
tick = tick + 15
|
tick = tick + 15
|
||||||
damage = damage + 10
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1098,7 +1098,7 @@ local function on_player_used_capsule(event)
|
|||||||
elseif object.obj_to_create == 'warp-gate' then
|
elseif object.obj_to_create == 'warp-gate' then
|
||||||
player.teleport(surface.find_non_colliding_position('character', game.forces.player.get_spawn_position(surface), 3, 0, 5), surface)
|
player.teleport(surface.find_non_colliding_position('character', game.forces.player.get_spawn_position(surface), 3, 0, 5), surface)
|
||||||
rpg_t[player.index].mana = 0
|
rpg_t[player.index].mana = 0
|
||||||
Functions.damage_player_over_time(player, 10)
|
Functions.damage_player_over_time(player, math.random(8, 16))
|
||||||
player.play_sound {path = 'utility/armor_insert', volume_modifier = 1}
|
player.play_sound {path = 'utility/armor_insert', volume_modifier = 1}
|
||||||
p(({'rpg_main.warped_ok'}), Color.info)
|
p(({'rpg_main.warped_ok'}), Color.info)
|
||||||
rpg_t[player.index].mana = rpg_t[player.index].mana - object.mana_cost
|
rpg_t[player.index].mana = rpg_t[player.index].mana - object.mana_cost
|
||||||
|
|||||||
Reference in New Issue
Block a user