1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-03-17 20:58:13 +02:00
This commit is contained in:
danielmartin0 2022-03-12 11:51:11 +00:00
parent 4b5e81d9df
commit e53e9aa19a
12 changed files with 92 additions and 23 deletions

View File

@ -13,7 +13,7 @@ softmod_info_new_players_1=For New Players
softmod_info_new_players_2=Mine coal and other resources and bring them to the ship to keep things going, or try asking the captain for more specific tasks.
softmod_info_tips_1=Features of the game that are hard to work out alone
softmod_info_tips_2=• You can steer the boat from the crow's nest by placing 100 rail signals in one of the blue boxes.\n• Resources granted to the ship appear in the captain's cabin.\n• Charging a silo launches a rocket. This causes pollution and evo, but gives a reward of fuel and doubloons.\n• Charging a silo drains power from everything else on its network.\n• Electric networks upstairs and downstairs are separate.\n• The quantity of ore available on an island is independent of the order in which you break rocks.\n• Passive pollution ramps up over time on each island.\n• The strength of attacks is proportional to the number of remaining nests. (The time-based rate of evolution is proportional to nests too, but destroying a nest will immediately jump evolution by the amount it 'would have' made had it survived.)\n• Covered markets give back any plates spent to unlock them.\n• Lab productivity increases with each league.\n• The player who spent the longest as captain between leagues 0 and 1000 (exclusive) is written into the highscores table.\n• Logged-out players keep their items with them for a while — except 'important' items that are returned to the crew immediately.\n• Commands: /class {classname} tells you what a named class does. /ccolor gives you a fun color. Captains also have /undock, /officer, /plank.
softmod_info_tips_2=• You can steer the boat from the crow's nest by placing 100 rail signals in one of the blue boxes.\n• Resources granted to the ship appear in the captain's cabin.\n• Charging a silo launches a rocket. This causes pollution and evo, but gives a reward of fuel and doubloons.\n• Charging a silo drains power from everything else on its network.\n• The quantity of ore available on an island is independent of the order in which you break rocks.\n• Passive pollution ramps up over time on each island.\n• The strength of attacks is proportional to the number of remaining nests. (The time-based rate of evolution is proportional to nests too, but destroying a nest will immediately jump evolution by the amount it 'would have' made had it survived.)\n• Covered markets give back any plates spent to unlock them.\n• Lab productivity increases with each league.\n• The player who spent the longest as captain between leagues 0 and 1000 (exclusive) is written into the highscores table.\n• Logged-out players keep their items with them for a while — except 'important' items that are returned to the crew immediately.\n• Commands: /class {classname} tells you what a named class does. /ccolor gives you a fun color. Captains also have /undock, /officer, /plank.
softmod_info_updates_1=Development
softmod_info_updates_2=Recent significant changes: Fuel mechanic replaces gold. Silo death is no longer a lose condition. Game made much easier for small crews. New islands and classes.

View File

@ -40,6 +40,7 @@ Public.rocket_launch_coin_reward = 5000
function Public.crew_scale()
local ret = Common.activecrewcount()/10
if ret == 0 then ret = 1/10 end --if all players are afk
if ret > 3 then ret = 3 end --cap
return ret
end
@ -450,7 +451,8 @@ function Public.starting_items_crew_downstairs()
{['storage-tank'] = 4},
{['medium-electric-pole'] = Math.random(15,21)},
{['coin'] = 2000},
{['solar-panel'] = 4},
{['solar-panel'] = 3},
{['accumulator'] = 1},
}
end

View File

@ -268,10 +268,10 @@ function(cmd)
local player = game.players[cmd.player_index]
local memory = Memory.get_crew_memory()
if memory.boat.state == Boats.enum_state.DOCKED then
Progression.undock_from_dock()
Progression.undock_from_dock(true)
elseif memory.boat.state == Boats.enum_state.LANDED then
if Common.query_can_pay_cost_to_leave() then
Progression.try_retreat_from_island()
Progression.try_retreat_from_island(true)
else
Common.notify_player_error(player, 'Not enough stored resources.')
end
@ -388,7 +388,7 @@ function(cmd)
local player = game.players[cmd.player_index]
local crew_id = tonumber(string.sub(player.force.name, -3, -1)) or nil
Memory.set_working_id(crew_id)
Progression.retreat_from_island()
Progression.retreat_from_island(true)
end
end)

View File

