mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-21 08:03:13 +09:00
Fix logistics data on servers without logistic researched (#809)
* Initial plan * Add logistics technology validation to prevent load failures Co-authored-by: Danielv123 <6792749+Danielv123@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Danielv123 <6792749+Danielv123@users.noreply.github.com>
This commit is contained in:
1 parent
1c9aae5909
commit
9018397b09
1 file changed
+15
@@ -76,6 +76,12 @@ end
|
|||||||
-- min
|
-- min
|
||||||
-- max
|
-- max
|
||||||
function serialize.serialize_personal_logistic_slots(player)
|
function serialize.serialize_personal_logistic_slots(player)
|
||||||
|
-- Check if logistics technology is researched
|
||||||
|
local force = player.force
|
||||||
|
if not force.technologies["logistic-robotics"] or not force.technologies["logistic-robotics"].researched then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
if v2_logistic_api then
|
if v2_logistic_api then
|
||||||
local logistic_point = player.get_requester_point()
|
local logistic_point = player.get_requester_point()
|
||||||
if logistic_point == nil then
|
if logistic_point == nil then
|
||||||
@@ -129,9 +135,18 @@ function serialize.deserialize_personal_logistic_slots(player, serialized)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Check if logistics technology is researched
|
||||||
|
local force = player.force
|
||||||
|
if not force.technologies["logistic-robotics"] or not force.technologies["logistic-robotics"].researched then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
-- Load personal logistic slots
|
-- Load personal logistic slots
|
||||||
if v2_logistic_api then
|
if v2_logistic_api then
|
||||||
local logistic_point = player.get_requester_point()
|
local logistic_point = player.get_requester_point()
|
||||||
|
if logistic_point == nil then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
-- Remove old sections up to section_count
|
-- Remove old sections up to section_count
|
||||||
for i = logistic_point.sections_count, 1, -1 do
|
for i = logistic_point.sections_count, 1, -1 do
|
||||||
|
|||||||
Reference in new issue
Block a user