Item & Node: update settings & callbacks: inheritance from ide-helper

This commit is contained in:
Van
2026-06-20 22:36:12 +03:00
parent 45a1e79bc6
commit f39a696653
9 changed files with 25 additions and 761 deletions

View File

@@ -83,14 +83,8 @@ local function addRarityToDesc(rarity, desc)
return desc..'\n'..colorize(color, rarityString)
end
---The alias `table.merge` for EmmyLua
---@type fun(...):(NodeDefinition|ItemDefinition)
local defMerge = function(...)
return tableMerge(...)
end
---@param itemDef Item.ItemDefinition
---@return NodeDefinition|ItemDefinition
---@return ItemDefinition
local function itemDefToLuantiDef(itemDef)
local modName = Mod.getInfo().shortName
local S = core.get_translator(modName)
@@ -127,7 +121,7 @@ local function itemDefToLuantiDef(itemDef)
s._description = description
s.description = luantiDescription..core.get_background_escape_sequence('#110F13')
local luantiDef = defMerge(s, c, true)
local luantiDef = tableMerge(s, c, true) --[[@as ItemDefinition]]
return luantiDef
end
@@ -167,8 +161,7 @@ function Item:new(itemDef)
itemDef = tableCopy(itemDef)
-- Adding default parameterss
---@type Item.ItemDefinition
itemDef = tableMerge(itemDef, self.defaultDef, true)
itemDef = tableMerge(itemDef, self.defaultDef, true) --[[@as Item.ItemDefinition]]
local s = itemDef.settings
local shortModName = Mod.getInfo().shortName
@@ -190,7 +183,7 @@ function Item:new(itemDef)
itemDef.settings._type = nil
if type == 'node' then
registerNode(luantiDef)
registerNode(luantiDef --[[@as NodeDefinition]])
elseif type == 'craftitem' then
registerCraftitem(luantiDef)
elseif type == 'tool' then

View File

@@ -1,67 +1,4 @@
---@class Item.Callbacks
---@meta
---@class Item.Callbacks : ItemDefinition.Callbacks
local Callbacks = {}
---Called when the 'place' key was pressed with the item in hand
---and pointing at a node.
---Shall place item and return the leftover itemstack
---or nil to not modify the inventory.
---The placer may be any ObjectRef or nil.
---
---default: core.item_place
---@type (fun(itemstack:ItemStack, placer:Player|ObjectRef|nil, pointed_thing:pointed_thing):ItemStack|nil, Position|vector|nil)?
Callbacks.on_place = core.item_place
---Same as on_place but called when not pointing at a node.
---Function must return either nil if inventory shall not be modified,
---or an itemstack to replace the original itemstack.
---The user may be any ObjectRef or nil.
---
---default: core.item_secondary_use
---@type fun(itemstack:ItemStack, user:Player|ObjectRef|nil, pointed_thing:pointed_thing)?
Callbacks.on_secondary_use = nil
---Shall drop item and return the leftover itemstack.
---The dropper may be any ObjectRef or nil.
---
---default: core.item_drop
---@type (fun(itemstack:ItemStack|ItemStackString, dropper:Player|ObjectRef|nil, pos:Position):ItemStack)?
Callbacks.on_drop = core.item_drop
---Called when a dropped item is punched by a player.
---Shall pick-up the item and return the leftover itemstack or nil to not
---modify the dropped item.
---
---default: core.item_pickup
---* `itemstack`: the `ItemStack` to be picked up
---* `picker`: any `ObjectRef` or `nil`
---* `pointed_thing`: the dropped item (a `"__builtin:item"` luaentity) as `type="object"` `pointed_thing`
---* `time_from_last_punch`: other parameters from `luaentity:on_punch`
---* `...`: other parameters from `luaentity:on_punch`
---@type fun(itemstack:ItemStack, picker:Player|ObjectRef|nil, pointed_thing:pointed_thing, time_from_last_punch, ...)?
Callbacks.on_pickup = core.item_pickup
---Called when user presses the 'punch/dig' key with the item in hand.
---Function must return either nil if inventory shall not be modified,
---or an itemstack to replace the original itemstack.
---e.g. itemstack:take_item(); return itemstack
---The user may be any ObjectRef or nil.
---Note that defining this callback will prevent normal punching/digging
---behavior on the client, as the interaction is instead "forwarded" to the
---server.
---
---default: nil
---@type (fun(itemstack:ItemStack, user:Player|ObjectRef|nil, pointed_thing:pointed_thing):ItemStack|nil)?
Callbacks.on_use = nil
---Called after a tool is used to dig a node and will replace the default
---tool wear-out handling.
---Shall return the leftover itemstack or nil to not
---modify the dropped item.
---The user may be any ObjectRef or nil.
---
---default: nil
---
---@type fun(itemstack:ItemStack, user:Player|ObjectRef|nil, node, digparams)?
Callbacks.after_use = nil
return Callbacks

