mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-01-20 03:29:47 +02:00
Parrot tip for burried treasure
Changes: - When players find treasure map, but are unable to dig it, parrots will give them tip, when they will leave the island.
This commit is contained in:
parent
383035aed1
commit
899ce22ed3
@ -72,6 +72,7 @@ parrot_radioactive_tip_2=The biters don't care if we pollute here, but they evol
|
||||
parrot_maze_tip_1=Something seems wrong with our minimap.
|
||||
parrot_captain_first_time_in_cabin_hint=The captain can buy items in the cabin, such as rail signals to steer the ship.
|
||||
parrot_cliff_explosive_tip=Cliff explosives? I remember they're powerful enough to blow those annoying chests in our hold.
|
||||
parrot_burried_treasure_tip=If X marks the spot - use inserters to dig!
|
||||
|
||||
|
||||
|
||||
|
@ -1681,8 +1681,6 @@ function Public.event_on_chunk_generated(event)
|
||||
|
||||
if special.name and special.name == 'buried-treasure' then
|
||||
if destination.dynamic_data.buried_treasure and crewid ~= 0 then
|
||||
|
||||
|
||||
destination.dynamic_data.buried_treasure[#destination.dynamic_data.buried_treasure + 1] = {treasure = Loot.buried_treasure_loot(), position = special.position}
|
||||
end
|
||||
elseif special.name and special.name == 'chest' then
|
||||
|
@ -674,21 +674,26 @@ end
|
||||
|
||||
|
||||
function Public.buried_treasure_check(tickinterval)
|
||||
local memory = Memory.get_crew_memory()
|
||||
-- local memory = Memory.get_crew_memory()
|
||||
local destination = Common.current_destination()
|
||||
|
||||
local remaining = destination.dynamic_data.treasure_remaining
|
||||
|
||||
if remaining and remaining > 0 and destination.surface_name and destination.dynamic_data.buried_treasure and #destination.dynamic_data.buried_treasure > 0 then
|
||||
local surface = game.surfaces[destination.surface_name]
|
||||
local treasure_table = destination.dynamic_data.buried_treasure
|
||||
if not (remaining and remaining > 0 and destination.surface_name and destination.dynamic_data.buried_treasure and #destination.dynamic_data.buried_treasure > 0) then
|
||||
return
|
||||
end
|
||||
|
||||
for i = 1, #treasure_table do
|
||||
local treasure = treasure_table[i]
|
||||
if not treasure then break end
|
||||
local surface = game.surfaces[destination.surface_name]
|
||||
local treasure_table = destination.dynamic_data.buried_treasure
|
||||
|
||||
for i = 1, #treasure_table do
|
||||
local treasure = treasure_table[i]
|
||||
if not treasure then break end
|
||||
|
||||
local t = treasure.treasure
|
||||
|
||||
if t then
|
||||
local p = treasure.position
|
||||
|
||||
|
||||
local free = surface.can_place_entity{name = 'wooden-chest', position = p}
|
||||
|
||||
if free then
|
||||
@ -724,13 +729,6 @@ function Public.buried_treasure_check(tickinterval)
|
||||
if inserters[j] and inserters[j][1] then
|
||||
local ins = inserters[j][1]
|
||||
|
||||
local t = treasure.treasure
|
||||
-- if #treasure.treasure > 0 then
|
||||
-- t = treasure.treasure
|
||||
-- -- t = treasure.treasure[1]
|
||||
-- end
|
||||
if not t then break end
|
||||
|
||||
if destination.dynamic_data.treasure_remaining > 0 and ins.held_stack.count == 0 and ins.status == defines.entity_status.waiting_for_source_items then
|
||||
surface.create_entity{name = 'item-on-ground', position = p, stack = {name = t.name, count = 1}}
|
||||
t.count = t.count - 1
|
||||
@ -1537,4 +1535,23 @@ function Public.equalise_fluid_storages()
|
||||
end
|
||||
end
|
||||
|
||||
function Public.revealed_buried_treasure_distance_check()
|
||||
local destination = Common.current_destination()
|
||||
|
||||
if destination.dynamic_data.some_player_was_close_to_buried_treasure then return end
|
||||
|
||||
local maps = destination.dynamic_data.treasure_maps or {}
|
||||
for _, map in pairs(maps) do
|
||||
if map.state == 'picked_up' then
|
||||
for _, player in pairs(Common.crew_get_crew_members()) do
|
||||
if player.character and player.character.valid then
|
||||
if Math.distance(player.character.position, map.buried_treasure_position) <= 20 then
|
||||
destination.dynamic_data.some_player_was_close_to_buried_treasure = true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return Public
|
@ -184,6 +184,7 @@ local function crew_tick()
|
||||
PiratesApiOnTick.update_alert_sound_frequency_tracker()
|
||||
PiratesApiOnTick.check_for_cliff_explosives_in_hold_wooden_chests()
|
||||
PiratesApiOnTick.equalise_fluid_storages() -- Made the update less often for small performance gain, but frequency can be increased if players complain
|
||||
PiratesApiOnTick.revealed_buried_treasure_distance_check()
|
||||
|
||||
if destination.dynamic_data.timer then
|
||||
destination.dynamic_data.timer = destination.dynamic_data.timer + 1
|
||||
|
@ -617,6 +617,18 @@ function Public.go_from_currentdestination_to_sea()
|
||||
Overworld.try_overworld_move_v2{x = d, y = 0}
|
||||
|
||||
|
||||
-- If crew revealed treasure, but couldn't figure out how to dig it, give them tip
|
||||
if destination.dynamic_data.some_player_was_close_to_buried_treasure then
|
||||
local maps = destination.dynamic_data.treasure_maps or {}
|
||||
for _, map in pairs(maps) do
|
||||
if map.state == 'picked_up' then
|
||||
Common.parrot_speak(memory.force, {'pirates.parrot_burried_treasure_tip'})
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local players_marooned_count = 0
|
||||
for _, player in pairs(game.connected_players) do
|
||||
if (player.surface == oldsurface and player.character and player.character.valid) then
|
||||
|
@ -73,6 +73,8 @@ function Public.spawn_treasure_maps(destination, points_to_avoid)
|
||||
|
||||
local p = Hunt.mid_farness_position_1(args, points_to_avoid)
|
||||
|
||||
-- game.print(p)
|
||||
|
||||
map.position = p
|
||||
map.mapobject_rendering = rendering.draw_sprite{
|
||||
surface = surface,
|
||||
|
@ -691,6 +691,8 @@ end
|
||||
|
||||
|
||||
function Public.clean_up(destination)
|
||||
-- game.print('clean_up')
|
||||
|
||||
local memory = Memory.get_crew_memory()
|
||||
|
||||
local oldsurface = game.surfaces[destination.surface_name]
|
||||
@ -701,11 +703,6 @@ function Public.clean_up(destination)
|
||||
local seasurface = game.surfaces[memory.sea_name]
|
||||
|
||||
Quest.try_resolve_quest()
|
||||
destination.dynamic_data.quest_type = nil
|
||||
destination.dynamic_data.quest_reward = nil
|
||||
destination.dynamic_data.quest_progress = nil
|
||||
destination.dynamic_data.quest_progressneeded = nil
|
||||
destination.dynamic_data.quest_complete = nil
|
||||
|
||||
-- handle players that were left on the island
|
||||
-- if there is more than one crew on a surface, this will need to be generalised
|
||||
|
Loading…
x
Reference in New Issue
Block a user