mirror of
https://github.com/Refactorio/RedMew.git
synced 2025-01-26 03:52:00 +02:00
Logistics slots save/reset during force toggle event
This commit is contained in:
parent
06ec743530
commit
fff3395cad
@ -339,11 +339,23 @@ local function forcetoggle(cmd)
|
||||
global.force_toggle_init = false
|
||||
end
|
||||
|
||||
-- save the logistics slots
|
||||
local slots = {}
|
||||
local slot_counts = game.player.character.request_slot_count
|
||||
if game.player.character.request_slot_count > 0 then
|
||||
for i = 1, slot_counts do
|
||||
slot = game.player.character.get_request_slot(i)
|
||||
if slot ~= nil then
|
||||
table.insert(slots, slot)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if game.player.force.name == "enemy" then
|
||||
local old_force = global.old_force[game.player.name]
|
||||
if not old_force then
|
||||
game.player.force = "player"
|
||||
game.player.print("Your are now on the player force.")
|
||||
game.player.print("You're are now on the player force.")
|
||||
else
|
||||
if game.forces[old_force] then
|
||||
game.player.force = old_force
|
||||
@ -376,6 +388,14 @@ local function forcetoggle(cmd)
|
||||
game.player.force = "enemy"
|
||||
end
|
||||
game.player.print("You are now on the " .. game.player.force.name .. " force.")
|
||||
|
||||
-- Attempt to rebuild the request slots
|
||||
slot_counts = game.player.character.request_slot_count
|
||||
if game.player.character.request_slot_count > 0 then
|
||||
for _,slot in ipairs(slots) do
|
||||
game.player.character.set_request_slot(slot, _)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function get_group()
|
||||
|
Loading…
x
Reference in New Issue
Block a user