View File

@@ -1,6 +1,6 @@
---@meta
---@class Item.ItemDefinition
---@field settings Item.Settings
---@field callbacks Item.Callbacks?
local ItemDefinition = {}
return ItemDefinition

View File

@@ -1,3 +1,5 @@
---@meta
---Rarity of items:
--- * `common`
--- * `uncommon`

View File

@@ -1,13 +1,12 @@
---@class Item.Settings
---@meta
---@class Item.Settings : ItemDefinition.Settings
local Settings = {}
---Technical name of the item. Must be unique and have the format `mod_name:item_name`
---@type string
Settings.name = ''
---@type string?
Settings.description = nil
---Whether to add the mod name to the settings.name. Default: `true`
---@type boolean?
Settings._add_mod_name = nil
@@ -40,14 +39,6 @@ Settings._type = nil
---@type Item.Rarity?
Settings._rarity = nil
---Table of groups-characteristics of Item.
---`key` = name, `value` = rating; `rating` = number.
---
---If rating not applicable, use 1.
---@type table<string,number>?
Settings.groups = nil
---The number of inventory slots that can be stored in an ItemStack.
---@type integer?
Settings._itemstack_inventory_size = nil
@@ -68,142 +59,3 @@ Settings._itemstack_inventory_allowed_groups = nil
---with which cannot be placed in an item's inventory.
---@type string[]?
Settings._itemstack_inventory_disallowed_groups = nil
---Texture shown in the inventory GUI.
---Defaults to a 3D rendering of the node if left empty.
---@type string?
Settings.inventory_image = nil
---An overlay texture which is not affected by colorization.
---@type string?
Settings.inventory_overlay = nil
---Texture shown when item is held in hand.
---Defaults to a 3D rendering of the node if left empty.
---@type string?
Settings.wield_image = nil
---Like `inventory_overlay` but only used in the same situation as `wield_image`.
---@type string?
Settings.wield_overlay = nil
---Scale for the item when held in hand.
---@type Position?
Settings.wield_scale = nil
---An image file containing the palette of a node.
---You can set the currently used color as the "palette_index" field of
---the item stack metadata.
---The palette is always stretched to fit indices between 0 and 255, to
---ensure compatibility with "colorfacedir" (and similar) nodes.
---@type string?
Settings.palette = nil
---Color the item is colorized with. The palette overrides this.
---It is a colorspec.
---@type string|ColorSpec|nil
Settings.color = nil
---Maximum amount of items that can be in a single stack.
---The default can be changed by the setting `default_stack_max`.
---@type number?
Settings.stack_max = nil
---Range of node and object pointing that is possible with this item held.
---Can be overridden with itemstack meta.
---@type number?
Settings.range = nil
---If true, item can point to all liquid nodes (`liquidtype ~= "none"`),
---even those for which `pointable = false`.
---@type boolean?
Settings.liquids_pointable = nil
---Contains lists to override the `pointable` property of nodes and objects.
---The index can be a node/entity name or a group with the prefix `"group:"`.
---For objects `armor_groups` are used and for players the entity name is irrelevant.)
---If multiple fields fit, the following priority order is applied:
---1. value of matching node/entity name
---2. `true` for any group
---3. `false` for any group
---4. `"blocking"` for any group
---5. `liquids_pointable` if it is a liquid node
---6. `pointable` property of the node or object
---@type table?
Settings.pointabilities = nil
---When used for nodes: Defines amount of light emitted by node.
---Otherwise: Defines texture glow when viewed as a dropped item.
---To set the maximum (14), use the value `core.LIGHT_MAX`.
---A value outside the range 0 to `core.LIGHT_MAX` causes undefined
---behavior.
---@type number?
Settings.light_source = nil
---See "Tool Capabilities" section for an example including explanation.
---TODO: сделать или подтянуть из какого-нибудь helpers тип этой таблицы
---@type table?
Settings.tool_capabilities = nil
---Set wear bar color of the tool by setting color stops and blend mode.
---See "Wear Bar Color" section for further explanation including an example.
---TODO: сделать или подтянуть из какого-нибудь helpers тип этой таблицы
---@type table?
Settings.wear_color = nil
---If nil and item is node, prediction is made automatically.
---If nil and item is not a node, no prediction is made.
---If "" and item is anything, no prediction is made.
---Otherwise should be name of node which the client immediately places
---on ground when the player places the item. Server will always update
---with actual result shortly.
---@type string?
Settings.node_placement_prediction = nil
---if "", no prediction is made.
---if "air", node is removed.
---Otherwise should be name of node which the client immediately places
---upon digging. Server will always update with actual result shortly.
---`default: "air"`
---@type string?
Settings.node_dig_prediction = nil
---Only affects touchscreen clients.
---Defines the meaning of short and long taps with the item in hand.
---If specified as a table, the field to be used is selected according to
---the current `pointed_thing`.
---There are three possible TouchInteractionMode values:
---* "long_dig_short_place" (long tap = dig, short tap = place)
---* "short_dig_long_place" (short tap = dig, long tap = place)
---* "user":
---* * For `pointed_object`: Equivalent to "short_dig_long_place" if the
--- client-side setting "touch_punch_gesture" is "short_tap" (the
--- default value) and the item is able to punch (i.e. has no on_use
--- callback defined).
--- Equivalent to "long_dig_short_place" otherwise.
---* * For `pointed_node` and `pointed_nothing`:
--- Equivalent to "long_dig_short_place".
---* * The behavior of "user" may change in the future.
---The default value is "user".
---
---@type table<string,SimpleSoundSpec>?
Settings.touch_interaction = nil
---Definition of item sounds to be played at various events.
---All fields in this table are optional.
---
---@type table<string,SimpleSoundSpec>?
Settings.sound = nil
return Settings

