1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-10 00:43:27 +02:00
ComfyFactorio/maps/pirates/surfaces/dock.lua
2021-10-13 09:21:53 +01:00

154 lines
9.2 KiB
Lua

local Memory = require 'maps.pirates.memory'
local Math = require 'maps.pirates.math'
local Balance = require 'maps.pirates.balance'
local Structures = require 'maps.pirates.structures.structures'
local Boats = require 'maps.pirates.structures.boats.boats'
local Common = require 'maps.pirates.common'
local Hold = require 'maps.pirates.surfaces.hold'
local Cabin = require 'maps.pirates.surfaces.cabin'
local CoreData = require 'maps.pirates.coredata'
local Utils = require 'maps.pirates.utils_local'
local inspect = require 'utils.inspect'.inspect
local Public = {}
Public.Data = {}
Public.Data.display_names = {'Dock'}
Public.Data.discord_emoji = CoreData.comfy_emojis.smolfish
Public.Data.width = 296
Public.Data.height = 98
Public.Data.top_boat_bottom = -7
Public.Data.bottom_boat_top = 5
Public.Data.playerboat_starting_xcoord = 35
Public.Data.static_params_default = {
starting_time_of_day = 0,
daynightcycletype = 1,
width = Public.Data.width,
height = Public.Data.height,
}
Public.PurchaseableBoats = {
[Boats.enum.SLOOP] = {
type = Boats.enum.SLOOP,
position = Utils.snap_coordinates_for_rails({x = 24 - Boats[Boats.enum.SLOOP].Data.leftmost_gate_position, y = Public.Data.bottom_boat_top + Boats[Boats.enum.SLOOP].Data.height/2}),
},
-- [Boats.enum.CUTTER] = {
-- type = Boats.enum.CUTTER,
-- position = Utils.snap_coordinates_for_rails({x = 24 - Boats[Boats.enum.CUTTER].Data.leftmost_gate_position, y = Public.Data.bottom_boat_top + Boats[Boats.enum.CUTTER].Data.height/2}),
-- cannonscount = 4
-- },
-- [Boats.enum.CUTTER_WITH_HOLD] = {
-- type = Boats.enum.CUTTER_WITH_HOLD,
-- position = Utils.snap_coordinates_for_rails({x = 24 - Boats[Boats.enum.CUTTER_WITH_HOLD].Data.leftmost_gate_position, y = Public.Data.bottom_boat_top + Boats[Boats.enum.CUTTER_WITH_HOLD].Data.height/2}),
-- cannonscount = 4
-- },
-- [Boats.enum.SLOOP_WITH_HOLD] = {
-- type = Boats.enum.SLOOP_WITH_HOLD,
-- position = Utils.snap_coordinates_for_rails({x = 24 - Boats[Boats.enum.SLOOP_WITH_HOLD].Data.leftmost_gate_position, y = Public.Data.bottom_boat_top + Boats[Boats.enum.SLOOP_WITH_HOLD].Data.height/2}),
-- cannonscount = 2
-- },
}
Public.Data.market_position = {x = -7.5, y = 13.5}
-- FIXME:
Public.Data.rightmostgate_stopping_xposition = 49 -- not sure if this is right for all boat types
Public.Data.iconized_map_width = 4
Public.Data.iconized_map_height = 20
function Public.execute_boat_purchase()
local memory = Memory.get_crew_memory()
local destination = Common.current_destination()
memory.boat = destination.dynamic_data.boat_for_sale
destination.dynamic_data.boat_for_sale = nil
Hold.connect_up_linked_belts_to_deck()
Cabin.connect_up_linked_belts_to_deck()
memory.mainshop_availability_bools.new_boat_cutter_with_hold = false
memory.mainshop_availability_bools.new_boat_sloop_with_hold = false
memory.mainshop_availability_bools.new_boat_cutter = false
end
function Public.place_dock_jetty_and_boats()
local memory = Memory.get_crew_memory()
local boat = memory.boat
local destination = Common.current_destination()
if not (boat and boat.surface_name) then return end
local surface = game.surfaces[boat.surface_name]
local offset = Public.Data.jetty_offset
local tiles = {}
for _, p in pairs(Common.tile_positions_from_blueprint(Public.Data.jetty_bp, offset)) do
tiles[#tiles + 1] = {name = CoreData.walkway_tile, position = p}
end
surface.set_tiles(tiles, true)
local boat_for_sale_type = destination.static_params.boat_for_sale_type
if boat_for_sale_type then
local boat2 = Utils.deepcopy(Public.PurchaseableBoats[boat_for_sale_type])
-- not needed whilst we're not buying boats:
-- boat2.dockedposition = boat2.position
-- boat2.state = Boats.enum_state.DOCKED
-- boat2.speed = 0
-- boat2.decksteeringchests = {}
-- boat2.questrewardchest = nil
-- boat2.hold_input_belts = boat.hold_input_belts
-- boat2.hold_output_belts = boat.hold_output_belts
-- boat2.crowsneststeeringchests = boat.crowsneststeeringchests
-- boat2.cannons = {}
-- boat2.speedticker1 = 0
-- boat2.speedticker2 = 1/3 * Common.boat_steps_at_a_time
-- boat2.speedticker3 = 2/3 * Common.boat_steps_at_a_time
boat2.force_name = boat.force_name
boat2.surface_name = boat.surface_name
Boats.place_boat(boat2, CoreData.static_boat_floor, true, true)
Boats.place_random_obstacle_boxes(boat2, 10, {}, 2)
destination.dynamic_data.boat_for_sale = boat2
end
-- for y = -3.5, 3.5 do
-- local e = surface.create_entity{name = 'stone-wall', position = {x = -68.5, y = y}, force = 'environment'}
-- e.destructible = false
-- e.minable = false
-- e.rotatable = false
-- e.operable = false
-- end
end
function Public.terrain(args)
local x, y = args.p.x, args.p.y
args.tiles[#args.tiles + 1] = {name = 'water', position = args.p}
local fishrng = Math.random(600)
if fishrng == 1 then
args.entities[#args.entities + 1] = {name = 'fish', position = args.p}
end
return
end
function Public.chunk_structures(args)
return
end
Public.Data.jetty_offset = {x = -40, y = -6}
Public.Data.jetty_bp = [[0eNqd3cuKXscVgNF3+ccKqPatqvQqwQNfGtMgy0Juhxijd49lK7Mk9MpQptyCXWB/65w61b8/vnv/69PHT88fXh7vfn/88uHbj397+flvP356/uHLn//5eLdWvHn89njX/fnN4/n7nz/88nj39z9WPv/44dv3X9a8/Pbx6fHu8fzy9NPjzePDtz99+dMf677/9PTy9PjyL3344enLD/r8zZvHy/P7p79+wMeff3l+ef75w9e/5u2ff0l+/k8/4b8sLlncsnhk8ZbFRxbf1y1eMrolo1syuiWjWzK6JaNbMrqQ0YWMLmR0IaMLGV3I6EJGlzK6lNGljC5ldCmjSxldyuhKRlcyupLRlYyuZHQloysZXcvoWkbXMrqW0bWMrmV0LaMbGd3I6EZGNzK6kdGNjG5kdFtGt2V0W0a3ZXRbRrdldFtGd2R0R0Z3ZHRHRndkdEdGd2R0V0Z3ZXRXRndldFdGd2V0l5KYOLHIE4tAsUgUi0ixyBTLUGGqMFaYKwwWJgujBdliES4W6WIRLxb5YhEwFgljETEWGWMRMhYpYxEzFjljETQWSWMRNR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