1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-03-25 21:29:06 +02:00

Fix fish defender v2

This commit is contained in:
Gerkiz 2024-10-22 23:49:08 +02:00
parent 62312a5462
commit 99e73627af
5 changed files with 144 additions and 135 deletions

View File

@ -28,13 +28,13 @@ local function on_player_changed_position(event)
end
if flame_boots[player.index].fuel < 0 then
player.print('Your flame boots have worn out.', {r = 0.22, g = 0.77, b = 0.44})
player.print('Your flame boots have worn out.', { r = 0.22, g = 0.77, b = 0.44 })
flame_boots[player.index] = {}
return
end
if flame_boots[player.index].fuel % 500 == 0 then
player.print('Fuel remaining: ' .. flame_boots[player.index].fuel, {r = 0.22, g = 0.77, b = 0.44})
player.print('Fuel remaining: ' .. flame_boots[player.index].fuel, { r = 0.22, g = 0.77, b = 0.44 })
end
if not flame_boots[player.index].step_history then
@ -43,13 +43,13 @@ local function on_player_changed_position(event)
local elements = #flame_boots[player.index].step_history
flame_boots[player.index].step_history[elements + 1] = {x = player.position.x, y = player.position.y}
flame_boots[player.index].step_history[elements + 1] = { x = player.physical_position.x, y = player.physical_position.y }
if elements < 50 then
return
end
player.surface.create_entity({name = 'fire-flame', position = flame_boots[player.index].step_history[elements - 2]})
player.surface.create_entity({ name = 'fire-flame', position = flame_boots[player.index].step_history[elements - 2] })
flame_boots[player.index].fuel = flame_boots[player.index].fuel - 1
end

View File

