1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-28 03:57:22 +02:00

Update for journey

This commit is contained in:
hanakocz 2025-01-14 17:01:17 +01:00
parent 1da5548398
commit af0d9e3226
4 changed files with 25 additions and 14 deletions

View File

@ -1,6 +1,6 @@
[journey] [journey]
map_info_main_caption=The Journey map_info_main_caption=The Journey
map_info_sub_caption=v 1.9 map_info_sub_caption=v 2.0
map_info_text=The selectors in the mothership, allow you to choose a destination.\nWorlds can be rerolled by spending a satellite at the top selector.\nOnce enough players are on a selector, mothership will start traveling.\n\nA teleporter will be deployed, after reaching the target.\nIt is however, only capable of transfering the subjects body.\n\nWorlds will get more difficult with each jump, stacking the chosen modifiers.\nLaunch uranium fuel cells via rocket cargo, to advance to the next world.\nThe tooltips on the top buttons yield informations about the current world.\nIf the journey ends, an admin can fully reset the map via command "/journey-reset".\n\nHow far will the journey lead? map_info_text=The selectors in the mothership, allow you to choose a destination.\nWorlds can be rerolled by spending a satellite at the top selector.\nOnce enough players are on a selector, mothership will start traveling.\n\nA teleporter will be deployed, after reaching the target.\nIt is however, only capable of transfering the subjects body.\n\nWorlds will get more difficult with each jump, stacking the chosen modifiers.\nLaunch uranium fuel cells via rocket cargo, to advance to the next world.\nThe tooltips on the top buttons yield informations about the current world.\nIf the journey ends, an admin can fully reset the map via command "/journey-reset".\n\nHow far will the journey lead?
tooltip_satellite=Satellites stored: __1__ / __2__\nSatellites are used by Mothership to scout for alternative destinations. tooltip_satellite=Satellites stored: __1__ / __2__\nSatellites are used by Mothership to scout for alternative destinations.

View File

