mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-03-29 21:47:08 +02:00
Fix fish defender v2
This commit is contained in:
parent
62312a5462
commit
99e73627af
@ -43,7 +43,7 @@ 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
|
||||
|
@ -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
|
||||
|
||||
|
@ -58,54 +58,55 @@ local function refresh_market_offers()
|
||||
{ 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 = { 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,7 +114,7 @@ local function refresh_market_offers()
|
||||
if not Public.get('trapped_capsules_unlocked') then
|
||||
market.add_market_item(
|
||||
{
|
||||
price = {{'coin', 3500}},
|
||||
price = { { name = 'coin', count = 3500 } },
|
||||
offer = { type = 'nothing', effect_description = special_descriptions['trapped-capsules'] }
|
||||
}
|
||||
)
|
||||
@ -121,7 +122,7 @@ local function refresh_market_offers()
|
||||
if not Public.get('explosive_bullets_unlocked') then
|
||||
market.add_market_item(
|
||||
{
|
||||
price = {{'coin', 4500}},
|
||||
price = { { name = 'coin', count = 4500 } },
|
||||
offer = { type = 'nothing', effect_description = special_descriptions['explosive-bullets'] }
|
||||
}
|
||||
)
|
||||
@ -129,7 +130,7 @@ local function refresh_market_offers()
|
||||
if not Public.get('bouncy_shells_unlocked') then
|
||||
market.add_market_item(
|
||||
{
|
||||
price = {{'coin', 10000}},
|
||||
price = { { name = 'coin', count = 10000 } },
|
||||
offer = { type = 'nothing', effect_description = special_descriptions['bouncy-shells'] }
|
||||
}
|
||||
)
|
||||
@ -137,7 +138,7 @@ local function refresh_market_offers()
|
||||
if not Public.get('vehicle_nanobots_unlocked') then
|
||||
market.add_market_item(
|
||||
{
|
||||
price = {{'coin', 15000}},
|
||||
price = { { name = 'coin', count = 15000 } },
|
||||
offer = { type = 'nothing', effect_description = special_descriptions['vehicle-nanobots'] }
|
||||
}
|
||||
)
|
||||
@ -153,7 +154,7 @@ local function refresh_market_offers()
|
||||
if not Public.get('laser_pointer_unlocked') then
|
||||
market.add_market_item(
|
||||
{
|
||||
price = {{'coin', 65000}},
|
||||
price = { { name = 'coin', count = 65000 } },
|
||||
offer = { type = 'nothing', effect_description = special_descriptions['laser-pointer'] }
|
||||
}
|
||||
)
|
||||
|
@ -44,7 +44,7 @@ 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 = {}
|
||||
|
@ -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
|
||||
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
|
||||
storage.fish_in_space = storage.fish_in_space + launched_fish_count
|
||||
end
|
||||
|
||||
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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user