1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-16 02:47:48 +02:00

tweaks to mtn fortress

This commit is contained in:
Gerkiz 2020-11-17 15:03:05 +01:00
parent dc3b62ed85
commit af6ba53cd2
10 changed files with 270 additions and 27 deletions

View File

@ -1,8 +1,7 @@
[mountain_fortress_v3]
map_info_main_caption=M O U N T A I N F O R T R E S S V3
map_info_sub_caption= ~~ diggy diggy choo choo ~~
map_info_text=The biters have caught the scent of fish in the cargo wagon.\nGuide the choo into the mountain and protect it as long as possible!\nThis however will not be an easy task,\nsince their strength and numbers increase over time.\n\nIn additon, the southern grounds collapse over time.\n\nDelve deep for greater treasures, but also face increased dangers.\nMining productivity research, will overhaul your mining equipment,\nreinforcing your pickaxe as well as increasing the size of your backpack.\n\nAs you dig, you will encounter impassable dark chasms or rivers.\nArtillery will try to shoot you down! Dig fast, dig north!\n\nSome explosives may cause parts of the ceiling to crumble, filling the void, creating new ways.\nAll they need is a container and a well aimed shot.\n\nEnter the cargo wagon to reveal the wagon surface!\n\nRandom buildings that generate resources can be found throughout the world.\n\nPlacing steel-chests near cargo-wagons enables you to quickly move content.\n\nStaying inside the locomotive aura prevents biters from spawning when mining entities.\n\nRPG GUI is disabled inside the locomotive.\nDisconnecting wagons is disabled.\nYou can´t cancel crafting when standing inside the locomotive aura.\n\nGood luck on your journey!
map_info_text=The biters have caught the scent of fish in the cargo wagon.\nGuide the choo into the mountain and protect it as long as possible!\nThis however will not be an easy task,\nsince their strength and numbers increase over time.\n\nIn additon, the southern grounds collapse over time.\n\nDelve deep for greater treasures, but also face increased dangers.\nMining productivity research, will overhaul your mining equipment,\nreinforcing your pickaxe as well as increasing the size of your backpack.\n\nAs you dig, you will encounter impassable dark chasms or rivers.\nArtillery will try to shoot you down! Dig fast, dig north!\n\nSome explosives may cause parts of the ceiling to crumble, filling the void, creating new ways.\nAll they need is a container and a well aimed shot.\n\nEnter the cargo wagon to reveal the wagon surface!\n\nRandom buildings that generate resources can be found throughout the world.\n\nPlacing steel-chests near cargo-wagons enables you to quickly move content.\n\nStaying inside the locomotive aura prevents biters from spawning when mining entities.\n\nRPG GUI is disabled inside the locomotive.\nDisconnecting wagons is disabled.\nYou can´t cancel crafting when standing inside the locomotive aura.\n\nDon't try to run north with your Spidertron if the train is not near you.\nYou have been warned.\n\nGood luck on your journey!
[breached_wall]
collapse_start=[color=blue]Mapkeeper:[/color]\nWarning, Collapse has begun!
@ -10,6 +9,7 @@ spidertron_unlocked=[color=blue]Mapkeeper:[/color]\nAttention! Spidertron has be
wall_breached=[color=blue]Mapkeeper:[/color]\nSurvivor! Well done. You have completed zone __1__!
first_to_reach=[color=blue]Mapkeeper:[/color]\n__1__ was the first to reach zone __2__.
artillery_warning=[color=blue]Mapkeeper:[/color]\nWarning, Artillery have been spotted north!
cheating_through=__1__ tried to cheat their way north with their spidertron!
[entity]
treasure_1=You notice an old crate within the rubble. It's filled with treasure!

View File

