Restore logistic group filters when the group is missing or empty (#1097)

* Restore logistic group filters when the group is missing or empty

Named personal logistic groups were restored by name only, so a force
without a group of that name got an empty one, and the empty filters were
uploaded again on leave. Keep assigning the name only when the force's group
already has filters, otherwise also write the stored filters.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* Restore ghost player force before logistic slots

A player waiting to respawn had its personal logistic slots restored
before its force was set. The group lookup and the filter write then
used the force the player had on this server, which could write the
incoming requests into a group shared with other players.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: ILLISIS <jayson.harris01@gmail.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
authored and GitHub committed 2026-10-16 15:29:37 +03:00
1 parent ba74ab048b
commit a75354f9bb
1 file changed
+8 -1
+8 -1
View File
@@ -196,8 +196,13 @@ function serialize.deserialize_personal_logistic_slots(player, serialized)
sec.active = section.active
sec.multiplier = section.multiplier
if section.group ~= "" then -- "" is the default group name, which is truthy
-- Named groups get added with name only - this avoids overwriting existing groups on the server
-- Named groups that have filters on the server get added with name only - this avoids
-- overwriting existing groups. Missing or empty groups get the filters of the player.
local existing = force.get_logistic_group(section.group)
sec.group = section.group
if not existing or #existing.filters == 0 then
sec.filters = section.filters
end
else
-- Unnamed groups get added with filters
sec.filters = section.filters
@@ -803,6 +808,8 @@ function serialize.deserialize_player(player, serialized)
elseif serialized.controller == "ghost" then
-- Ghost state stores hidden logistic and filters which are only accessible in the character controller
-- The force first, so the character and the logistic groups are on the restored player's force
player.force = serialized.force
local character = ensure_character(player)
if serialized.personal_logistic_slots then
serialize.deserialize_personal_logistic_slots(player, serialized.personal_logistic_slots)