@ -485,7 +485,7 @@ function Public.surface_place_random_obstacle_boxes(surface, center, width, heig
e.rotatable = false
if contents[placed] and j==1 then
local inventory = e.get_inventory(defines.inventory.chest)
for name, count2 in pairs(contents[i]) do
for name, count2 in pairs(contents[placed]) do
inventory.insert{name = name, count = count2}
end
end

View File

@ -1081,10 +1081,10 @@ local function on_gui_click(event)
if (not memory.undock_shortcut_are_you_sure_data) then memory.undock_shortcut_are_you_sure_data = {} end
if memory.undock_shortcut_are_you_sure_data[player.index] and memory.undock_shortcut_are_you_sure_data[player.index] > game.tick - 60 * 4 then
if memory.boat.state == Boats.enum_state.DOCKED then
Progression.undock_from_dock()
Progression.undock_from_dock(true)
elseif memory.boat.state == Boats.enum_state.LANDED then
if Common.query_can_pay_cost_to_leave() then
Progression.try_retreat_from_island()
Progression.try_retreat_from_island(true)
else
Common.notify_player_error(player, 'Not enough stored resources.')
end

View File

@ -218,7 +218,7 @@ function Public.update(player)
elseif flow2.selected_tab_index == 2 then
flow2.style.height = 280
elseif flow2.selected_tab_index == 3 then
flow2.style.height = 680
flow2.style.height = 660
elseif flow2.selected_tab_index == 4 then
flow2.style.height = 330
end

View File

@ -1162,7 +1162,7 @@ local function on_player_changed_surface(event)
return
end
-- prevent connecting power between surfaces:
-- prevent connecting power between surfaces: (for the ship we do this automatically, but no need to let players do it in the general case:)
if not player.is_cursor_empty() then
if player.cursor_stack and player.cursor_stack.valid_for_read then
local blacklisted = {

View File

@ -253,9 +253,9 @@ local function crew_tick()
local surface_name_decoded = Surfaces.SurfacesCommon.decode_surface_name(memory.boat.surface_name)
local type = surface_name_decoded.type
if type == Surfaces.enum.ISLAND then
Progression.retreat_from_island()
Progression.retreat_from_island(false)
elseif type == Surfaces.enum.DOCK then
Progression.undock_from_dock()
Progression.undock_from_dock(false)
end
end
end

View File

@ -130,7 +130,7 @@ function Public.go_from_starting_dock_to_first_destination()
local scope = Boats.get_scope(boat)
local boatwidth, boatheight = scope.Data.width, scope.Data.height
Common.surface_place_random_obstacle_boxes(game.surfaces[boat.surface_name], {x = boat.position.x - boatwidth*0.575, y = boat.position.y}, boatwidth*0.85, boatheight*0.8, 'oil-refinery', {[1] = 3, [2] = 2, [3] = 0, [4] = 0}, items)
Common.surface_place_random_obstacle_boxes(game.surfaces[boat.surface_name], {x = boat.position.x - boatwidth*0.575, y = boat.position.y}, boatwidth*0.85, boatheight*0.8, 'oil-refinery', {[1] = 3, [2] = 3, [3] = 0, [4] = 0}, items)
-- go:
Public.progress_to_destination(1) --index of first destination
@ -410,7 +410,7 @@ end
function Public.try_retreat_from_island() -- Assumes the cost can be paid
function Public.try_retreat_from_island(manual) -- Assumes the cost can be paid
local memory = Memory.get_crew_memory()
if memory.game_lost then return end
local destination = Common.current_destination()
@ -456,11 +456,11 @@ function Public.try_retreat_from_island() -- Assumes the cost can be paid
if cost then
Common.spend_stored_resources(cost)
end
Public.retreat_from_island()
Public.retreat_from_island(manual)
end
end
function Public.retreat_from_island()
function Public.retreat_from_island(manual)
local memory = Memory.get_crew_memory()
local boat = memory.boat
@ -473,14 +473,18 @@ function Public.retreat_from_island()
local force = memory.force
if not (force and force.valid) then return end
Common.notify_force(force,'[font=heading-1]Boat undocked[/font].')
if manual then
Common.notify_force(force,'[font=heading-1]Ship undocked[/font]. Return to ship.')
else
Common.notify_force(force,'[font=heading-1]Ship auto-undocked[/font]. Return to ship.')
end
Surfaces.destination_on_departure(Common.current_destination())
end
function Public.undock_from_dock()
function Public.undock_from_dock(manual)
local memory = Memory.get_crew_memory()
local boat = memory.boat
local destination = Common.current_destination()
@ -498,7 +502,11 @@ function Public.undock_from_dock()
local force = memory.force
if not (force and force.valid) then return end
Common.notify_force(force,'Leaving the dock.')
if manual then
Common.notify_force(force,'[font=heading-1]Ship undocked[/font].')
else
Common.notify_force(force,'[font=heading-1]Ship auto-undocked[/font].')
end
end

View File

@ -282,6 +282,24 @@ function Public.place_boat(boat, floor_tile, place_entities_bool, correct_tiles,
end
end
if scope.Data.upstairs_poles then
for i = 1, 2 do
local p = scope.Data.upstairs_poles[i]
local p2 = {x = boat.position.x + p.x, y = boat.position.y + p.y}
local e = surface.create_entity({name = 'substation', position = p2, force = boat.force_name, create_build_effect_smoke = false})
if e and e.valid then
e.destructible = false
e.minable = false
e.rotatable = false
e.operable = false
if i == 1 then
boat.upstairs_pole = e
Public.try_connect_upstairs_and_downstairs_poles(boat)
end
end
end
end
if scope.Data.cannons then
for _, p in pairs(scope.Data.cannons) do
local p2 = {x = boat.position.x + p.x, y = boat.position.y + p.y}
@ -640,6 +658,15 @@ end
-- end
function Public.try_connect_upstairs_and_downstairs_poles(boat)
local memory = Memory.get_crew_memory()
if not (boat and boat.upstairs_pole and boat.upstairs_pole.valid and boat.downstairs_poles and boat.downstairs_poles[1] and boat.downstairs_poles[1][1] and boat.downstairs_poles[1][1].valid) then return end
boat.upstairs_pole.connect_neighbour(boat.downstairs_poles[1][1])
end
@ -1038,6 +1065,12 @@ function Public.teleport_boat(boat, newsurface_name, newposition, new_floor_tile
end
local ee = e.clone{position = p2, surface = newsurface, create_build_effect_smoke = false}
if boat.upstairs_pole and e == boat.upstairs_pole then
boat.upstairs_pole = ee
Public.try_connect_upstairs_and_downstairs_poles(boat)
end
e.destroy()
-- Right now in the game we don't expect any non-player characters, so let's kill them to make a point:

View File

@ -120,11 +120,15 @@ Public.entities = {
},
}
Public.EEIs = {
{x = -13, y = -10},
{x = -13, y = 10},
{x = -64, y = -10},
{x = -64, y = 10},
}
Public.power1_rendering_position = {x = -13, y = 9.5}
Public.power2_rendering_position = {x = -13, y = -10.5}
Public.upstairs_poles = {
{x = -39.0, y = -5.0},
{x = -39.0, y = 5.0},
}
Public.power1_rendering_position = {x = -64, y = 9.5}
Public.power2_rendering_position = {x = -64, y = -10.5}
Public.cannons = {
{x = -39.5, y = 11.5},

View File

@ -27,6 +27,10 @@ Public.Data.height = 46
Public.Data.loco_offset = {x = -2, y = 0}
-- Public.Data.loco_offset = {x = 18, y = 0}
-- Public.Data.display_name = 'Ship\'s Hold'
Public.Data.downstairs_pole_positions = {
{x = -1, y = -5},
{x = -1, y = 5},
}
Public[enum.INITIAL] = {}
Public[enum.INITIAL].Data = {}
@ -160,6 +164,24 @@ function Public.create_hold_surface(nth)
Common.surface_place_random_obstacle_boxes(Public.get_hold_surface(nth), {x=0,y=0}, Public.Data.width, Public.Data.height, 'rocket-silo', {[1] = 0, [2] = 8, [3] = 4, [4] = 1}, items)
-- Public.hold_place_random_obstacle_boxes(nth, {[1] = 0, [2] = 9, [3] = 3, [4] = 1}, items)
if not boat.downstairs_poles then boat.downstairs_poles = {} end
boat.downstairs_poles[nth] = {}
for i = 1, 2 do
local e = surface.create_entity({name = 'substation', position = Public.Data.downstairs_pole_positions[i], force = boat.force_name, create_build_effect_smoke = false})
if e and e.valid then
e.destructible = false
e.minable = false
e.rotatable = false
e.operable = false
boat.downstairs_poles[nth][i] = e
end
end
if nth >= 2 then
if boat.downstairs_poles[nth][1] and boat.downstairs_poles[nth][1].valid and boat.downstairs_poles[nth-1][2] and boat.downstairs_poles[nth-1][2].valid then
boat.downstairs_poles[nth][1].connect_neighbour(boat.downstairs_poles[nth-1][2])
end
end
if subtype == enum.SECONDARY then
if Common.difficulty() >= 1 then
Public.upgrade_chests(nth, 'iron-chest')