mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-03-17 20:58:13 +02:00
minor changes to mtn fortress
This commit is contained in:
parent
586ad177b0
commit
0a5f986640
@ -245,7 +245,7 @@ local function biters_chew_rocks_faster(event)
|
||||
return
|
||||
end --Enemy Force
|
||||
|
||||
event.entity.health = event.entity.health - event.final_damage_amount * 5
|
||||
event.entity.health = event.entity.health - event.final_damage_amount * 7
|
||||
end
|
||||
|
||||
local projectiles = {'grenade', 'explosive-rocket', 'grenade', 'explosive-rocket', 'explosive-cannon-projectile'}
|
||||
@ -535,9 +535,9 @@ local function on_entity_damaged(event)
|
||||
biters_chew_rocks_faster(event)
|
||||
local wave_number = WD.get_wave()
|
||||
local boss_wave_warning = WD.alert_boss_wave()
|
||||
local much_time = WPT.get('much_time')
|
||||
local munch_time = WPT.get('munch_time')
|
||||
|
||||
if much_time then
|
||||
if munch_time then
|
||||
if boss_wave_warning or wave_number >= 1500 then
|
||||
if math.random(0, 512) == 1 then
|
||||
boss_puncher(event)
|
||||
|
@ -372,6 +372,7 @@ Public.disable_destructible_callback =
|
||||
function(entity)
|
||||
if entity and entity.valid then
|
||||
entity.destructible = false
|
||||
entity.minable = false
|
||||
end
|
||||
end
|
||||
)
|
||||
|
@ -31,9 +31,14 @@ local function do_tile(y, x, data, shape)
|
||||
if type(tile) == 'table' then
|
||||
do_tile_inner(data.tiles, tile.tile, pos)
|
||||
|
||||
local hidden_tile = tile.hidden_tile
|
||||
if hidden_tile then
|
||||
data.hidden_tiles[#data.hidden_tiles + 1] = {tile = hidden_tile, position = pos}
|
||||
end
|
||||
|
||||
local entities = tile.entities
|
||||
if entities then
|
||||
for _, entity in pairs(entities) do
|
||||
for _, entity in ipairs(entities) do
|
||||
if not entity.position then
|
||||
entity.position = pos
|
||||
end
|
||||
@ -43,7 +48,7 @@ local function do_tile(y, x, data, shape)
|
||||
|
||||
local buildings = tile.buildings
|
||||
if buildings then
|
||||
for _, entity in pairs(buildings) do
|
||||
for _, entity in ipairs(buildings) do
|
||||
if not entity.position then
|
||||
entity.position = pos
|
||||
end
|
||||
@ -53,14 +58,14 @@ local function do_tile(y, x, data, shape)
|
||||
|
||||
local decoratives = tile.decoratives
|
||||
if decoratives then
|
||||
for _, decorative in pairs(decoratives) do
|
||||
for _, decorative in ipairs(decoratives) do
|
||||
data.decoratives[#data.decoratives + 1] = decorative
|
||||
end
|
||||
end
|
||||
|
||||
local markets = tile.markets
|
||||
if markets then
|
||||
for _, t in pairs(markets) do
|
||||
for _, t in ipairs(markets) do
|
||||
if not t.position then
|
||||
t.position = pos
|
||||
end
|
||||
@ -70,7 +75,7 @@ local function do_tile(y, x, data, shape)
|
||||
|
||||
local treasure = tile.treasure
|
||||
if treasure then
|
||||
for _, t in pairs(treasure) do
|
||||
for _, t in ipairs(treasure) do
|
||||
if not t.position then
|
||||
t.position = pos
|
||||
end
|
||||
@ -99,9 +104,14 @@ local function do_row(row, data, shape)
|
||||
if type(tile) == 'table' then
|
||||
do_tile_inner(tiles, tile.tile, pos)
|
||||
|
||||
local hidden_tile = tile.hidden_tile
|
||||
if hidden_tile then
|
||||
data.hidden_tiles[#data.hidden_tiles + 1] = {tile = hidden_tile, position = pos}
|
||||
end
|
||||
|
||||
local entities = tile.entities
|
||||
if entities then
|
||||
for _, entity in pairs(entities) do
|
||||
for _, entity in ipairs(entities) do
|
||||
if not entity.position then
|
||||
entity.position = pos
|
||||
end
|
||||
@ -111,7 +121,7 @@ local function do_row(row, data, shape)
|
||||
|
||||
local buildings = tile.buildings
|
||||
if buildings then
|
||||
for _, entity in pairs(buildings) do
|
||||
for _, entity in ipairs(buildings) do
|
||||
if not entity.position then
|
||||
entity.position = pos
|
||||
end
|
||||
@ -121,7 +131,7 @@ local function do_row(row, data, shape)
|
||||
|
||||
local decoratives = tile.decoratives
|
||||
if decoratives then
|
||||
for _, decorative in pairs(decoratives) do
|
||||
for _, decorative in ipairs(decoratives) do
|
||||
if not decorative.position then
|
||||
decorative.position = pos
|
||||
end
|
||||
@ -131,7 +141,7 @@ local function do_row(row, data, shape)
|
||||
|
||||
local markets = tile.markets
|
||||
if markets then
|
||||
for _, t in pairs(markets) do
|
||||
for _, t in ipairs(markets) do
|
||||
if not t.position then
|
||||
t.position = pos
|
||||
end
|
||||
@ -141,7 +151,7 @@ local function do_row(row, data, shape)
|
||||
|
||||
local treasure = tile.treasure
|
||||
if treasure then
|
||||
for _, t in pairs(treasure) do
|
||||
for _, t in ipairs(treasure) do
|
||||
if not t.position then
|
||||
t.position = pos
|
||||
end
|
||||
@ -163,7 +173,7 @@ local function do_place_treasure(data)
|
||||
end
|
||||
pcall(
|
||||
function()
|
||||
for _, e in pairs(data.treasure) do
|
||||
for _, e in ipairs(data.treasure) do
|
||||
if math.random(1, 6) == 1 then
|
||||
e.chest = 'iron-chest'
|
||||
end
|
||||
@ -199,9 +209,19 @@ local function do_place_markets(data)
|
||||
end
|
||||
|
||||
local function do_place_tiles(data)
|
||||
local surface = data.surface
|
||||
pcall(
|
||||
function()
|
||||
data.surface.set_tiles(data.tiles, true)
|
||||
surface.set_tiles(data.tiles, true)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
local function do_place_hidden_tiles(data)
|
||||
local surface = data.surface
|
||||
pcall(
|
||||
function()
|
||||
surface.set_tiles(data.hidden_tiles, true)
|
||||
end
|
||||
)
|
||||
end
|
||||
@ -228,7 +248,7 @@ local function do_place_buildings(data)
|
||||
local callback
|
||||
pcall(
|
||||
function()
|
||||
for _, e in pairs(data.buildings) do
|
||||
for _, e in ipairs(data.buildings) do
|
||||
if e.e_type then
|
||||
local p = e.position
|
||||
if
|
||||
@ -272,7 +292,7 @@ local function do_place_entities(data)
|
||||
local callback
|
||||
pcall(
|
||||
function()
|
||||
for _, e in pairs(data.entities) do
|
||||
for _, e in ipairs(data.entities) do
|
||||
if e.collision then
|
||||
if surface.can_place_entity(e) then
|
||||
entity = surface.create_entity(e)
|
||||
@ -388,26 +408,30 @@ local function map_gen_action(data)
|
||||
data.y = 33
|
||||
return true
|
||||
elseif state == 33 then
|
||||
do_place_entities(data)
|
||||
do_place_hidden_tiles(data)
|
||||
data.y = 34
|
||||
return true
|
||||
elseif state == 34 then
|
||||
do_place_buildings(data)
|
||||
do_place_entities(data)
|
||||
data.y = 35
|
||||
return true
|
||||
elseif state == 35 then
|
||||
do_place_markets(data)
|
||||
do_place_buildings(data)
|
||||
data.y = 36
|
||||
return true
|
||||
elseif state == 36 then
|
||||
do_place_treasure(data)
|
||||
do_place_markets(data)
|
||||
data.y = 37
|
||||
return true
|
||||
elseif state == 37 then
|
||||
do_place_decoratives(data)
|
||||
do_place_treasure(data)
|
||||
data.y = 38
|
||||
return true
|
||||
elseif state == 38 then
|
||||
do_place_decoratives(data)
|
||||
data.y = 39
|
||||
return true
|
||||
elseif state == 39 then
|
||||
run_chart_update(data)
|
||||
return false
|
||||
end
|
||||
@ -445,6 +469,7 @@ function Public.schedule_chunk(event)
|
||||
top_y = area.left_top.y,
|
||||
surface = surface,
|
||||
tiles = {},
|
||||
hidden_tiles = {},
|
||||
entities = {},
|
||||
buildings = {},
|
||||
decoratives = {},
|
||||
@ -483,6 +508,7 @@ function Public.do_chunk(event)
|
||||
top_y = area.left_top.y,
|
||||
surface = surface,
|
||||
tiles = {},
|
||||
hidden_tiles = {},
|
||||
entities = {},
|
||||
buildings = {},
|
||||
decoratives = {},
|
||||
@ -499,6 +525,7 @@ function Public.do_chunk(event)
|
||||
end
|
||||
|
||||
do_place_tiles(data)
|
||||
do_place_hidden_tiles(data)
|
||||
do_place_entities(data)
|
||||
do_place_buildings(data)
|
||||
do_place_decoratives(data)
|
||||
|
@ -55,11 +55,15 @@ local function kick_players_out_of_vehicles(wagon)
|
||||
end
|
||||
end
|
||||
|
||||
local function recreate_players()
|
||||
for _, player in pairs(game.connected_players) do
|
||||
if not player.character then
|
||||
player.set_controller({type = defines.controllers.god})
|
||||
player.create_character()
|
||||
local function teleport_char(position, destination_area, wagon)
|
||||
for _, e in pairs(wagon.surface.find_entities_filtered({name = 'character', area = wagon.area})) do
|
||||
local player = e.player
|
||||
if player then
|
||||
position[player.index] = {
|
||||
player.position.x,
|
||||
player.position.y + (destination_area.left_top.y - wagon.area.left_top.y)
|
||||
}
|
||||
player.teleport({0, 0}, game.surfaces.nauvis)
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -334,7 +338,6 @@ function Public.kill_wagon(icw, entity)
|
||||
Public.kill_minimap(e.player)
|
||||
else
|
||||
e.destroy()
|
||||
recreate_players()
|
||||
end
|
||||
end
|
||||
for _, tile in pairs(surface.find_tiles_filtered({area = wagon.area})) do
|
||||
@ -832,16 +835,7 @@ local function move_room_to_train(icw, train, wagon)
|
||||
|
||||
kick_players_out_of_vehicles(wagon)
|
||||
local player_positions = {}
|
||||
for _, e in pairs(wagon.surface.find_entities_filtered({name = 'character', area = wagon.area})) do
|
||||
local player = e.player
|
||||
if player then
|
||||
player_positions[player.index] = {
|
||||
player.position.x,
|
||||
player.position.y + (destination_area.left_top.y - wagon.area.left_top.y)
|
||||
}
|
||||
player.teleport({0, 0}, game.surfaces.nauvis)
|
||||
end
|
||||
end
|
||||
teleport_char(player_positions, destination_area, wagon)
|
||||
|
||||
kill_wagon_doors(icw, wagon)
|
||||
|
||||
@ -852,9 +846,7 @@ local function move_room_to_train(icw, train, wagon)
|
||||
destination_surface = train.surface,
|
||||
clone_tiles = true,
|
||||
clone_entities = true,
|
||||
clone_decoratives = true,
|
||||
clear_destination_entities = true,
|
||||
clear_destination_decoratives = true,
|
||||
expand_map = true
|
||||
}
|
||||
)
|
||||
@ -864,8 +856,6 @@ local function move_room_to_train(icw, train, wagon)
|
||||
player.teleport(position, train.surface)
|
||||
end
|
||||
|
||||
recreate_players()
|
||||
|
||||
for _, tile in pairs(wagon.surface.find_tiles_filtered({area = wagon.area})) do
|
||||
wagon.surface.set_tiles({{name = 'out-of-map', position = tile.position}}, true)
|
||||
end
|
||||
|
@ -1439,6 +1439,21 @@ local function on_console_chat(event)
|
||||
shoo(event)
|
||||
end
|
||||
|
||||
local function on_player_changed_surface(event)
|
||||
local player = game.players[event.player_index]
|
||||
if not validate_player(player) then
|
||||
return
|
||||
end
|
||||
|
||||
local map_name = 'mountain_fortress_v3'
|
||||
|
||||
if string.sub(player.surface.name, 0, #map_name) ~= map_name then
|
||||
return Public.add_player_to_permission_group(player, 'locomotive')
|
||||
else
|
||||
return Public.add_player_to_permission_group(player, 'default')
|
||||
end
|
||||
end
|
||||
|
||||
function Public.close_gui_player(frame)
|
||||
if not frame then
|
||||
return
|
||||
@ -1902,14 +1917,14 @@ local function tick()
|
||||
boost_players()
|
||||
end
|
||||
|
||||
if ticker % 2500 == 0 then
|
||||
pollute_area()
|
||||
end
|
||||
|
||||
if ticker % 1800 == 0 then
|
||||
if ticker % 1200 == 0 then
|
||||
set_player_spawn()
|
||||
refill_fish()
|
||||
end
|
||||
|
||||
if ticker % 2500 == 0 then
|
||||
pollute_area()
|
||||
end
|
||||
end
|
||||
|
||||
Public.place_market = place_market
|
||||
@ -1928,5 +1943,6 @@ Event.add(defines.events.on_entity_died, on_player_and_robot_mined_entity)
|
||||
Event.add(defines.events.on_pre_player_mined_item, on_player_and_robot_mined_entity)
|
||||
Event.add(defines.events.on_robot_mined_entity, on_player_and_robot_mined_entity)
|
||||
Event.add(defines.events.on_console_chat, on_console_chat)
|
||||
Event.add(defines.events.on_player_changed_surface, on_player_changed_surface)
|
||||
|
||||
return Public
|
||||
|
@ -105,19 +105,81 @@ local set_difficulty = function()
|
||||
if amount > 8 then
|
||||
amount = 8
|
||||
end
|
||||
Collapse.set_amount(amount)
|
||||
|
||||
if player_count >= 8 and player_count <= 12 then
|
||||
Collapse.set_speed(8)
|
||||
elseif player_count >= 20 then
|
||||
Collapse.set_speed(6)
|
||||
elseif player_count >= 35 then
|
||||
Collapse.set_speed(5)
|
||||
local difficulty = Difficulty.get()
|
||||
local name = difficulty.difficulties[difficulty.difficulty_vote_index].name
|
||||
if name == 'Insane' then
|
||||
Collapse.set_amount(15)
|
||||
else
|
||||
Collapse.set_amount(amount)
|
||||
end
|
||||
|
||||
wave_defense_table.wave_interval = 3600 - player_count * 60
|
||||
if wave_defense_table.wave_interval < 1800 then
|
||||
if name == 'Insane' then
|
||||
Collapse.set_speed(5)
|
||||
else
|
||||
if player_count >= 8 and player_count <= 12 then
|
||||
Collapse.set_speed(8)
|
||||
elseif player_count >= 20 then
|
||||
Collapse.set_speed(6)
|
||||
elseif player_count >= 35 then
|
||||
Collapse.set_speed(5)
|
||||
end
|
||||
end
|
||||
if name == 'Insane' then
|
||||
wave_defense_table.wave_interval = 1800
|
||||
else
|
||||
wave_defense_table.wave_interval = 3600 - player_count * 60
|
||||
if wave_defense_table.wave_interval < 1800 then
|
||||
wave_defense_table.wave_interval = 1800
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local biter_settings = function()
|
||||
-- biter settings
|
||||
local Diff = Difficulty.get()
|
||||
if not Diff.difficulty_vote_value then
|
||||
Diff.difficulty_vote_value = 0.1
|
||||
end
|
||||
|
||||
local plus = ((game.forces.enemy.evolution_factor * 100) + 50) / (77 - Diff.difficulty_vote_value * 2)
|
||||
local sub = (((1 - game.forces.enemy.evolution_factor) * 100) + 50) / (73 + Diff.difficulty_vote_value * 2)
|
||||
|
||||
local enemy_expansion = game.map_settings.enemy_expansion
|
||||
local unit_group = game.map_settings.unit_group
|
||||
local path_finder = game.map_settings.path_finder
|
||||
unit_group.max_wait_time_for_late_members = 3600 * plus
|
||||
unit_group.min_group_radius = 30 * plus
|
||||
unit_group.max_group_radius = 60 * plus
|
||||
unit_group.max_member_speedup_when_behind = 3 * plus
|
||||
unit_group.member_disown_distance = 20 * plus
|
||||
unit_group.max_gathering_unit_groups = 10 * plus
|
||||
path_finder.max_work_done_per_tick = 6000 * plus
|
||||
|
||||
path_finder.max_steps_worked_per_tick = 20 + (100 * plus)
|
||||
if path_finder.max_steps_worked_per_tick > 2000 then
|
||||
path_finder.max_steps_worked_per_tick = 200
|
||||
end
|
||||
|
||||
enemy_expansion.building_coefficient = 0.1 * sub
|
||||
enemy_expansion.other_base_coefficient = 2.0 * sub
|
||||
enemy_expansion.neighbouring_chunk_coefficient = 0.5 * sub
|
||||
enemy_expansion.neighbouring_base_chunk_coefficient = 0.4 * sub
|
||||
|
||||
enemy_expansion.max_expansion_distance = 20 * plus
|
||||
if enemy_expansion.max_expansion_distance > 20 then
|
||||
enemy_expansion.max_expansion_distance = 20
|
||||
end
|
||||
enemy_expansion.friendly_base_influence_radius = 8 * plus
|
||||
enemy_expansion.enemy_building_influence_radius = 3 * plus
|
||||
|
||||
enemy_expansion.settler_group_min_size = 5 * plus
|
||||
if enemy_expansion.settler_group_min_size < 1 then
|
||||
enemy_expansion.settler_group_min_size = 1
|
||||
end
|
||||
|
||||
enemy_expansion.settler_group_max_size = 20 * plus
|
||||
if enemy_expansion.settler_group_max_size > 50 then
|
||||
enemy_expansion.settler_group_max_size = 50
|
||||
end
|
||||
end
|
||||
|
||||
@ -308,6 +370,7 @@ function Public.reset_map()
|
||||
wave_defense_table.spawn_position = {x = 0, y = 100}
|
||||
WD.alert_boss_wave(true)
|
||||
WD.clear_corpses(false)
|
||||
WD.remove_entities(true)
|
||||
|
||||
set_difficulty()
|
||||
|
||||
@ -321,6 +384,8 @@ function Public.reset_map()
|
||||
Task.start_queue()
|
||||
Task.set_queue_speed(32)
|
||||
|
||||
biter_settings()
|
||||
|
||||
this.chunk_load_tick = game.tick + 1200
|
||||
|
||||
--HD.enable_auto_init = false
|
||||
@ -627,12 +692,13 @@ local boost_difficulty = function()
|
||||
end
|
||||
|
||||
local difficulty = Difficulty.get()
|
||||
local name = difficulty.difficulties[difficulty.difficulty_vote_index].name
|
||||
|
||||
if game.tick < difficulty.difficulty_poll_closing_timeout then
|
||||
return
|
||||
end
|
||||
|
||||
local rpg_extra = RPG_Settings.get('rpg_extra')
|
||||
local name = difficulty.difficulties[difficulty.difficulty_vote_index].name
|
||||
Difficulty.get().name = name
|
||||
|
||||
Difficulty.get().button_tooltip = difficulty.tooltip[difficulty.difficulty_vote_index]
|
||||
@ -686,6 +752,20 @@ local boost_difficulty = function()
|
||||
WPT.get().bonus_xp_on_join = 50
|
||||
WD.set().next_wave = game.tick + 3600 * 10
|
||||
WPT.get().difficulty_set = true
|
||||
elseif name == 'Insane' then
|
||||
rpg_extra.difficulty = 0
|
||||
game.forces.player.manual_mining_speed_modifier = 0
|
||||
force_mining_speed.speed = game.forces.player.manual_mining_speed_modifier
|
||||
game.forces.player.character_running_speed_modifier = 0
|
||||
game.forces.player.manual_crafting_speed_modifier = 0
|
||||
WPT.get().coin_amount = 1
|
||||
WPT.get('upgrades').flame_turret.limit = 0
|
||||
WPT.get('upgrades').landmine.limit = 0
|
||||
WPT.get().locomotive_health = 1000
|
||||
WPT.get().locomotive_max_health = 1000
|
||||
WPT.get().bonus_xp_on_join = 0
|
||||
WD.set().next_wave = game.tick + 3600 * 5
|
||||
WPT.get().difficulty_set = true
|
||||
end
|
||||
end
|
||||
|
||||
@ -702,9 +782,8 @@ end
|
||||
local collapse_message =
|
||||
Token.register(
|
||||
function(data)
|
||||
local keeper = '[color=blue]Mapkeeper:[/color] \n'
|
||||
local pos = data.position
|
||||
local message = keeper .. 'Warning, collapse has begun - wave limit has been reached!'
|
||||
local message = data.message
|
||||
local collapse_position = {
|
||||
position = pos
|
||||
}
|
||||
@ -720,12 +799,27 @@ local collapse_after_wave_100 = function()
|
||||
if Collapse.start_now() then
|
||||
return
|
||||
end
|
||||
local difficulty = Difficulty.get()
|
||||
local name = difficulty.difficulties[difficulty.difficulty_vote_index].name
|
||||
|
||||
local difficulty_set = WPT.get('difficulty_set')
|
||||
if not difficulty_set and name == 'Insane' then
|
||||
return
|
||||
end
|
||||
|
||||
local wave_number = WD.get_wave()
|
||||
if wave_number >= 100 then
|
||||
|
||||
if wave_number >= 100 or name == 'Insane' then
|
||||
local keeper = '[color=blue]Mapkeeper:[/color] \n'
|
||||
Collapse.start_now(true)
|
||||
local data = {
|
||||
position = Collapse.get_position()
|
||||
}
|
||||
if name == 'Insane' then
|
||||
data.message = keeper .. 'Warning, Collapse has begun - god speed!'
|
||||
else
|
||||
data.message = keeper .. 'Warning, Collapse has begun - wave limit has been reached!'
|
||||
end
|
||||
Task.set_timeout_in_ticks(550, collapse_message, data)
|
||||
end
|
||||
end
|
||||
@ -735,8 +829,13 @@ local on_tick = function()
|
||||
local surface = game.surfaces[active_surface_index]
|
||||
local wave_defense_table = WD.get_table()
|
||||
local update_gui = Gui_mf.update_gui
|
||||
local tick = game.tick
|
||||
|
||||
if game.tick % 60 == 0 then
|
||||
if tick % 36000 == 0 then
|
||||
biter_settings()
|
||||
end
|
||||
|
||||
if tick % 60 == 0 then
|
||||
for _, player in pairs(game.connected_players) do
|
||||
update_gui(player)
|
||||
end
|
||||
@ -745,7 +844,7 @@ local on_tick = function()
|
||||
has_the_game_ended()
|
||||
chunk_load()
|
||||
|
||||
if game.tick % 1200 == 0 then
|
||||
if tick % 1200 == 0 then
|
||||
remove_offline_players()
|
||||
boost_difficulty()
|
||||
collapse_after_wave_100()
|
||||
@ -779,6 +878,12 @@ local on_init = function()
|
||||
[3] = {
|
||||
name = 'Hard',
|
||||
value = 1.5,
|
||||
color = {r = 0.25, g = 0.25, b = 0.00},
|
||||
print_color = {r = 0.4, g = 0.0, b = 0.00}
|
||||
},
|
||||
[4] = {
|
||||
name = 'Insane',
|
||||
value = 3,
|
||||
color = {r = 0.25, g = 0.00, b = 0.00},
|
||||
print_color = {r = 0.4, g = 0.0, b = 0.00}
|
||||
}
|
||||
@ -787,7 +892,8 @@ local on_init = function()
|
||||
local tooltip = {
|
||||
[1] = 'Wave Defense is based on amount of players.\nXP Extra reward points = 1.\nMining speed boosted = 1.5.\nRunning speed boosted = 0.2.\nCrafting speed boosted = 0.4.\nCoin amount per harvest = 2.\nFlame Turret limit = 25.\nLandmine limit = 100.\nLocomotive health = 20000.\nHidden Treasure has higher chance to spawn.\nGrace period: 20 minutes',
|
||||
[2] = 'Wave Defense is based on amount of players.\nXP Extra reward points = 0.5.\nMining speed boosted = 1.\nRunning speed boosted = 0.1.\nCrafting speed boosted = 0.2.\nCoin amount per harvest = 1.\nFlame Turret limit = 10.\nLandmine limit = 50.\nLocomotive health = 10000.\nHidden Treasure has normal chance to spawn.\nGrace period: 15 minutes',
|
||||
[3] = 'Wave Defense is based on amount of players.\nXP Extra reward points = 0.\nMining speed boosted = 0.\nRunning speed boosted = 0.\nCrafting speed boosted = 0.\nCoin amount per harvest = 1.\nFlame Turret limit = 3.\nLandmine limit = 10.\nLocomotive health = 5000.\nHidden Treasure has lower chance to spawn.\nGrace period: 10 minutes'
|
||||
[3] = 'Wave Defense is based on amount of players.\nXP Extra reward points = 0.\nMining speed boosted = 0.\nRunning speed boosted = 0.\nCrafting speed boosted = 0.\nCoin amount per harvest = 1.\nFlame Turret limit = 3.\nLandmine limit = 10.\nLocomotive health = 5000.\nHidden Treasure has lower chance to spawn.\nGrace period: 10 minutes',
|
||||
[4] = 'Wave Defense is based on amount of players.\nXP Extra reward points = 0.\nMining speed boosted = 0.\nRunning speed boosted = 0.\nCrafting speed boosted = 0.\nCoin amount per harvest = 1.\nFlame Turret limit = 0.\nLandmine limit = 0.\nLocomotive health = 1000.\nHidden Treasure has lower chance to spawn.\nGrace period: 5 minutes\nBiters are way more aggressive.\nCollapse starts after difficulty poll has ended.\nCollapse is much faster.'
|
||||
}
|
||||
|
||||
Difficulty.set_difficulties(difficulties)
|
||||
|
@ -77,10 +77,10 @@ function Public.reset_table()
|
||||
y = 0
|
||||
}
|
||||
this.traps = {}
|
||||
this.much_time = true
|
||||
this.munch_time = true
|
||||
this.coin_amount = 1
|
||||
this.difficulty_set = false
|
||||
this.bonus_xp_on_join = 150
|
||||
this.bonus_xp_on_join = 250
|
||||
this.main_market_items = {}
|
||||
this.spill_items_to_surface = false
|
||||
this.outside_chests = {}
|
||||
|
@ -106,8 +106,12 @@ local function place_wagon(data)
|
||||
placed_trains_in_zone = WPT.get('placed_trains_in_zone')
|
||||
end
|
||||
|
||||
if placed_trains_in_zone.placed >= placed_trains_in_zone.limit then
|
||||
return
|
||||
end
|
||||
|
||||
local surface = data.surface
|
||||
local tiles = data.tiles
|
||||
local tiles = data.hidden_tiles
|
||||
local entities = data.entities
|
||||
local top_x = data.top_x
|
||||
local top_y = data.top_y
|
||||
@ -120,10 +124,6 @@ local function place_wagon(data)
|
||||
callback = Functions.disable_destructible_callback
|
||||
}
|
||||
|
||||
if placed_trains_in_zone.placed >= placed_trains_in_zone.limit then
|
||||
return
|
||||
end
|
||||
|
||||
local radius = 300
|
||||
local area = {
|
||||
left_top = {x = position.x - radius, y = position.y - radius},
|
||||
@ -150,13 +150,8 @@ local function place_wagon(data)
|
||||
end
|
||||
|
||||
for k, tile in pairs(location) do
|
||||
if tile.collides_with('resource-layer') then
|
||||
tiles[#tiles + 1] = {name = 'landfill', position = tile.position}
|
||||
end
|
||||
for _, e in pairs(surface.find_entities_filtered({position = tile.position, force = {'neutral', 'enemy'}})) do
|
||||
e.destroy()
|
||||
end
|
||||
if tile.position.y % 2 == 0 and tile.position.x % 2 == 0 then
|
||||
tiles[#tiles + 1] = {name = 'brown-refined-concrete', position = tile.position}
|
||||
if tile.position.y % 1 == 0 and tile.position.x % 1 == 0 then
|
||||
entities[#entities + 1] = {
|
||||
name = 'straight-rail',
|
||||
position = tile.position,
|
||||
@ -222,7 +217,7 @@ local function wall(data)
|
||||
local seed = data.seed
|
||||
local p = {x = x + data.top_x, y = y + data.top_y}
|
||||
|
||||
local small_caves = get_noise('small_caves', p, seed + 12300)
|
||||
local small_caves = get_noise('small_caves', p, seed + 300000)
|
||||
local cave_ponds = get_noise('cave_rivers', p, seed + 150000)
|
||||
if y > 9 + cave_ponds * 6 and y < 23 + small_caves * 6 then
|
||||
if small_caves > 0.02 or cave_ponds > 0.02 then
|
||||
@ -242,7 +237,7 @@ local function wall(data)
|
||||
entities[#entities + 1] = {name = 'fish', position = p}
|
||||
end
|
||||
else
|
||||
tiles[#tiles + 1] = {name = 'tutorial-grid', position = p}
|
||||
tiles[#tiles + 1] = {name = 'brown-refined-concrete', position = p}
|
||||
|
||||
if math.random(1, 5) ~= 1 then
|
||||
entities[#entities + 1] = {name = rock_raffle[math.random(1, #rock_raffle)], position = p}
|
||||
@ -256,7 +251,7 @@ local function wall(data)
|
||||
end
|
||||
end
|
||||
else
|
||||
tiles[#tiles + 1] = {name = 'tutorial-grid', position = p}
|
||||
tiles[#tiles + 1] = {name = 'brown-refined-concrete', position = p}
|
||||
|
||||
if
|
||||
surface.can_place_entity(
|
||||
@ -275,7 +270,7 @@ local function wall(data)
|
||||
end
|
||||
else
|
||||
if y < 4 or y > 25 then
|
||||
if y <= 24 then
|
||||
if y <= 23 then
|
||||
if math.random(1, y + 1) == 1 then
|
||||
entities[#entities + 1] = {
|
||||
name = 'stone-wall',
|
||||
@ -369,6 +364,13 @@ local function process_level_13_position(x, y, data)
|
||||
local noise_cave_ponds = get_noise('cave_ponds', p, seed)
|
||||
local smol_areas = get_noise('smol_areas', p, seed + 70000)
|
||||
|
||||
--Resource Spots
|
||||
if smol_areas < -0.72 then
|
||||
if math.random(1, 8) == 1 then
|
||||
Generate_resources(buildings, p, Public.level_depth)
|
||||
end
|
||||
end
|
||||
|
||||
if small_caves > -0.22 and small_caves < 0.22 then
|
||||
tiles[#tiles + 1] = {name = 'dirt-3', position = p}
|
||||
if math.random(1, 768) == 1 then
|
||||
@ -395,15 +397,12 @@ local function process_level_13_position(x, y, data)
|
||||
return
|
||||
end
|
||||
|
||||
--Resource Spots
|
||||
if smol_areas < -0.72 then
|
||||
if math.random(1, 8) == 1 then
|
||||
Generate_resources(buildings, p, Public.level_depth)
|
||||
end
|
||||
end
|
||||
|
||||
if small_caves > -0.40 and small_caves < 0.40 then
|
||||
if noise_cave_ponds > 0.35 then
|
||||
local success = place_wagon(data)
|
||||
if success then
|
||||
return
|
||||
end
|
||||
tiles[#tiles + 1] = {name = 'dirt-' .. math.random(1, 4), position = p}
|
||||
if math.random(1, 256) == 1 then
|
||||
treasure[#treasure + 1] = {position = p, chest = 'wooden-chest'}
|
||||
@ -441,6 +440,13 @@ local function process_level_12_position(x, y, data)
|
||||
local noise_2 = get_noise('no_rocks_2', p, seed + 20000)
|
||||
local smol_areas = get_noise('smol_areas', p, seed + 60000)
|
||||
|
||||
--Resource Spots
|
||||
if smol_areas < -0.72 then
|
||||
if math.random(1, 8) == 1 then
|
||||
Generate_resources(buildings, p, Public.level_depth)
|
||||
end
|
||||
end
|
||||
|
||||
if noise_1 > 0.65 then
|
||||
if math.random(1, 100) > 88 then
|
||||
entities[#entities + 1] = {name = 'tree-0' .. math.random(1, 9), position = p}
|
||||
@ -456,6 +462,10 @@ local function process_level_12_position(x, y, data)
|
||||
end
|
||||
|
||||
if noise_1 < -0.72 then
|
||||
local success = place_wagon(data)
|
||||
if success then
|
||||
return
|
||||
end
|
||||
tiles[#tiles + 1] = {name = 'lab-dark-2', position = p}
|
||||
if math.random(1, 100) > 88 then
|
||||
entities[#entities + 1] = {name = 'tree-0' .. math.random(1, 9), position = p}
|
||||
@ -478,13 +488,6 @@ local function process_level_12_position(x, y, data)
|
||||
return
|
||||
end
|
||||
|
||||
--Resource Spots
|
||||
if smol_areas < -0.72 then
|
||||
if math.random(1, 8) == 1 then
|
||||
Generate_resources(buildings, p, Public.level_depth)
|
||||
end
|
||||
end
|
||||
|
||||
if math.random(1, 64) == 1 and noise_2 > 0.65 then
|
||||
if math.random(1, 32) == 1 then
|
||||
entities[#entities + 1] = {name = 'stone', position = p, amount = math.abs(p.y) + 1}
|
||||
@ -531,6 +534,13 @@ local function process_level_11_position(x, y, data)
|
||||
return
|
||||
end
|
||||
|
||||
--Resource Spots
|
||||
if smol_areas < -0.72 then
|
||||
if math.random(1, 8) == 1 then
|
||||
Generate_resources(buildings, p, Public.level_depth)
|
||||
end
|
||||
end
|
||||
|
||||
if noise_1 < -0.72 then
|
||||
tiles[#tiles + 1] = {name = 'lab-dark-1', position = p}
|
||||
entities[#entities + 1] = {name = 'uranium-ore', position = p, amount = math.abs(p.y) + 1 * 3}
|
||||
@ -552,13 +562,6 @@ local function process_level_11_position(x, y, data)
|
||||
return
|
||||
end
|
||||
|
||||
--Resource Spots
|
||||
if smol_areas < -0.72 then
|
||||
if math.random(1, 8) == 1 then
|
||||
Generate_resources(buildings, p, Public.level_depth)
|
||||
end
|
||||
end
|
||||
|
||||
if math.random(1, 64) == 1 and noise_2 > 0.65 then
|
||||
entities[#entities + 1] = {name = 'crude-oil', position = p, amount = get_oil_amount(p)}
|
||||
end
|
||||
@ -573,6 +576,11 @@ local function process_level_11_position(x, y, data)
|
||||
}
|
||||
end
|
||||
|
||||
local success = place_wagon(data)
|
||||
if success then
|
||||
return
|
||||
end
|
||||
|
||||
tiles[#tiles + 1] = {name = 'tutorial-grid', position = p}
|
||||
end
|
||||
|
||||
@ -616,6 +624,10 @@ local function process_level_10_position(x, y, data)
|
||||
return
|
||||
end
|
||||
if math.abs(scrapyard) > 0.25 and math.abs(scrapyard) < 0.40 then
|
||||
local success = place_wagon(data)
|
||||
if success then
|
||||
return
|
||||
end
|
||||
if math.random(1, 128) == 1 then
|
||||
Biters.wave_defense_set_worm_raffle(math.abs(p.y) * worm_level_modifier)
|
||||
entities[#entities + 1] = {name = Biters.wave_defense_roll_worm_name(), position = p, force = 'enemy'}
|
||||
@ -670,6 +682,10 @@ local function process_level_9_position(x, y, data)
|
||||
end
|
||||
|
||||
if maze_noise > 0 and maze_noise < 0.45 then
|
||||
local success = place_wagon(data)
|
||||
if success then
|
||||
return
|
||||
end
|
||||
if math.random(1, 512) == 1 then
|
||||
markets[#markets + 1] = p
|
||||
end
|
||||
@ -745,6 +761,10 @@ local function process_level_8_position(x, y, data)
|
||||
return
|
||||
end
|
||||
if scrapyard < -0.28 or scrapyard > 0.28 then
|
||||
local success = place_wagon(data)
|
||||
if success then
|
||||
return
|
||||
end
|
||||
if math.random(1, 128) == 1 then
|
||||
Biters.wave_defense_set_worm_raffle(math.abs(p.y) * worm_level_modifier)
|
||||
entities[#entities + 1] = {name = Biters.wave_defense_roll_worm_name(), position = p, force = 'enemy'}
|
||||
@ -834,13 +854,6 @@ local function process_level_7_position(x, y, data)
|
||||
return
|
||||
end
|
||||
|
||||
--Resource Spots
|
||||
if smol_areas < -0.72 then
|
||||
if math.random(1, 8) == 1 then
|
||||
Generate_resources(buildings, p, Public.level_depth)
|
||||
end
|
||||
end
|
||||
|
||||
local noise_ores = get_noise('no_rocks_2', p, seed + 25000)
|
||||
|
||||
if cave_rivers_3 > -0.20 and cave_rivers_3 < 0.20 then
|
||||
@ -870,6 +883,10 @@ local function process_level_7_position(x, y, data)
|
||||
if cave_rivers_4 > -0.20 and cave_rivers_4 < 0.20 then
|
||||
tiles[#tiles + 1] = {name = 'grass-' .. math.floor(cave_rivers_4 * 32) % 3 + 1, position = p}
|
||||
if cave_rivers_4 > -0.10 and cave_rivers_4 < 0.10 then
|
||||
local success = place_wagon(data)
|
||||
if success then
|
||||
return
|
||||
end
|
||||
if math.random(1, 8) == 1 and no_rocks_2 > -0.25 then
|
||||
entities[#entities + 1] = {name = 'tree-02', position = p}
|
||||
end
|
||||
@ -967,6 +984,10 @@ local function process_level_6_position(x, y, data)
|
||||
end
|
||||
|
||||
if cave_rivers > -0.1 and cave_rivers < 0.1 then
|
||||
local success = place_wagon(data)
|
||||
if success then
|
||||
return
|
||||
end
|
||||
if math.random(1, 36) == 1 then
|
||||
entities[#entities + 1] = {name = 'tree-0' .. math.random(1, 9), position = p}
|
||||
end
|
||||
@ -1041,6 +1062,10 @@ local function process_level_5_position(x, y, data)
|
||||
|
||||
if small_caves > -0.40 and small_caves < 0.40 then
|
||||
if noise_cave_ponds > 0.35 then
|
||||
local success = place_wagon(data)
|
||||
if success then
|
||||
return
|
||||
end
|
||||
tiles[#tiles + 1] = {name = 'dirt-' .. math.random(1, 4), position = p}
|
||||
if math.random(1, 256) == 1 then
|
||||
treasure[#treasure + 1] = {position = p, chest = 'wooden-chest'}
|
||||
@ -1075,7 +1100,7 @@ local function process_level_4_position(x, y, data)
|
||||
|
||||
local noise_large_caves = get_noise('large_caves', p, seed)
|
||||
local noise_cave_ponds = get_noise('cave_ponds', p, seed)
|
||||
local small_caves = get_noise('small_caves', p, seed)
|
||||
local small_caves = get_noise('dungeons', p, seed)
|
||||
local smol_areas = get_noise('smol_areas', p, seed + 15000)
|
||||
|
||||
if math.abs(noise_large_caves) > 0.7 then
|
||||
@ -1102,6 +1127,10 @@ local function process_level_4_position(x, y, data)
|
||||
Biters.wave_defense_set_worm_raffle(math.abs(p.y) * worm_level_modifier)
|
||||
entities[#entities + 1] = {name = Biters.wave_defense_roll_worm_name(), position = p, force = 'enemy'}
|
||||
end
|
||||
local success = place_wagon(data)
|
||||
if success then
|
||||
return
|
||||
end
|
||||
if math.random(1, 1024) == 1 then
|
||||
treasure[#treasure + 1] = {position = p, chest = 'wooden-chest'}
|
||||
end
|
||||
@ -1182,12 +1211,19 @@ local function process_level_3_position(x, y, data)
|
||||
local markets = data.markets
|
||||
local treasure = data.treasure
|
||||
|
||||
local small_caves = get_noise('small_caves', p, seed + 50000)
|
||||
local small_caves = get_noise('dungeons', p, seed + 50000)
|
||||
local small_caves_2 = get_noise('small_caves_2', p, seed + 70000)
|
||||
local noise_large_caves = get_noise('large_caves', p, seed + 60000)
|
||||
local noise_cave_ponds = get_noise('cave_ponds', p, seed)
|
||||
local smol_areas = get_noise('smol_areas', p, seed + 60000)
|
||||
|
||||
--Resource Spots
|
||||
if smol_areas < -0.72 then
|
||||
if math.random(1, 8) == 1 then
|
||||
Generate_resources(buildings, p, Public.level_depth)
|
||||
end
|
||||
end
|
||||
|
||||
--Market Spots
|
||||
if noise_cave_ponds < -0.77 then
|
||||
if noise_cave_ponds > -0.79 then
|
||||
@ -1205,13 +1241,6 @@ local function process_level_3_position(x, y, data)
|
||||
return
|
||||
end
|
||||
|
||||
--Resource Spots
|
||||
if smol_areas < -0.72 then
|
||||
if math.random(1, 8) == 1 then
|
||||
Generate_resources(buildings, p, Public.level_depth)
|
||||
end
|
||||
end
|
||||
|
||||
if noise_large_caves > -0.15 and noise_large_caves < 0.15 or small_caves_2 > 0 then
|
||||
--Green Water Ponds
|
||||
if noise_cave_ponds > 0.80 then
|
||||
@ -1296,6 +1325,10 @@ local function process_level_3_position(x, y, data)
|
||||
--Main Rock Terrain
|
||||
local no_rocks_2 = get_noise('no_rocks_2', p, seed + 75000)
|
||||
if no_rocks_2 > 0.80 or no_rocks_2 < -0.80 then
|
||||
local success = place_wagon(data)
|
||||
if success then
|
||||
return
|
||||
end
|
||||
tiles[#tiles + 1] = {name = 'dirt-' .. math.floor(no_rocks_2 * 8) % 2 + 5, position = p}
|
||||
if math.random(1, 512) == 1 then
|
||||
treasure[#treasure + 1] = {position = p, chest = 'wooden-chest'}
|
||||
@ -1325,10 +1358,17 @@ local function process_level_2_position(x, y, data)
|
||||
local markets = data.markets
|
||||
local treasure = data.treasure
|
||||
|
||||
local small_caves = get_noise('small_caves', p, seed)
|
||||
local small_caves = get_noise('dungeons', p, seed)
|
||||
local noise_large_caves = get_noise('large_caves', p, seed)
|
||||
local smol_areas = get_noise('smol_areas', p, seed + 15000)
|
||||
|
||||
--Resource Spots
|
||||
if smol_areas < -0.72 then
|
||||
if math.random(1, 8) == 1 then
|
||||
Generate_resources(buildings, p, Public.level_depth)
|
||||
end
|
||||
end
|
||||
|
||||
if noise_large_caves > -0.75 and noise_large_caves < 0.75 then
|
||||
local noise_cave_ponds = get_noise('cave_ponds', p, seed)
|
||||
|
||||
@ -1383,13 +1423,6 @@ local function process_level_2_position(x, y, data)
|
||||
return
|
||||
end
|
||||
|
||||
--Resource Spots
|
||||
if smol_areas < -0.72 then
|
||||
if math.random(1, 8) == 1 then
|
||||
Generate_resources(buildings, p, Public.level_depth)
|
||||
end
|
||||
end
|
||||
|
||||
local no_rocks = get_noise('no_rocks', p, seed + 25000)
|
||||
--Worm oil Zones
|
||||
if no_rocks < 0.20 and no_rocks > -0.20 then
|
||||
@ -1422,6 +1455,10 @@ local function process_level_2_position(x, y, data)
|
||||
--Main Rock Terrain
|
||||
local no_rocks_2 = get_noise('no_rocks_2', p, seed + 75000)
|
||||
if no_rocks_2 > 0.80 or no_rocks_2 < -0.80 then
|
||||
local success = place_wagon(data)
|
||||
if success then
|
||||
return
|
||||
end
|
||||
tiles[#tiles + 1] = {name = 'grass-' .. math.random(1, 4), position = p}
|
||||
if math.random(1, 512) == 1 then
|
||||
treasure[#treasure + 1] = {position = p, chest = 'wooden-chest'}
|
||||
@ -1451,9 +1488,16 @@ local function process_level_1_position(x, y, data)
|
||||
local markets = data.markets
|
||||
local treasure = data.treasure
|
||||
|
||||
local small_caves = get_noise('small_caves', p, seed)
|
||||
local small_caves = get_noise('dungeons', p, seed)
|
||||
local noise_cave_ponds = get_noise('cave_ponds', p, seed)
|
||||
local smol_areas = get_noise('smol_areas', p, seed + 50000)
|
||||
local smol_areas = get_noise('smol_areas', p, seed)
|
||||
|
||||
--Resource Spots
|
||||
if smol_areas < -0.72 then
|
||||
-- if math.random(1, 8) == 1 then
|
||||
Generate_resources(buildings, p, Public.level_depth)
|
||||
-- end
|
||||
end
|
||||
|
||||
--Chasms
|
||||
if noise_cave_ponds < 0.111 and noise_cave_ponds > -0.112 then
|
||||
@ -1477,7 +1521,7 @@ local function process_level_1_position(x, y, data)
|
||||
end
|
||||
|
||||
--Rivers
|
||||
local cave_rivers = get_noise('cave_rivers', p, seed + 100000)
|
||||
local cave_rivers = get_noise('cave_rivers', p, seed + 300000)
|
||||
if cave_rivers < 0.042 and cave_rivers > -0.042 then
|
||||
if noise_cave_ponds > 0 then
|
||||
tiles[#tiles + 1] = {name = 'water-shallow', position = p}
|
||||
@ -1512,14 +1556,7 @@ local function process_level_1_position(x, y, data)
|
||||
return
|
||||
end
|
||||
|
||||
--Resource Spots
|
||||
if smol_areas < -0.72 then
|
||||
-- if math.random(1, 8) == 1 then
|
||||
Generate_resources(buildings, p, Public.level_depth)
|
||||
-- end
|
||||
end
|
||||
|
||||
local no_rocks = get_noise('no_rocks', p, seed + 25000)
|
||||
local no_rocks = get_noise('no_rocks', p, seed + 50000)
|
||||
--Worm oil Zones
|
||||
if p.y < -64 + noise_cave_ponds * 10 then
|
||||
if no_rocks < 0.12 and no_rocks > -0.12 then
|
||||
@ -1551,6 +1588,10 @@ local function process_level_1_position(x, y, data)
|
||||
--Main Rock Terrain
|
||||
local no_rocks_2 = get_noise('no_rocks_2', p, seed + 75000)
|
||||
if no_rocks_2 > 0.66 or no_rocks_2 < -0.66 then
|
||||
local success = place_wagon(data)
|
||||
if success then
|
||||
return
|
||||
end
|
||||
tiles[#tiles + 1] = {name = 'dirt-' .. math.floor(no_rocks_2 * 8) % 2 + 5, position = p}
|
||||
if math.random(1, 32) == 1 then
|
||||
entities[#entities + 1] = {name = 'tree-0' .. math.random(1, 9), position = p}
|
||||
@ -1725,7 +1766,6 @@ function Public.heavy_functions(x, y, data)
|
||||
|
||||
if top_y < 0 then
|
||||
process_bits(x, y, data)
|
||||
place_wagon(data)
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -916,8 +916,6 @@ local function on_player_used_capsule(event)
|
||||
|
||||
if mana <= object.mana_cost then
|
||||
return p('You don´t have enough mana to cast this spell.', Color.fail)
|
||||
else
|
||||
rpg_t[player.index].mana = rpg_t[player.index].mana - object.mana_cost
|
||||
end
|
||||
|
||||
local target_pos
|
||||
@ -945,6 +943,7 @@ local function on_player_used_capsule(event)
|
||||
if object.obj_to_create == 'suicidal_comfylatron' then
|
||||
Functions.suicidal_comfylatron(position, surface)
|
||||
p('You wave your wand and ' .. object_name .. ' is on the run!', Color.success)
|
||||
rpg_t[player.index].mana = rpg_t[player.index].mana - object.mana_cost
|
||||
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),
|
||||
@ -954,6 +953,7 @@ local function on_player_used_capsule(event)
|
||||
player.character.health = 10
|
||||
player.character.surface.create_entity({name = 'water-splash', position = player.position})
|
||||
p('Warped home with minor bruises.', Color.info)
|
||||
rpg_t[player.index].mana = rpg_t[player.index].mana - object.mana_cost
|
||||
elseif projectile_types[obj_name] then
|
||||
for i = 1, object.amount do
|
||||
local damage_area = {
|
||||
@ -968,13 +968,16 @@ local function on_player_used_capsule(event)
|
||||
end
|
||||
end
|
||||
p('You wave your wand and ' .. object_name .. ' appears.', Color.success)
|
||||
rpg_t[player.index].mana = rpg_t[player.index].mana - object.mana_cost
|
||||
else
|
||||
if object.target then
|
||||
surface.create_entity({name = obj_name, position = position, force = force, target = target_pos, speed = 1})
|
||||
p('You wave your wand and ' .. object_name .. ' appears.', Color.success)
|
||||
rpg_t[player.index].mana = rpg_t[player.index].mana - object.mana_cost
|
||||
elseif object.obj_to_create == 'fish' then
|
||||
player.insert({name = 'raw-fish', count = object.amount})
|
||||
p('You wave your wand and ' .. object_name .. ' appears.', Color.success)
|
||||
rpg_t[player.index].mana = rpg_t[player.index].mana - object.mana_cost
|
||||
elseif surface.can_place_entity {name = obj_name, position = position} then
|
||||
if object.biter then
|
||||
local e = surface.create_entity({name = obj_name, position = position, force = force})
|
||||
@ -983,6 +986,7 @@ local function on_player_used_capsule(event)
|
||||
surface.create_entity({name = obj_name, position = position, force = force})
|
||||
end
|
||||
p('You wave your wand and ' .. object_name .. ' appears.', Color.success)
|
||||
rpg_t[player.index].mana = rpg_t[player.index].mana - object.mana_cost
|
||||
else
|
||||
p('Can´t create entity at given location.', Color.fail)
|
||||
return
|
||||
|
@ -44,6 +44,36 @@ local function shuffle_distance(tbl, position)
|
||||
return tbl
|
||||
end
|
||||
|
||||
local function remove_trees(entity)
|
||||
local surface = entity.surface
|
||||
local radius = 1.5
|
||||
local pos = entity.position
|
||||
local area = {{pos.x - radius, pos.y - radius}, {pos.x + radius, pos.y + radius}}
|
||||
local trees = surface.find_entities_filtered{area = area, type = "tree"}
|
||||
if #trees > 0 then
|
||||
for i,tree in pairs(trees) do
|
||||
if tree and tree.valid then
|
||||
tree.die()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function remove_rocks(entity)
|
||||
local surface = entity.surface
|
||||
local radius = 1.5
|
||||
local pos = entity.position
|
||||
local area = {{pos.x - radius, pos.y - radius}, {pos.x + radius, pos.y + radius}}
|
||||
local rocks = surface.find_entities_filtered{area = area, type = "simple-entity"}
|
||||
if #rocks > 0 then
|
||||
for i,rock in pairs(rocks) do
|
||||
if rock and rock.valid then
|
||||
rock.die()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function is_unit_valid(biter)
|
||||
local wave_defense_table = WD.get_table()
|
||||
if not biter.entity then debug_print("is_unit_valid - unit destroyed - does no longer exist") return false end
|
||||
@ -212,6 +242,10 @@ local function spawn_biter(surface, is_boss_biter)
|
||||
local biter = surface.create_entity({name = name, position = wave_defense_table.spawn_position, force = "enemy"})
|
||||
biter.ai_settings.allow_destroy_when_commands_fail = false
|
||||
biter.ai_settings.allow_try_return_to_spawner = false
|
||||
if wave_defense_table.remove_entities then
|
||||
remove_trees(biter)
|
||||
remove_rocks(biter)
|
||||
end
|
||||
if is_boss_biter then BiterHealthBooster.add_boss_unit(biter, global.biter_health_boost * 5, 0.35) end
|
||||
wave_defense_table.active_biters[biter.unit_number] = {entity = biter, spawn_tick = game.tick}
|
||||
wave_defense_table.active_biter_count = wave_defense_table.active_biter_count + 1
|
||||
|
@ -51,6 +51,7 @@ function Public.reset_wave_defense()
|
||||
wave_defense.worm_raffle = {}
|
||||
wave_defense.clear_corpses = false
|
||||
wave_defense.alert_boss_wave = false
|
||||
wave_defense.remove_entities = false
|
||||
end
|
||||
|
||||
function Public.get(key)
|
||||
@ -89,6 +90,13 @@ function Public.alert_boss_wave(value)
|
||||
return wave_defense.alert_boss_wave
|
||||
end
|
||||
|
||||
function Public.remove_entities(value)
|
||||
if value then
|
||||
wave_defense.remove_entities = value
|
||||
end
|
||||
return wave_defense.remove_entities
|
||||
end
|
||||
|
||||
local on_init = function()
|
||||
Public.reset_wave_defense()
|
||||
end
|
||||
|
@ -507,6 +507,12 @@ function Event.generate_event_name(name)
|
||||
return event_id
|
||||
end
|
||||
|
||||
function Event.on_configuration_changed(func)
|
||||
if type(func) == 'function' then
|
||||
script.on_configuration_changed(func)
|
||||
end
|
||||
end
|
||||
|
||||
function Event.add_event_filter(event, filter)
|
||||
local current_filters = script.get_event_filter(event)
|
||||
|
||||
|
@ -88,9 +88,10 @@ local noises = {
|
||||
local function get_noise(name, pos, seed)
|
||||
local noise = 0
|
||||
local d = 0
|
||||
for _, n in pairs(noises[name]) do
|
||||
noise = noise + simplex_noise(pos.x * n.modifier, pos.y * n.modifier, seed) * n.weight
|
||||
d = d + n.weight
|
||||
for i = 1, #noises[name] do
|
||||
local mod = noises[name]
|
||||
noise = noise + simplex_noise(pos.x * mod[i].modifier, pos.y * mod[i].modifier, seed) * mod[i].weight
|
||||
d = d + mod[i].weight
|
||||
seed = seed + 10000
|
||||
end
|
||||
noise = noise / d
|
||||
|
Loading…
x
Reference in New Issue
Block a user