2024-09-10 11:29:44 +01:00
-- This file is part of thesixthroc's Pirate Ship softmod, licensed under GPLv3 and stored at https://github.com/ComfyFactory/ComfyFactorio and https://github.com/danielmartin0/ComfyFactorio-Pirates.
2022-06-01 19:50:36 +01:00
2021-10-13 09:21:53 +01:00
local Memory = require ' maps.pirates.memory '
local Math = require ' maps.pirates.math '
2022-03-19 21:20:55 +00:00
-- local Balance = require 'maps.pirates.balance'
-- local Structures = require 'maps.pirates.structures.structures'
2021-10-13 09:21:53 +01:00
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 '
2022-03-19 21:20:55 +00:00
local _inspect = require ' utils.inspect ' . inspect
2022-03-13 01:44:32 +00:00
local CustomEvents = require ' maps.pirates.custom_events '
2021-10-13 09:21:53 +01:00
local Public = { }
Public.Data = { }
2022-05-29 12:36:27 +01:00
Public.Data . display_names = { { ' pirates.location_displayname_dock_1 ' } }
2022-10-23 19:03:43 +03:00
Public.Data . discord_emoji = CoreData.comfy_emojis . hype
2021-10-13 09:21:53 +01:00
Public.Data . width = 296
Public.Data . height = 98
2022-03-07 18:41:42 +00:00
Public.Data . static_boat_bottom = 34
Public.Data . player_boat_top = - 29
Public.Data . playerboat_starting_xcoord = 10
Public.Data . markets_position = { x = 6.5 , y = - 46.5 }
Public.Data . rightmostgate_stopping_xposition = 16
2021-10-13 09:21:53 +01:00
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 ,
2022-03-09 21:39:47 +00:00
position = Utils.snap_coordinates_for_rails ( { x = - 23 - Boats [ Boats.enum . SLOOP ] . Data.leftmost_gate_position , y = Public.Data . static_boat_bottom - Boats [ Boats.enum . SLOOP ] . Data.height / 2 } ) ,
2021-10-13 09:21:53 +01:00
} ,
-- [Boats.enum.CUTTER] = {
-- type = Boats.enum.CUTTER,
2022-03-07 18:41:42 +00:00
-- position = Utils.snap_coordinates_for_rails({x = 24 - Boats[Boats.enum.CUTTER].Data.leftmost_gate_position, y = Public.Data.static_boat_bottom + Boats[Boats.enum.CUTTER].Data.height/2}),
2021-10-13 09:21:53 +01:00
-- cannonscount = 4
-- },
-- [Boats.enum.CUTTER_WITH_HOLD] = {
-- type = Boats.enum.CUTTER_WITH_HOLD,
2022-03-07 18:41:42 +00:00
-- position = Utils.snap_coordinates_for_rails({x = 24 - Boats[Boats.enum.CUTTER_WITH_HOLD].Data.leftmost_gate_position, y = Public.Data.static_boat_bottom + Boats[Boats.enum.CUTTER_WITH_HOLD].Data.height/2}),
2021-10-13 09:21:53 +01:00
-- cannonscount = 4
-- },
-- [Boats.enum.SLOOP_WITH_HOLD] = {
-- type = Boats.enum.SLOOP_WITH_HOLD,
2022-03-07 18:41:42 +00:00
-- position = Utils.snap_coordinates_for_rails({x = 24 - Boats[Boats.enum.SLOOP_WITH_HOLD].Data.leftmost_gate_position, y = Public.Data.static_boat_bottom + Boats[Boats.enum.SLOOP_WITH_HOLD].Data.height/2}),
2021-10-13 09:21:53 +01:00
-- cannonscount = 2
-- },
}
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
2022-03-13 01:44:32 +00:00
script.raise_event ( CustomEvents.enum [ ' update_crew_fuel_gui ' ] , { } )
2021-10-13 09:21:53 +01:00
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 tiles = { }
2022-03-07 18:41:42 +00:00
Common.add_tiles_from_blueprint ( tiles , Public.Data . ground_bp_1 , ' grass-4 ' , Public.Data . ground_bp_1_offset )
Common.add_tiles_from_blueprint ( tiles , Public.Data . jetty_bp , CoreData.walkway_tile , Public.Data . jetty_offset )
Common.add_tiles_from_blueprint ( tiles , Public.Data . stone_bp_1 , ' stone-path ' , Public.Data . stone_bp_1_offset )
2022-03-19 21:20:55 +00:00
2021-10-13 09:21:53 +01:00
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 )
2022-03-11 22:53:36 +00:00
-- Boats.deck_place_random_obstacle_boxes(boat2, 6, {}, 2)
2021-10-13 09:21:53 +01:00
destination.dynamic_data . boat_for_sale = boat2
end
2022-03-19 21:20:55 +00:00
2021-10-13 09:21:53 +01:00
-- 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 )
2022-03-19 21:20:55 +00:00
-- local x, y = args.p.x, args.p.y
2021-10-13 09:21:53 +01:00
args.tiles [ # args.tiles + 1 ] = { name = ' water ' , position = args.p }
2024-09-09 22:59:24 +01:00
if Math.random ( 165 ) == 1 then
2021-10-13 09:21:53 +01:00
args.entities [ # args.entities + 1 ] = { name = ' fish ' , position = args.p }
end
end
2022-03-19 21:20:55 +00:00
function Public . chunk_structures ( )
2022-02-27 16:42:25 +00:00
return nil
2021-10-13 09:21:53 +01:00
end
2022-03-07 18:41:42 +00:00
Public.Data . jetty_offset = { x = - 20 , y = - 38 }
Public.Data . jetty_bp = [[0eNqVmcFO4zAYhN/F5yBl5ncSJ6+y4lAgQpFKWrUBgVDenZZw4LC76nesNHVGHs/nxP5MD/vX8Xia5iUNn+k87453y+Hu+TQ9XX+/pyFylT7SkNu1StPjYT6n4c9FOD3Pu/1VsnwcxzSkaRlfUpXm3cv110X3eBqXMV3/ND+Nl3G03ldpmfbjNsDxcJ6W6TD/PKXeHhLr34b4lzojdXObWsiJkBMhJ0ZOjJwYOQnkJJCTQE4ycpKRk4ycNMhJg5w0yEmLnLTISYucdMhJh5x0yElBTgpyUpCTHjnpkZOekY1BVoyygpiFnIWgZaQVQ60Ya8VgK0ZbMdyK8VYMuGLEFUOuGHPFoCtGXTHsinFXDLxi5BVDrxh7xeArRl8x/IrxVwzAYgQ2I7AZgc0IbEZgMwIbvuvCl134tssIbEZgMwKbEdiMwGYENiOwGYHNCGxGYDMCmxHYjMDeGNkidYfUBakDynskzzWTB5NnJr81o4IyKiijgjIqLKPCMiosI7Zfm+3XZvu1tx21RmohtZE6kDojNZuTFqk7pC5sTqC8Z3PIws8s/czizzB/tgBuPoCrSSt+1EJqI3UgdUZqNictUndIXdicQHnP5pCFn1n6mcWfYf5sAdzcCqFWCLVCqBVCrRBqhVArhFoh1AqhVoi1QqwVYq0Qa4VYK9indLBP6WCf0mG0AoxWgNEKMFsBZivAbAWwE4ZgJwwBL9QCZRQoo0AZBcsoWEbBMoIXjfCm8X8HL/fVdoU9/LoQr9LbeDp/D+Ci3PXuGjWKtl7XLyUP5fs=]]
2022-04-29 23:48:34 +01:00
Public.Data . stone_bp_1_offset = { x = - 19 , y = - 49 }
Public.Data . stone_bp_1 = [[0eNqd2t1q20AUxPF32WsZfGa0+nqVkgsnEamoIxtbKQ3B71470UUptOzfl4aT9c5wCPohf6TH/dt4PE3zkoaPdJ53x81y2Lycpufb519pcFul9zS0lypNT4f5nIZv17npZd7tbxPL+3FMQ5qW8TVVad693j6dl8M8bh5P09OPdPu7+Xm8nhSXhyot0378OuN4OE/LdJjX79l+fs328tchx93y/XrGP8aDjYuNu3Q82N2D3T3Y3eOeu9el42JRxaKKRRWLKhbVLKpZVLOoZlHNotYsas2i1ixqzaLWLGpmUTOLmlnUzKJmFrVhURsWtWFRG/hvCa5kwJ0MuJQBtzLgngVctICbFvmu+xfvWsBlC7htAdct6L41d+XNxfMt7KeF/bSwnxb208J+2rv6aYrnO9hnB/vsYJ8d7LODfXawzw722cM+e9hnD/vsYZ897LOHffasT0HPCIJGUDSCpFnnazif4Xx5n9BYgsgSVJYgs0SdFbDPgH1SyFHJUcpRy0HMrfMZzpf3CbUoyEVBLwqCUVCM63yG8+V9wud/wed/wed/wed/QZau8xnOl/cJPSLoEUGPCHpE0CPrfIbz5X1C7wh6R9A7gt4R9I6gd9b58j6hjwR9JOgjQR8J+kjQR4I+EvSRoI8EfSToI0EfCfpI0EeCPhL0kaCPBH0k6CNBHwn6yNBHhj4y9JGhjwx9ZOgjQx8Z+sjQR4Y+MvSRoY8MfWToI0MfGfrI0EeGPjJ92QV9ZOgj07dp9HUafZ9GX6hBHxn6yNBHhj4y9JGhjwx9ZOgjQx8ZesfQO4beMfSOoXcMPWLoEUOP+L8eeai+fjEy/PHzkyr9HE/nzxPURd32anMdztt8ufwGAFgVOg==]]
2022-03-07 18:41:42 +00:00
2021-10-13 09:21:53 +01:00
2022-03-07 18:41:42 +00:00
Public.Data . ground_bp_1_offset = { x = - 122 , y = - 49 }
Public.Data . ground_bp_1 = [ [ 0 eNqd3duOncdxQOF3mWsZYNehq1uvEvjCB8IgIEuCRAcxDL17JGfvqwTB /+ lSRpnenJ7idK + 1 TP3r48 / f / ePzjz99 + f7rx7f /+ vj5 + z / 9 + IevP / zhbz99 + etv // xfH9 / Gp / nm458f367zyzcfX / 7 yw / c / f3z7H79Ofvnb93 / 67 reZr // 88 fPHtx9fvn7 ++ 8 c3H9 // 6 e +// dOvc3 / 56 fPXzx +// Ze +/+ vnX3 + h9csfv / n4 + uW7z // zC / z4w89fvn754fvX / 8 ynf /+ PfPrl // oV / tfwkuHw4fVsOOVXTvmVS37l8l85ng23fIyWj9HyMbZ8jC0fY8vHGPkYIx9j5GMc + RhHPsaRj3HlY1z5GNc / Rj78c8P + lPkkn / o1HTT99HPTH3iv6UXTQdP2uevhNP1JveiP6td00HTS9NPfJf3UWPRj4zUdNJ00 / fR3ST / BFv0IW / Qz7DWdNP30d0k / IBf9hFz0I / I1nTT99HdJP38X / QBe9BP4NZ00bb / LfjhNl4FFt4FF14HXdNJ00fTTrwndTBZdTRbdTV7TSdNF00 +/ JnRNWnRPWnRRWnZTuvQ1ufI1CbqFBd3Cgm5hQbew13TR9NOviT1p6YYXdMMLuuEF3fBe00 +/ JvZyp / tg0H0w6D4YdB98TT / 9 mtDtMej2GHR7DLo9Bt0eX9NPvyZ01wy6awbdNYPumkF3zdf0068J3UyDbqZBN9Ogm2nQzfQ1bV + T / XCabr1Bt96gW2 / QrTfo1ht0631NP / 0 K0h056I4cdEcOuiMH3ZGD7siv6adfQbpRB92og27UQTfqoBt10I36Nf30K0j376D7d9D9O + j + HXT / Drt / 39 / xFZyHloPu9kl3 + 6 S7fdLdPulun3S3f01vmn769aZ3Q9K7IendkPRuSHo3JL0bXtObpu3rfR5O0wsmTT7SCybpBZP0gkl6wbymN00PTT89HfO39JZKekslvaWS3lJJb6nX9Kbpoemnp0OvuqRXXdKrLulVl / SqS3rVvaY3TQ9NPz0del8mvS + T3pdJ78uk92XS + zLpffmaHpq207kPp + mlm / TSTXrpJr10k166SS / dpJfua3po + tD007OkN3fSmzvpzZ305k56cye9uZPe3K / poelD00 / Pkl7 / Sa // pNd / 0 us / 6 fWf9PpPev2 / poemD00 / PUviEEkcIolDJHGIJA6RxCGSOEQah7h0llfOsohxFDGOIsZRxDiKGEcR4yhiHEWM4zV9aPrpWRI / KeInRfykiJ8U8ZMiflLET4r4SRE / eU0 / PUuiLUW0pYi2FNGWItpSRFuKaEsRbSmiLa / pp2dJbKYsric2U8RmithMEZspYjNFbKaIzbymn56l / b8Z7P / OQCSniOQUkZwiklNEcopIThHJeU0 / PUviPkXcp4j7FHGfIu5TxH2KuE8R9yniPkXcp4j7FHGfIu5TxH2KuE8R9yniPkXcp4j7FHGfIu5TxH2KuE8R9yniPkXcp4j7FHGfIu5TxH2KuE8R9yniPkXcp4j7FHGfIu5TxH2KuE8R9yniPkXcp4j7FHGfIu5TxH2KuE8R9yniPkXcp4n7NHGfJu7TxH2auE8T92niPk3cp4n7NHGfJu7TxH2auE8T92niPk3cp4n7NHGfJu7TxH2auE8T92niPk3cp4n7NHGfJu7TxH2auE8T92niPk3cp4n7NHGfJu7TxH2auE8T92niPp2 / 4 yzX08MkTNSEidr + 2 gvCRE2YqAkTNWGiJkzUhImaMNH7dJ4epv1FI / Y3jRBVaqJKTVSpiSo1UaUmqtRElZqo0vt0nh4mQagmCNUEoZogVBOEaoJQTRCqCUI1QagmCPU + naeHScyqiVk1MasmZtXErJqYVROzamJWTcyqiVm9TwcP8 + lpEhFrImJNRKyJiDURsSYi1kTEmohYExFrImLv08HDfHqaxNuaeFsTb2vibU28rYm3NfG2Jt7WxNvaeNu175RL3ymbaN4mmreJ5m2ieZto3iaat4nmbaJ5m2jeJpr3Ph08zKenSaxwEyvcxAo3scJNrHATK9zECjexwk2scBMrfJ8OHubT0yQSuYlEbiKRm0jkJhK5iURuIpGbSOQm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