Skip to content

Commit

Permalink
Merge latest
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerkiz committed Dec 9, 2024
2 parents a0659d4 + 1b6a2dc commit 6847146
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 78 deletions.
52 changes: 26 additions & 26 deletions locale/en/journey.cfg
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
[journey]
map_info_main_caption=The Journey
map_info_sub_caption=v 1.9
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_nuclear_fuel=Emergency Reactors working: __1__ / __2__\n30 Emergency Reactors are usually damaged by Mothership if the current colony is determined to be lost and Mothership has to leave in a hurry.\nIf teleporter is lost and there is no emergency power, the game is over and run resets.
tooltip_fuel=Fuel requirement to advance to next world:\n__1__\n\nNuclear Fuel Cells in Mothership Cargo:\n__2__
tooltip_delivery=Orbital Station Delivery: __1__ / __2__\nStation pays with one random starting item roll per time threshold.\nTimes: 120min, 240min, 480min, 960min, 1920min, 3840min\nCurrent time: __3__ minutes.

beacon_hp=HP: __1__/10000
teleporter=Personal Teleporter

chunks_delete=Deleting chunks.. __1__
mothership_format=[font=heading-1][color=255,155,155]<Mothership> [/color][/font][font=default-game][color=200,200,200]__1__[/color][/font]
world=World __1__ | __2__
world_tooltip=__1__\n\n__2__\nCapsules:\n__3__
tooltip_modifier=__1__ - __2__%\n
tooltip_capsule= __1__x [item=__2__]
tooltip_capsule2= __1__x [item=__2__]\n

message_rocket_launched=Launching a rocket with __1__x [item=__2__] at [gps=__3__,__4__,nauvis].
message_min_players=The minimal amount of players to vote for new world is set to __1__.
message_delivery_done=[img=item/__1__] Orbital Station delivery completed in __2__ minutes, granting __3__ loot rolls!
message_delivered=Delivered from Orbital Station: __2__x [img=item/__1__] added to capsule storage.
cmd_server_restarting=Server is restarting to apply updates to the scenario...Please reconnect in a minute.
[journey]
map_info_main_caption=The Journey
map_info_sub_caption=v 1.9
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_nuclear_fuel=Emergency Reactors working: __1__ / __2__\n3 Emergency Reactors are usually damaged by Mothership if the current colony is determined to be lost and Mothership has to leave in a hurry.\nIf teleporter is lost and there is no emergency power, the game is over and run resets.
tooltip_fuel=Fuel requirement to advance to next world:\n__1__\n\nNuclear Fuel Cells in Mothership Cargo:\n__2__
tooltip_delivery=Orbital Station Delivery: __1__ / __2__\nStation pays with one random starting item roll per time threshold.\nTimes: 120min, 240min, 480min, 960min, 1920min, 3840min\nCurrent time: __3__ minutes.

beacon_hp=HP: __1__/10000
teleporter=Personal Teleporter

chunks_delete=Deleting chunks.. __1__
mothership_format=[font=heading-1][color=255,155,155]<Mothership> [/color][/font][font=default-game][color=200,200,200]__1__[/color][/font]
world=World __1__ | __2__
world_tooltip=__1__\n\n__2__\nCapsules:\n__3__
tooltip_modifier=__1__ - __2__%\n
tooltip_capsule= __1__x [item=__2__]
tooltip_capsule2= __1__x [item=__2__]\n

