diff --git a/locale/en/pirates.cfg b/locale/en/pirates.cfg index 23034951..607f1d36 100644 --- a/locale/en/pirates.cfg +++ b/locale/en/pirates.cfg @@ -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• 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: /ccolor gives you a fun color. /classinfo {classname} gives the description of the named class. To manage your class, use /take {classname} or /giveup. Captains also have /undock, /req, /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 most of 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: /ccolor gives you a fun color. /classinfo {classname} gives the description of the named class. To manage your class, use /take {classname} or /giveup. Captains also have /undock, /req, /officer, /plank. softmod_info_updates_1=Development softmod_info_updates_2=Recent significant changes: Silo death is no longer a lose condition. Game made much easier for small crews. New islands and classes. The ship now shares power across each of its floors. Officers can now access chests in the captain's cabin directly. diff --git a/maps/pirates/common.lua b/maps/pirates/common.lua index bde3628d..84cae940 100644 --- a/maps/pirates/common.lua +++ b/maps/pirates/common.lua @@ -652,12 +652,11 @@ function Public.spend_stored_resources(to_spend) end -function Public.new_healthbar(text, target_entity, max_health, optional_id, health, size) +function Public.new_healthbar(text, target_entity, max_health, optional_id, health, size, location_override) health = health or max_health size = size or 0.5 text = text or false - - local memory = Memory.get_crew_memory() + location_override = location_override or Memory.get_crew_memory() local render1 = rendering.draw_sprite( { @@ -695,18 +694,19 @@ function Public.new_healthbar(text, target_entity, max_health, optional_id, heal id = optional_id, } - memory.healthbars[target_entity.unit_number] = new_healthbar + if not location_override.healthbars then location_override.healthbars = {} end + location_override.healthbars[target_entity.unit_number] = new_healthbar Public.update_healthbar_rendering(new_healthbar, health) return new_healthbar end -function Public.transfer_healthbar(old_unit_number, new_entity) - local memory = Memory.get_crew_memory() +function Public.transfer_healthbar(old_unit_number, new_entity, location_override) + location_override = location_override or Memory.get_crew_memory() local new_unit_number = new_entity.unit_number - if not memory.healthbars then return end - local old_healthbar = memory.healthbars[old_unit_number] + if not location_override.healthbars then return end + local old_healthbar = location_override.healthbars[old_unit_number] -- if new_surface_bool then -- Public.new_healthbar(old_healthbar.render2, new_entity, old_healthbar.max_health, old_healthbar.id, old_healthbar.health, rendering.get_y_scale(old_healthbar.render1)) @@ -718,7 +718,7 @@ function Public.transfer_healthbar(old_unit_number, new_entity) -- memory.healthbars[new_unit_number] = old_healthbar -- end - Public.new_healthbar(old_healthbar.render2, new_entity, old_healthbar.max_health, old_healthbar.id, old_healthbar.health, old_healthbar.size) + Public.new_healthbar(old_healthbar.render2, new_entity, old_healthbar.max_health, old_healthbar.id, old_healthbar.health, old_healthbar.size, location_override) if rendering.is_valid(old_healthbar.render1) then rendering.destroy(old_healthbar.render1) @@ -727,7 +727,7 @@ function Public.transfer_healthbar(old_unit_number, new_entity) rendering.destroy(old_healthbar.render2) end - memory.healthbars[old_unit_number] = nil + location_override.healthbars[old_unit_number] = nil end function Public.entity_damage_healthbar(entity, damage) diff --git a/maps/pirates/crew.lua b/maps/pirates/crew.lua index a26447c8..569f9bd0 100644 --- a/maps/pirates/crew.lua +++ b/maps/pirates/crew.lua @@ -746,7 +746,7 @@ function Public.initialise_crew(accepted_proposal) local boat = memory.boat for _, e in pairs(memory.boat.cannons_temporary_reference or {}) do - Common.new_healthbar(true, e, 2000, nil, e.health, 0.5) + Common.new_healthbar(true, e, 2000, nil, e.health, 0.3, memory.boat) end boat.dockedposition = boat.position diff --git a/maps/pirates/structures/boats/boats.lua b/maps/pirates/structures/boats/boats.lua index f07c68ae..92af2034 100644 --- a/maps/pirates/structures/boats/boats.lua +++ b/maps/pirates/structures/boats/boats.lua @@ -726,8 +726,8 @@ local function process_entity_on_boat_unteleportable(memory, boat, newsurface, v if ee and ee.valid then - if un and memory.healthbars and memory.healthbars[un] then - Common.transfer_healthbar(un, ee) + if un and boat.healthbars and boat.healthbars[un] then + Common.transfer_healthbar(un, ee, boat) --for some reason I don't understand, if the old healthbars is contained within memory rather than boat, sometimes this function can't find them (observed during the initial ship launch) end if name == 'artillery-turret' then