@ -1,8 +1,7 @@
[mountain_fortress_v3]
map_info_main_caption=M O U N T A I N F O R T R E S S V3
map_info_sub_caption= ~~ diggy diggy choo choo ~~
map_info_text=The biters have caught the scent of fish in the cargo wagon.\nGuide the choo into the mountain and protect it as long as possible!\nThis however will not be an easy task,\nsince their strength and numbers increase over time.\n\nIn additon, the southern grounds collapse over time.\n\nDelve deep for greater treasures, but also face increased dangers.\nMining productivity research, will overhaul your mining equipment,\nreinforcing your pickaxe as well as increasing the size of your backpack.\n\nAs you dig, you will encounter impassable dark chasms or rivers.\nArtillery will try to shoot you down! Dig fast, dig north!\n\nSome explosives may cause parts of the ceiling to crumble, filling the void, creating new ways.\nAll they need is a container and a well aimed shot.\n\nEnter the cargo wagon to reveal the wagon surface!\n\nRandom buildings that generate resources can be found throughout the world.\n\nPlacing steel-chests near cargo-wagons enables you to quickly move content.\n\nStaying inside the locomotive aura prevents biters from spawning when mining entities.\n\nRPG GUI is disabled inside the locomotive.\nDisconnecting wagons is disabled.\nYou can´t cancel crafting when standing inside the locomotive aura.\n\nGood luck on your journey!
map_info_text=The biters have caught the scent of fish in the cargo wagon.\nGuide the choo into the mountain and protect it as long as possible!\nThis however will not be an easy task,\nsince their strength and numbers increase over time.\n\nIn additon, the southern grounds collapse over time.\n\nDelve deep for greater treasures, but also face increased dangers.\nMining productivity research, will overhaul your mining equipment,\nreinforcing your pickaxe as well as increasing the size of your backpack.\n\nAs you dig, you will encounter impassable dark chasms or rivers.\nArtillery will try to shoot you down! Dig fast, dig north!\n\nSome explosives may cause parts of the ceiling to crumble, filling the void, creating new ways.\nAll they need is a container and a well aimed shot.\n\nEnter the cargo wagon to reveal the wagon surface!\n\nRandom buildings that generate resources can be found throughout the world.\n\nPlacing steel-chests near cargo-wagons enables you to quickly move content.\n\nStaying inside the locomotive aura prevents biters from spawning when mining entities.\n\nRPG GUI is disabled inside the locomotive.\nDisconnecting wagons is disabled.\nYou can´t cancel crafting when standing inside the locomotive aura.\n\nDon't try to run north with your Spidertron if the train is not near you.\nYou have been warned.\n\nGood luck on your journey!
[breached_wall]
collapse_start=[color=blue]Mapkeeper:[/color]\nWarning, Collapse has begun!
@ -10,6 +9,7 @@ spidertron_unlocked=[color=blue]Mapkeeper:[/color]\nAttention! Spidertron has be
wall_breached=[color=blue]Mapkeeper:[/color]\nSurvivor! Well done. You have completed zone __1__!
first_to_reach=[color=blue]Mapkeeper:[/color]\n__1__ was the first to reach zone __2__.
artillery_warning=[color=blue]Mapkeeper:[/color]\nWarning, Artillery have been spotted north!
cheating_through=__1__ tried to cheat their way north with their spidertron!
[entity]
treasure_1=You notice an old crate within the rubble. It's filled with treasure!

View File

