From 049f1162afe4a9909e511e85df69269f36e2ca36 Mon Sep 17 00:00:00 2001 From: Gerkiz Date: Sun, 16 May 2021 13:48:50 +0200 Subject: [PATCH] minor changes to mtn fortress --- locale/en/mtn_fortress_v3.cfg | 4 +- maps/mountain_fortress_v3/buried_enemies.lua | 40 ++++-------- maps/mountain_fortress_v3/entities.lua | 6 +- maps/mountain_fortress_v3/functions.lua | 16 +++-- maps/mountain_fortress_v3/locomotive.lua | 68 ++++++++++++++------ maps/mountain_fortress_v3/loot.lua | 16 ++++- maps/mountain_fortress_v3/table.lua | 5 +- maps/mountain_fortress_v3/terrain.lua | 5 +- 8 files changed, 95 insertions(+), 65 deletions(-) diff --git a/locale/en/mtn_fortress_v3.cfg b/locale/en/mtn_fortress_v3.cfg index d0b7502b..251c640c 100644 --- a/locale/en/mtn_fortress_v3.cfg +++ b/locale/en/mtn_fortress_v3.cfg @@ -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\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! +map_info_sub_caption= ~~ diggy diggy choo choo ~~ +map_info_text=[color=red]First, an announcement!\nIf there are any code bugs or desyncs. Please report asap to @Gerkiz![/color]\n\nThe 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! diff --git a/maps/mountain_fortress_v3/buried_enemies.lua b/maps/mountain_fortress_v3/buried_enemies.lua index b3a99771..dac7d511 100644 --- a/maps/mountain_fortress_v3/buried_enemies.lua +++ b/maps/mountain_fortress_v3/buried_enemies.lua @@ -145,7 +145,7 @@ local function spawn_worms(data) max_biters.amount = max_biters.amount + 1 end -function Public.buried_biter(surface, position, max) +function Public.buried_biter(surface, position) if not (surface and surface.valid) then return end @@ -159,33 +159,21 @@ function Public.buried_biter(surface, position, max) return end - local amount = 8 - local a = 0 - max = max or random(4, 6) - - local ticks = amount * 30 - ticks = ticks + 90 - for t = 1, ticks, 1 do + for t = 1, 60, 1 do if not traps[game.tick + t] then traps[game.tick + t] = {} end traps[game.tick + t][#traps[game.tick + t] + 1] = { callback = 'create_particles', - data = {surface = surface, position = {x = position.x, y = position.y}, amount = 4} + data = {surface = surface, position = {x = position.x, y = position.y}, amount = math.ceil(t * 0.05)} } - if t > 90 then - if t % 30 == 29 then - a = a + 1 - traps[game.tick + t][#traps[game.tick + t] + 1] = { - callback = 'spawn_biters', - data = {surface = surface, position = {x = position.x, y = position.y}} - } - if a >= max then - break - end - end + if t == 60 then + traps[game.tick + t][#traps[game.tick + t] + 1] = { + callback = 'spawn_biters', + data = {surface = surface, position = {x = position.x, y = position.y}} + } end end end @@ -204,27 +192,21 @@ function Public.buried_worm(surface, position) return end - local amount = 8 - - local ticks = amount * 30 - ticks = ticks + 90 - local a = false - for t = 1, ticks, 1 do + for t = 1, 60, 1 do if not traps[game.tick + t] then traps[game.tick + t] = {} end traps[game.tick + t][#traps[game.tick + t] + 1] = { callback = 'create_particles', - data = {surface = surface, position = {x = position.x, y = position.y}, amount = 4} + data = {surface = surface, position = {x = position.x, y = position.y}, amount = math.ceil(t * 0.05)} } - if not a then + if t == 60 then traps[game.tick + t][#traps[game.tick + t] + 1] = { callback = 'spawn_worms', data = {surface = surface, position = {x = position.x, y = position.y}} } - a = true end end end diff --git a/maps/mountain_fortress_v3/entities.lua b/maps/mountain_fortress_v3/entities.lua index 39c67035..88004d73 100644 --- a/maps/mountain_fortress_v3/entities.lua +++ b/maps/mountain_fortress_v3/entities.lua @@ -430,8 +430,8 @@ local function angry_tree(entity, cause, player) if player then local forest_zone = RPG_Settings.get_value_from_player(player.index, 'forest_zone') if forest_zone and random(1, 32) == 1 then - local cbl = Callbacks.power_source_callback - local data = {callback_data = Callbacks.laser_turrent_power_source} + local cbl = Callbacks.refill_turret_callback + local data = {callback_data = Callbacks.piercing_rounds_magazine_ammo} local e = entity.surface.create_entity( { @@ -516,7 +516,7 @@ local mining_events = { return end - BuriedEnemies.buried_biter(entity.surface, entity.position, 1) + BuriedEnemies.buried_biter(entity.surface, entity.position) entity.destroy() end, 4096, diff --git a/maps/mountain_fortress_v3/functions.lua b/maps/mountain_fortress_v3/functions.lua index df4e48d1..adc63f24 100644 --- a/maps/mountain_fortress_v3/functions.lua +++ b/maps/mountain_fortress_v3/functions.lua @@ -128,7 +128,7 @@ local function do_refill_turrets() end end -local function do_turret_energy() +--[[ local function do_turret_energy() local power_sources = this.power_sources for index = 1, #power_sources do @@ -140,8 +140,7 @@ local function do_turret_energy() ps_data.energy = 0xfffff end -end - +end ]] local function do_magic_crafters() local magic_crafters = this.magic_crafters local limit = #magic_crafters @@ -1283,6 +1282,9 @@ local disable_recipes = function(force) force.recipes['car'].enabled = false force.recipes['tank'].enabled = false force.recipes['artillery-wagon'].enabled = false + force.recipes['artillery-turret'].enabled = false + force.recipes['artillery-shell'].enabled = false + force.recipes['artillery-targeting-remote'].enabled = false force.recipes['locomotive'].enabled = false force.recipes['pistol'].enabled = false force.recipes['spidertron-remote'].enabled = false @@ -1295,6 +1297,12 @@ function Public.disable_tech() force.technologies['spidertron'].researched = false force.technologies['atomic-bomb'].enabled = false force.technologies['atomic-bomb'].researched = false + force.technologies['artillery-shell-range-1'].enabled = false + force.technologies['artillery-shell-range-1'].researched = false + force.technologies['artillery-shell-speed-1'].enabled = false + force.technologies['artillery-shell-speed-1'].researched = false + force.technologies['artillery'].enabled = false + force.technologies['artillery'].researched = false force.technologies['optics'].researched = true force.technologies['railway'].researched = true force.technologies['land-mine'].enabled = false @@ -1364,6 +1372,6 @@ Event.add(defines.events.on_research_finished, on_research_finished) Event.add(defines.events.on_player_changed_position, on_player_changed_position) Event.add(defines.events.on_pre_player_left_game, on_pre_player_left_game) Event.on_nth_tick(10, tick) -Event.on_nth_tick(5, do_turret_energy) +-- Event.on_nth_tick(5, do_turret_energy) return Public diff --git a/maps/mountain_fortress_v3/locomotive.lua b/maps/mountain_fortress_v3/locomotive.lua index 1f9caa39..8f590175 100644 --- a/maps/mountain_fortress_v3/locomotive.lua +++ b/maps/mountain_fortress_v3/locomotive.lua @@ -1071,6 +1071,14 @@ local function gui_click(event) return end if name == 'locomotive_max_health' then + if this.health_upgrades >= this.health_upgrades_limit then + local main_market_items = WPT.get('main_market_items') + main_market_items['locomotive_max_health'].enabled = false + main_market_items['locomotive_max_health'].tooltip = ({'locomotive.limit_reached'}) + redraw_market_items(data.item_frame, player, data.search_text) + return + end + player.remove_item({name = item.value, count = item.price}) local message = ({'locomotive.health_bought_info', shopkeeper, player.name, format_number(item.price, true)}) @@ -1080,7 +1088,13 @@ local function gui_click(event) player.name .. ' has bought the locomotive health modifier for ' .. format_number(item.price, true) .. ' coins.' } ) - this.locomotive_max_health = this.locomotive_max_health + (this.locomotive_max_health * 0.5 * item.stack) + + this.locomotive_max_health = this.locomotive_max_health + 10000 + + --[[ + this.locomotive_max_health = this.locomotive_max_health + (this.locomotive_max_health * 0.5) + This exists as a reminder to never ever screw up health pool ever again. + ]] local m = this.locomotive_health / this.locomotive_max_health if this.carriages then @@ -2072,6 +2086,7 @@ function Public.get_items() static = true } end + if main_market_items['chest_limit_outside'] then main_market_items['chest_limit_outside'] = { stack = 1, @@ -2096,16 +2111,30 @@ function Public.get_items() } end - main_market_items['locomotive_max_health'] = { - stack = 1, - value = 'coin', - price = health_cost, - tooltip = ({'main_market.locomotive_max_health'}), - sprite = 'achievement/getting-on-track', - enabled = true, - upgrade = true, - static = true - } + if main_market_items['locomotive_max_health'] then + main_market_items['locomotive_max_health'] = { + stack = 1, + value = 'coin', + price = health_cost, + tooltip = main_market_items['locomotive_max_health'].tooltip, + sprite = 'achievement/getting-on-track', + enabled = main_market_items['locomotive_max_health'].enabled, + upgrade = true, + static = true + } + else + main_market_items['locomotive_max_health'] = { + stack = 1, + value = 'coin', + price = health_cost, + tooltip = ({'main_market.locomotive_max_health'}), + sprite = 'achievement/getting-on-track', + enabled = true, + upgrade = true, + static = true + } + end + main_market_items['locomotive_xp_aura'] = { stack = 1, value = 'coin', @@ -2191,15 +2220,14 @@ function Public.get_items() } 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 - } + main_market_items['express-loader'] = { + stack = 1, + value = 'coin', + price = 512, + tooltip = ({'entity-name.express-loader'}), + upgrade = false, + static = true + } end main_market_items['small-lamp'] = { stack = 1, diff --git a/maps/mountain_fortress_v3/loot.lua b/maps/mountain_fortress_v3/loot.lua index dc415b0a..305628c7 100644 --- a/maps/mountain_fortress_v3/loot.lua +++ b/maps/mountain_fortress_v3/loot.lua @@ -71,7 +71,7 @@ function Public.add(surface, position, chest) end for _ = 1, 3, 1 do - if random(1, 8) == 1 then + if random(1, 16) == 1 then container.insert({name = 'explosives', count = random(25, 50)}) else break @@ -110,8 +110,20 @@ function Public.add_rare(surface, position, chest, magic) end container.minable = false + if random(1, 8) == 1 then + container.insert({name = 'coin', count = random(1, 32)}) + elseif random(1, 32) == 1 then + container.insert({name = 'coin', count = random(1, 128)}) + elseif random(1, 128) == 1 then + container.insert({name = 'coin', count = random(1, 256)}) + elseif random(1, 256) == 1 then + container.insert({name = 'coin', count = random(1, 512)}) + elseif random(1, 512) == 1 then + container.insert({name = 'coin', count = random(1, 2048)}) + end + for _ = 1, 3, 1 do - if random(1, 8) == 1 then + if random(1, 16) == 1 then container.insert({name = 'explosives', count = random(25, 50)}) else break diff --git a/maps/mountain_fortress_v3/table.lua b/maps/mountain_fortress_v3/table.lua index 44f29d08..ccf4f16e 100644 --- a/maps/mountain_fortress_v3/table.lua +++ b/maps/mountain_fortress_v3/table.lua @@ -137,8 +137,9 @@ function Public.reset_table() } this.aura_upgrades = 0 this.pickaxe_tier = 1 - this.pickaxe_speed_per_purchase = 0.10 - this.health_upgrades = 0 + this.pickaxe_speed_per_purchase = 0.07 + this.health_upgrades = 1 + this.health_upgrades_limit = 100 this.breached_wall = 1 this.left_top = { x = 0, diff --git a/maps/mountain_fortress_v3/terrain.lua b/maps/mountain_fortress_v3/terrain.lua index f5c23bb6..5cc9472d 100644 --- a/maps/mountain_fortress_v3/terrain.lua +++ b/maps/mountain_fortress_v3/terrain.lua @@ -91,7 +91,6 @@ local trees = { local firearm_magazine_ammo = Functions.firearm_magazine_ammo local piercing_rounds_magazine_ammo = Functions.piercing_rounds_magazine_ammo local uranium_rounds_magazine_ammo = Functions.uranium_rounds_magazine_ammo -local laser_turrent_power_source = Functions.laser_turrent_power_source local light_oil_ammo = Functions.light_oil_ammo local artillery_shell_ammo = Functions.artillery_shell_ammo @@ -99,7 +98,7 @@ local callback = { [1] = {callback = Functions.refill_turret_callback, data = firearm_magazine_ammo}, [2] = {callback = Functions.refill_turret_callback, data = piercing_rounds_magazine_ammo}, [3] = {callback = Functions.refill_turret_callback, data = uranium_rounds_magazine_ammo}, - [4] = {callback = Functions.power_source_callback, data = laser_turrent_power_source}, + [4] = {callback = Functions.refill_turret_callback, data = uranium_rounds_magazine_ammo}, [5] = {callback = Functions.refill_liquid_turret_callback, data = light_oil_ammo}, [6] = {callback = Functions.refill_artillery_turret_callback, data = artillery_shell_ammo} } @@ -108,7 +107,7 @@ local turret_list = { [1] = {name = 'gun-turret', callback = callback[1]}, [2] = {name = 'gun-turret', callback = callback[2]}, [3] = {name = 'gun-turret', callback = callback[3]}, - [4] = {name = 'laser-turret', callback = callback[4]}, + [4] = {name = 'gun-turret', callback = callback[4]}, [5] = {name = 'flamethrower-turret', callback = callback[5]}, [6] = {name = 'artillery-turret', callback = callback[6]} }