View File

@@ -1 +1,3 @@
---@alias Item.Type 'craftitem'|'node'|'tool'
---@meta
---@alias Item.Type 'craftitem'|'node'|'tool'

View File

@@ -1,190 +1,4 @@
---@type Item.Callbacks
local ItemCallbacks = Mod.getInfo('smc__core__item').require('Item.Callbacks')
---@meta
---@class Node.Callbacks : Item.Callbacks
local Callbacks = Class.extend(ItemCallbacks, {})
---Node constructor; called after adding node.
---Can set up metadata and stuff like that.
---Not called for bulk node placement (i.e. schematics and VoxelManip).
---Note: Within an `on_construct` callback, `core.set_node` can cause an
---infinite loop if it invokes the same callback.
---Consider using `core.swap_node` instead.
---
---default: nil
---* `pos`: node position
---@type fun(pos:MapVector)?
Callbacks.on_construct = nil
---Node destructor; called before removing node.
---Not called for bulk node placement.
---
---default: nil
---* `pos`: node position
---@type fun(pos:MapVector)?
Callbacks.on_destruct = nil
---Node destructor; called after removing node.
---Not called for bulk node placement.
---
---default: nil
---* `pos`: node position
---* `oldnode`: node table of node before it was deleted
---@type fun(pos:MapVector, old_node)?
Callbacks.after_destruct = nil
---Called when a liquid (newnode) is about to flood oldnode, if it has
---`floodable = true` in the nodedef. Not called for bulk node placement
---(i.e. schematics and VoxelManip) or air nodes. If return true the
---node is not flooded, but on_flood callback will most likely be called
---over and over again every liquid update interval.
---
---Default: nil
---
---Warning: making a liquid node 'floodable' will cause problems.
---* `pos`: table node position
---* `oldnode`: table node table of node before it was deleted
---* `newnode`: TODO: какой тут тип?
---@type fun(pos:MapVector, old_node, new_node)?
Callbacks.on_flood = nil
---Called when `oldnode` is about be converted to an item, but before the
---node is deleted from the world or the drops are added. This is
---generally the result of either the node being dug or an attached node
---becoming detached.
---
---default: `nil`
---* `pos`: node position
---* `oldnode`: node table of node before it was deleted
---* `oldmeta`: metadata of node before it was deleted, as a metadata table
---* `drops`: a table of `ItemStack`s, so any metadata to be preserved can
--- be added directly to one or more of the dropped items. See
--- "ItemStackMetaRef".
---@type fun(pos:MapVector, old_node, new_node, old_meta, drops:ItemStack[])?
Callbacks.preserve_metadata = nil
---Called after constructing node when node was placed using
---core.item_place_node / core.place_node.
---If return true no item is taken from itemstack.
---
---default: nil
---* `pos`: node position
---* `placer`: may be any valid ObjectRef or nil
---* `itemstack`: TODO: сделать описание
---* `pointed_thing`: Vector of the direction of the gaze of the person who placed the block
---@type fun(pos:MapVector, placer:Player|ObjectRef|nil, itemstack:ItemStack, pointed_thing:pointed_thing)?
Callbacks.after_place_node = nil
---Called after destructing the node when node was dug using
---`core.node_dig` / `core.dig_node`.
---
---default: nil
---* `pos`: node position
---* `oldnode`: node table of node before it was dug
---* `oldmetadata`: metadata of node before it was dug, as a metadata table
---* `digger`: ObjectRef of digger
---@type fun(pos:Player, oldnode, oldmetadata, digger:Player|ObjectRef|nil)?
Callbacks.after_dig_node = nil
---Returns true if node can be dug, or false if not.
---
---default: nil
---* `pos`: node position
---* player: ObjectRef of digger
---@type fun(pos:MapVector, player:Player|ObjectRef|nil)?
Callbacks.can_dig = nil
---Called when puncher (an ObjectRef) punches the node at pos.
---By default calls core.register_on_punchnode callbacks.
---
---default: core.node_punch
---* `pos`: node position
---* `node`: node being hit
---* `puncher`: ObjectRef of punch
---* `pointed_thing`: Vector of the direction of the gaze of the person who placed the block
---@type fun(pos:MapVector, node:NodeTable, puncher:Player|ObjectRef, pointed_thing:pointed_thing)?
Callbacks.on_punch = nil
---Called when clicker (an ObjectRef) used the 'place/build' key
---(not necessarily an actual rightclick)
---while pointing at the node at pos with 'node' being the node table.
---itemstack will hold clicker's wielded item.
---Shall return the leftover itemstack.
---
---Note: pointed_thing can be nil, if a mod calls this function.
---
---default: nil
---@type (fun(pos:MapVector, node:NodeTable, clicker:Player|ObjectRef, itemstack:ItemStack, pointed_thing:pointed_thing|nil):ItemStack|nil)?
Callbacks.on_rightclick = core.node_punch
---By default checks privileges, wears out item (if tool) and removes node.
---return true if the node was dug successfully, false otherwise.
---Deprecated: returning nil is the same as returning true.
---
---default: core.node_dig
---@type (fun(pos:MapVector, node:NodeTable, digger:Player): boolean)?
Callbacks.on_dig = minetest.node_dig
---called by NodeTimers, see core.get_node_timer and NodeTimerRef.
---* `elapsed`: total time passed since the timer was started.
---* `node`: node table (since 5.14)
---* `timeout`: timeout value of the just ended timer (since 5.14)
---return true to run the timer for another cycle with the same timeout value.
---
---default: nil
---@type (fun(pos:MapVector, elapsed:number, node:NodeTable, timeout:number):boolean?)?
Callbacks.on_timer = nil
---fields = {name1 = value1, name2 = value2, ...}
---
---formname should be the empty string; you **must not** use formname.
---Called when an UI form (e.g. sign text input) returns data.
---See `core.register_on_player_receive_fields` for more info.
---
---default: nil
---@type fun(pos:MapVector, formname:string, fields:table, sender:Player)?
Callbacks.on_receive_fields = nil
---Called when a player wants to put something into the inventory.
---
---Return value: number of items allowed to put.
---
---Return value -1: Allow and don't modify item count in inventory.
---@type (fun(pos:MapVector, from_list:string, from_index:number, to_list:string, to_index:number, count:number, player:Player): number)?
Callbacks.allow_metadata_inventory_move = nil
---Called when a player wants to take something out of the inventory.
---
---Return value: number of items allowed to take.
---
---Return value -1: Allow and don't modify item count in inventory.
---@type (fun(pos:MapVector, listname:string, index:number, stack:ItemStack, player:Player): number)?
Callbacks.allow_metadata_inventory_take = nil
---Called after the actual action has happened, according to what was allowed.
---
---No return value.
---@type (fun(pos:MapVector, from_list:string, from_index:number, to_list:string, to_index:number, count:number, player:Player): any)?
Callbacks.on_metadata_inventory_move = nil
---Called after the actual action has happened, according to what was allowed.
---
---No return value.
---@type (fun(pos:MapVector, listname:string, index:number, stack:ItemStack, player:Player): any)?
Callbacks.on_metadata_inventory_put = nil
---Called after the actual action has happened, according to what was allowed.
---
---No return value.
---@type (fun(pos:MapVector, listname:string, index:number, stack:ItemStack, player:Player): any)?
Callbacks.on_metadata_inventory_take = nil
---If defined, called when an explosion touches the node, instead of
---removing the node.
---* `intensity`: 1.0 = mid range of regular TNT.
---@type (fun(pos:MapVector, intensity:number): any)?
Callbacks.on_blast = nil
return Callbacks
---@class Node.Callbacks : Item.Callbacks, NodeDefinition.Callbacks
local Callbacks = {}

