mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2024-12-28 23:06:38 +02:00
mountain fortress and rpg updates
This commit is contained in:
parent
6a95cb2108
commit
2065118aca
@ -13,11 +13,13 @@ local fallout_width = 64
|
||||
local fallout_debris = {}
|
||||
|
||||
for x = fallout_width * -1 - 32, fallout_width + 32, 1 do
|
||||
for y = fallout_width * -1 - 32, fallout_width + 32, 1 do
|
||||
local position = {x = x, y = y}
|
||||
local fallout = sqrt(position.x ^ 2 + position.y ^ 2)
|
||||
if fallout > fallout_width then
|
||||
fallout_debris[#fallout_debris + 1] = {position.x, position.y}
|
||||
if x < -31 or x > 31 then
|
||||
for y = fallout_width * -1 - 32, fallout_width + 32, 1 do
|
||||
local position = {x = x, y = y}
|
||||
local fallout = sqrt(position.x ^ 2 + position.y ^ 2)
|
||||
if fallout > fallout_width then
|
||||
fallout_debris[#fallout_debris + 1] = {position.x, position.y}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -32,7 +34,7 @@ local reconstruct_all_trains =
|
||||
)
|
||||
|
||||
local function get_tile_name()
|
||||
local main_tile_name = 'tutorial-grid'
|
||||
local main_tile_name = 'black-refined-concrete'
|
||||
local modded = is_game_modded()
|
||||
if modded then
|
||||
if game.active_mods['Krastorio2'] then
|
||||
@ -200,6 +202,50 @@ local function input_filtered(wagon_inventory, chest, chest_inventory, free_slot
|
||||
end
|
||||
end
|
||||
|
||||
local remove_lights_token =
|
||||
Token.register(
|
||||
function(data)
|
||||
local id = data.id
|
||||
if id then
|
||||
rendering.destroy(id)
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
function Public.glimpse_of_lights(icw)
|
||||
local surface = WPT.get('loco_surface')
|
||||
if not surface or not surface.valid then
|
||||
return
|
||||
end
|
||||
|
||||
local hazardous_debris = icw.hazardous_debris
|
||||
if not hazardous_debris then
|
||||
return
|
||||
end
|
||||
|
||||
local text = rendering.draw_text
|
||||
local position = fallout_debris[random(1, size_of_debris)]
|
||||
|
||||
local p = {x = position[1], y = position[2]}
|
||||
local get_tile = surface.get_tile(p)
|
||||
if get_tile.valid and get_tile.name == 'out-of-map' then
|
||||
local id =
|
||||
text {
|
||||
text = '★',
|
||||
surface = surface,
|
||||
target = position,
|
||||
color = {r = 1, g = 1, b = 0},
|
||||
orientation = random(0, 100) * 0.01,
|
||||
scale = 0.4,
|
||||
font = 'heading-1',
|
||||
alignment = 'center',
|
||||
scale_with_zoom = false
|
||||
}
|
||||
|
||||
Task.set_timeout_in_ticks(300, remove_lights_token, {id = id})
|
||||
end
|
||||
end
|
||||
|
||||
function Public.hazardous_debris(icw)
|
||||
local speed = icw.speed
|
||||
local surface = WPT.get('loco_surface')
|
||||
@ -214,15 +260,6 @@ function Public.hazardous_debris(icw)
|
||||
|
||||
local create = surface.create_entity
|
||||
|
||||
for _ = 1, 16 * speed, 1 do
|
||||
local position = fallout_debris[random(1, size_of_debris)]
|
||||
local p = {x = position[1], y = position[2]}
|
||||
local get_tile = surface.get_tile(p)
|
||||
if get_tile.valid and get_tile.name == 'out-of-map' then
|
||||
create({name = 'blue-laser', position = position, force = 'neutral', target = {position[1], position[2] + fallout_width * 2}, speed = speed})
|
||||
end
|
||||
end
|
||||
|
||||
for _ = 1, 16 * speed, 1 do
|
||||
local position = fallout_debris[random(1, size_of_debris)]
|
||||
local p = {x = position[1], y = position[2]}
|
||||
|
@ -97,6 +97,7 @@ local function on_tick()
|
||||
if tick % 10 == 0 then
|
||||
Functions.item_transfer(icw)
|
||||
Functions.hazardous_debris(icw)
|
||||
Functions.glimpse_of_lights(icw)
|
||||
end
|
||||
if tick % 240 == 0 then
|
||||
Functions.update_minimap(icw)
|
||||
|
@ -1084,7 +1084,7 @@ local function gui_click(event)
|
||||
player.name .. ' has bought the locomotive health modifier for ' .. format_number(item.price, true) .. ' coins.'
|
||||
}
|
||||
)
|
||||
this.locomotive_max_health = this.locomotive_max_health + 4000 * item.stack
|
||||
this.locomotive_max_health = this.locomotive_max_health + (this.locomotive_max_health * 0.5 * item.stack)
|
||||
local m = this.locomotive_health / this.locomotive_max_health
|
||||
|
||||
if this.carriages then
|
||||
|
@ -64,6 +64,10 @@ function Public.add(surface, position, chest)
|
||||
container.insert({name = 'coin', count = random(1, 128)})
|
||||
elseif random(1, 128) == 1 then
|
||||
container.insert({name = 'coin', count = random(1, 256)})
|
||||
elseif random(1, 256) == 1 then
|
||||
container.insert({name = 'coin', count = random(1, 512)})
|
||||
elseif random(1, 512) == 1 then
|
||||
container.insert({name = 'coin', count = random(1, 1024)})
|
||||
end
|
||||
|
||||
for _ = 1, 3, 1 do
|
||||
|
@ -4,6 +4,8 @@ local Gui = require 'utils.gui'
|
||||
local Color = require 'utils.color_presets'
|
||||
local Token = require 'utils.token'
|
||||
local Alert = require 'utils.alert'
|
||||
local Task = require 'utils.task'
|
||||
local Token = require 'utils.token'
|
||||
|
||||
local Public = {}
|
||||
|
||||
@ -734,6 +736,35 @@ function Public.global_pool(players, count)
|
||||
return
|
||||
end
|
||||
|
||||
local damage_player_over_time_token =
|
||||
Token.register(
|
||||
function(data)
|
||||
local player = data.player
|
||||
local damage = data.damage
|
||||
if not player.character or not player.character.valid then
|
||||
return
|
||||
end
|
||||
player.character.health = player.character.health - damage
|
||||
player.character.surface.create_entity({name = 'water-splash', position = player.position})
|
||||
end
|
||||
)
|
||||
|
||||
--- Damages a player over time.
|
||||
function Public.damage_player_over_time(player, amount, damage)
|
||||
if not player or not player.valid then
|
||||
return
|
||||
end
|
||||
|
||||
amount = amount or 5
|
||||
damage = damage or 10
|
||||
local tick = 20
|
||||
for _ = 1, amount, 1 do
|
||||
Task.set_timeout_in_ticks(tick, damage_player_over_time_token, {player = player, damage = damage})
|
||||
tick = tick + 15
|
||||
damage = damage + 10
|
||||
end
|
||||
end
|
||||
|
||||
--- Distributes the global xp pool to every connected player.
|
||||
function Public.distribute_pool()
|
||||
local count = #game.connected_players
|
||||
|
@ -1098,8 +1098,8 @@ local function on_player_used_capsule(event)
|
||||
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)
|
||||
rpg_t[player.index].mana = 0
|
||||
player.character.health = 10
|
||||
player.character.surface.create_entity({name = 'water-splash', position = player.position})
|
||||
Functions.damage_player_over_time(player, 10)
|
||||
player.play_sound {path = 'utility/armor_insert', volume_modifier = 1}
|
||||
p(({'rpg_main.warped_ok'}), Color.info)
|
||||
rpg_t[player.index].mana = rpg_t[player.index].mana - object.mana_cost
|
||||
elseif projectile_types[obj_name] then -- projectiles
|
||||
|
Loading…
Reference in New Issue
Block a user