EmmyLua -> LuaLS
This commit is contained in:
@@ -126,7 +126,7 @@ function BaseCraft:recipeToString(recipeIndex, mainList)
|
||||
local recipeItem = ItemStack(itemName)
|
||||
recipeDesc = recipeDesc..('%s %s x%s\n'):format(
|
||||
getCheckMaterialItem(recipeItem, recipeItem:get_count(), mainList),
|
||||
core.strip_colors(recipeItem:get_definition()._title),
|
||||
core.strip_colors(Smc.getItemDefinition(recipeItem).settings._title),
|
||||
recipeItem:get_count())
|
||||
else
|
||||
recipeDesc = recipeDesc..('%s any item from the group %s x%s\n'):format(
|
||||
|
||||
@@ -4,8 +4,7 @@ local coreChatSendPlayer, coreItemDrop = core.chat_send_player, core.item_drop
|
||||
|
||||
local require = Mod.getInfo('smc__core__craft_system').require
|
||||
|
||||
---@type Events.ImmersiveCraftEvents
|
||||
local ImmersiveCraftEvents = Smc.requireEvents('ImmersiveCraftEvents')
|
||||
local ImmersiveCraftEvents = Smc.requireEvents('ImmersiveCraftEvents') --[[@as Events.ImmersiveCraftEvents]]
|
||||
|
||||
---@type CraftSystem.BaseCraft
|
||||
local BaseCraft = require('CraftSystem.BaseCraft')
|
||||
@@ -43,6 +42,8 @@ function ImmersiveCraft:new(name, def)
|
||||
local StageClass = stageTypes[stageDef.type]
|
||||
|
||||
stageDef.craftName = name
|
||||
|
||||
---@cast stageDef CraftSystem.ImmersiveCraftStage.TappingStageDef
|
||||
local stage = StageClass:new(stageDef)
|
||||
|
||||
stagesByName[stageDef.name] = stage
|
||||
@@ -60,8 +61,7 @@ function ImmersiveCraft:new(name, def)
|
||||
if nextStageName == nil then
|
||||
instance:endCraft(pos, player)
|
||||
else
|
||||
---@type ImmersiveWorkStation?
|
||||
local workStation = Smc.getNodeSuperclassByPos(pos)
|
||||
local workStation = Smc.getNodeSuperclassByPos(pos) --[[@as ImmersiveWorkStation?]]
|
||||
assert(workStation ~= nil)
|
||||
local nextStage = instance.stagesByName[nextStageName]
|
||||
|
||||
@@ -83,8 +83,7 @@ end
|
||||
---@param amount integer
|
||||
---@return boolean
|
||||
function ImmersiveCraft:startCraft(pos, player, amount)
|
||||
---@type ImmersiveWorkStation?
|
||||
local workStation = Smc.getNodeSuperclassByPos(pos)
|
||||
local workStation = Smc.getNodeSuperclassByPos(pos) --[[@as ImmersiveWorkStation?]]
|
||||
assert(workStation ~= nil)
|
||||
|
||||
local meta = workStation:getMeta(pos)
|
||||
@@ -118,8 +117,7 @@ end
|
||||
---@param pos MapVector
|
||||
---@param player Player
|
||||
function ImmersiveCraft:endCraft(pos, player)
|
||||
---@type ImmersiveWorkStation?
|
||||
local workStation = Smc.getNodeSuperclassByPos(pos)
|
||||
local workStation = Smc.getNodeSuperclassByPos(pos) --[[@as ImmersiveWorkStation?]]
|
||||
assert(workStation ~= nil)
|
||||
|
||||
local meta = workStation:getMeta(pos)
|
||||
@@ -147,8 +145,7 @@ end
|
||||
---Stop the crafting process and free up the workbench.
|
||||
---@param pos MapVector
|
||||
function ImmersiveCraft:abortCraft(pos)
|
||||
---@type ImmersiveWorkStation?
|
||||
local workStation = Smc.getNodeSuperclassByPos(pos)
|
||||
local workStation = Smc.getNodeSuperclassByPos(pos) --[[@as ImmersiveWorkStation?]]
|
||||
assert(workStation ~= nil)
|
||||
|
||||
local meta = workStation:getMeta(pos)
|
||||
@@ -171,7 +168,9 @@ function ImmersiveCraft:abortCraft(pos)
|
||||
end
|
||||
|
||||
---Returns a human-readable description of the crafting process.
|
||||
---@return string
|
||||
---@param recipeIndex integer?
|
||||
---@param mainList ItemStack[]?
|
||||
---@return string
|
||||
function ImmersiveCraft:recipeToString(recipeIndex, mainList)
|
||||
local recipeDesc = ''
|
||||
---@type string?
|
||||
|
||||
@@ -53,6 +53,8 @@ core.register_on_mods_loaded(function()
|
||||
tableSort(crafts, function(a, b)
|
||||
if a.output < b.output then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -69,6 +71,8 @@ core.register_on_mods_loaded(function()
|
||||
|
||||
if outputA < outputB then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
local require = Mod.getInfo('smc__core__craft_system').require
|
||||
|
||||
---@type Events.ImmersiveCraftEvents
|
||||
local ImmersiveCraftEvents = Smc.requireEvents('ImmersiveCraftEvents')
|
||||
local ImmersiveCraftEvents = Smc.requireEvents('ImmersiveCraftEvents') --[[@as Events.ImmersiveCraftEvents]]
|
||||
|
||||
---@type CraftSystem.ImmersiveCraftNode
|
||||
local ImmersiveCraftNode = require('CraftSystem.ImmersiveCraftNode')
|
||||
@@ -68,7 +67,7 @@ local tappingNode = ImmersiveCraftNode:new({
|
||||
|
||||
---@param luaEntity CraftSystem.ImmersiveCraftNode.LuaTappingNode
|
||||
get_staticdata = function(luaEntity)
|
||||
---@type CraftSystem.ImmersiveCraftStage.TappingNode.InitParams?
|
||||
---@type CraftSystem.ImmersiveCraftStage.TappingNode.InitParams
|
||||
local params = {
|
||||
targetItem = luaEntity._item_name,
|
||||
craftName = luaEntity._craft_name,
|
||||
|
||||
@@ -5,8 +5,7 @@ local coreItemDrop = core.item_drop
|
||||
|
||||
local require = Mod.getInfo('smc__core__craft_system').require
|
||||
|
||||
---@type Events.ImmersiveCraftEvents
|
||||
local ImmersiveCraftEvents = Smc.requireEvents('ImmersiveCraftEvents')
|
||||
local ImmersiveCraftEvents = Smc.requireEvents('ImmersiveCraftEvents') --[[@as Events.ImmersiveCraftEvents]]
|
||||
|
||||
---@type CraftSystem.ImmersiveCraftStage
|
||||
local ImmersiveCraftStage = require('CraftSystem.ImmersiveCraftStage')
|
||||
@@ -41,8 +40,7 @@ local TappingStage = extend(ImmersiveCraftStage, {})
|
||||
|
||||
---@param def CraftSystem.ImmersiveCraftStage.TappingStageDef
|
||||
function TappingStage:new(def)
|
||||
---@type CraftSystem.ImmersiveCraftStage.TappingStage
|
||||
local instance = ImmersiveCraftStage:new(def)
|
||||
local instance = ImmersiveCraftStage:new(def) --[[@as CraftSystem.ImmersiveCraftStage.TappingStage]]
|
||||
instance.targetItem = def.targetItem
|
||||
instance.clicksNeed = def.clicksNeed
|
||||
instance.toolGroup = def.toolGroup
|
||||
@@ -71,8 +69,7 @@ function TappingStage:new(def)
|
||||
entityGUID = obj:get_guid()
|
||||
}
|
||||
|
||||
---@type ImmersiveWorkStation?
|
||||
local workStation = Smc.getNodeSuperclassByPos(pos)
|
||||
local workStation = Smc.getNodeSuperclassByPos(pos) --[[@as ImmersiveWorkStation?]]
|
||||
assert(workStation ~= nil)
|
||||
|
||||
local meta = workStation:getMeta(pos)
|
||||
@@ -82,8 +79,7 @@ function TappingStage:new(def)
|
||||
-- Registering the crafting stage process handler.
|
||||
-- Called when a player clicks on a crafting node (entity).
|
||||
instance.processHandler = function(tappingStage, pos, player)
|
||||
---@type ImmersiveWorkStation?
|
||||
local workStation = Smc.getNodeSuperclassByPos(pos)
|
||||
local workStation = Smc.getNodeSuperclassByPos(pos) --[[@as ImmersiveWorkStation?]]
|
||||
assert(workStation ~= nil)
|
||||
local meta = workStation:getMeta(pos)
|
||||
|
||||
@@ -104,8 +100,7 @@ function TappingStage:new(def)
|
||||
|
||||
-- Registering the crafting stage end handler.
|
||||
instance.endHandler = function(tappingStage, pos, player)
|
||||
---@type ImmersiveWorkStation?
|
||||
local workStation = Smc.getNodeSuperclassByPos(pos)
|
||||
local workStation = Smc.getNodeSuperclassByPos(pos) --[[@as ImmersiveWorkStation?]]
|
||||
assert(workStation ~= nil)
|
||||
local meta = workStation:getMeta(pos)
|
||||
|
||||
@@ -113,7 +108,7 @@ function TappingStage:new(def)
|
||||
local stageData = core.deserialize(meta:get_string('stage_data'))
|
||||
assert(stageData ~= nil)
|
||||
|
||||
local entity = Smc.getObjectByGUID(stageData.entityGUID)
|
||||
local entity = Smc.getObjectByGUID(stageData.entityGUID) --[[@as Entity?]]
|
||||
assert(entity ~= nil, 'The entity for immersive crafting is nil.')
|
||||
|
||||
entity:remove()
|
||||
@@ -123,9 +118,9 @@ function TappingStage:new(def)
|
||||
|
||||
-- Registering the aborting the crafting process handler.
|
||||
---@param tappingStage CraftSystem.ImmersiveCraftStage.TappingStage
|
||||
---@param pos MapVector
|
||||
instance.abortHandler = function(tappingStage, pos)
|
||||
---@type ImmersiveWorkStation?
|
||||
local workStation = Smc.getNodeSuperclassByPos(pos)
|
||||
local workStation = Smc.getNodeSuperclassByPos(pos) --[[@as ImmersiveWorkStation?]]
|
||||
assert(workStation ~= nil)
|
||||
local meta = workStation:getMeta(pos)
|
||||
|
||||
@@ -140,7 +135,8 @@ function TappingStage:new(def)
|
||||
local stageData = stageData
|
||||
assert(stageData ~= nil, 'Immersive stage data is empty.')
|
||||
|
||||
local entity = Smc.getObjectByGUID(stageData.entityGUID)
|
||||
---@type Entity?
|
||||
local entity = Smc.getObjectByGUID(stageData.entityGUID) --[[@as Entity?]]
|
||||
assert(entity ~= nil, 'The entity for immersive crafting is nil.')
|
||||
|
||||
entity:remove()
|
||||
|
||||
@@ -69,6 +69,8 @@ core.register_on_mods_loaded(function()
|
||||
tableSort(crafts, function(a, b)
|
||||
if a.output < b.output then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -85,6 +87,8 @@ core.register_on_mods_loaded(function()
|
||||
|
||||
if outputA < outputB then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user