@ -27,7 +27,7 @@ local function clear_selectors(journey)
end end
local function protect(entity, operable) local function protect(entity, operable)
entity.minable = false entity.minable_flag = false
entity.destructible = false entity.destructible = false
entity.operable = operable entity.operable = operable
end end
@ -62,7 +62,7 @@ local function place_teleporter(journey, surface, position, build_beacon)
local beacon = surface.create_entity({ name = 'cargo-landing-pad', position = { x = position.x + 3, y = position.y + 2 }, force = 'player' }) local beacon = surface.create_entity({ name = 'cargo-landing-pad', position = { x = position.x + 3, y = position.y + 2 }, force = 'player' })
journey.beacon_objective_health = 10000 journey.beacon_objective_health = 10000
beacon.operable = true beacon.operable = true
beacon.minable = false beacon.minable_flag = false
beacon.active = true beacon.active = true
rendering.draw_text { rendering.draw_text {
text = { 'journey.teleporter' }, text = { 'journey.teleporter' },
@ -235,7 +235,7 @@ local function delete_nauvis_chunks(journey)
table.insert(journey.nauvis_chunk_positions, { chunk.x, chunk.y }) table.insert(journey.nauvis_chunk_positions, { chunk.x, chunk.y })
end end
journey.size_of_nauvis_chunk_positions = #journey.nauvis_chunk_positions journey.size_of_nauvis_chunk_positions = #journey.nauvis_chunk_positions
for _, e in pairs(surface.find_entities_filtered { type = 'radar' }) do for _, e in pairs(surface.find_entities_filtered { type = {'radar', 'roboport', 'spider-vehicle'} }) do
e.destroy() e.destroy()
end end
for _, player in pairs(game.players) do for _, player in pairs(game.players) do
@ -253,7 +253,7 @@ local function delete_nauvis_chunks(journey)
return return
end end
for _ = 1, 12, 1 do for _ = 1, 1, 1 do --1 chunk per action until 2.0.31! TODO: fix back to 12 when version released
local chunk_position = journey.nauvis_chunk_positions[journey.size_of_nauvis_chunk_positions] local chunk_position = journey.nauvis_chunk_positions[journey.size_of_nauvis_chunk_positions]
if chunk_position then if chunk_position then
surface.delete_chunk(chunk_position) surface.delete_chunk(chunk_position)
@ -526,6 +526,7 @@ function Public.hard_reset(journey)
Autostash.bottom_button(true) Autostash.bottom_button(true)
Misc.bottom_button(true) Misc.bottom_button(true)
if game.surfaces.mothership and game.surfaces.mothership.valid then if game.surfaces.mothership and game.surfaces.mothership.valid then
game.surfaces.mothership.destroy_global_electric_network()
game.delete_surface(game.surfaces.mothership) game.delete_surface(game.surfaces.mothership)
end end
@ -608,6 +609,7 @@ function Public.create_mothership(journey)
local surface = game.create_surface('mothership', Constants.mothership_gen_settings) local surface = game.create_surface('mothership', Constants.mothership_gen_settings)
surface.request_to_generate_chunks({ x = 0, y = 0 }, 6) surface.request_to_generate_chunks({ x = 0, y = 0 }, 6)
surface.force_generate_chunk_requests() surface.force_generate_chunk_requests()
surface.create_global_electric_network()
surface.freeze_daytime = true surface.freeze_daytime = true
journey.game_state = 'draw_mothership' journey.game_state = 'draw_mothership'
end end
@ -694,7 +696,7 @@ function Public.draw_mothership(journey)
only_in_alt_mode = false only_in_alt_mode = false
} }
for k, item_name in pairs({ 'arithmetic-combinator', 'constant-combinator', 'decider-combinator', 'selector-combinator', 'display-panel', 'programmable-speaker', 'small-lamp', 'substation', 'pipe', 'gate', 'stone-wall', 'transport-belt' }) do for k, item_name in pairs({ 'arithmetic-combinator', 'constant-combinator', 'decider-combinator', 'selector-combinator', 'display-panel', 'programmable-speaker', 'small-lamp', 'pipe', 'gate', 'stone-wall', 'transport-belt' }) do
local chest = surface.create_entity({ name = 'infinity-chest', position = { -7 + k, Constants.mothership_radius - 3 }, force = 'player' }) local chest = surface.create_entity({ name = 'infinity-chest', position = { -7 + k, Constants.mothership_radius - 3 }, force = 'player' })
if not chest or not chest.valid then break end if not chest or not chest.valid then break end
chest.set_infinity_container_filter(1, { name = item_name, count = prototypes.item[item_name].stack_size, index = 1 }) chest.set_infinity_container_filter(1, { name = item_name, count = prototypes.item[item_name].stack_size, index = 1 })
@ -707,8 +709,6 @@ function Public.draw_mothership(journey)
for m = -1, 1, 2 do for m = -1, 1, 2 do
local inter = surface.create_entity({ name = 'electric-energy-interface', position = { 11 * m, Constants.mothership_radius - 4 }, force = 'player' }) local inter = surface.create_entity({ name = 'electric-energy-interface', position = { 11 * m, Constants.mothership_radius - 4 }, force = 'player' })
protect(inter, true) protect(inter, true)
local sub = surface.create_entity({ name = 'substation', position = { 9 * m, Constants.mothership_radius - 4 }, force = 'player' })
protect(sub, true)
end end
for m = -1, 1, 2 do for m = -1, 1, 2 do
@ -1445,10 +1445,15 @@ function Public.dispatch_goods(journey)
if journey.dispatch_beacon_position then if journey.dispatch_beacon_position then
local good = goods_to_dispatch[journey.dispatch_key] local good = goods_to_dispatch[journey.dispatch_key]
local pod = surface.create_entity({name = 'cargo-pod-container', position = journey.dispatch_beacon_position, force = game.forces.player}) local pod = surface.create_entity({name = 'cargo-pod-container', position = journey.dispatch_beacon_position, force = game.forces.player})
local itemcount = good[2]
if pod and pod.valid then if pod and pod.valid then
pod.insert({name = good[1], count = good[2]}) local inserted = pod.insert({name = good[1], count = itemcount})
else if inserted > 0 then
surface.spill_item_stack({ position = journey.dispatch_beacon_position, stack = { name = good[1], count = good[2] }, enable_looted = true, allow_belts = false }) itemcount = itemcount - inserted
end
end
if itemcount > 0 then
surface.spill_item_stack({ position = journey.dispatch_beacon_position, stack = { name = good[1], count = itemcount }, enable_looted = true, allow_belts = false })
end end
table.remove(journey.goods_to_dispatch, journey.dispatch_key) table.remove(journey.goods_to_dispatch, journey.dispatch_key)
journey.dispatch_beacon = nil journey.dispatch_beacon = nil
@ -1469,7 +1474,7 @@ function Public.dispatch_goods(journey)
end end
journey.dispatch_beacon = surface.create_entity({ name = 'stone-wall', position = position, force = 'neutral' }) journey.dispatch_beacon = surface.create_entity({ name = 'stone-wall', position = position, force = 'neutral' })
journey.dispatch_beacon.minable = false journey.dispatch_beacon.minable_flag = false
journey.dispatch_beacon_position = { x = position.x, y = position.y } journey.dispatch_beacon_position = { x = position.x, y = position.y }
journey.dispatch_key = Math.random(1, size_of_goods_to_dispatch) journey.dispatch_key = Math.random(1, size_of_goods_to_dispatch)
@ -1576,6 +1581,9 @@ function Public.teleporters(journey, player)
if not player.character.valid then if not player.character.valid then
return return
end end
if player.vehicle then
return
end
local surface = player.physical_surface local surface = player.physical_surface
local tile = surface.get_tile(player.physical_position) local tile = surface.get_tile(player.physical_position)
if not tile or not tile.valid then if not tile or not tile.valid then

View File

@ -194,6 +194,9 @@ local function on_rocket_launched(event)
force.technologies['space-science-pack'].researched = true force.technologies['space-science-pack'].researched = true
force.print('[technology=space-science-pack] researched.') force.print('[technology=space-science-pack] researched.')
force.play_sound({path = 'utility/research_completed'}) force.play_sound({path = 'utility/research_completed'})
table.insert(journey.goods_to_dispatch, { 'loader', 3 })
table.insert(journey.mothership_messages, 'I am sending you some loaders. Use them to load the rocket silos with all needed items.')
journey.game_state = 'dispatch_goods'
end end
Functions.draw_gui(journey) Functions.draw_gui(journey)
end end

View File

@ -239,7 +239,7 @@ Public.tarball = {
if tarball_minable[entity.type] then if tarball_minable[entity.type] then
return return
end end
entity.minable = false entity.minable_flag = false
end, end,
on_built_entity = function (event) on_built_entity = function (event)
local entity = event.entity local entity = event.entity
@ -252,7 +252,7 @@ Public.tarball = {
if tarball_minable[entity.type] then if tarball_minable[entity.type] then
return return
end end
entity.minable = false entity.minable_flag = false
end, end,
on_chunk_generated = function (event, journey) on_chunk_generated = function (event, journey)
table.insert( table.insert(