ItemDefinition & NodeDefinition: add luanti & smc groups annotations
This commit is contained in:
@@ -8,4 +8,5 @@
|
|||||||
---This `ItemDefinition` class is a combination of `ItemDefinition.Settings`
|
---This `ItemDefinition` class is a combination of `ItemDefinition.Settings`
|
||||||
---and `ItemDefinition.Callbacks` and to some extent corresponds to the original.
|
---and `ItemDefinition.Callbacks` and to some extent corresponds to the original.
|
||||||
---@class ItemDefinition : ItemDefinition.Settings, ItemDefinition.Callbacks
|
---@class ItemDefinition : ItemDefinition.Settings, ItemDefinition.Callbacks
|
||||||
|
---@field [string] any
|
||||||
local ItemDefinition = {}
|
local ItemDefinition = {}
|
||||||
|
|||||||
20
definitions/ItemDefinition/Groups.lua
Normal file
20
definitions/ItemDefinition/Groups.lua
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
---Version: 5.18
|
||||||
|
---@meta
|
||||||
|
|
||||||
|
---@class ItemDefinition.Groups
|
||||||
|
---@field [string] integer?
|
||||||
|
local ItemDefinition = {}
|
||||||
|
|
||||||
|
--- Luanti groups ---
|
||||||
|
|
||||||
|
---Special group for inventory mods to indicate that the item should be hidden in item lists.
|
||||||
|
---@type integer?
|
||||||
|
ItemDefinition.not_in_creative_inventory = nil
|
||||||
|
|
||||||
|
---If set to 1 for a tool, it cannot be repaired using the `"toolrepair"` crafting recipe.
|
||||||
|
---@type integer?
|
||||||
|
ItemDefinition.disable_repair = nil
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--- SMC groups ---
|
||||||
@@ -34,7 +34,7 @@ Settings.short_description = nil
|
|||||||
--- {bendy = 2, snappy = 1},
|
--- {bendy = 2, snappy = 1},
|
||||||
--- {hard = 1, metal = 1, spikes = 1}
|
--- {hard = 1, metal = 1, spikes = 1}
|
||||||
---```
|
---```
|
||||||
---@type table<string,integer>?
|
---@type ItemDefinition.Groups?
|
||||||
Settings.groups = nil
|
Settings.groups = nil
|
||||||
|
|
||||||
---Texture shown in the inventory GUI.
|
---Texture shown in the inventory GUI.
|
||||||
|
|||||||
150
definitions/NodeDefinition/Groups.lua
Normal file
150
definitions/NodeDefinition/Groups.lua
Normal file
@@ -0,0 +1,150 @@
|
|||||||
|
---Version: 5.18
|
||||||
|
---@meta
|
||||||
|
|
||||||
|
---@class NodeDefinition.Groups : ItemDefinition.Groups
|
||||||
|
---@field [string] integer?
|
||||||
|
local NodeDefinition = {}
|
||||||
|
|
||||||
|
--- Luanti groups ---
|
||||||
|
|
||||||
|
---The node is `'attached'` to a neighboring node.
|
||||||
|
---
|
||||||
|
---It checks whether the node it is attached to is walkable.
|
||||||
|
---If it isn't, the node will drop as an item.
|
||||||
|
---
|
||||||
|
--- * `1`: if the node is wallmounted, the node is attached in the wallmounted direction.
|
||||||
|
--- Otherwise, the node is attached to the node below.
|
||||||
|
--- * `2`: if the node is facedir or 4dir, the facedir or 4dir direction is checked.
|
||||||
|
--- No effect for other nodes. Note: The "attaching face" of this node is tile № 5 (back face).
|
||||||
|
--- * `3`: the node is always attached to the node below.
|
||||||
|
--- * `4`: the node is always attached to the node above.
|
||||||
|
---@type integer?
|
||||||
|
NodeDefinition.attached_node = nil
|
||||||
|
|
||||||
|
---Value is bounce speed in percent.
|
||||||
|
---
|
||||||
|
---If positive, jump/sneak on floor impact will increase/decrease bounce height.
|
||||||
|
---
|
||||||
|
---Negative value is the same bounciness, but non-controllable.
|
||||||
|
---@type integer?
|
||||||
|
NodeDefinition.bouncy = nil
|
||||||
|
|
||||||
|
---Makes nodes of raillike drawtype with same group value connect to each other
|
||||||
|
---@type integer?
|
||||||
|
NodeDefinition.connect_to_raillike = nil
|
||||||
|
|
||||||
|
---Player can always pick up node without reducing tool wear
|
||||||
|
--- * `2`: the node always gets the digging time 0.5 seconds (rail, sign)
|
||||||
|
--- * `3`: the node always gets the digging time 0 seconds (torch)
|
||||||
|
---@type integer?
|
||||||
|
NodeDefinition.connect_to_raillike = nil
|
||||||
|
|
||||||
|
---Player (and possibly other things) cannot jump from node or
|
||||||
|
---if their feet are in the node.
|
||||||
|
---
|
||||||
|
---**Note**: not supported for `new_move = false`.
|
||||||
|
---@type integer?
|
||||||
|
NodeDefinition.disable_jump = nil
|
||||||
|
|
||||||
|
---Player (and possibly other things) cannot actively descend in node using `Sneak` or `Aux1`
|
||||||
|
---key (for liquids and climbable nodes only).
|
||||||
|
---
|
||||||
|
---**Note**: not supported for `new_move = false`.
|
||||||
|
---@type integer?
|
||||||
|
NodeDefinition.disable_descend = nil
|
||||||
|
|
||||||
|
---Modifies the fall damage suffered when hitting the top of this node.
|
||||||
|
---
|
||||||
|
---There's also an armor group with the same name.
|
||||||
|
---
|
||||||
|
---The final player damage is determined by the following formula:
|
||||||
|
---```lua
|
||||||
|
--- damage =
|
||||||
|
--- collision speed
|
||||||
|
--- * ((node_fall_damage_add_percent + 100) / 100) -- node group
|
||||||
|
--- * ((player_fall_damage_add_percent + 100) / 100) -- player armor group
|
||||||
|
--- - (14)
|
||||||
|
---```
|
||||||
|
---
|
||||||
|
---Negative damage values are discarded as no damage.
|
||||||
|
---@type integer?
|
||||||
|
NodeDefinition.fall_damage_add_percent = nil
|
||||||
|
|
||||||
|
---If there is no walkable node under the node it will fall.
|
||||||
|
---
|
||||||
|
---It also falls if the node below is `buildable_to`.
|
||||||
|
---@type integer?
|
||||||
|
NodeDefinition.falling_node = nil
|
||||||
|
|
||||||
|
---The node will not fall through liquids (liquidtype ~= "none")
|
||||||
|
---
|
||||||
|
---A liquid source with `groups = {falling_node = 1, float = 1}`
|
||||||
|
---will fall through flowing liquids.
|
||||||
|
---@type integer?
|
||||||
|
NodeDefinition.float = nil
|
||||||
|
|
||||||
|
---Can be used to give an additional sense of progression in the game.
|
||||||
|
---@type integer?
|
||||||
|
NodeDefinition.level = nil
|
||||||
|
|
||||||
|
---Players and items will slide on the node.
|
||||||
|
---
|
||||||
|
---Slipperiness rises steadily with `slippery` value, starting at `1`.
|
||||||
|
---@type integer?
|
||||||
|
NodeDefinition.slippery = nil
|
||||||
|
|
||||||
|
---Can be added to nodes that shouldn't logically be breakable by the hand but are.
|
||||||
|
---
|
||||||
|
---Somewhat similar to dig_immediate, but times are more like `{[1]=3.50,[2]=2.00,[3]=0.70}`
|
||||||
|
---and this does not override the digging speed of an item if it can dig at
|
||||||
|
---a faster speed than this suggests for the hand.
|
||||||
|
NodeDefinition.oddly_breakable_by_hand = nil
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--- SMC groups digging time defining group ---
|
||||||
|
|
||||||
|
---Digging time defining group.
|
||||||
|
---
|
||||||
|
---Suitable for items that can be cut (режущийся).
|
||||||
|
---@type integer?
|
||||||
|
NodeDefinition.cutting = nil
|
||||||
|
|
||||||
|
---Digging time defining group.
|
||||||
|
---
|
||||||
|
---Suitable for items that can be crash (раскалываемый).
|
||||||
|
---@type integer?
|
||||||
|
NodeDefinition.crushing = nil
|
||||||
|
|
||||||
|
---Digging time defining group.
|
||||||
|
---
|
||||||
|
---Suitable for items that can be chop (рубящийся).
|
||||||
|
---@type integer?
|
||||||
|
NodeDefinition.chopping = nil
|
||||||
|
|
||||||
|
---Digging time defining group.
|
||||||
|
---
|
||||||
|
---Suitable for items that can be dig (вскапывающийся).
|
||||||
|
---@type integer?
|
||||||
|
NodeDefinition.digging = nil
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--- SMC node types groups ---
|
||||||
|
|
||||||
|
---@type integer?
|
||||||
|
NodeDefinition.slabs = nil
|
||||||
|
|
||||||
|
---@type integer?
|
||||||
|
NodeDefinition.stairs = nil
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--- SMC special groups ---
|
||||||
|
|
||||||
|
---A group for the automatic registration of node segments (slabs and stairs).
|
||||||
|
--- * `1`: registration only slabs
|
||||||
|
--- * `2`: registration only stairs
|
||||||
|
--- * `3`: registration slabs & stairs
|
||||||
|
---@type integer?
|
||||||
|
NodeDefinition.segments = nil
|
||||||
@@ -4,6 +4,22 @@
|
|||||||
---@class NodeDefinition.Settings : ItemDefinition.Settings
|
---@class NodeDefinition.Settings : ItemDefinition.Settings
|
||||||
local Settings = {}
|
local Settings = {}
|
||||||
|
|
||||||
|
---Table of groups-characteristics of Item.
|
||||||
|
---```
|
||||||
|
--- key = name, value = rating; rating = number.
|
||||||
|
---```
|
||||||
|
---If rating not applicable, use 1.
|
||||||
|
---
|
||||||
|
---e.g.:
|
||||||
|
---```
|
||||||
|
--- {wool = 1, fluffy = 3}
|
||||||
|
--- {soil = 2, outerspace = 1, crumbly = 1}
|
||||||
|
--- {bendy = 2, snappy = 1},
|
||||||
|
--- {hard = 1, metal = 1, spikes = 1}
|
||||||
|
---```
|
||||||
|
---@type NodeDefinition.Groups?
|
||||||
|
Settings.groups = nil
|
||||||
|
|
||||||
---@alias Node.Settings.drawtype
|
---@alias Node.Settings.drawtype
|
||||||
---|'normal'
|
---|'normal'
|
||||||
---|'airlike'
|
---|'airlike'
|
||||||
|
|||||||
Reference in New Issue
Block a user