mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-02-05 13:15:03 +02:00
wait for other crews to load
This commit is contained in:
parent
57291b76d5
commit
0282d47717
@ -145,6 +145,7 @@ granted_3=__1__ __2__, __3__, __4__.
|
||||
|
||||
approaching_destination=Approaching destination __1__, __2__.
|
||||
loading_destination=Loading destination __1__, __2__.
|
||||
wait_for_crew_to_finish_loading=Ship held at signal: Waiting for crew __1__ to finish loading.
|
||||
|
||||
steer_left=Steering portside...
|
||||
steer_right=Steering starboard...
|
||||
|
@ -875,11 +875,13 @@ end
|
||||
|
||||
|
||||
function Public.loading_update(tickinterval)
|
||||
local global_memory = Memory.get_global_memory()
|
||||
local memory = Memory.get_crew_memory()
|
||||
if memory.game_lost then return end
|
||||
|
||||
if not memory.loadingticks then return end
|
||||
|
||||
if memory.game_lost then return end
|
||||
|
||||
local currentdestination = Common.current_destination()
|
||||
|
||||
local destination_index = memory.mapbeingloadeddestination_index
|
||||
@ -889,13 +891,38 @@ function Public.loading_update(tickinterval)
|
||||
|
||||
if not memory.boat.state then return end
|
||||
|
||||
local needs_loading_update = false
|
||||
if memory.boat.state == Boats.enum_state.LANDED then needs_loading_update = true end
|
||||
if memory.boat.state == Boats.enum_state.ATSEA_LOADING_MAP then needs_loading_update = true end
|
||||
if memory.boat.state == Boats.enum_state.LEAVING_DOCK then needs_loading_update = true end
|
||||
if memory.boat.state == Boats.enum_state.APPROACHING and destination_index == 1 then needs_loading_update = true end
|
||||
local map_loads = false
|
||||
if memory.boat.state == Boats.enum_state.LANDED then map_loads = true end
|
||||
if memory.boat.state == Boats.enum_state.ATSEA_LOADING_MAP then map_loads = true end
|
||||
if memory.boat.state == Boats.enum_state.LEAVING_DOCK then map_loads = true end
|
||||
if memory.boat.state == Boats.enum_state.APPROACHING and destination_index == 1 then map_loads = true end
|
||||
|
||||
if not map_loads then return end
|
||||
|
||||
|
||||
local crew_to_wait_for = nil
|
||||
if memory.boat.state == Boats.enum_state.ATSEA_LOADING_MAP then
|
||||
for id, crew_memory in pairs(global_memory.crew_memories) do
|
||||
if crew_memory.loadingticks and (crew_memory.loadingticks > memory.loadingticks or (crew_memory.loadingticks == memory.loadingticks and id < memory.id)) then
|
||||
crew_to_wait_for = id
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if crew_to_wait_for then
|
||||
if not memory.waiting_for_other_crew or memory.waiting_for_other_crew ~= crew_to_wait_for then
|
||||
memory.waiting_for_other_crew = crew_to_wait_for
|
||||
local waiting_crew_name = global_memory.crew_memories[crew_to_wait_for].name or "Unknown crew"
|
||||
|
||||
Common.notify_force(memory.force, {'pirates.wait_for_crew_to_finish_loading', waiting_crew_name})
|
||||
end
|
||||
|
||||
return
|
||||
else
|
||||
memory.waiting_for_other_crew = nil
|
||||
end
|
||||
|
||||
if not needs_loading_update then return end
|
||||
|
||||
memory.loadingticks = memory.loadingticks + tickinterval
|
||||
|
||||
|
@ -146,7 +146,7 @@ function Public.destination_on_collide(destination)
|
||||
local memory = Memory.get_crew_memory()
|
||||
|
||||
local name = destination.static_params.name and destination.static_params.name or 'NameNotFound'
|
||||
local message = {'', '[' .. memory.name .. '] ', {'pirates.approaching_destination', memory.destinationsvisited_indices and (#memory.destinationsvisited_indices + 1) or 0, name}} --notify the whole server
|
||||
local message = {'', '[' .. memory.name .. '] ', {'pirates.loading_destination', memory.destinationsvisited_indices and (#memory.destinationsvisited_indices + 1) or 0, name}} --notify the whole server
|
||||
Common.notify_game(message)
|
||||
|
||||
if destination.type ~= Public.enum.DOCK then
|
||||
@ -170,8 +170,6 @@ function Public.destination_on_collide(destination)
|
||||
local index = destination.destination_index
|
||||
Crowsnest.paint_around_destination(index, CoreData.overworld_loading_tile)
|
||||
|
||||
|
||||
|
||||
if destination.subtype == IslandEnum.enum.RADIOACTIVE then
|
||||
Common.parrot_speak(memory.force, {'pirates.parrot_radioactive_tip_1'})
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user