CraftSystem: TappingNode: add get_staticdata method, enable static_save`
This commit is contained in:
@@ -25,7 +25,7 @@ local tappingNode = ImmersiveCraftNode:new({
|
|||||||
initial_properties = {
|
initial_properties = {
|
||||||
visual = 'wielditem',
|
visual = 'wielditem',
|
||||||
visual_size = {x=0.4, y=0.4, z=0.4},
|
visual_size = {x=0.4, y=0.4, z=0.4},
|
||||||
static_save = false,
|
--static_save = false,
|
||||||
},
|
},
|
||||||
|
|
||||||
_item_name = '',
|
_item_name = '',
|
||||||
@@ -58,11 +58,24 @@ local tappingNode = ImmersiveCraftNode:new({
|
|||||||
on_punch = function(luaEntity, puncher, time_from_last_punch, tool_capabilities, dir, damage)
|
on_punch = function(luaEntity, puncher, time_from_last_punch, tool_capabilities, dir, damage)
|
||||||
-- We simply trigger the event that the player hits the crafting node, bound to the work station with coordinates.
|
-- We simply trigger the event that the player hits the crafting node, bound to the work station with coordinates.
|
||||||
Events.call(('craft_system:punch_tapping_node:%s:%s'):format(
|
Events.call(('craft_system:punch_tapping_node:%s:%s'):format(
|
||||||
luaEntity._craft_name, luaEntity._stage_name), luaEntity._work_station_pos, puncher)
|
luaEntity._craft_name, luaEntity._stage_name), luaEntity._work_station_pos, puncher, luaEntity)
|
||||||
|
|
||||||
return false
|
return false
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
---@param luaEntity CraftSystem.ImmersiveCraftNode.LuaTappingNode
|
||||||
|
get_staticdata = function(luaEntity)
|
||||||
|
---@type CraftSystem.ImmersiveCraftStage.TappingNode.InitParams?
|
||||||
|
local params = {
|
||||||
|
targetItem = luaEntity._item_name,
|
||||||
|
craftName = luaEntity._craft_name,
|
||||||
|
stageName = luaEntity._stage_name,
|
||||||
|
WorkStationPos = luaEntity._work_station_pos
|
||||||
|
}
|
||||||
|
|
||||||
|
return core.serialize(params)
|
||||||
|
end,
|
||||||
|
|
||||||
---Sets the entity display of the item. If the item stack was not transferred, `self._item_name` is used.
|
---Sets the entity display of the item. If the item stack was not transferred, `self._item_name` is used.
|
||||||
---@param luaEntity CraftSystem.ImmersiveCraftNode.LuaTappingNode
|
---@param luaEntity CraftSystem.ImmersiveCraftNode.LuaTappingNode
|
||||||
---@param itemName ItemStackString?
|
---@param itemName ItemStackString?
|
||||||
|
|||||||
Reference in New Issue
Block a user