@ -1,7 +1,7 @@
[mountain_fortress_v3]
map_info_main_caption=M O U N T A I N F O R T R E S S V3
map_info_sub_caption= ~~ diggy diggy choo choo ~~
map_info_text=The biters have caught the scent of fish in the cargo wagon.\nGuide the choo into the mountain and protect it as long as possible!\nThis however will not be an easy task,\nsince their strength and numbers increase over time.\n\nIn additon, the southern grounds collapse over time.\n\nDelve deep for greater treasures, but also face increased dangers.\nMining productivity research, will overhaul your mining equipment,\nreinforcing your pickaxe as well as increasing the size of your backpack.\n\nAs you dig, you will encounter impassable dark chasms or rivers.\nArtillery will try to shoot you down! Dig fast, dig north!\n\nSome explosives may cause parts of the ceiling to crumble, filling the void, creating new ways.\nAll they need is a container and a well aimed shot.\n\nEnter the cargo wagon to reveal the wagon surface!\n\nRandom buildings that generate resources can be found throughout the world.\n\nPlacing steel-chests near cargo-wagons enables you to quickly move content.\n\nStaying inside the locomotive aura prevents biters from spawning when mining entities.\n\nRPG GUI is disabled inside the locomotive.\nDisconnecting wagons is disabled.\nYou can´t cancel crafting when standing inside the locomotive aura.\n\nGood luck on your journey!
map_info_text=The biters have caught the scent of fish in the cargo wagon.\nGuide the choo into the mountain and protect it as long as possible!\nThis however will not be an easy task,\nsince their strength and numbers increase over time.\n\nIn additon, the southern grounds collapse over time.\n\nDelve deep for greater treasures, but also face increased dangers.\nMining productivity research, will overhaul your mining equipment,\nreinforcing your pickaxe as well as increasing the size of your backpack.\n\nAs you dig, you will encounter impassable dark chasms or rivers.\nArtillery will try to shoot you down! Dig fast, dig north!\n\nSome explosives may cause parts of the ceiling to crumble, filling the void, creating new ways.\nAll they need is a container and a well aimed shot.\n\nEnter the cargo wagon to reveal the wagon surface!\n\nRandom buildings that generate resources can be found throughout the world.\n\nPlacing steel-chests near cargo-wagons enables you to quickly move content.\n\nStaying inside the locomotive aura prevents biters from spawning when mining entities.\n\nRPG GUI is disabled inside the locomotive.\nDisconnecting wagons is disabled.\nYou can´t cancel crafting when standing inside the locomotive aura.\n\nDon't try to run north with your Spidertron if the train is not near you.\nYou have been warned.\n\nGood luck on your journey!
[breached_wall]
@ -10,6 +10,7 @@ spidertron_unlocked=[color=blue]Mapkeeper:[/color]\nAttention! Spidertron has be
wall_breached=[color=blue]Mapkeeper:[/color]\nSurvivor! Well done. You have completed zone __1__!
first_to_reach=[color=blue]Mapkeeper:[/color]\n__1__ was the first to reach zone __2__.
artillery_warning=[color=blue]Mapkeeper:[/color]\nWarning, Artillery have been spotted north!
cheating_through=__1__ tried to cheat their way north with their spidertron!
[entity]
treasure_1=You notice an old crate within the rubble. It's filled with treasure!

View File

@ -0,0 +1,133 @@
local Event = require 'utils.event'
local RPG_Settings = require 'modules.rpg.table'
local insert = table.insert
local floor = math.floor
local random = math.random
local coin_yield = {
['behemoth-biter'] = 5,
['behemoth-spitter'] = 5,
['behemoth-worm-turret'] = 20,
['big-biter'] = 3,
['big-spitter'] = 3,
['big-worm-turret'] = 16,
['biter-spawner'] = 32,
['medium-biter'] = 2,
['medium-spitter'] = 2,
['medium-worm-turret'] = 12,
['small-biter'] = 1,
['small-spitter'] = 1,
['small-worm-turret'] = 8,
['spitter-spawner'] = 32
}
local entities_that_earn_coins = {
['artillery-turret'] = true,
['gun-turret'] = true,
['laser-turret'] = true,
['flamethrower-turret'] = true
}
--extra coins for "boss" biters from biter_health_booster.lua
local function get_coin_count(entity)
local coin_count = coin_yield[entity.name]
if not coin_count then
return
end
if not global.biter_health_boost_units then
return coin_count
end
local unit_number = entity.unit_number
if not unit_number then
return coin_count
end
if not global.biter_health_boost_units[unit_number] then
return coin_count
end
if not global.biter_health_boost_units[unit_number][3] then
return coin_count
end
local m = 1 / global.biter_health_boost_units[unit_number][2]
coin_count = floor(coin_count * m)
if coin_count < 1 then
return 1
end
return coin_count
end
local function on_entity_died(event)
local entity = event.entity
if not entity.valid then
return
end
if entity.force.index ~= 2 then
return
end
local cause = event.cause
local coin_count = get_coin_count(entity)
if not coin_count then
return
end
local players_to_reward = {}
local p
local reward_has_been_given = false
if cause then
if cause.valid then
if (cause and cause.name == 'character' and cause.player) then
p = cause.player
end
if cause.name == 'character' then
insert(players_to_reward, cause)
reward_has_been_given = true
end
if cause.type == 'car' then
local player = cause.get_driver()
local passenger = cause.get_passenger()
if player then
insert(players_to_reward, player.player)
end
if passenger then
insert(players_to_reward, passenger.player)
end
reward_has_been_given = true
end
if cause.type == 'locomotive' then
local train_passengers = cause.train.passengers
if train_passengers then
for _, passenger in pairs(train_passengers) do
insert(players_to_reward, passenger)
end
reward_has_been_given = true
end
end
for _, player in pairs(players_to_reward) do
local forest_zone
if p then
forest_zone = RPG_Settings.get_value_from_player(p.index, 'forest_zone')
end
if forest_zone then
if random(1, 6) == 1 then
player.insert({name = 'coin', count = coin_count})
end
else
player.insert({name = 'coin', count = coin_count})
end
end
end
if entities_that_earn_coins[cause.name] then
event.entity.surface.spill_item_stack(cause.position, {name = 'coin', count = coin_count}, true)
reward_has_been_given = true
end
end
if reward_has_been_given == false then
event.entity.surface.spill_item_stack(event.entity.position, {name = 'coin', count = coin_count}, true)
end
end
Event.add(defines.events.on_entity_died, on_entity_died)