@ -253,6 +253,13 @@ local function on_market_item_purchased()
end
local function get_biter_initial_pool()
local active_surface_index = Public.get('active_surface_index')
local surface = game.surfaces[active_surface_index]
if not surface or not surface.valid then
return
end
local evo = game.forces.enemy.get_evolution_factor(surface)
local wave_count = Public.get('wave_count')
local biter_pool
if wave_count > 1750 then
@ -286,14 +293,14 @@ local function get_biter_initial_pool()
}
return biter_pool
end
if game.forces.enemy.evolution_factor < 0.1 then
if evo < 0.1 then
biter_pool = {
{ name = 'small-biter', threat = threat_values.small_biter, weight = 3 },
{ name = 'small-spitter', threat = threat_values.small_spitter, weight = 1 }
}
return biter_pool
end
if game.forces.enemy.evolution_factor < 0.2 then
if evo < 0.2 then
biter_pool = {
{ name = 'small-biter', threat = threat_values.small_biter, weight = 10 },
{ name = 'medium-biter', threat = threat_values.medium_biter, weight = 2 },
@ -302,7 +309,7 @@ local function get_biter_initial_pool()
}
return biter_pool
end
if game.forces.enemy.evolution_factor < 0.3 then
if evo < 0.3 then
biter_pool = {
{ name = 'small-biter', threat = threat_values.small_biter, weight = 18 },
{ name = 'medium-biter', threat = threat_values.medium_biter, weight = 6 },
@ -312,7 +319,7 @@ local function get_biter_initial_pool()
}
return biter_pool
end
if game.forces.enemy.evolution_factor < 0.4 then
if evo < 0.4 then
biter_pool = {
{ name = 'small-biter', threat = threat_values.small_biter, weight = 2 },
{ name = 'medium-biter', threat = threat_values.medium_biter, weight = 8 },
@ -323,7 +330,7 @@ local function get_biter_initial_pool()
}
return biter_pool
end
if game.forces.enemy.evolution_factor < 0.5 then
if evo < 0.5 then
biter_pool = {
{ name = 'small-biter', threat = threat_values.small_biter, weight = 2 },
{ name = 'medium-biter', threat = threat_values.medium_biter, weight = 4 },
@ -334,7 +341,7 @@ local function get_biter_initial_pool()
}
return biter_pool
end
if game.forces.enemy.evolution_factor < 0.6 then
if evo < 0.6 then
biter_pool = {
{ name = 'medium-biter', threat = threat_values.medium_biter, weight = 4 },
{ name = 'big-biter', threat = threat_values.big_biter, weight = 8 },
@ -343,7 +350,7 @@ local function get_biter_initial_pool()
}
return biter_pool
end
if game.forces.enemy.evolution_factor < 0.7 then
if evo < 0.7 then
biter_pool = {
{ name = 'behemoth-biter', threat = threat_values.small_biter, weight = 2 },
{ name = 'medium-biter', threat = threat_values.medium_biter, weight = 12 },
@ -354,7 +361,7 @@ local function get_biter_initial_pool()
}
return biter_pool
end
if game.forces.enemy.evolution_factor < 0.8 then
if evo < 0.8 then
biter_pool = {
{ name = 'behemoth-biter', threat = threat_values.small_biter, weight = 2 },
{ name = 'medium-biter', threat = threat_values.medium_biter, weight = 4 },
@ -365,7 +372,7 @@ local function get_biter_initial_pool()
}
return biter_pool
end
if game.forces.enemy.evolution_factor <= 0.9 then
if evo <= 0.9 then
biter_pool = {
{ name = 'big-biter', threat = threat_values.big_biter, weight = 12 },
{ name = 'behemoth-biter', threat = threat_values.behemoth_biter, weight = 2 },
@ -374,7 +381,7 @@ local function get_biter_initial_pool()
}
return biter_pool
end
if game.forces.enemy.evolution_factor <= 1 then
if evo <= 1 then
biter_pool = {
{ name = 'big-biter', threat = threat_values.big_biter, weight = 4 },
{ name = 'behemoth-biter', threat = threat_values.behemoth_biter, weight = 2 },
@ -483,17 +490,6 @@ local function send_unit_group(unit_group)
if not (market and market.valid) then
return
end
for x = unit_group.position.x, market.position.x, -48 do
local destination = unit_group.surface.find_non_colliding_position('stone-wall', { x = x, y = unit_group.position.y }, 32, 4)
if destination then
commands[#commands + 1] = {
type = defines.command.attack_area,
destination = destination,
radius = 16,
distraction = defines.distraction.by_enemy
}
end
end
commands[#commands + 1] = {
type = defines.command.attack_area,
destination = { x = market.position.x, y = unit_group.position.y },
@ -509,7 +505,7 @@ local function send_unit_group(unit_group)
unit_group.set_command(
{
type = defines.command.compound,
structure_type = defines.compound_command.logical_and,
structure_type = defines.compound_command.return_last,
commands = commands
}
)
@ -606,6 +602,7 @@ local function wake_up_the_biters(surface)
end
end
surface.set_multi_command(
{
command = {
@ -694,7 +691,8 @@ local function biter_attack_wave()
if evolution > 1 then
evolution = 1
end
game.forces.enemy.evolution_factor = evolution
game.forces.enemy.set_evolution_factor(evolution, surface)
local y_raffle = get_y_coord_raffle_table()
@ -993,7 +991,7 @@ local function market_kill_visuals()
end
end
end
surface.spill_item_stack(market.position, { name = 'raw-fish', count = 1024 }, true)
surface.spill_item_stack({ position = market.position, stack = { name = 'raw-fish', count = 1024, quality = 'normal' }, enable_looted = true })
end
local function on_entity_died(event)
@ -1224,12 +1222,12 @@ local function on_player_changed_position(event)
return
end
if player.position.x >= 254 then
player.teleport({ player.position.x - 2, player.position.y }, surface)
if player.physical_position.x >= 254 then
player.teleport({ player.physical_position.x - 2, player.physical_position.y }, surface)
if player.character then
player.character.health = player.character.health - 25
player.character.surface.create_entity({ name = 'water-splash', position = player.position })
player.character.surface.create_entity({ name = 'water-splash', position = player.physical_position })
if player.character.health <= 0 then
player.character.die('enemy')
end
@ -1438,6 +1436,8 @@ function Public.reset_game()
['enemy-base'] = { frequency = 'none', size = 'none', richness = 'none' }
}
map_gen_settings.default_enable_all_autoplace_controls = false
local active_surface_index = Public.get('active_surface_index')
if not active_surface_index then
@ -1598,7 +1598,7 @@ local function on_tick()
if tick % 180 == 0 then
if surface then
game.forces.player.chart(surface, { { -160, -130 }, { 160, 179 } })
Public.set('wave_interval', Public.get_current_difficulty_wave_interval())
-- Public.set('wave_interval', Public.get_current_difficulty_wave_interval())
end
end

View File

@ -2,11 +2,11 @@ local Event = require 'utils.event'
local Public = require 'maps.fish_defender_v2.table'
local slot_upgrade_offers = {
[1] = {'ammo-turret', 'gun turret'},
[2] = {'electric-turret', 'laser turret'},
[3] = {'artillery-turret', 'artillery turret'},
[4] = {'fluid-turret', 'flamethrower turret'},
[5] = {'land-mine', 'land mine'}
[1] = { 'ammo-turret', 'gun turret' },
[2] = { 'electric-turret', 'laser turret' },
[3] = { 'artillery-turret', 'artillery turret' },
[4] = { 'fluid-turret', 'flamethrower turret' },
[5] = { 'land-mine', 'land mine' }
}
local special_descriptions = {
@ -53,59 +53,60 @@ local function refresh_market_offers()
str5 = str5 .. ' Coins.'
local market_items = {
{price = {}, offer = {type = 'nothing', effect_description = str1}},
{price = {}, offer = {type = 'nothing', effect_description = str2}},
{price = {}, offer = {type = 'nothing', effect_description = str3}},
{price = {}, offer = {type = 'nothing', effect_description = str4}},
{price = {}, offer = {type = 'nothing', effect_description = str5}},
{price = {{'coin', 5}}, offer = {type = 'give-item', item = 'raw-fish', count = 1}},
{price = {{'coin', 1}}, offer = {type = 'give-item', item = 'wood', count = 8}},
{price = {{'coin', 8}}, offer = {type = 'give-item', item = 'grenade', count = 1}},
{price = {{'coin', 32}}, offer = {type = 'give-item', item = 'cluster-grenade', count = 1}},
{price = {{'coin', 1}}, offer = {type = 'give-item', item = 'land-mine', count = 1}},
{price = {{'coin', 80}}, offer = {type = 'give-item', item = 'car', count = 1}},
{price = {{'coin', 1200}}, offer = {type = 'give-item', item = 'tank', count = 1}},
{price = {{'coin', 3}}, offer = {type = 'give-item', item = 'cannon-shell', count = 1}},
{price = {{'coin', 7}}, offer = {type = 'give-item', item = 'explosive-cannon-shell', count = 1}},
{price = {{'coin', 50}}, offer = {type = 'give-item', item = 'gun-turret', count = 1}},
{price = {{'coin', 300}}, offer = {type = 'give-item', item = 'laser-turret', count = 1}},
{price = {{'coin', 450}}, offer = {type = 'give-item', item = 'artillery-turret', count = 1}},
{price = {{'coin', 10}}, offer = {type = 'give-item', item = 'artillery-shell', count = 1}},
{price = {{'coin', 25}}, offer = {type = 'give-item', item = 'artillery-targeting-remote', count = 1}},
{price = {{'coin', 1}}, offer = {type = 'give-item', item = 'firearm-magazine', count = 1}},
{price = {{'coin', 4}}, offer = {type = 'give-item', item = 'piercing-rounds-magazine', count = 1}},
{price = {{'coin', 2}}, offer = {type = 'give-item', item = 'shotgun-shell', count = 1}},
{price = {{'coin', 6}}, offer = {type = 'give-item', item = 'piercing-shotgun-shell', count = 1}},
{price = {{'coin', 30}}, offer = {type = 'give-item', item = 'submachine-gun', count = 1}},
{price = {{'coin', 250}}, offer = {type = 'give-item', item = 'combat-shotgun', count = 1}},
{price = {{'coin', 450}}, offer = {type = 'give-item', item = 'flamethrower', count = 1}},
{price = {{'coin', 25}}, offer = {type = 'give-item', item = 'flamethrower-ammo', count = 1}},
{price = {{'coin', 125}}, offer = {type = 'give-item', item = 'rocket-launcher', count = 1}},
{price = {{'coin', 2}}, offer = {type = 'give-item', item = 'rocket', count = 1}},
{price = {{'coin', 7}}, offer = {type = 'give-item', item = 'explosive-rocket', count = 1}},
{price = {{'coin', 7500}}, offer = {type = 'give-item', item = 'atomic-bomb', count = 1}},
{price = {{'coin', 40}}, offer = {type = 'give-item', item = 'poison-capsule', count = 1}},
{price = {{'coin', 4}}, offer = {type = 'give-item', item = 'defender-capsule', count = 1}},
{price = {{'coin', 10}}, offer = {type = 'give-item', item = 'light-armor', count = 1}},
{price = {{'coin', 125}}, offer = {type = 'give-item', item = 'heavy-armor', count = 1}},
{price = {{'coin', 350}}, offer = {type = 'give-item', item = 'modular-armor', count = 1}},
{price = {{'coin', 1500}}, offer = {type = 'give-item', item = 'power-armor', count = 1}},
{price = {{'coin', 12000}}, offer = {type = 'give-item', item = 'power-armor-mk2', count = 1}},
{price = {{'coin', 50}}, offer = {type = 'give-item', item = 'solar-panel-equipment', count = 1}},
{price = {{'coin', 2250}}, offer = {type = 'give-item', item = 'fusion-reactor-equipment', count = 1}},
{price = {{'coin', 100}}, offer = {type = 'give-item', item = 'battery-equipment', count = 1}},
{price = {{'coin', 200}}, offer = {type = 'give-item', item = 'energy-shield-equipment', count = 1}},
{price = {{'coin', 850}}, offer = {type = 'give-item', item = 'personal-laser-defense-equipment', count = 1}},
{price = {{'coin', 175}}, offer = {type = 'give-item', item = 'exoskeleton-equipment', count = 1}},
{price = {{'coin', 125}}, offer = {type = 'give-item', item = 'night-vision-equipment', count = 1}},
{price = {{'coin', 200}}, offer = {type = 'give-item', item = 'belt-immunity-equipment', count = 1}},
{price = {{'coin', 250}}, offer = {type = 'give-item', item = 'personal-roboport-equipment', count = 1}},
{price = {{'coin', 350}}, offer = {type = 'give-item', item = 'roboport', count = 1}},
{price = {{'coin', 50}}, offer = {type = 'give-item', item = 'logistic-chest-storage', count = 1}},
{price = {{'coin', 35}}, offer = {type = 'give-item', item = 'construction-robot', count = 1}},
{price = {{'coin', 25}}, offer = {type = 'give-item', item = 'cliff-explosives', count = 1}}
{ price = {}, offer = { type = 'nothing', effect_description = str1 } },
{ price = {}, offer = { type = 'nothing', effect_description = str2 } },
{ price = {}, offer = { type = 'nothing', effect_description = str3 } },
{ price = {}, offer = { type = 'nothing', effect_description = str4 } },
{ price = {}, offer = { type = 'nothing', effect_description = str5 } },
{ price = { name = { 'coin', count = 5 } }, offer = { type = 'give-item', item = 'raw-fish', count = 1 } },
{ price = { name = { 'coin', count = 1 } }, offer = { type = 'give-item', item = 'wood', count = 8 } },
{ price = { name = { 'coin', count = 8 } }, offer = { type = 'give-item', item = 'grenade', count = 1 } },
{ price = { name = { 'coin', count = 32 } }, offer = { type = 'give-item', item = 'cluster-grenade', count = 1 } },
{ price = { name = { 'coin', count = 1 } }, offer = { type = 'give-item', item = 'land-mine', count = 1 } },
{ price = { name = { 'coin', count = 80 } }, offer = { type = 'give-item', item = 'car', count = 1 } },
{ price = { name = { 'coin', count = 1200 } }, offer = { type = 'give-item', item = 'tank', count = 1 } },
{ price = { name = { 'coin', count = 3 } }, offer = { type = 'give-item', item = 'cannon-shell', count = 1 } },
{ price = { name = { 'coin', count = 7 } }, offer = { type = 'give-item', item = 'explosive-cannon-shell', count = 1 } },
{ price = { name = { 'coin', count = 50 } }, offer = { type = 'give-item', item = 'gun-turret', count = 1 } },
{ price = { name = { 'coin', count = 300 } }, offer = { type = 'give-item', item = 'laser-turret', count = 1 } },
{ price = { name = { 'coin', count = 450 } }, offer = { type = 'give-item', item = 'artillery-turret', count = 1 } },
{ price = { name = { 'coin', count = 10 } }, offer = { type = 'give-item', item = 'artillery-shell', count = 1 } },
{ price = { name = { 'coin', count = 25 } }, offer = { type = 'give-item', item = 'artillery-targeting-remote', count = 1 } },
{ price = { name = { 'coin', count = 1 } }, offer = { type = 'give-item', item = 'firearm-magazine', count = 1 } },
{ price = { name = { 'coin', count = 4 } }, offer = { type = 'give-item', item = 'piercing-rounds-magazine', count = 1 } },
{ price = { name = { 'coin', count = 2 } }, offer = { type = 'give-item', item = 'shotgun-shell', count = 1 } },
{ price = { name = { 'coin', count = 6 } }, offer = { type = 'give-item', item = 'piercing-shotgun-shell', count = 1 } },
{ price = { name = { 'coin', count = 30 } }, offer = { type = 'give-item', item = 'submachine-gun', count = 1 } },
{ price = { name = { 'coin', count = 250 } }, offer = { type = 'give-item', item = 'combat-shotgun', count = 1 } },
{ price = { name = { 'coin', count = 450 } }, offer = { type = 'give-item', item = 'flamethrower', count = 1 } },
{ price = { name = { 'coin', count = 25 } }, offer = { type = 'give-item', item = 'flamethrower-ammo', count = 1 } },
{ price = { name = { 'coin', count = 125 } }, offer = { type = 'give-item', item = 'rocket-launcher', count = 1 } },
{ price = { name = { 'coin', count = 2 } }, offer = { type = 'give-item', item = 'rocket', count = 1 } },
{ price = { name = { 'coin', count = 7 } }, offer = { type = 'give-item', item = 'explosive-rocket', count = 1 } },
{ price = { name = { 'coin', count = 7500 } }, offer = { type = 'give-item', item = 'atomic-bomb', count = 1 } },
{ price = { name = { 'coin', count = 40 } }, offer = { type = 'give-item', item = 'poison-capsule', count = 1 } },
{ price = { name = { 'coin', count = 4 } }, offer = { type = 'give-item', item = 'defender-capsule', count = 1 } },
{ price = { name = { 'coin', count = 10 } }, offer = { type = 'give-item', item = 'light-armor', count = 1 } },
{ price = { name = { 'coin', count = 125 } }, offer = { type = 'give-item', item = 'heavy-armor', count = 1 } },
{ price = { name = { 'coin', count = 350 } }, offer = { type = 'give-item', item = 'modular-armor', count = 1 } },
{ price = { name = { 'coin', count = 1500 } }, offer = { type = 'give-item', item = 'power-armor', count = 1 } },
{ price = { name = { 'coin', count = 12000 } }, offer = { type = 'give-item', item = 'power-armor-mk2', count = 1 } },
{ price = { name = { 'coin', count = 50 } }, offer = { type = 'give-item', item = 'solar-panel-equipment', count = 1 } },
{ price = { name = { 'coin', count = 2250 } }, offer = { type = 'give-item', item = 'fission-reactor-equipment', count = 1 } },
{ price = { name = { 'coin', count = 100 } }, offer = { type = 'give-item', item = 'battery-equipment', count = 1 } },
{ price = { name = { 'coin', count = 200 } }, offer = { type = 'give-item', item = 'energy-shield-equipment', count = 1 } },
{ price = { name = { 'coin', count = 850 } }, offer = { type = 'give-item', item = 'personal-laser-defense-equipment', count = 1 } },
{ price = { name = { 'coin', count = 175 } }, offer = { type = 'give-item', item = 'exoskeleton-equipment', count = 1 } },
{ price = { name = { 'coin', count = 125 } }, offer = { type = 'give-item', item = 'night-vision-equipment', count = 1 } },
{ price = { name = { 'coin', count = 200 } }, offer = { type = 'give-item', item = 'belt-immunity-equipment', count = 1 } },
{ price = { name = { 'coin', count = 250 } }, offer = { type = 'give-item', item = 'personal-roboport-equipment', count = 1 } },
{ price = { name = { 'coin', count = 350 } }, offer = { type = 'give-item', item = 'roboport', count = 1 } },
{ price = { name = { 'coin', count = 50 } }, offer = { type = 'give-item', item = 'storage-chest', count = 1 } },
{ price = { name = { 'coin', count = 35 } }, offer = { type = 'give-item', item = 'construction-robot', count = 1 } },
{ price = { name = { 'coin', count = 25 } }, offer = { type = 'give-item', item = 'cliff-explosives', count = 1 } }
}
for _, item in pairs(market_items) do
market.add_market_item(item)
end
@ -113,32 +114,32 @@ local function refresh_market_offers()
if not Public.get('trapped_capsules_unlocked') then
market.add_market_item(
{
price = {{'coin', 3500}},
offer = {type = 'nothing', effect_description = special_descriptions['trapped-capsules']}
price = { { name = 'coin', count = 3500 } },
offer = { type = 'nothing', effect_description = special_descriptions['trapped-capsules'] }
}
)
end
if not Public.get('explosive_bullets_unlocked') then
market.add_market_item(
{
price = {{'coin', 4500}},
offer = {type = 'nothing', effect_description = special_descriptions['explosive-bullets']}
price = { { name = 'coin', count = 4500 } },
offer = { type = 'nothing', effect_description = special_descriptions['explosive-bullets'] }
}
)
end
if not Public.get('bouncy_shells_unlocked') then
market.add_market_item(
{
price = {{'coin', 10000}},
offer = {type = 'nothing', effect_description = special_descriptions['bouncy-shells']}
price = { { name = 'coin', count = 10000 } },
offer = { type = 'nothing', effect_description = special_descriptions['bouncy-shells'] }
}
)
end
if not Public.get('vehicle_nanobots_unlocked') then
market.add_market_item(
{
price = {{'coin', 15000}},
offer = {type = 'nothing', effect_description = special_descriptions['vehicle-nanobots']}
price = { { name = 'coin', count = 15000 } },
offer = { type = 'nothing', effect_description = special_descriptions['vehicle-nanobots'] }
}
)
end
@ -153,8 +154,8 @@ local function refresh_market_offers()
if not Public.get('laser_pointer_unlocked') then
market.add_market_item(
{
price = {{'coin', 65000}},
offer = {type = 'nothing', effect_description = special_descriptions['laser-pointer']}
price = { { name = 'coin', count = 65000 } },
offer = { type = 'nothing', effect_description = special_descriptions['laser-pointer'] }
}
)
end
@ -175,17 +176,17 @@ local function slot_upgrade(player, offer_index)
price = (entry.limit + 1) * entry.slot_price
end
local coins_removed = player.remove_item({name = 'coin', count = price})
local coins_removed = player.remove_item({ name = 'coin', count = price })
if coins_removed ~= price then
if coins_removed > 0 then
player.insert({name = 'coin', count = coins_removed})
player.insert({ name = 'coin', count = coins_removed })
end
player.print('Not enough coins.', {r = 0.22, g = 0.77, b = 0.44})
player.print('Not enough coins.', { r = 0.22, g = 0.77, b = 0.44 })
return false
end
entity_limits[slot_upgrade_offers[offer_index][1]].limit = entity_limits[slot_upgrade_offers[offer_index][1]].limit + gain
game.print(player.name .. ' has bought a ' .. slot_upgrade_offers[offer_index][2] .. ' slot for ' .. price .. ' coins!', {r = 0.22, g = 0.77, b = 0.44})
game.print(player.name .. ' has bought a ' .. slot_upgrade_offers[offer_index][2] .. ' slot for ' .. price .. ' coins!', { r = 0.22, g = 0.77, b = 0.44 })
refresh_market_offers()
end
@ -211,49 +212,49 @@ local function on_market_item_purchased(event)
end
if bought_offer.effect_description == special_descriptions['explosive-bullets'] then
game.print(player.name .. ' has unlocked explosive bullets.', {r = 0.22, g = 0.77, b = 0.44})
game.print(player.name .. ' has unlocked explosive bullets.', { r = 0.22, g = 0.77, b = 0.44 })
Public.set('explosive_bullets_unlocked', true)
refresh_market_offers()
return
end
if bought_offer.effect_description == special_descriptions['bouncy-shells'] then
game.print(player.name .. ' has unlocked bouncy shells.', {r = 0.22, g = 0.77, b = 0.44})
game.print(player.name .. ' has unlocked bouncy shells.', { r = 0.22, g = 0.77, b = 0.44 })
Public.set('bouncy_shells_unlocked', true)
refresh_market_offers()
return
end
if bought_offer.effect_description == special_descriptions['trapped-capsules'] then
game.print(player.name .. ' has unlocked trapped capsules!', {r = 0.22, g = 0.77, b = 0.44})
game.print(player.name .. ' has unlocked trapped capsules!', { r = 0.22, g = 0.77, b = 0.44 })
Public.set('trapped_capsules_unlocked', true)
refresh_market_offers()
return
end
if bought_offer.effect_description == special_descriptions['ultra-mines'] then
game.print(player.name .. ' has unlocked ultra mines!', {r = 0.22, g = 0.77, b = 0.44})
game.print(player.name .. ' has unlocked ultra mines!', { r = 0.22, g = 0.77, b = 0.44 })
Public.set('ultra_mines_unlocked', true)
refresh_market_offers()
return
end
if bought_offer.effect_description == special_descriptions['laser-pointer'] then
game.print(player.name .. ' has unleashed the quest to slay the red dot!', {r = 0.22, g = 0.77, b = 0.44})
game.print(player.name .. ' has unleashed the quest to slay the red dot!', { r = 0.22, g = 0.77, b = 0.44 })
Public.set('laser_pointer_unlocked', true)
refresh_market_offers()
return
end
if bought_offer.effect_description == special_descriptions['crumbly-walls'] then
game.print(player.name .. ' has unlocked crumbly walls!', {r = 0.22, g = 0.77, b = 0.44})
game.print(player.name .. ' has unlocked crumbly walls!', { r = 0.22, g = 0.77, b = 0.44 })
Public.set('crumbly_walls_unlocked', true)
refresh_market_offers()
return
end
if bought_offer.effect_description == special_descriptions['vehicle-nanobots'] then
game.print(player.name .. ' has unlocked vehicle nanobots!', {r = 0.22, g = 0.77, b = 0.44})
game.print(player.name .. ' has unlocked vehicle nanobots!', { r = 0.22, g = 0.77, b = 0.44 })
Public.set('vehicle_nanobots_unlocked', true)
refresh_market_offers()
return

View File

@ -8,7 +8,7 @@ local Public = {}
Global.register(
this,
function(tbl)
function (tbl)
this = tbl
end
)
@ -44,16 +44,16 @@ function Public.reset_table()
this.market_age = nil
this.last_reset = game.tick
this.wave_interval = 3600
this.wave_grace_period = game.tick + 72000
this.wave_grace_period = game.tick + 7200
-- this.wave_grace_period = game.tick + 3600
this.boss_biters = {}
this.acid_lines_delay = {}
this.entity_limits = {
['ammo-turret'] = {placed = 1, limit = 6, str = 'gun turret', slot_price = 70},
['electric-turret'] = {placed = 0, limit = 1, str = 'laser turret', slot_price = 300},
['artillery-turret'] = {placed = 0, limit = 1, str = 'artillery turret', slot_price = 500},
['fluid-turret'] = {placed = 0, limit = 0, str = 'flamethrower turret', slot_price = 50000},
['land-mine'] = {placed = 0, limit = 1, str = 'mine', slot_price = 20}
['ammo-turret'] = { placed = 1, limit = 6, str = 'gun turret', slot_price = 70 },
['electric-turret'] = { placed = 0, limit = 1, str = 'laser turret', slot_price = 300 },
['artillery-turret'] = { placed = 0, limit = 1, str = 'artillery turret', slot_price = 500 },
['fluid-turret'] = { placed = 0, limit = 0, str = 'flamethrower turret', slot_price = 50000 },
['land-mine'] = { placed = 0, limit = 1, str = 'mine', slot_price = 20 }
}
this.difficulties_votes = {
[1] = {
@ -88,24 +88,24 @@ function Public.reset_table()
}
}
this.boss_waves = {
[50] = {{name = 'big-biter', count = 3}},
[100] = {{name = 'behemoth-biter', count = 1}},
[150] = {{name = 'behemoth-spitter', count = 4}, {name = 'big-spitter', count = 16}},
[50] = { { name = 'big-biter', count = 3 } },
[100] = { { name = 'behemoth-biter', count = 1 } },
[150] = { { name = 'behemoth-spitter', count = 4 }, { name = 'big-spitter', count = 16 } },
[200] = {
{name = 'behemoth-biter', count = 4},
{name = 'behemoth-spitter', count = 2},
{name = 'big-biter', count = 32}
{ name = 'behemoth-biter', count = 4 },
{ name = 'behemoth-spitter', count = 2 },
{ name = 'big-biter', count = 32 }
},
[250] = {
{name = 'behemoth-biter', count = 8},
{name = 'behemoth-spitter', count = 4},
{name = 'big-spitter', count = 32}
{ name = 'behemoth-biter', count = 8 },
{ name = 'behemoth-spitter', count = 4 },
{ name = 'big-spitter', count = 32 }
},
[300] = {{name = 'behemoth-biter', count = 16}, {name = 'behemoth-spitter', count = 8}}
[300] = { { name = 'behemoth-biter', count = 16 }, { name = 'behemoth-spitter', count = 8 } }
}
this.comfylatron_habitat = {
left_top = {x = -1500, y = -1500},
right_bottom = {x = -80, y = 1500}
left_top = { x = -1500, y = -1500 },
right_bottom = { x = -80, y = 1500 }
}
this.shotgun_shell_damage_modifier_old = {}
this.fish_eye = false
@ -167,7 +167,7 @@ function Public.get_current_difficulty_amount_modifier()
end
end
local on_init = function()
local on_init = function ()
Public.reset_table()
end

View File

@ -136,6 +136,8 @@ local function fish_in_space_gui(player)
label.style.font_color = { r = 0.11, g = 0.8, b = 0.44 }
frame.style.bottom_padding = -2
frame.style.minimal_height = 40
local progress = storage.fish_in_space / storage.catplanet_goals[i + 1].goal
if progress > 1 then
progress = 1
@ -180,12 +182,18 @@ local function fireworks(entity)
end
local function on_rocket_launched(event)
local rocket_inventory = event.rocket.get_inventory(defines.inventory.rocket)
local launched_fish_count = rocket_inventory.get_item_count('raw-fish')
if launched_fish_count == 0 then
return
local rocket_inventory = event.rocket.cargo_pod.get_inventory(defines.inventory.cargo_unit)
local slot = rocket_inventory[1]
if slot and slot.valid and slot.valid_for_read then
if slot.name ~= "raw-fish" then
return
end
end
storage.fish_in_space = storage.fish_in_space + launched_fish_count
rocket_inventory.clear()
rocket_inventory.insert({ name = 'space-science-pack', count = 200 })
storage.fish_in_space = storage.fish_in_space + slot.count
local i = get_rank()
@ -282,4 +290,4 @@ Event.on_nth_tick(60, tick)
Event.on_init(on_init)
Event.add(defines.events.on_gui_click, on_gui_click)
Event.add(defines.events.on_player_joined_game, on_player_joined_game)
Event.add(defines.events.on_rocket_launched, on_rocket_launched)
Event.add(defines.events.on_rocket_launch_ordered, on_rocket_launched)