mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-03-11 14:49:24 +02:00
Quickbar datastore
Fixes that a player could receive another players logistic settings by mistake.
This commit is contained in:
parent
d2b314446c
commit
b694a90635
@ -1,3 +1,5 @@
|
|||||||
|
-- created by Gerkiz for ComfyFactorio
|
||||||
|
|
||||||
local Token = require 'utils.token'
|
local Token = require 'utils.token'
|
||||||
local Color = require 'utils.color_presets'
|
local Color = require 'utils.color_presets'
|
||||||
local Server = require 'utils.server'
|
local Server = require 'utils.server'
|
||||||
@ -25,14 +27,14 @@ Global.register(
|
|||||||
local Public = {}
|
local Public = {}
|
||||||
|
|
||||||
local function apply_stash(player)
|
local function apply_stash(player)
|
||||||
local stash = this.logistics[player.index]
|
local stash = this.logistics[player.name]
|
||||||
if stash then
|
if stash then
|
||||||
for i, slot in pairs(stash) do
|
for i, slot in pairs(stash) do
|
||||||
if slot and slot.name then
|
if slot and slot.name then
|
||||||
player.set_personal_logistic_slot(i, {name = slot.name, min = slot.min, max = slot.max})
|
player.set_personal_logistic_slot(i, {name = slot.name, min = slot.min, max = slot.max})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
this.logistics[player.index] = nil
|
this.logistics[player.name] = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -71,10 +73,10 @@ local fetch_logistics =
|
|||||||
if tech then
|
if tech then
|
||||||
player.set_personal_logistic_slot(i, {name = slot.name, min = slot.min, max = slot.max})
|
player.set_personal_logistic_slot(i, {name = slot.name, min = slot.min, max = slot.max})
|
||||||
else
|
else
|
||||||
if not this.logistics[player.index] then
|
if not this.logistics[player.name] then
|
||||||
this.logistics[player.index] = {}
|
this.logistics[player.name] = {}
|
||||||
end
|
end
|
||||||
this.logistics[player.index][i] = {name = slot.name, min = slot.min, max = slot.max}
|
this.logistics[player.name][i] = {name = slot.name, min = slot.min, max = slot.max}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user