View File

@ -4,7 +4,19 @@ local get_noise = require 'utils.get_noise'
local math_abs = math.abs
local math_round = math.round
function Public.set_daytime(surface, tick)
function Public.set_daytime(surface, tick, static)
if static then
surface.brightness_visual_weights = {
a = 1,
b = 1,
g = 1,
r = 0.57314002513885498
}
surface.daytime = 0.55
surface.freeze_daytime = true
return
end
local noise = get_noise('n1', {x = tick * 1, y = 0}, surface.map_gen_settings.seed)
local daytime = math_abs(math_round(noise, 5))
@ -26,6 +38,7 @@ function Public.set_daytime(surface, tick)
daytime = 0.55
end
surface.daytime = daytime
surface.freeze_daytime = true
end
return Public

View File

@ -69,6 +69,39 @@ local artillery_warning =
end
)
local spidertron_too_far =
Token.register(
function(data)
local player = data.player
local message = ({'breached_wall.cheating_through', player.name})
Alert.alert_all_players(30, message)
end
)
local compare_player_and_train = function(player, entity)
local position = player.position
local locomotive = WPT.get('locomotive')
if not locomotive or not locomotive.valid then
return
end
local c_y = position.y
local t_y = locomotive.position.y
local gap_between_zones = WPT.get('gap_between_zones')
if c_y - t_y <= gap_between_zones.neg_gap then
if entity.health then
entity.health = entity.health - 500
if entity.health <= 0 then
entity.die('enemy')
Task.set_timeout_in_ticks(30, spidertron_too_far, {player = player})
return
end
end
end
end
local function distance(player)
local index = player.index
local bonus = RPG_Settings.get_value_from_player(index, 'bonus')
@ -77,6 +110,15 @@ local function distance(player)
local bonus_xp_on_join = WPT.get('bonus_xp_on_join')
local enable_arties = WPT.get('enable_arties')
local s = WPT.get('validate_spider')
if s[index] then
local e = s[index]
if not (e and e.valid) then
s[index] = nil
end
compare_player_and_train(player, s[index])
end
local distance_to_center = floor(sqrt(player.position.x ^ 2 + player.position.y ^ 2))
local location = distance_to_center
if location < Terrain.level_depth * bonus - 10 then
@ -94,6 +136,7 @@ local function distance(player)
WPT.set().breached_wall = breached_wall + 1
WPT.set().placed_trains_in_zone.placed = 0
WPT.set().biters.amount = 0
WPT.set('blood_moon', false)
WPT.set().placed_trains_in_zone.randomized = false
WPT.set().placed_trains_in_zone.positions = {}
raise_event(Balance.events.breached_wall, {})
@ -114,12 +157,24 @@ local function distance(player)
end
end
if breached_wall == 3 or breached_wall == 11 then
if breached_wall % 2 == 0 then
local blood_moon = WPT.get('blood_moon')
local t = game.tick
local s = player.surface
if t % 2 == 0 then
BM.set_daytime(s, t)
if not blood_moon then
BM.set_daytime(s, t, true)
WPT.set('blood_moon', true)
end
else
local s = player.surface
s.brightness_visual_weights = {
a = 1,
b = 0,
g = 0,
r = 0
}
s.daytime = 0.7
s.freeze_daytime = false
end
local data = {
@ -133,6 +188,7 @@ local function distance(player)
end
end
end
if not Collapse.start_now() then
Collapse.start_now(true)
local data = {
@ -140,6 +196,7 @@ local function distance(player)
}
Task.set_timeout_in_ticks(550, collapse_message, data)
end
RPG_Settings.set_value_to_player(index, 'bonus', bonus + 1)
local b = RPG_Settings.get_value_from_player(index, 'bonus')
@ -176,4 +233,26 @@ local function on_player_changed_position(event)
distance(player)
end
local function on_player_driving_changed_state(event)
local player = game.players[event.player_index]
if not (player and player.valid) then
return
end
local entity = event.entity
if not (entity and entity.valid) then
return
end
local s = WPT.get('validate_spider')
if entity.name == 'spidertron' then
if not s[player.index] then
s[player.index] = entity
end
else
if s[player.index] then
s[player.index] = nil
end
end
end
Event.add(defines.events.on_player_changed_position, on_player_changed_position)
Event.add(defines.events.on_player_driving_changed_state, on_player_driving_changed_state)

View File

@ -78,19 +78,33 @@ local function spawn_biters(data)
end
end
local m = 0.0015
if d.difficulty_vote_index then
if not d.strength_modifier then
m = m * 1.05
else
m = m * d.strength_modifier
local function trigger_health()
local m = 0.0015
if d.difficulty_vote_index then
if not d.strength_modifier then
m = m * 1.05
else
m = m * d.strength_modifier
end
end
end
local boosted_health = 1 + (wave_number * (m * 2))
local boosted_health = 1.25
if wave_number >= 100 then
boosted_health = boosted_health * 2
if wave_number <= 10 then
wave_number = 10
end
boosted_health = boosted_health * (wave_number * 0.02)
local sum = boosted_health * 5
sum = sum + m
if sum >= 100 then
sum = 100
end
return sum
end
BiterRolls.wave_defense_set_unit_raffle(h * 0.20)
@ -104,9 +118,10 @@ local function spawn_biters(data)
max_biters.amount = max_biters.amount + 1
end
if random(1, 64) == 1 then
if random(1, 32) == 1 then
local sum = trigger_health()
max_biters.amount = max_biters.amount + 1
BiterHealthBooster.add_boss_unit(unit, boosted_health, 0.38)
BiterHealthBooster.add_boss_unit(unit, sum, 0.38)
end
end

View File

@ -351,10 +351,10 @@ local function angry_tree(entity, cause, player)
if abs(entity.position.y) < Terrain.level_depth then
return
end
if random(1, 16) == 1 then
if random(1, 32) == 1 then
BuriedEnemies.buried_biter(entity.surface, entity.position)
end
if random(1, 16) == 1 then
if random(1, 32) == 1 then
BuriedEnemies.buried_worm(entity.surface, entity.position)
end
if random(1, 32) ~= 1 then
@ -407,7 +407,7 @@ local function give_coin(player)
local forest_zone = RPG_Settings.get_value_from_player(player.index, 'forest_zone')
if forest_zone then
if random(1, 32) ~= 1 then
if random(1, 3) ~= 1 then
return
end
end

View File

@ -2,13 +2,13 @@ require 'maps.mountain_fortress_v3.generate'
require 'maps.mountain_fortress_v3.commands'
require 'maps.mountain_fortress_v3.breached_wall'
require 'maps.mountain_fortress_v3.ic.main'
require 'maps.mountain_fortress_v3.biters_yield_coins'
require 'modules.rpg.main'
require 'modules.shotgun_buff'
require 'modules.no_deconstruction_of_neutral_entities'
require 'modules.rocks_yield_ore_veins'
require 'modules.spawners_contain_biters'
require 'modules.biters_yield_coins'
require 'modules.wave_defense.main'
require 'modules.charging_station'

View File

@ -94,7 +94,8 @@ function Public.reset_table()
this.locomotive_max_health = 10000
this.gap_between_zones = {
set = false,
gap = 900
gap = 900,
neg_gap = -300
}
this.force_chunk = false
this.train_upgrades = 0
@ -177,6 +178,7 @@ function Public.reset_table()
this.spidertron_unlocked_at_wave = 11
-- this.void_or_tile = 'lab-dark-2'
this.void_or_tile = 'out-of-map'
this.validate_spider = {}
--!reset player tables
for _, player in pairs(this.players) do
@ -193,7 +195,7 @@ function Public.get(key)
end
function Public.set(key, value)
if key and value then
if key and (value or value == false) then
this[key] = value
return this[key]
elseif key then