message_rocket_launched=Launching a rocket with __1__x [item=__2__] at [gps=__3__,__4__,nauvis].
message_min_players=The minimal amount of players to vote for new world is set to __1__.
message_delivery_done=[img=item/__1__] Orbital Station delivery completed in __2__ minutes, granting __3__ loot rolls!
message_delivered=Delivered from Orbital Station: __2__x [img=item/__1__] added to capsule storage.
cmd_server_restarting=Server is restarting to apply updates to the scenario...Please reconnect in a minute.
3 changes: 3 additions & 0 deletions maps/journey/constants.lua
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ Public.modifiers = {
['cliff_continuity'] = { min = 1, max = 10, base = 8, dmin = -30, dmax = -15, name = 'Cliff Continuity' },
['cliff_frequency'] = { min = 5, max = 80, base = 60, dmin = -30, dmax = -15, name = 'Cliff Frequency' },
['water'] = { min = 0.01, max = 10, base = 1, dmin = -20, dmax = -10, name = 'Water' },
['scale'] = { min = 1, max = 1, base = 1, dmin = 0, dmax = 0, name = 'Landmass scale', static = true},
['coal'] = { min = 0.01, max = 10, base = 1, dmin = -20, dmax = -10, name = 'Coal' },
['stone'] = { min = 0.01, max = 10, base = 1, dmin = -20, dmax = -10, name = 'Stone' },
['iron-ore'] = { min = 0.01, max = 10, base = 1, dmin = -20, dmax = -10, name = 'Iron Ore' },
Expand Down Expand Up @@ -203,6 +204,8 @@ Public.build_type_whitelist = {
['arithmetic-combinator'] = true,
['constant-combinator'] = true,
['decider-combinator'] = true,
['selector-combinator'] = true,
['display-panel'] = true,
['electric-energy-interface'] = true,
['electric-pole'] = true,
['gate'] = true,
Expand Down
32 changes: 17 additions & 15 deletions maps/journey/functions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,15 @@ local function drop_player_items(journey, player)
end

local surface = player.surface
local spill_blockage = surface.create_entity { name = 'oil-refinery', position = journey.beacon_objective.position or player.position }
local spill_blockage = surface.create_entity { name = 'oil-refinery', position = journey.beacon_objective.position or player.physical_position }

for _, define in pairs({ defines.inventory.character_main, defines.inventory.character_guns, defines.inventory.character_ammo, defines.inventory.character_armor, defines.inventory.character_vehicle, defines.inventory.character_trash }) do
local inventory = character.get_inventory(define)
if inventory and inventory.valid then
for i = 1, #inventory, 1 do
local slot = inventory[i]
if slot.valid and slot.valid_for_read then
surface.spill_item_stack({ position = player.position, stack = slot, enable_looted = true, allow_belts = false })
surface.spill_item_stack({ position = player.physical_position, stack = slot, enable_looted = true, allow_belts = false })
end
end
inventory.clear()
Expand Down Expand Up @@ -196,10 +196,11 @@ local function set_map_modifiers(journey)
mgs.autoplace_controls['enemy-base'].richness = calc_modifier(journey, 'enemy_base_richness')
mgs.autoplace_controls['enemy-base'].size = calc_modifier(journey, 'enemy_base_size')
mgs.autoplace_controls['enemy-base'].frequency = calc_modifier(journey, 'enemy_base_frequency')
mgs.autoplace_controls['water'].size = calc_modifier(journey, 'water')
mgs.autoplace_controls['water'].frequency = calc_modifier(journey, 'scale')
mgs.starting_area = calc_modifier(journey, 'starting_area')
mgs.cliff_settings.cliff_elevation_interval = calc_modifier(journey, 'cliff_frequency')
mgs.cliff_settings.richness = calc_modifier(journey, 'cliff_continuity')
mgs.water = calc_modifier(journey, 'water')
game.map_settings.enemy_evolution['time_factor'] = calc_modifier(journey, 'time_factor')
game.map_settings.enemy_evolution['destroy_factor'] = calc_modifier(journey, 'destroy_factor')
game.map_settings.enemy_evolution['pollution_factor'] = calc_modifier(journey, 'pollution_factor')
Expand Down Expand Up @@ -325,14 +326,11 @@ local function cargo_gui(name, itemname, tooltip, value, hidden)
sprite.style.maximal_height = 28
sprite.style.margin = 0
sprite.style.padding = 0
local progressbar = frame.add({ type = 'progressbar', name = name .. '_progressbar', value = 0 })
progressbar.style = 'achievement_progressbar'
local progressbar_style = progressbar.style --[[@as LuaGuiElementStyle]]
local progressbar = frame.add({ type = 'progressbar', name = name .. '_progressbar', value = 0, style = 'achievement_progressbar' })
local progressbar_style = progressbar.style
progressbar_style.minimal_width = 100
progressbar_style.maximal_width = 100
---@diagnostic disable-next-line: inject-field
progressbar_style.top_margin = 2
---@diagnostic disable-next-line: inject-field
progressbar_style.right_margin = 6
progressbar_style.height = 20
end
Expand Down Expand Up @@ -696,7 +694,7 @@ function Public.draw_mothership(journey)
only_in_alt_mode = false
}

for k, item_name in pairs({ 'arithmetic-combinator', 'constant-combinator', 'decider-combinator', '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', 'substation', 'pipe', 'gate', 'stone-wall', 'transport-belt' }) do
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
chest.set_infinity_container_filter(1, { name = item_name, count = prototypes.item[item_name].stack_size, index = 1 })
Expand Down Expand Up @@ -905,7 +903,7 @@ function Public.set_world_selectors(journey)
world_selector.modifiers = {}
world_selector.bonus_goods = {}
world_selector.world_trait = unique_world_traits[k]
world_selector.fuel_requirement = Math.random(25, 50)
world_selector.fuel_requirement = Math.random(5, 10)
end
local position = Constants.world_selector_areas[k].left_top
local texts = world_selector.texts
Expand Down Expand Up @@ -1076,7 +1074,7 @@ function Public.set_world_selectors(journey)
Server.to_discord_embed('World ' .. journey.world_number + 1 .. ' selection has started!')
Public.set_minimum_to_vote(journey)
journey.importing = false

game.forces.player.set_surface_hidden(game.surfaces.nauvis, true)
journey.game_state = 'delete_nauvis_chunks'
end

Expand Down Expand Up @@ -1270,8 +1268,9 @@ function Public.create_the_world(journey)
local surface = game.surfaces.nauvis
local mgs = surface.map_gen_settings
mgs.seed = Math.random(1, 4294967295)
mgs.terrain_segmentation = Math.random(10, 20) * 0.1
journey.world_modifiers['scale'] = Math.random(10, 20) * 0.1
mgs.peaceful_mode = false
surface.map_gen_settings = mgs

local modifiers = journey.world_selectors[journey.selected_world].modifiers
for _, modifier in pairs(modifiers) do
Expand All @@ -1280,7 +1279,6 @@ function Public.create_the_world(journey)
local extremes = { Constants.modifiers[name].min, Constants.modifiers[name].max }
journey.world_modifiers[name] = math.round(math.min(extremes[2], math.max(extremes[1], journey.world_modifiers[name] * m)) * 100000, 5) / 100000
end
surface.map_gen_settings = mgs
journey.world_trait = journey.world_selectors[journey.selected_world].world_trait

local unique_modifier = Unique_modifiers[journey.world_trait]
Expand Down Expand Up @@ -1397,6 +1395,7 @@ function Public.place_teleporter_into_world(journey)
surface.request_to_generate_chunks({ x = 0, y = 0 }, 3)
surface.force_generate_chunk_requests()
place_teleporter(journey, surface, Constants.mothership_teleporter_position, true)
game.forces.player.set_surface_hidden(surface, false)
journey.game_state = 'make_it_night'
end

Expand Down Expand Up @@ -1572,8 +1571,11 @@ function Public.teleporters(journey, player)
if not player.character.valid then
return
end
local surface = player.surface
local tile = surface.get_tile(player.position)
local surface = player.physical_surface
local tile = surface.get_tile(player.physical_position)
if not tile or not tile.valid then
return
end
if tile.name ~= Constants.teleporter_tile and tile.hidden_tile ~= Constants.teleporter_tile then
return
end
Expand Down
6 changes: 5 additions & 1 deletion maps/journey/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ local function on_rocket_launched(event)
end
rocket_inventory.clear()
rocket_inventory.insert({name = 'space-science-pack', count = 200})
local force = event.rocket.force
force.technologies['space-science-pack'].researched = true
force.print('[technology=space-science-pack] researched.')
force.play_sound({path = 'utility/research_completed'})
Functions.draw_gui(journey)
end

Expand Down Expand Up @@ -260,7 +264,7 @@ local function cmd_handler()
end
if player and not player.admin then
p('You are not an admin!')
return false
return false, nil, p
end
return true, player or {name = 'Server'}, p
end
Expand Down
60 changes: 25 additions & 35 deletions maps/journey/unique_modifiers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,9 @@ Public.replicant_fauna = {
return
end
if cause.force.index == 2 then
cause.surface.create_entity({ name = BiterRaffle.roll('mixed', game.forces.enemy.evolution_factor), position = entity.position, force = 'enemy' })
local surface = entity.surface
local force = game.forces.enemy
surface.create_entity({ name = BiterRaffle.roll('mixed', force.get_evolution_factor(surface)), position = entity.position, force = force })
end
end
}
Expand Down Expand Up @@ -279,6 +281,7 @@ Public.tarball = {
Public.swamps = {
set_specials = function (journey)
journey.world_specials['water'] = 2
journey.world_specials['scale'] = 0.5
end,
on_chunk_generated = function (event, journey)
local surface = event.surface
Expand Down Expand Up @@ -326,7 +329,7 @@ Public.wasteland = {
if math_random(1, 3) ~= 1 then
return
end
for _ = 1, math_random(0, 5), 1 do
for _ = 1, math_random(0, 8), 1 do
local name = wrecks[math_random(1, size_of_wrecks)]
local position = surface.find_non_colliding_position(name, { left_top_x + math_random(0, 31), left_top_y + math_random(0, 31) }, 16, 1)
if position then
Expand All @@ -342,31 +345,13 @@ Public.wasteland = {
end
end
end,
on_world_start = function (journey)
local surface = game.surfaces.nauvis
local mgs = surface.map_gen_settings
mgs.terrain_segmentation = 2.7
mgs.water = mgs.water + 1
surface.map_gen_settings = mgs
surface.clear(true)
end,
clear = function (journey)
local surface = game.surfaces.nauvis
local mgs = surface.map_gen_settings
mgs.water = mgs.water - 1
surface.map_gen_settings = mgs
set_specials = function (journey)
journey.world_specials['water'] = 2
journey.world_specials['scale'] = 2.7
end
}

Public.oceanic = {
on_world_start = function (journey)
local surface = game.surfaces.nauvis
local mgs = surface.map_gen_settings
mgs.terrain_segmentation = 0.5
mgs.water = mgs.water + 6
surface.map_gen_settings = mgs
surface.clear(true)
end,
on_robot_built_entity = function (event)
local entity = event.entity
if not entity.valid then
Expand All @@ -391,11 +376,10 @@ Public.oceanic = {
entity.die()
end
end,
clear = function (journey)
local surface = game.surfaces.nauvis
local mgs = surface.map_gen_settings
mgs.water = mgs.water - 6
surface.map_gen_settings = mgs
set_specials = function (journey)
journey.world_specials['water'] = 6
journey.world_specials['scale'] = 0.5
journey.world_specials['stone'] = 2
end
}

Expand Down Expand Up @@ -425,10 +409,10 @@ Public.volcanic = {
if surface.index ~= 1 then
return
end
if solid_tiles[surface.get_tile(player.position.x, player.position.y).name] then
if solid_tiles[surface.get_tile(player.physical_position.x, player.physical_position.y).name] then
return
end
surface.create_entity({ name = 'fire-flame', position = player.position })
surface.create_entity({ name = 'fire-flame', position = player.physical_position })
end,
on_world_start = function (journey)
local surface = game.surfaces.nauvis
Expand Down Expand Up @@ -500,7 +484,9 @@ Public.infested = {
if entity.type ~= 'simple-entity' and entity.type ~= 'tree' then
return
end
entity.surface.create_entity({ name = BiterRaffle.roll('mixed', game.forces.enemy.evolution_factor + 0.1), position = entity.position, force = 'enemy' })
local surface = entity.surface
local force = game.forces.enemy
surface.create_entity({ name = BiterRaffle.roll('mixed', force.get_evolution_factor(surface) + 0.1), position = entity.position, force = force })
end,
on_player_mined_entity = function (event)
if math_random(1, 2) == 1 then
Expand All @@ -516,7 +502,9 @@ Public.infested = {
if entity.type ~= 'simple-entity' and entity.type ~= 'tree' then
return
end
entity.surface.create_entity({ name = BiterRaffle.roll('mixed', game.forces.enemy.evolution_factor + 0.1), position = entity.position, force = 'enemy' })
local surface = entity.surface
local force = game.forces.enemy
surface.create_entity({ name = BiterRaffle.roll('mixed', force.get_evolution_factor(surface) + 0.1), position = entity.position, force = force })
end,
on_robot_mined_entity = function (event)
local entity = event.entity
Expand All @@ -529,7 +517,9 @@ Public.infested = {
if entity.type ~= 'simple-entity' and entity.type ~= 'tree' then
return
end
entity.surface.create_entity({ name = BiterRaffle.roll('mixed', game.forces.enemy.evolution_factor + 0.1), position = entity.position, force = 'enemy' })
local surface = entity.surface
local force = game.forces.enemy
surface.create_entity({ name = BiterRaffle.roll('mixed', force.get_evolution_factor(surface) + 0.1), position = entity.position, force = force })
end
}

Expand Down Expand Up @@ -764,9 +754,9 @@ Public.crazy_science = {
on_research_finished = function (event, journey)
local name = 'technology_price_multiplier'
local force = event.research.force
journey.world_specials[name] = math.max(0.1, journey.world_specials[name] * 0.95)
journey.world_specials[name] = math.max(0.1, journey.world_specials[name] * 0.96)
game.difficulty_settings.technology_price_multiplier = journey.world_modifiers[name] * (journey.world_specials[name] or 1)
force.laboratory_productivity_bonus = math.max(0.1, force.laboratory_productivity_bonus * 0.95)
force.laboratory_productivity_bonus = math.max(0.1, force.laboratory_productivity_bonus * 0.96)
end
}

Expand Down
2 changes: 1 addition & 1 deletion utils/dump_env.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ local function player_joined(event)
local dump_string = inspect(_ENV, {process = filter})
if dump_string then
local s = string.format('tick on join: %s\n%s', event.tick, dump_string)
game.write_file(filename, s)
helpers.write_file(filename, s)
game.print('_ENV dumped into ' .. filename)
else
game.print('_ENV not dumped, dump_string was nil')
Expand Down

0 comments on commit 6847146

Please sign in to comment.