mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2024-12-30 23:17:53 +02:00
mtn fortress - is now compatible with Krastorio 2
This commit is contained in:
parent
f006ffa88a
commit
e793d827fa
@ -183,7 +183,7 @@ local function distance(player)
|
||||
WPT.set().placed_trains_in_zone.randomized = false
|
||||
WPT.set().placed_trains_in_zone.positions = {}
|
||||
raise_event(Balance.events.breached_wall, {})
|
||||
if WPT.get('breached_wall') == WPT.get('spidertron_unlocked_at_wave') then
|
||||
if WPT.get('breached_wall') == WPT.get('spidertron_unlocked_at_zone') then
|
||||
local main_market_items = WPT.get('main_market_items')
|
||||
if not main_market_items['spidertron'] then
|
||||
local rng = random(70000, 120000)
|
||||
|
@ -177,10 +177,15 @@ local function check_health()
|
||||
if not (entity and entity.valid) then
|
||||
return
|
||||
end
|
||||
local cargo_health = 600
|
||||
local modded = is_game_modded()
|
||||
if modded then
|
||||
cargo_health = 750
|
||||
end
|
||||
if entity.type == 'locomotive' then
|
||||
entity.health = 1000 * m
|
||||
else
|
||||
entity.health = 600 * m
|
||||
entity.health = cargo_health * m
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -461,7 +466,7 @@ local function give_coin(player)
|
||||
if coin_override then
|
||||
player.insert({name = 'coin', count = coin_override})
|
||||
else
|
||||
player.insert({name = 'coin', count = coin_amount})
|
||||
player.insert({name = 'coin', count = random(1, coin_amount)})
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -637,9 +642,60 @@ local mining_events = {
|
||||
return
|
||||
end
|
||||
|
||||
local ent_to_create = {'biter-spawner', 'spitter-spawner'}
|
||||
|
||||
if is_mod_loaded('bobenemies') then
|
||||
ent_to_create = {'bob-biter-spawner', 'bob-spitter-spawner'}
|
||||
end
|
||||
|
||||
local position = entity.position
|
||||
local surface = entity.surface
|
||||
local e = surface.create_entity({name = 'biter-spawner', position = position, force = 'enemy'})
|
||||
local e = surface.create_entity({name = ent_to_create[random(1, #ent_to_create)], position = position, force = 'enemy'})
|
||||
if is_mod_loaded('Krastorio2') then
|
||||
local tiles = {}
|
||||
for y = 3 * -2, 3 * 2, 1 do
|
||||
for x = 3 * -2, 3 * 2, 1 do
|
||||
local p = {y = position.y + y, x = position.x + x}
|
||||
tiles[#tiles + 1] = {name = 'kr-creep', position = p}
|
||||
end
|
||||
end
|
||||
entity.surface.set_tiles(tiles, true)
|
||||
end
|
||||
|
||||
e.destructible = false
|
||||
Task.set_timeout_in_ticks(300, immunity_spawner, {entity = e})
|
||||
Public.unstuck_player(index)
|
||||
end,
|
||||
512,
|
||||
'Nest'
|
||||
},
|
||||
{
|
||||
function(entity, index)
|
||||
if Locomotive.is_around_train(entity) then
|
||||
entity.destroy()
|
||||
return
|
||||
end
|
||||
|
||||
local ent_to_create = {'biter-spawner', 'spitter-spawner'}
|
||||
|
||||
if is_mod_loaded('bobenemies') then
|
||||
ent_to_create = {'bob-biter-spawner', 'bob-spitter-spawner'}
|
||||
end
|
||||
|
||||
local position = entity.position
|
||||
local surface = entity.surface
|
||||
local e = surface.create_entity({name = ent_to_create[random(1, #ent_to_create)], position = position, force = 'enemy'})
|
||||
if is_mod_loaded('Krastorio2') then
|
||||
local tiles = {}
|
||||
for y = 3 * -2, 3 * 2, 1 do
|
||||
for x = 3 * -2, 3 * 2, 1 do
|
||||
local p = {y = position.y + y, x = position.x + x}
|
||||
tiles[#tiles + 1] = {name = 'kr-creep', position = p}
|
||||
end
|
||||
end
|
||||
entity.surface.set_tiles(tiles, true)
|
||||
end
|
||||
|
||||
e.destructible = false
|
||||
Task.set_timeout_in_ticks(300, immunity_spawner, {entity = e})
|
||||
Public.unstuck_player(index)
|
||||
|
@ -777,7 +777,7 @@ local function calc_players()
|
||||
end
|
||||
end
|
||||
if total <= 0 then
|
||||
total = 1
|
||||
total = #players
|
||||
end
|
||||
return total
|
||||
end
|
||||
@ -847,6 +847,12 @@ function Public.render_direction(surface)
|
||||
if winter_mode then
|
||||
text = 'Welcome to Wintery Mountain Fortress v3!'
|
||||
end
|
||||
|
||||
local modded = is_game_modded()
|
||||
|
||||
if modded then
|
||||
text = 'Welcome to Modded Mountain Fortress v3!'
|
||||
end
|
||||
if counter then
|
||||
rendering.draw_text {
|
||||
text = text .. '\nRun: ' .. counter,
|
||||
@ -969,50 +975,70 @@ function Public.boost_difficulty()
|
||||
|
||||
local force = game.forces.player
|
||||
|
||||
local unit_modifiers = WD.get('modified_unit_health')
|
||||
|
||||
if name == "I'm too young to die" then
|
||||
-- rpg_extra.difficulty = 1
|
||||
force.manual_mining_speed_modifier = force.manual_mining_speed_modifier + 0.5
|
||||
force.character_running_speed_modifier = 0.15
|
||||
force.manual_crafting_speed_modifier = 0.15
|
||||
WPT.set().coin_amount = 1
|
||||
WPT.set('coin_amount', 1)
|
||||
WPT.set('upgrades').flame_turret.limit = 12
|
||||
WPT.set('upgrades').landmine.limit = 50
|
||||
WPT.set().locomotive_health = 10000
|
||||
WPT.set().locomotive_max_health = 10000
|
||||
WPT.set().bonus_xp_on_join = 500
|
||||
WD.set().next_wave = game.tick + 3600 * 15
|
||||
WPT.set().spidertron_unlocked_at_wave = 14
|
||||
WPT.set().difficulty_set = true
|
||||
if is_game_modded() then
|
||||
WPT.set('locomotive_health', 20000)
|
||||
WPT.set('locomotive_max_health', 20000)
|
||||
else
|
||||
WPT.set('locomotive_health', 10000)
|
||||
WPT.set('locomotive_max_health', 10000)
|
||||
end
|
||||
WPT.set('bonus_xp_on_join', 500)
|
||||
WD.set('next_wave', game.tick + 3600 * 15)
|
||||
WPT.set('spidertron_unlocked_at_zone', 10)
|
||||
WD.set_biter_health_boost(1.50)
|
||||
unit_modifiers.limit_value = 30
|
||||
unit_modifiers.health_increase_per_boss_wave = 0.04
|
||||
WPT.set('difficulty_set', true)
|
||||
elseif name == 'Hurt me plenty' then
|
||||
-- rpg_extra.difficulty = 0.5
|
||||
force.manual_mining_speed_modifier = force.manual_mining_speed_modifier + 0.25
|
||||
force.character_running_speed_modifier = 0.1
|
||||
force.manual_crafting_speed_modifier = 0.1
|
||||
WPT.set().coin_amount = 1
|
||||
WPT.set('coin_amount', 2)
|
||||
WPT.set('upgrades').flame_turret.limit = 10
|
||||
WPT.set('upgrades').landmine.limit = 50
|
||||
WPT.set().locomotive_health = 7000
|
||||
WPT.set().locomotive_max_health = 7000
|
||||
WPT.set().bonus_xp_on_join = 300
|
||||
WD.set().next_wave = game.tick + 3600 * 10
|
||||
WPT.set().spidertron_unlocked_at_wave = 16
|
||||
WPT.set().difficulty_set = true
|
||||
if is_game_modded() then
|
||||
WPT.set('locomotive_health', 12000)
|
||||
WPT.set('locomotive_max_health', 12000)
|
||||
else
|
||||
WPT.set('locomotive_health', 7000)
|
||||
WPT.set('locomotive_max_health', 7000)
|
||||
end
|
||||
WPT.set('bonus_xp_on_join', 300)
|
||||
WD.set('next_wave', game.tick + 3600 * 8)
|
||||
WPT.set('spidertron_unlocked_at_zone', 8)
|
||||
unit_modifiers.limit_value = 40
|
||||
unit_modifiers.health_increase_per_boss_wave = 0.06
|
||||
WD.set_biter_health_boost(2)
|
||||
WPT.set('difficulty_set', true)
|
||||
elseif name == 'Ultra-violence' then
|
||||
-- rpg_extra.difficulty = 0
|
||||
force.character_running_speed_modifier = 0
|
||||
force.manual_crafting_speed_modifier = 0
|
||||
WPT.set().coin_amount = 1
|
||||
WPT.set('coin_amount', 4)
|
||||
WPT.set('upgrades').flame_turret.limit = 3
|
||||
WPT.set('upgrades').landmine.limit = 10
|
||||
WPT.set().locomotive_health = 5000
|
||||
WPT.set().locomotive_max_health = 5000
|
||||
WPT.set().bonus_xp_on_join = 50
|
||||
WD.set().next_wave = game.tick + 3600 * 5
|
||||
WPT.set().spidertron_unlocked_at_wave = 18
|
||||
WPT.set().difficulty_set = true
|
||||
WD.set_biter_health_boost(3)
|
||||
if is_game_modded() then
|
||||
WPT.set('locomotive_health', 8000)
|
||||
WPT.set('locomotive_max_health', 8000)
|
||||
else
|
||||
WPT.set('locomotive_health', 5000)
|
||||
WPT.set('locomotive_max_health', 5000)
|
||||
end
|
||||
WPT.set('bonus_xp_on_join', 50)
|
||||
WD.set('next_wave', game.tick + 3600 * 5)
|
||||
WPT.set('spidertron_unlocked_at_zone', 6)
|
||||
unit_modifiers.limit_value = 50
|
||||
unit_modifiers.health_increase_per_boss_wave = 0.08
|
||||
WD.set_biter_health_boost(4)
|
||||
WPT.set('difficulty_set', true)
|
||||
end
|
||||
end
|
||||
|
||||
@ -1139,6 +1165,11 @@ function Public.on_player_joined_game(event)
|
||||
player_data.first_join = true
|
||||
end
|
||||
|
||||
local top = player.gui.top
|
||||
if top['mod_gui_top_frame'] then
|
||||
top['mod_gui_top_frame'].destroy()
|
||||
end
|
||||
|
||||
if player.surface.index ~= active_surface_index then
|
||||
player.teleport(surface.find_non_colliding_position('character', game.forces.player.get_spawn_position(surface), 3, 0, 5), surface)
|
||||
else
|
||||
@ -1265,8 +1296,7 @@ function Public.on_player_changed_position(event)
|
||||
end
|
||||
end
|
||||
|
||||
local disable_recipes = function()
|
||||
local force = game.forces.player
|
||||
local disable_recipes = function(force)
|
||||
force.recipes['cargo-wagon'].enabled = false
|
||||
force.recipes['fluid-wagon'].enabled = false
|
||||
force.recipes['car'].enabled = false
|
||||
@ -1275,18 +1305,28 @@ local disable_recipes = function()
|
||||
force.recipes['locomotive'].enabled = false
|
||||
force.recipes['pistol'].enabled = false
|
||||
force.recipes['spidertron-remote'].enabled = false
|
||||
if is_mod_loaded('Krastorio2') then
|
||||
force.recipes['kr-advanced-tank'].enabled = false
|
||||
end
|
||||
end
|
||||
|
||||
function Public.disable_tech()
|
||||
game.forces.player.technologies['landfill'].enabled = false
|
||||
game.forces.player.technologies['spidertron'].enabled = false
|
||||
game.forces.player.technologies['spidertron'].researched = false
|
||||
game.forces.player.technologies['atomic-bomb'].enabled = false
|
||||
game.forces.player.technologies['atomic-bomb'].researched = false
|
||||
game.forces.player.technologies['optics'].researched = true
|
||||
game.forces.player.technologies['railway'].researched = true
|
||||
game.forces.player.technologies['land-mine'].enabled = false
|
||||
disable_recipes()
|
||||
local force = game.forces.player
|
||||
force.technologies['landfill'].enabled = false
|
||||
force.technologies['spidertron'].enabled = false
|
||||
force.technologies['spidertron'].researched = false
|
||||
force.technologies['atomic-bomb'].enabled = false
|
||||
force.technologies['atomic-bomb'].researched = false
|
||||
force.technologies['optics'].researched = true
|
||||
force.technologies['railway'].researched = true
|
||||
force.technologies['land-mine'].enabled = false
|
||||
if is_mod_loaded('Krastorio2') then
|
||||
force.technologies['kr-nuclear-locomotive'].enabled = false
|
||||
force.technologies['kr-nuclear-locomotive'].researched = false
|
||||
force.technologies['kr-advanced-tank'].enabled = false
|
||||
force.technologies['kr-advanced-tank'].researched = false
|
||||
end
|
||||
disable_recipes(force)
|
||||
end
|
||||
|
||||
local disable_tech = Public.disable_tech
|
||||
@ -1321,9 +1361,16 @@ function Public.on_research_finished(event)
|
||||
end
|
||||
end
|
||||
|
||||
-- if is_mod_loaded('Krastorio2') then
|
||||
-- Public.firearm_magazine_ammo = {name = 'rifle-magazine', count = 200}
|
||||
-- Public.piercing_rounds_magazine_ammo = {name = 'armor-piercing-rifle-magazine', count = 200}
|
||||
-- Public.uranium_rounds_magazine_ammo = {name = 'uranium-rifle-magazine', count = 200}
|
||||
-- else
|
||||
Public.firearm_magazine_ammo = {name = 'firearm-magazine', count = 200}
|
||||
Public.piercing_rounds_magazine_ammo = {name = 'piercing-rounds-magazine', count = 200}
|
||||
Public.uranium_rounds_magazine_ammo = {name = 'uranium-rounds-magazine', count = 200}
|
||||
-- end
|
||||
|
||||
Public.light_oil_ammo = {name = 'light-oil', amount = 100}
|
||||
Public.artillery_shell_ammo = {name = 'artillery-shell', count = 15}
|
||||
Public.laser_turrent_power_source = {buffer_size = 2400000, power_production = 40000}
|
||||
|
@ -327,6 +327,9 @@ local function do_place_entities(data)
|
||||
if entity and e.force then
|
||||
entity.force = e.force
|
||||
end
|
||||
if entity and e.amount then
|
||||
entity.amount = e.amount
|
||||
end
|
||||
if entity and e.callback then
|
||||
local c = e.callback.callback
|
||||
if not c then
|
||||
@ -351,6 +354,9 @@ local function do_place_entities(data)
|
||||
if entity and e.force then
|
||||
entity.force = e.force
|
||||
end
|
||||
if entity and e.amount then
|
||||
entity.amount = e.amount
|
||||
end
|
||||
if entity and e.callback then
|
||||
local c = e.callback.callback
|
||||
if not c then
|
||||
|
@ -287,7 +287,7 @@ local function get_total_biter_killcount(force)
|
||||
return count
|
||||
end
|
||||
|
||||
local function write_additional_stats(key)
|
||||
local function write_additional_stats(key, difficulty)
|
||||
local player = game.forces.player
|
||||
local new_breached_zone = WPT.get('breached_wall')
|
||||
local new_wave_number = WD.get('wave_number')
|
||||
@ -329,6 +329,10 @@ local function write_additional_stats(key)
|
||||
t.total_time = old_total_time
|
||||
end
|
||||
|
||||
if difficulty then
|
||||
t.difficulty = difficulty
|
||||
end
|
||||
|
||||
local new_stats = get_mvps()
|
||||
if new_stats then
|
||||
t.players = new_stats
|
||||
@ -361,16 +365,22 @@ function Public.get_scores()
|
||||
if not secs then
|
||||
return
|
||||
else
|
||||
if is_game_modded() then
|
||||
score_key = 'mountain_fortress_v3_scores_modded'
|
||||
end
|
||||
try_get_data(score_dataset, score_key, get_scores)
|
||||
end
|
||||
end
|
||||
|
||||
function Public.set_scores()
|
||||
function Public.set_scores(difficulty)
|
||||
local secs = Server.get_current_time()
|
||||
if not secs then
|
||||
return
|
||||
else
|
||||
write_additional_stats(score_key)
|
||||
if is_game_modded() then
|
||||
score_key = 'mountain_fortress_v3_scores_modded'
|
||||
end
|
||||
write_additional_stats(score_key, difficulty)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -51,10 +51,17 @@ local function render_owner_text(renders, player, entity, new_owner)
|
||||
if renders[player.index] then
|
||||
rendering.destroy(renders[player.index])
|
||||
end
|
||||
|
||||
local ce_name = entity.name
|
||||
|
||||
if ce_name == 'kr-advanced-tank' then
|
||||
ce_name = 'Tank'
|
||||
end
|
||||
|
||||
if new_owner then
|
||||
renders[new_owner.index] =
|
||||
rendering.draw_text {
|
||||
text = '## - ' .. new_owner.name .. "'s " .. entity.name .. ' - ##',
|
||||
text = '## - ' .. new_owner.name .. "'s " .. ce_name .. ' - ##',
|
||||
surface = entity.surface,
|
||||
target = entity,
|
||||
target_offset = {0, -2.6},
|
||||
@ -67,7 +74,7 @@ local function render_owner_text(renders, player, entity, new_owner)
|
||||
else
|
||||
renders[player.index] =
|
||||
rendering.draw_text {
|
||||
text = '## - ' .. player.name .. "'s " .. entity.name .. ' - ##',
|
||||
text = '## - ' .. player.name .. "'s " .. ce_name .. ' - ##',
|
||||
surface = entity.surface,
|
||||
target = entity,
|
||||
target_offset = {0, -2.6},
|
||||
@ -699,9 +706,14 @@ function Public.create_car_room(ic, car)
|
||||
local surface = car.surface
|
||||
local car_areas = ic.car_areas
|
||||
local entity_name = car.name
|
||||
local entity_type = car.type
|
||||
local area = car_areas[entity_name]
|
||||
local tiles = {}
|
||||
|
||||
if not area then
|
||||
area = car_areas[entity_type]
|
||||
end
|
||||
|
||||
for x = area.left_top.x, area.right_bottom.x - 1, 1 do
|
||||
for y = area.left_top.y + 2, area.right_bottom.y - 3, 1 do
|
||||
tiles[#tiles + 1] = {name = main_tile_name, position = {x, y}}
|
||||
@ -810,6 +822,9 @@ function Public.create_car(ic, event)
|
||||
|
||||
local car_areas = ic.car_areas
|
||||
local car_area = car_areas[ce.name]
|
||||
if not car_area then
|
||||
car_area = car_areas[ce.type]
|
||||
end
|
||||
|
||||
ic.cars[un] = {
|
||||
entity = ce,
|
||||
@ -819,7 +834,8 @@ function Public.create_car(ic, event)
|
||||
},
|
||||
doors = {},
|
||||
owner = player.index,
|
||||
name = ce.name
|
||||
name = ce.name,
|
||||
type = ce.type
|
||||
}
|
||||
|
||||
local car = ic.cars[un]
|
||||
|
@ -15,9 +15,10 @@ local function on_entity_died(event)
|
||||
return
|
||||
end
|
||||
|
||||
local ic = IC.get()
|
||||
local valid_types = IC.get_types()
|
||||
|
||||
if entity.type == 'car' or entity.name == 'spidertron' then
|
||||
if (valid_types[entity.type] or valid_types[entity.name]) then
|
||||
local ic = IC.get()
|
||||
Functions.kill_car(ic, entity)
|
||||
end
|
||||
end
|
||||
@ -28,9 +29,10 @@ local function on_player_mined_entity(event)
|
||||
return
|
||||
end
|
||||
|
||||
local ic = IC.get()
|
||||
local valid_types = IC.get_types()
|
||||
|
||||
if entity.type == 'car' or entity.name == 'spidertron' then
|
||||
if (valid_types[entity.type] or valid_types[entity.name]) then
|
||||
local ic = IC.get()
|
||||
Minimap.kill_minimap(game.players[event.player_index])
|
||||
Functions.save_car(ic, event)
|
||||
end
|
||||
@ -42,9 +44,11 @@ local function on_robot_mined_entity(event)
|
||||
if not entity and not entity.valid then
|
||||
return
|
||||
end
|
||||
local ic = IC.get()
|
||||
|
||||
if entity.type == 'car' or entity.name == 'spidertron' then
|
||||
local valid_types = IC.get_types()
|
||||
|
||||
if (valid_types[entity.type] or valid_types[entity.name]) then
|
||||
local ic = IC.get()
|
||||
Functions.kill_car(ic, entity)
|
||||
end
|
||||
end
|
||||
@ -55,7 +59,10 @@ local function on_built_entity(event)
|
||||
if not ce or not ce.valid then
|
||||
return
|
||||
end
|
||||
if (ce.type == 'car' or ce.name == 'spidertron') ~= true then
|
||||
|
||||
local valid_types = IC.get_types()
|
||||
|
||||
if (valid_types[ce.type] or valid_types[ce.name]) ~= true then
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -41,12 +41,14 @@ function Public.reset()
|
||||
this.entity_type = {
|
||||
['car'] = true,
|
||||
['tank'] = true,
|
||||
['kr-advanced-tank'] = true,
|
||||
['spidertron'] = true,
|
||||
['spider-vehicle'] = true
|
||||
}
|
||||
this.car_areas = {
|
||||
['car'] = {left_top = {x = -20, y = 0}, right_bottom = {x = 20, y = 20}},
|
||||
['tank'] = {left_top = {x = -30, y = 0}, right_bottom = {x = 30, y = 40}},
|
||||
['kr-advanced-tank'] = {left_top = {x = -40, y = 0}, right_bottom = {x = 40, y = 60}},
|
||||
['spidertron'] = {left_top = {x = -40, y = 0}, right_bottom = {x = 40, y = 60}},
|
||||
['spider-vehicle'] = {left_top = {x = -40, y = 0}, right_bottom = {x = 40, y = 60}}
|
||||
}
|
||||
@ -60,6 +62,10 @@ function Public.get(key)
|
||||
end
|
||||
end
|
||||
|
||||
function Public.get_types()
|
||||
return this.entity_type
|
||||
end
|
||||
|
||||
function Public.set(key, value)
|
||||
if key and (value or value == false) then
|
||||
this[key] = value
|
||||
|
@ -5,7 +5,6 @@ local WPT = require 'maps.mountain_fortress_v3.table'
|
||||
local Task = require 'utils.task'
|
||||
local Token = require 'utils.token'
|
||||
local SpamProtection = require 'utils.spam_protection'
|
||||
local main_tile_name = 'tutorial-grid'
|
||||
|
||||
local reconstruct_all_trains =
|
||||
Token.register(
|
||||
@ -15,6 +14,17 @@ local reconstruct_all_trains =
|
||||
end
|
||||
)
|
||||
|
||||
local function get_tile_name()
|
||||
local main_tile_name = 'tutorial-grid'
|
||||
local modded = is_game_modded()
|
||||
if modded then
|
||||
if game.active_mods['Krastorio2'] then
|
||||
main_tile_name = 'kr-black-reinforced-plate'
|
||||
end
|
||||
end
|
||||
return main_tile_name
|
||||
end
|
||||
|
||||
function Public.request_reconstruction(icw)
|
||||
Task.set_timeout_in_ticks(60, reconstruct_all_trains, {icw = icw})
|
||||
end
|
||||
@ -283,6 +293,7 @@ end
|
||||
local function construct_wagon_doors(icw, wagon)
|
||||
local area = wagon.area
|
||||
local surface = wagon.surface
|
||||
local main_tile_name = get_tile_name()
|
||||
|
||||
for _, x in pairs({area.left_top.x - 1.5, area.right_bottom.x + 1.5}) do
|
||||
local p = {x = x, y = area.left_top.y + ((area.right_bottom.y - area.left_top.y) * 0.5)}
|
||||
@ -405,6 +416,7 @@ end
|
||||
function Public.create_wagon_room(icw, wagon)
|
||||
local surface = wagon.surface
|
||||
local area = wagon.area
|
||||
local main_tile_name = get_tile_name()
|
||||
|
||||
local tiles = {}
|
||||
for x = -3, 2, 1 do
|
||||
|
@ -35,12 +35,21 @@ function Public.reset()
|
||||
['locomotive'] = true
|
||||
}
|
||||
|
||||
this.wagon_areas = {
|
||||
['cargo-wagon'] = {left_top = {x = -30, y = 0}, right_bottom = {x = 30, y = 80}},
|
||||
['artillery-wagon'] = {left_top = {x = -30, y = 0}, right_bottom = {x = 30, y = 80}},
|
||||
['fluid-wagon'] = {left_top = {x = -30, y = 0}, right_bottom = {x = 30, y = 80}},
|
||||
['locomotive'] = {left_top = {x = -30, y = 0}, right_bottom = {x = 30, y = 80}}
|
||||
}
|
||||
if is_game_modded() then
|
||||
this.wagon_areas = {
|
||||
['cargo-wagon'] = {left_top = {x = -45, y = 0}, right_bottom = {x = 45, y = 100}},
|
||||
['artillery-wagon'] = {left_top = {x = -45, y = 0}, right_bottom = {x = 45, y = 100}},
|
||||
['fluid-wagon'] = {left_top = {x = -45, y = 0}, right_bottom = {x = 45, y = 100}},
|
||||
['locomotive'] = {left_top = {x = -45, y = 0}, right_bottom = {x = 45, y = 100}}
|
||||
}
|
||||
else
|
||||
this.wagon_areas = {
|
||||
['cargo-wagon'] = {left_top = {x = -30, y = 0}, right_bottom = {x = 30, y = 80}},
|
||||
['artillery-wagon'] = {left_top = {x = -30, y = 0}, right_bottom = {x = 30, y = 80}},
|
||||
['fluid-wagon'] = {left_top = {x = -30, y = 0}, right_bottom = {x = 30, y = 80}},
|
||||
['locomotive'] = {left_top = {x = -30, y = 0}, right_bottom = {x = 30, y = 80}}
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
function Public.get(key)
|
||||
|
@ -452,10 +452,15 @@ local function set_locomotive_health()
|
||||
if not (entity and entity.valid) then
|
||||
return
|
||||
end
|
||||
local cargo_health = 600
|
||||
local modded = is_game_modded()
|
||||
if modded then
|
||||
cargo_health = 750
|
||||
end
|
||||
if entity.type == 'locomotive' then
|
||||
entity.health = 1000 * m
|
||||
else
|
||||
entity.health = 600 * m
|
||||
entity.health = cargo_health * m
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -1067,10 +1072,15 @@ local function gui_click(event)
|
||||
if not (entity and entity.valid) then
|
||||
return
|
||||
end
|
||||
local cargo_health = 600
|
||||
local modded = is_game_modded()
|
||||
if modded then
|
||||
cargo_health = 750
|
||||
end
|
||||
if entity.type == 'locomotive' then
|
||||
entity.health = 1000 * m
|
||||
else
|
||||
entity.health = 600 * m
|
||||
entity.health = cargo_health * m
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -1327,10 +1337,16 @@ local function spawn_biter()
|
||||
'big-spitter',
|
||||
'behemoth-spitter'
|
||||
}
|
||||
if is_mod_loaded('bobenemies') then
|
||||
biters = {'bob-leviathan-biter', 'bob-behemoth-biter', 'bob-huge-explosive-spitter'}
|
||||
end
|
||||
|
||||
local size_of = #biters
|
||||
|
||||
if not position then
|
||||
return
|
||||
end
|
||||
this.locomotive_biter = loco_surface.create_entity({name = biters[random(1, 4)], position = position, force = 'player', create_build_effect_smoke = false})
|
||||
this.locomotive_biter = loco_surface.create_entity({name = biters[random(1, size_of)], position = position, force = 'player', create_build_effect_smoke = false})
|
||||
this.locomotive_biter.ai_settings.allow_destroy_when_commands_fail = false
|
||||
this.locomotive_biter.ai_settings.allow_try_return_to_spawner = false
|
||||
|
||||
@ -1689,7 +1705,7 @@ local function shoo(event)
|
||||
message = string.lower(message)
|
||||
for word in string.gmatch(message, '%g+') do
|
||||
if word == 'shoo' then
|
||||
if not locomotive_biter then
|
||||
if not locomotive_biter or not locomotive_biter.valid then
|
||||
spawn_biter()
|
||||
return
|
||||
end
|
||||
@ -2144,34 +2160,67 @@ function Public.get_items()
|
||||
}
|
||||
|
||||
if game.forces.player.technologies['logistics'].researched then
|
||||
main_market_items['loader'] = {
|
||||
stack = 1,
|
||||
value = 'coin',
|
||||
price = 128,
|
||||
tooltip = ({'entity-name.loader'}),
|
||||
upgrade = false,
|
||||
static = true
|
||||
}
|
||||
if is_mod_loaded('Krastorio2') then
|
||||
main_market_items['kr-loader'] = {
|
||||
stack = 1,
|
||||
value = 'coin',
|
||||
price = 128,
|
||||
tooltip = ({'entity-name.kr-loader'}),
|
||||
upgrade = false,
|
||||
static = true
|
||||
}
|
||||
else
|
||||
main_market_items['loader'] = {
|
||||
stack = 1,
|
||||
value = 'coin',
|
||||
price = 128,
|
||||
tooltip = ({'entity-name.loader'}),
|
||||
upgrade = false,
|
||||
static = true
|
||||
}
|
||||
end
|
||||
end
|
||||
if game.forces.player.technologies['logistics-2'].researched then
|
||||
main_market_items['fast-loader'] = {
|
||||
stack = 1,
|
||||
value = 'coin',
|
||||
price = 256,
|
||||
tooltip = ({'entity-name.fast-loader'}),
|
||||
upgrade = false,
|
||||
static = true
|
||||
}
|
||||
if is_mod_loaded('Krastorio2') then
|
||||
main_market_items['kr-fast-loader'] = {
|
||||
stack = 1,
|
||||
value = 'coin',
|
||||
price = 256,
|
||||
tooltip = ({'entity-name.kr-fast-loader'}),
|
||||
upgrade = false,
|
||||
static = true
|
||||
}
|
||||
else
|
||||
main_market_items['fast-loader'] = {
|
||||
stack = 1,
|
||||
value = 'coin',
|
||||
price = 256,
|
||||
tooltip = ({'entity-name.fast-loader'}),
|
||||
upgrade = false,
|
||||
static = true
|
||||
}
|
||||
end
|
||||
end
|
||||
if game.forces.player.technologies['logistics-3'].researched then
|
||||
main_market_items['express-loader'] = {
|
||||
stack = 1,
|
||||
value = 'coin',
|
||||
price = 512,
|
||||
tooltip = ({'entity-name.express-loader'}),
|
||||
upgrade = false,
|
||||
static = true
|
||||
}
|
||||
if is_mod_loaded('Krastorio2') then
|
||||
main_market_items['kr-express-loader'] = {
|
||||
stack = 1,
|
||||
value = 'coin',
|
||||
price = 512,
|
||||
tooltip = ({'entity-name.kr-express-loader'}),
|
||||
upgrade = false,
|
||||
static = true
|
||||
}
|
||||
else
|
||||
main_market_items['express-loader'] = {
|
||||
stack = 1,
|
||||
value = 'coin',
|
||||
price = 512,
|
||||
tooltip = ({'entity-name.express-loader'}),
|
||||
upgrade = false,
|
||||
static = true
|
||||
}
|
||||
end
|
||||
end
|
||||
main_market_items['small-lamp'] = {
|
||||
stack = 1,
|
||||
@ -2229,6 +2278,26 @@ function Public.get_items()
|
||||
upgrade = false,
|
||||
static = false
|
||||
}
|
||||
if is_mod_loaded('Factorio-Tiberium') then
|
||||
main_market_items['tiberium-ore'] = {
|
||||
stack = 25,
|
||||
value = 'coin',
|
||||
price = 15,
|
||||
tooltip = ({'item-name.tiberium-ore'}),
|
||||
upgrade = false,
|
||||
static = false
|
||||
}
|
||||
end
|
||||
if is_mod_loaded('Krastorio2') then
|
||||
main_market_items['first-aid-kit'] = {
|
||||
stack = 1,
|
||||
value = 'coin',
|
||||
price = 20,
|
||||
tooltip = ({'item-name.first-aid-kit'}),
|
||||
upgrade = false,
|
||||
static = false
|
||||
}
|
||||
end
|
||||
main_market_items['land-mine'] = {
|
||||
stack = 1,
|
||||
value = 'coin',
|
||||
@ -2277,6 +2346,16 @@ function Public.get_items()
|
||||
upgrade = false,
|
||||
static = true
|
||||
}
|
||||
if is_mod_loaded('Krastorio2') then
|
||||
main_market_items['kr-advanced-tank'] = {
|
||||
stack = 1,
|
||||
value = 'coin',
|
||||
price = 20000,
|
||||
tooltip = ({'main_market.tank'}),
|
||||
upgrade = false,
|
||||
static = true
|
||||
}
|
||||
end
|
||||
local wave_number = WD.get_wave()
|
||||
|
||||
if wave_number >= 650 then
|
||||
|
@ -152,6 +152,10 @@ function Public.reset_map()
|
||||
game.forces.player.manual_mining_speed_modifier = 0
|
||||
|
||||
BiterHealthBooster.set_active_surface(tostring(surface.name))
|
||||
BiterHealthBooster.acid_nova(true)
|
||||
BiterHealthBooster.check_on_entity_died(true)
|
||||
BiterHealthBooster.boss_spawns_projectiles(true)
|
||||
BiterHealthBooster.enable_boss_loot(false)
|
||||
|
||||
Balance.init_enemy_weapon_damage()
|
||||
|
||||
@ -213,7 +217,7 @@ function Public.reset_map()
|
||||
WD.check_collapse_position(true)
|
||||
WD.set_disable_threat_below_zero(true)
|
||||
WD.increase_boss_health_per_wave(true)
|
||||
WD.increase_damage_per_wave(false)
|
||||
WD.increase_damage_per_wave(true)
|
||||
WD.increase_health_per_wave(true)
|
||||
|
||||
Functions.set_difficulty()
|
||||
@ -231,6 +235,10 @@ function Public.reset_map()
|
||||
|
||||
HS.get_scores()
|
||||
|
||||
if is_game_modded() then
|
||||
game.difficulty_settings.technology_price_multiplier = 0.5
|
||||
end
|
||||
|
||||
this.chunk_load_tick = game.tick + 1200
|
||||
this.market_announce = game.tick + 1200
|
||||
this.game_lost = false
|
||||
@ -283,15 +291,18 @@ local has_the_game_ended = function()
|
||||
game.print(({'main.reset_in', cause_msg, this.game_reset_tick / 60}), {r = 0.22, g = 0.88, b = 0.22})
|
||||
end
|
||||
|
||||
local diff_name = Difficulty.get('name')
|
||||
|
||||
if this.soft_reset and this.game_reset_tick == 0 then
|
||||
this.game_reset_tick = nil
|
||||
HS.set_scores()
|
||||
HS.set_scores(diff_name)
|
||||
Public.reset_map()
|
||||
return
|
||||
end
|
||||
|
||||
if this.restart and this.game_reset_tick == 0 then
|
||||
if not this.announced_message then
|
||||
HS.set_scores()
|
||||
HS.set_scores(diff_name)
|
||||
game.print(({'entity.notify_restart'}), {r = 0.22, g = 0.88, b = 0.22})
|
||||
local message = 'Soft-reset is disabled! Server will restart from scenario to load new changes.'
|
||||
Server.to_discord_bold(table.concat {'*** ', message, ' ***'})
|
||||
@ -302,7 +313,7 @@ local has_the_game_ended = function()
|
||||
end
|
||||
if this.shutdown and this.game_reset_tick == 0 then
|
||||
if not this.announced_message then
|
||||
HS.set_scores()
|
||||
HS.set_scores(diff_name)
|
||||
game.print(({'entity.notify_shutdown'}), {r = 0.22, g = 0.88, b = 0.22})
|
||||
local message = 'Soft-reset is disabled! Server will shutdown. Most likely because of updates.'
|
||||
Server.to_discord_bold(table.concat {'*** ', message, ' ***'})
|
||||
@ -435,11 +446,23 @@ local on_init = function()
|
||||
local this = WPT.get()
|
||||
Public.reset_map()
|
||||
|
||||
local tooltip = {
|
||||
[1] = ({'main.diff_tooltip', '0', '0.5', '0.2', '0.4', '1', '12', '50', '10000', '100%', '15', '14'}),
|
||||
[2] = ({'main.diff_tooltip', '0', '0.25', '0.1', '0.1', '1', '10', '50', '7000', '75%', '10', '16'}),
|
||||
[3] = ({'main.diff_tooltip', '0', '0', '0', '0', '1', '3', '10', '5000', '50%', '10', '18'})
|
||||
}
|
||||
game.map_settings.path_finder.general_entity_collision_penalty = 1 -- Recommended value
|
||||
game.map_settings.path_finder.general_entity_subsequent_collision_penalty = 1 -- Recommended value
|
||||
|
||||
local tooltip
|
||||
if is_game_modded() then
|
||||
tooltip = {
|
||||
[1] = ({'main.diff_tooltip', '0', '0.5', '0.15', '0.15', '1', '12', '50', '20000', '100%', '15', '10'}),
|
||||
[2] = ({'main.diff_tooltip', '0', '0.25', '0.1', '0.1', '2', '10', '50', '12000', '75%', '8', '8'}),
|
||||
[3] = ({'main.diff_tooltip', '0', '0', '0', '0', '4', '3', '10', '8000', '50%', '5', '6'})
|
||||
}
|
||||
else
|
||||
tooltip = {
|
||||
[1] = ({'main.diff_tooltip', '0', '0.5', '0.15', '0.15', '1', '12', '50', '10000', '100%', '15', '10'}),
|
||||
[2] = ({'main.diff_tooltip', '0', '0.25', '0.1', '0.1', '2', '10', '50', '7000', '75%', '8', '8'}),
|
||||
[3] = ({'main.diff_tooltip', '0', '0', '0', '0', '4', '3', '10', '5000', '50%', '5', '6'})
|
||||
}
|
||||
end
|
||||
|
||||
Difficulty.set_tooltip(tooltip)
|
||||
|
||||
|
@ -139,9 +139,14 @@ local valid_scrap = {
|
||||
['crash-site-spaceship-wreck-small-3'] = true,
|
||||
['crash-site-spaceship-wreck-small-4'] = true,
|
||||
['crash-site-spaceship-wreck-small-5'] = true,
|
||||
['crash-site-spaceship-wreck-small-6'] = true
|
||||
['crash-site-spaceship-wreck-small-6'] = true,
|
||||
['mineable-wreckages'] = true
|
||||
}
|
||||
|
||||
if is_mod_loaded('MineableWreckage') then
|
||||
valid_scrap['mineable-wreckages'] = true
|
||||
end
|
||||
|
||||
local reward_wood = {
|
||||
['dead-tree-desert'] = true,
|
||||
['dead-dry-hairy-tree'] = true,
|
||||
@ -165,6 +170,10 @@ local particles = {
|
||||
['stone'] = 'stone-particle'
|
||||
}
|
||||
|
||||
if is_mod_loaded('Factorio-Tiberium') then
|
||||
particles['tiberium-ore'] = 'blood-particle'
|
||||
end
|
||||
|
||||
local function create_particles(surface, name, position, amount, cause_position)
|
||||
local d1 = (-100 + random(0, 200)) * 0.0004
|
||||
local d2 = (-100 + random(0, 200)) * 0.0004
|
||||
@ -204,6 +213,13 @@ local function mining_chances_ores()
|
||||
{name = 'stone', chance = 13},
|
||||
{name = 'uranium-ore', chance = 2}
|
||||
}
|
||||
if is_mod_loaded('Factorio-Tiberium') then
|
||||
data[#data + 1] = {name = 'tiberium-ore', chance = 5}
|
||||
end
|
||||
if is_mod_loaded('Krastorio2') then
|
||||
data[#data + 1] = {name = 'raw-rare-metals', chance = 5}
|
||||
end
|
||||
|
||||
return data
|
||||
end
|
||||
|
||||
|
@ -48,6 +48,35 @@ function Public.create_surface()
|
||||
['tile:deep-water:probability'] = -10000
|
||||
}
|
||||
}
|
||||
local modded = is_game_modded()
|
||||
if modded then
|
||||
map_gen_settings.autoplace_controls = {}
|
||||
if game.active_mods['Krastorio2'] then
|
||||
map_gen_settings.autoplace_controls.imersite = {
|
||||
frequency = 1,
|
||||
richness = 1,
|
||||
size = 1
|
||||
}
|
||||
map_gen_settings.autoplace_controls['mineral-water'] = {
|
||||
frequency = 1,
|
||||
richness = 1,
|
||||
size = 1
|
||||
}
|
||||
map_gen_settings.autoplace_controls['rare-metals'] = {
|
||||
frequency = 1,
|
||||
richness = 1,
|
||||
size = 1
|
||||
}
|
||||
end
|
||||
if game.active_mods['Factorio-Tiberium'] then
|
||||
map_gen_settings.autoplace_controls.tibGrowthNode = {
|
||||
frequency = 1,
|
||||
richness = 1,
|
||||
size = 1
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
local mine = {}
|
||||
mine['control-setting:moisture:bias'] = 0.33
|
||||
mine['control-setting:moisture:frequency:multiplier'] = 1
|
||||
|
@ -189,7 +189,7 @@ function Public.reset_table()
|
||||
compare_next = 200,
|
||||
distance_from = 2
|
||||
}
|
||||
this.spidertron_unlocked_at_wave = 11
|
||||
this.spidertron_unlocked_at_zone = 11
|
||||
-- this.void_or_tile = 'lab-dark-2'
|
||||
this.void_or_tile = 'out-of-map'
|
||||
this.validate_spider = {}
|
||||
|
@ -48,22 +48,6 @@ local tree_raffle = {
|
||||
}
|
||||
local size_of_tree_raffle = #tree_raffle
|
||||
|
||||
local scrap_mineable_entities = {
|
||||
'crash-site-spaceship-wreck-small-1',
|
||||
'crash-site-spaceship-wreck-small-1',
|
||||
'crash-site-spaceship-wreck-small-2',
|
||||
'crash-site-spaceship-wreck-small-2',
|
||||
'crash-site-spaceship-wreck-small-3',
|
||||
'crash-site-spaceship-wreck-small-3',
|
||||
'crash-site-spaceship-wreck-small-4',
|
||||
'crash-site-spaceship-wreck-small-4',
|
||||
'crash-site-spaceship-wreck-small-5',
|
||||
'crash-site-spaceship-wreck-small-5',
|
||||
'crash-site-spaceship-wreck-small-6'
|
||||
}
|
||||
|
||||
local scrap_mineable_entities_index = #scrap_mineable_entities
|
||||
|
||||
local scrap_entities = {
|
||||
'medium-ship-wreck',
|
||||
'small-ship-wreck',
|
||||
@ -129,6 +113,49 @@ local turret_list = {
|
||||
[6] = {name = 'artillery-turret', callback = callback[6]}
|
||||
}
|
||||
|
||||
local function get_scrap_mineable_entities()
|
||||
local scrap_mineable_entities = {
|
||||
'crash-site-spaceship-wreck-small-1',
|
||||
'crash-site-spaceship-wreck-small-1',
|
||||
'crash-site-spaceship-wreck-small-2',
|
||||
'crash-site-spaceship-wreck-small-2',
|
||||
'crash-site-spaceship-wreck-small-3',
|
||||
'crash-site-spaceship-wreck-small-3',
|
||||
'crash-site-spaceship-wreck-small-4',
|
||||
'crash-site-spaceship-wreck-small-4',
|
||||
'crash-site-spaceship-wreck-small-5',
|
||||
'crash-site-spaceship-wreck-small-5',
|
||||
'crash-site-spaceship-wreck-small-6'
|
||||
}
|
||||
|
||||
local modded = is_game_modded()
|
||||
if modded then
|
||||
if game.active_mods['MineableWreckage'] then
|
||||
scrap_mineable_entities = {'mineable-wreckages'}
|
||||
end
|
||||
end
|
||||
|
||||
local scrap_mineable_entities_index = #scrap_mineable_entities
|
||||
|
||||
return scrap_mineable_entities, scrap_mineable_entities_index
|
||||
end
|
||||
|
||||
local function get_tiberium_trees(entities, p)
|
||||
if is_mod_loaded('Factorio-Tiberium') then
|
||||
if random(1, 512) == 1 then
|
||||
entities[#entities + 1] = {name = 'tibGrowthNode', position = p, amount = 15000}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function get_imersite_ores(entities, p)
|
||||
if is_mod_loaded('Krastorio2') then
|
||||
if random(1, 2048) == 1 then
|
||||
entities[#entities + 1] = {name = 'imersite', position = p, amount = random(300000, 600000)}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function is_position_near(area, table_to_check)
|
||||
local status = false
|
||||
local function inside(pos)
|
||||
@ -339,6 +366,8 @@ local function wall(data)
|
||||
end
|
||||
end
|
||||
|
||||
get_tiberium_trees(entities, p)
|
||||
|
||||
if random(1, 40) == 1 then
|
||||
if
|
||||
surface.can_place_entity(
|
||||
@ -415,6 +444,8 @@ local function process_level_14_position(x, y, data)
|
||||
if random(1, 32) == 1 then
|
||||
Generate_resources(buildings, p, Public.level_depth)
|
||||
end
|
||||
get_tiberium_trees(entities, p)
|
||||
get_imersite_ores(entities, p)
|
||||
end
|
||||
|
||||
if small_caves > -0.21 and small_caves < 0.21 then
|
||||
@ -490,6 +521,8 @@ local function process_level_13_position(x, y, data)
|
||||
if random(1, 32) == 1 then
|
||||
Generate_resources(buildings, p, Public.level_depth)
|
||||
end
|
||||
get_tiberium_trees(entities, p)
|
||||
get_imersite_ores(entities, p)
|
||||
end
|
||||
|
||||
if small_caves > -0.22 and small_caves < 0.22 then
|
||||
@ -566,6 +599,8 @@ local function process_level_12_position(x, y, data, void_or_lab)
|
||||
if random(1, 32) == 1 then
|
||||
Generate_resources(buildings, p, Public.level_depth)
|
||||
end
|
||||
get_tiberium_trees(entities, p)
|
||||
get_imersite_ores(entities, p)
|
||||
end
|
||||
|
||||
if noise_1 > 0.65 then
|
||||
@ -660,6 +695,8 @@ local function process_level_11_position(x, y, data)
|
||||
if random(1, 32) == 1 then
|
||||
Generate_resources(buildings, p, Public.level_depth)
|
||||
end
|
||||
get_tiberium_trees(entities, p)
|
||||
get_imersite_ores(entities, p)
|
||||
end
|
||||
|
||||
if noise_1 < -0.72 then
|
||||
@ -758,6 +795,8 @@ local function process_level_10_position(x, y, data)
|
||||
if random(1, 32) == 1 then
|
||||
Generate_resources(buildings, p, Public.level_depth)
|
||||
end
|
||||
get_tiberium_trees(entities, p)
|
||||
get_imersite_ores(entities, p)
|
||||
end
|
||||
|
||||
if abs(scrapyard) > 0.40 and abs(scrapyard) < 0.65 then
|
||||
@ -883,6 +922,8 @@ local function process_level_9_position(x, y, data)
|
||||
if random(1, 32) == 1 then
|
||||
Generate_resources(buildings, p, Public.level_depth)
|
||||
end
|
||||
get_tiberium_trees(entities, p)
|
||||
get_imersite_ores(entities, p)
|
||||
end
|
||||
|
||||
if maze_noise < -0.5 or maze_noise > 0.5 then
|
||||
@ -963,6 +1004,9 @@ local function process_scrap_zone_1(x, y, data, void_or_lab)
|
||||
force = 'player'
|
||||
}
|
||||
end
|
||||
|
||||
local scrap_mineable_entities, scrap_mineable_entities_index = get_scrap_mineable_entities()
|
||||
|
||||
if random(1, 5) > 1 then
|
||||
entities[#entities + 1] = {name = scrap_mineable_entities[random(1, scrap_mineable_entities_index)], position = p, force = 'neutral'}
|
||||
end
|
||||
@ -988,6 +1032,8 @@ local function process_scrap_zone_1(x, y, data, void_or_lab)
|
||||
if random(1, 32) == 1 then
|
||||
Generate_resources(buildings, p, Public.level_depth)
|
||||
end
|
||||
get_tiberium_trees(entities, p)
|
||||
get_imersite_ores(entities, p)
|
||||
end
|
||||
|
||||
local large_caves = get_perlin('large_caves', p, seed)
|
||||
@ -1061,6 +1107,7 @@ local function process_level_7_position(x, y, data, void_or_lab)
|
||||
if random(1, 64) == 1 and no_rocks_2 > 0.7 then
|
||||
entities[#entities + 1] = {name = 'crude-oil', position = p, amount = get_oil_amount(p)}
|
||||
end
|
||||
get_imersite_ores(entities, p)
|
||||
if random(1, 2048) == 1 then
|
||||
treasure[#treasure + 1] = {position = p, chest = 'wooden-chest'}
|
||||
end
|
||||
@ -1116,6 +1163,7 @@ local function process_level_7_position(x, y, data, void_or_lab)
|
||||
if random(1, 32) == 1 then
|
||||
Generate_resources(buildings, p, Public.level_depth)
|
||||
end
|
||||
get_tiberium_trees(entities, p)
|
||||
end
|
||||
|
||||
tiles[#tiles + 1] = {name = 'dirt-7', position = p}
|
||||
@ -1177,6 +1225,7 @@ local function process_forest_zone_2(x, y, data, void_or_lab)
|
||||
force = 'enemy'
|
||||
}
|
||||
end
|
||||
get_imersite_ores(entities, p)
|
||||
return
|
||||
end
|
||||
local noise_forest_location = get_perlin('forest_location', p, seed)
|
||||
@ -1237,6 +1286,7 @@ local function process_forest_zone_2(x, y, data, void_or_lab)
|
||||
entities[#entities + 1] = {name = 'tree-02-red', position = p}
|
||||
end
|
||||
end
|
||||
get_tiberium_trees(entities, p)
|
||||
return
|
||||
end
|
||||
end
|
||||
@ -1304,6 +1354,7 @@ local function process_level_5_position(x, y, data, void_or_lab)
|
||||
force = 'enemy'
|
||||
}
|
||||
end
|
||||
get_imersite_ores(entities, p)
|
||||
return
|
||||
end
|
||||
|
||||
@ -1327,6 +1378,7 @@ local function process_level_5_position(x, y, data, void_or_lab)
|
||||
if random(1, 512) == 1 then
|
||||
treasure[#treasure + 1] = {position = p, chest = 'wooden-chest'}
|
||||
end
|
||||
get_tiberium_trees(entities, p)
|
||||
if random(1, 2) == 1 then
|
||||
entities[#entities + 1] = {name = rock_raffle[random(1, size_of_rock_raffle)], position = p}
|
||||
end
|
||||
@ -1432,6 +1484,7 @@ local function process_level_4_position(x, y, data, void_or_lab)
|
||||
force = 'enemy'
|
||||
}
|
||||
end
|
||||
get_imersite_ores(entities, p)
|
||||
return
|
||||
end
|
||||
|
||||
@ -1449,6 +1502,7 @@ local function process_level_4_position(x, y, data, void_or_lab)
|
||||
if random(1, 2048) == 1 then
|
||||
treasure[#treasure + 1] = {position = p, chest = 'wooden-chest'}
|
||||
end
|
||||
get_tiberium_trees(entities, p)
|
||||
tiles[#tiles + 1] = {name = 'dirt-7', position = p}
|
||||
if random(1, 100) > 30 then
|
||||
entities[#entities + 1] = {name = rock_raffle[random(1, size_of_rock_raffle)], position = p}
|
||||
@ -1576,6 +1630,7 @@ local function process_level_3_position(x, y, data, void_or_lab)
|
||||
force = 'enemy'
|
||||
}
|
||||
end
|
||||
get_imersite_ores(entities, p)
|
||||
if random(1, 256) == 1 then
|
||||
spawn_turret(entities, p, 3)
|
||||
end
|
||||
@ -1600,6 +1655,7 @@ local function process_level_3_position(x, y, data, void_or_lab)
|
||||
if random(1, 512) == 1 then
|
||||
treasure[#treasure + 1] = {position = p, chest = 'wooden-chest'}
|
||||
end
|
||||
get_tiberium_trees(entities, p)
|
||||
return
|
||||
end
|
||||
|
||||
@ -1716,6 +1772,7 @@ local function process_level_2_position(x, y, data, void_or_lab)
|
||||
force = 'enemy'
|
||||
}
|
||||
end
|
||||
get_imersite_ores(entities, p)
|
||||
if random(1, 256) == 1 then
|
||||
spawn_turret(entities, p, 2)
|
||||
end
|
||||
@ -1740,6 +1797,7 @@ local function process_level_2_position(x, y, data, void_or_lab)
|
||||
if random(1, 512) == 1 then
|
||||
treasure[#treasure + 1] = {position = p, chest = 'wooden-chest'}
|
||||
end
|
||||
get_tiberium_trees(entities, p)
|
||||
return
|
||||
end
|
||||
|
||||
@ -1859,6 +1917,8 @@ local function process_forest_zone_1(x, y, data, void_or_lab)
|
||||
}
|
||||
end
|
||||
|
||||
get_imersite_ores(entities, p)
|
||||
|
||||
if random(1, 1024) == 1 then
|
||||
treasure[#treasure + 1] = {position = p, chest = 'iron-chest'}
|
||||
end
|
||||
@ -1881,6 +1941,7 @@ local function process_forest_zone_1(x, y, data, void_or_lab)
|
||||
if random(1, 32) == 1 then
|
||||
entities[#entities + 1] = {name = 'tree-0' .. random(1, 9), position = p}
|
||||
end
|
||||
get_tiberium_trees(entities, p)
|
||||
if random(1, 512) == 1 then
|
||||
treasure[#treasure + 1] = {position = p, chest = 'iron-chest'}
|
||||
end
|
||||
@ -2037,6 +2098,8 @@ local function process_level_1_position(x, y, data, void_or_lab)
|
||||
}
|
||||
end
|
||||
|
||||
get_imersite_ores(entities, p)
|
||||
|
||||
if random(1, 1024) == 1 then
|
||||
treasure[#treasure + 1] = {position = p, chest = 'iron-chest'}
|
||||
end
|
||||
@ -2059,6 +2122,7 @@ local function process_level_1_position(x, y, data, void_or_lab)
|
||||
if random(1, 32) == 1 then
|
||||
entities[#entities + 1] = {name = 'tree-0' .. random(1, 9), position = p}
|
||||
end
|
||||
get_tiberium_trees(entities, p)
|
||||
if random(1, 512) == 1 then
|
||||
treasure[#treasure + 1] = {position = p, chest = 'iron-chest'}
|
||||
end
|
||||
@ -2219,6 +2283,9 @@ local function process_level_0_position(x, y, data, void_or_lab)
|
||||
if random(1, 32) == 1 then
|
||||
entities[#entities + 1] = {name = 'tree-0' .. random(1, 9), position = p}
|
||||
end
|
||||
|
||||
get_tiberium_trees(entities, p)
|
||||
|
||||
if random(1, 512) == 1 then
|
||||
treasure[#treasure + 1] = {position = p, chest = 'iron-chest'}
|
||||
end
|
||||
@ -2291,6 +2358,8 @@ local function border_chunk(data)
|
||||
if random(1, ceil(pos.y + pos.y) + 64) == 1 then
|
||||
entities[#entities + 1] = {name = trees[random(1, #trees)], position = pos}
|
||||
end
|
||||
local scrap_mineable_entities, scrap_mineable_entities_index = get_scrap_mineable_entities()
|
||||
|
||||
if not is_out_of_map(pos) then
|
||||
if random(1, ceil(pos.y + pos.y) + 32) == 1 then
|
||||
entities[#entities + 1] = {name = scrap_mineable_entities[random(1, scrap_mineable_entities_index)], position = pos, force = 'neutral'}
|
||||
@ -2429,13 +2498,18 @@ Event.add(
|
||||
|
||||
local winter_mode = WPT.get('winter_mode')
|
||||
if winter_mode then
|
||||
rendering.draw_sprite({sprite = "tile/lab-white", x_scale = 32, y_scale = 32, target = left_top, surface = surface, tint = {r = 0.6, g = 0.6, b = 0.6, a = 0.6}, render_layer = "ground"})
|
||||
rendering.draw_sprite(
|
||||
{sprite = 'tile/lab-white', x_scale = 32, y_scale = 32, target = left_top, surface = surface, tint = {r = 0.6, g = 0.6, b = 0.6, a = 0.6}, render_layer = 'ground'}
|
||||
)
|
||||
end
|
||||
|
||||
if left_top.y == -128 and left_top.x == -128 then
|
||||
local pl = WPT.get().locomotive.position
|
||||
for _, entity in pairs(surface.find_entities_filtered({area = {{pl.x - 5, pl.y - 6}, {pl.x + 5, pl.y + 10}}, type = 'simple-entity'})) do
|
||||
entity.destroy()
|
||||
local locomotive = WPT.get('locomotive')
|
||||
if locomotive and locomotive.valid then
|
||||
local position = locomotive.position
|
||||
for _, entity in pairs(surface.find_entities_filtered({area = {{position.x - 5, position.y - 6}, {position.x + 5, position.y + 10}}, type = 'simple-entity'})) do
|
||||
entity.destroy()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user