View File

@@ -1,6 +1,6 @@
---@meta
---@class Node.NodeDefinition
---@field settings Node.Settings
---@field callbacks Node.Callbacks?
local NodeDefinition = {}
return NodeDefinition

View File

@@ -1,340 +1,4 @@
---@type Item.Settings
local ItemSettings = Mod.getInfo('smc__core__item').require('Item.Settings')
---@meta
---@class Node.Settings : Item.Settings
local Settings = Class.extend(ItemSettings, {})
---See "Node drawtypes"
---@type string?
Settings.drawtype = nil
---Supported for drawtypes "plantlike", "signlike", "torchlike",
---"firelike", "mesh", "nodebox", "allfaces".
---For plantlike and firelike, the image will start at the bottom of the
---node. For torchlike, the image will start at the surface to which the
---node "attaches". For the other drawtypes the image will be centered
---on the node.
---@type number?
Settings.visual_scale = nil
---Textures of node: +Y, -Y, +X, -X, +Z, -Z.
---
---List can be shortened to needed length.
---@type (string[]|TileDefinition[])?
Settings.tiles = {}
---Same as `tiles`, but these textures are drawn on top of the base
---tiles. You can use this to colorize only specific parts of your
---texture. If the texture name is an empty string, that overlay is not
---drawn. Since such tiles are drawn twice, it is not recommended to use
---overlays on very common nodes.
---@type (string[]|TileDefinition[])?
Settings.overlay_tiles = nil
---Special textures of node; used rarely.
---
---List can be shortened to needed length.
---@type (string[]|TileDefinition[])?
Settings.special_tiles = nil
---The node's original color will be multiplied with this color.
---If the node has a palette, then this setting only has an effect in
---the inventory and on the wield item.
---@type (string|ColorSpec)?
Settings.color = nil
---Specifies how the texture's alpha channel will be used for rendering.
---Possible values:
---* `"opaque"`:
--- Node is rendered opaque regardless of alpha channel.
---* `"clip"`:
--- A given pixel is either fully see-through or opaque
--- depending on the alpha channel being below/above 50% in value.
--- Use this for nodes with fully transparent and fully opaque areas.
---* `"blend"`:
--- The alpha channel specifies how transparent a given pixel
--- of the rendered node is. This comes at a performance cost.
--- Only use this when correct rendering
--- among semitransparent nodes is necessary.
---
---The default is `"opaque"` for drawtypes normal, liquid and flowingliquid,
---mesh and nodebox or "clip" otherwise.
---If set to a boolean value (deprecated): true either sets it to blend
---or clip, false sets it to clip or opaque mode depending on the drawtype.
---@type string?
Settings.use_texture_alpha = nil
---The node's `param2` is used to select a pixel from the image.
---Pixels are arranged from left to right and from top to bottom.
---The node's color will be multiplied with the selected pixel's color.
---Tiles can override this behavior.
---
---Only when `paramtype2` supports palettes.
---@type string?
Settings.palette = nil
---Screen tint if a player is inside this node, see `ColorSpec`.
---Color is alpha-blended over the screen.
---@type string?
Settings.post_effect_color = nil
---Determines whether `post_effect_color` is affected by lighting.
---@type boolean?
Settings.post_effect_color_shaded = nil
---See "Nodes"
---@type string?
Settings.paramtype = nil
---See "Nodes"
---@type string?
Settings.paramtype2 = nil
---Value for param2 that is set when player places node.
---@type number?
Settings.place_param2 = nil
---If true, place_param2 is nil, and this is a wallmounted node,
---this node might use the special 90° rotation when placed
---on the floor or ceiling, depending on the direction.
---See the explanation about wallmounted for details.
---Otherwise, the rotation is always the same on vertical placement.
---@type boolean?
Settings.wallmounted_rotate_vertical = nil
---If false, the cave generator and dungeon generator will not carve
---through this node.
---Specifically, this stops mod-added nodes being removed by caves and
---dungeons when those generate in a neighbor mapchunk and extend out
---beyond the edge of that mapchunk.
---@type boolean?
Settings.is_ground_content = nil
---If true, sunlight will go infinitely through this node.
---@type boolean?
Settings.sunlight_propagates = nil
---If true, objects collide with node.
---@type boolean?
Settings.walkable = nil
---Can be `true` if it is pointable, `false` if it can be pointed through,
---or `"blocking"` if it is pointable but not selectable.
---Clients older than 5.9.0 interpret `pointable = "blocking"` as `pointable = true`.
---Can be overridden by the `pointabilities` of the held item.
---A client may be able to point non-pointable nodes, since it isn't checked server-side.
---@type boolean?
Settings.pointable = nil
---If false, can never be dug.
---@type boolean?
Settings.diggable = nil
---If true, can be climbed on like a ladder.
---@type boolean?
Settings.climbable = nil
---Slows down movement of players through this node (max. 7).
---If this is nil, it will be equal to liquid_viscosity.
---Note: If liquid movement physics apply to the node
---(see `liquid_move_physics`), the movement speed will also be
---affected by the `movement_liquid_*` settings.
---@type number?
Settings.move_resistance = nil
---If true, placed nodes can replace this node.
---@type boolean?
Settings.buildable_to = nil
---If true, liquids flow into and replace this node.
---
---Warning: making a liquid node 'floodable' will cause problems.
---@type boolean?
Settings.floodable = nil
---specifies liquid flowing physics
---* `"none"`: no liquid flowing physics
---* `"source"`: spawns flowing liquid nodes at all 4 sides and below;
--- recommended drawtype: "liquid".
---* `"flowing"`: spawned from source, spawns more flowing liquid nodes
--- around it until `liquid_range` is reached;
--- will drain out without a source;
--- recommended drawtype: "flowingliquid".
---
---If it's "source" or "flowing", then the
---`liquid_alternative_*` fields _must_ be specified
---@type string?
Settings.liquidtype = nil
---These fields may contain node names that represent the
---flowing version (`liquid_alternative_flowing`) and
---source version (`liquid_alternative_source`) of a liquid.
---
---Specifically, these fields are required if `liquidtype ~= "none"` or
---`drawtype == "flowingliquid"`.
---
---Liquids consist of up to two nodes: source and flowing.
---
---There are two ways to define a liquid:
---1) Source node and flowing node. This requires both fields to be
--- specified for both nodes.
---2) Standalone source node (cannot flow). `liquid_alternative_source`
--- must be specified and `liquid_range` must be set to 0.
---
---Example:
---
--- liquid_alternative_flowing = `"example:water_flowing"`,
--- liquid_alternative_source = `"example:water_source"`,
---@type string?
Settings.liquid_alternative_flowing = nil
---See `Node.Settings.liquid_alternative_flowing`.
---@type string?
Settings.liquid_alternative_source = nil
---Controls speed at which the liquid spreads/flows (max. 7).
---0 is fastest, 7 is slowest.
---By default, this also slows down movement of players inside the node
---(can be overridden using `move_resistance`)
---@type number?
Settings.liquid_viscosity = nil
---If true, a new liquid source can be created by placing two or more
---sources nearby.
---@type boolean?
Settings.liquid_renewable = nil
---specifies movement physics if inside node
---* `false`: No liquid movement physics apply.
---* `true`: Enables liquid movement physics. Enables things like
--- ability to "swim" up/down, sinking slowly if not moving,
--- smoother speed change when falling into, etc. The `movement_liquid_*`
--- settings apply.
---* `nil`: Will be treated as true if `liquidtype ~= "none"`
--- and as false otherwise.
---@type boolean?
Settings.liquid_move_physics = nil
---Unclear meaning, the engine sets this to true for 'air' and 'ignore'
---deprecated.
---@type string?
Settings.air_equivalent = nil
---Only valid for "nodebox" drawtype with 'type = "leveled"'.
---Allows defining the nodebox height without using param2.
---The nodebox height is 'leveled' / 64 nodes.
---The maximum value of 'leveled' is `leveled_max`.
---@type number?
Settings.leveled = nil
---Maximum value for `leveled` (0-127), enforced in
---`core.set_node_level` and `core.add_node_level`.
---Values above 124 might causes collision detection issues.
---@type number?
Settings.leveled_max = nil
---Maximum distance that flowing liquid nodes can spread around
---source on flat land;
---maximum = 8; set to 0 to disable liquid flow.
---@type number?
Settings.liquid_range = nil
---Player will take this amount of damage if no bubbles are left.
---@type number?
Settings.drowning = nil
---If player is inside node, this damage is caused.
---@type number?
Settings.damage_per_second = nil
---See "Node boxes"
---@type table?
Settings.node_box = nil
---Used for nodebox nodes with the type == "connected".
---Specifies to what neighboring nodes connections will be drawn.
---e.g. `{"group:fence", "default:wood"}` or `"default:stone"`
---@type table?
Settings.connects_to = nil
---Tells connected nodebox nodes to connect only to these sides of this
---node. possible: "top", "bottom", "front", "left", "back", "right"
---@type table?
Settings.connect_sides = nil
---File name of mesh when using "mesh" drawtype
---The center of the node is the model origin.
---For legacy reasons, this uses a different scale depending on the mesh:
---1. For glTF models: 10 units = 1 node (consistent with the scale for entities).
---2. For obj models: 1 unit = 1 node.
---3. For b3d and x models: 1 unit = 1 node if static, otherwise 10 units = 1 node.
---
---Using static glTF or obj models is recommended.
---
---You can use the `visual_scale` multiplier to achieve the expected scale.
---@type string?
Settings.mesh = nil
---Custom selection box definition. Multiple boxes can be defined.
---If "nodebox" drawtype is used and selection_box is nil, then node_box
---definition is used for the selection box
---@type table?
Settings.selection_box = nil
---Custom collision box definition. Multiple boxes can be defined.
---If "nodebox" drawtype is used and collision_box is nil, then node_box
---definition is used for the collision box.
---@type table?
Settings.collision_box = nil
---Support maps made in and before January 2012
---@type boolean?
Settings.legacy_facedir_simple = nil
---Support maps made in and before January 2012
---@type boolean?
Settings.legacy_wallmounted = nil
---Valid for drawtypes:
---mesh, nodebox, plantlike, allfaces_optional, liquid, flowingliquid.
---* 1 - wave node like plants (node top moves side-to-side, bottom is fixed)
---* 2 - wave node like leaves (whole node moves side-to-side)
---* 3 - wave node like liquids (whole node moves up and down)
---
---Not all models will properly wave.
---plantlike drawtype can only wave like plants.
---allfaces_optional drawtype can only wave like leaves.
---liquid, flowingliquid drawtypes can only wave like liquids.
---@type number?
Settings.waving = nil
---Definition of node sounds to be played at various events.
---All fields in this table are optional.
---
---@type nil|table<string,SimpleSoundSpec|string?>
Settings.sounds = nil
---Name of dropped item when dug.
---Default dropped item is the node itself.
---
---Using a table allows multiple items, drop chances and item filtering
---@type (table|string)?
Settings.drop = nil
return Settings
---@class Node.Settings : Item.Settings, NodeDefinition.Settings
local Settings = {}