From bdef2fffaf90ef8c3400252c270677e138c5c944 Mon Sep 17 00:00:00 2001 From: Vanic Date: Wed, 20 May 2026 21:18:02 +0300 Subject: [PATCH] `HelperLib`: remove `immersiveCraftData` stuff --- mods/SYSTEM/HelperLib/src/Lib.lua | 1 - .../HelperLib/src/Lib/immersiveCraftData.lua | 94 ------------------- 2 files changed, 95 deletions(-) delete mode 100644 mods/SYSTEM/HelperLib/src/Lib/immersiveCraftData.lua diff --git a/mods/SYSTEM/HelperLib/src/Lib.lua b/mods/SYSTEM/HelperLib/src/Lib.lua index 68f8cd4..d881f6a 100644 --- a/mods/SYSTEM/HelperLib/src/Lib.lua +++ b/mods/SYSTEM/HelperLib/src/Lib.lua @@ -6,7 +6,6 @@ local require = modInfo.require require('Lib.activeFormspecs') require('Lib.globalStep') require('Lib.color') -require('Lib.immersiveCraftData') require('Lib.itemStackInventory') require('Lib.getObjectByGUID') require('Lib.receiveFields') diff --git a/mods/SYSTEM/HelperLib/src/Lib/immersiveCraftData.lua b/mods/SYSTEM/HelperLib/src/Lib/immersiveCraftData.lua deleted file mode 100644 index 061e51f..0000000 --- a/mods/SYSTEM/HelperLib/src/Lib/immersiveCraftData.lua +++ /dev/null @@ -1,94 +0,0 @@ -local EMPTY_FLAG = 'EMPTY_FLAG' - ----@class ImmersiveStageData - ----@class ImmersiveCraftData ----@field playerName string The name of the player who started the craft. ----@field craftName string ----@field stageName string ----@field amount integer ----@field stageData ImmersiveStageData? - ----Returns craft data for immersive crafting, which is stored in the desktop metadata. ----@param meta NodeMetaRef ----@return ImmersiveCraftData? -function Smc.getCraftDataByMeta(meta) - local dataString = meta:get_string('craft_data') - - if dataString == EMPTY_FLAG then - return - end - - return core.deserialize(dataString) -end - ----Sets craft data for immersive crafting that is stored in the work station metadata. ---- ----If `data` is `nil`, the data is cleared. ----@param meta NodeMetaRef ----@param craftData ImmersiveCraftData? -function Smc.setCraftDataByMeta(meta, craftData) - if craftData == nil then - meta:set_string('craft_data', EMPTY_FLAG) - end - - meta:set_string('craft_data', core.serialize(craftData)) -end - ----Returns craft data for immersive crafting, which is stored in the work station metadata. ----@param pos MapPosition ----@return ImmersiveCraftData? -function Smc.getCraftDataByPos(pos) - local meta = core.get_meta(pos) - - return Smc.getCraftDataByMeta(meta) -end - ----Sets craft data for immersive crafting that is stored in the work station metadata. ---- ----If `data` is `nil`, the data is cleared. ----@param pos MapPosition ----@param craftData ImmersiveCraftData? -function Smc.setCraftDataByPos(pos, craftData) - local meta = core.get_meta(pos) - - Smc.setCraftDataByMeta(meta, craftData) -end - ----Returns stage data for immersive crafting, which is stored in the work station metadata. ---- ----**Note**: If the workbench does not have crafting data, an error will be thrown. ----@param pos MapPosition ----@return ImmersiveStageData? -function Smc.getStageDataByPos(pos) - local craftData = Smc.getCraftDataByPos(pos) - assert(craftData ~= nil, 'Immersive crafting data is empty.') - - return craftData.stageData -end - ----Sets stage data for immersive crafting that is stored in the work station metadata. ----@param pos MapPosition ----@param stageData ImmersiveStageData -function Smc.setStageDataByPos(pos, stageData) - local craftData = Smc.getCraftDataByPos(pos) - assert(craftData ~= nil, 'Immersive crafting data is empty.') - - craftData.stageData = stageData - Smc.setCraftDataByPos(pos, craftData) -end - ----Checks if the workstation is busy or free for new crafting. ---- ----The verification is based on `ImmersiveCraftData`. ----@param pos MapPosition ----@return boolean -function Smc.workStationIsFree(pos) - local data = Smc.getCraftDataByPos(pos) - - if data == nil then - return true - else - return false - end -end