Make ObjectProperties fields optional

This commit is contained in:
Van
2026-02-08 20:36:51 +03:00
parent 113a782c39
commit e5a12d31ba

View File

@@ -6,11 +6,11 @@ local ObjectProperties = {
--- Defines the maximum and default HP of the entity --- Defines the maximum and default HP of the entity
--- For Lua entities the maximum is not enforced. --- For Lua entities the maximum is not enforced.
--- For players this defaults to `core.PLAYER_MAX_HP_DEFAULT`. --- For players this defaults to `core.PLAYER_MAX_HP_DEFAULT`.
--- @type number --- @type number?
hp_max = 10, hp_max = 10,
--- For players only. Defaults to `core.PLAYER_MAX_BREATH_DEFAULT`. --- For players only. Defaults to `core.PLAYER_MAX_BREATH_DEFAULT`.
--- @type number --- @type number?
breath_max = 0, breath_max = 0,
--- For players only. Zoom FOV in degrees. --- For players only. Zoom FOV in degrees.
@@ -19,26 +19,26 @@ local ObjectProperties = {
--- Smaller zoom_fov values increase the distance loaded/generated. --- Smaller zoom_fov values increase the distance loaded/generated.
--- Defaults to 15 in creative mode, 0 in survival mode. --- Defaults to 15 in creative mode, 0 in survival mode.
--- zoom_fov = 0 disables zooming for the player. --- zoom_fov = 0 disables zooming for the player.
--- @type number --- @type number?
zoom_fov = 0.0, zoom_fov = 0.0,
--- For players only. Camera height above feet position in nodes. --- For players only. Camera height above feet position in nodes.
--- @type number --- @type number?
eye_height = 1.625, eye_height = 1.625,
--- Collide with `walkable` nodes. --- Collide with `walkable` nodes.
--- @type boolean --- @type boolean?
physical = false, physical = false,
--- Collide with other objects if physical = true --- Collide with other objects if physical = true
--- @type boolean --- @type boolean?
collide_with_objects = true, collide_with_objects = true,
--- { xmin, ymin, zmin, xmax, ymax, zmax } in nodes from object position. --- { xmin, ymin, zmin, xmax, ymax, zmax } in nodes from object position.
--- Collision boxes cannot rotate, setting `rotate = true` on it has no effect. --- Collision boxes cannot rotate, setting `rotate = true` on it has no effect.
--- If not set, the selection box copies the collision box, and will also not rotate. --- If not set, the selection box copies the collision box, and will also not rotate.
--- default: `{ -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }` --- default: `{ -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }`
--- @type number[] --- @type number[]?
collisionbox = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }, collisionbox = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 },
--- { xmin, ymin, zmin, xmax, ymax, zmax } in nodes from object position. --- { xmin, ymin, zmin, xmax, ymax, zmax } in nodes from object position.
--- Collision boxes cannot rotate, setting `rotate = true` on it has no effect. --- Collision boxes cannot rotate, setting `rotate = true` on it has no effect.
@@ -48,17 +48,17 @@ local ObjectProperties = {
--- Raycasts use the selection box and object's rotation, but do *not* obey attachment rotations. --- Raycasts use the selection box and object's rotation, but do *not* obey attachment rotations.
--- For server-side raycasts to work correctly, --- For server-side raycasts to work correctly,
--- the selection box should extend at most 5 units in each direction. --- the selection box should extend at most 5 units in each direction.
--- @type number[]|{rotate:boolean} --- @type number[]|{rotate:boolean}|nil
selectionbox = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5, rotate = false }, selectionbox = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5, rotate = false },
--- Can be `true` if it is pointable, `false` if it can be pointed through, --- Can be `true` if it is pointable, `false` if it can be pointed through,
--- or `"blocking"` if it is pointable but not selectable. --- or `"blocking"` if it is pointable but not selectable.
--- Clients older than 5.9.0 interpret `pointable = "blocking"` as `pointable = true`. --- Clients older than 5.9.0 interpret `pointable = "blocking"` as `pointable = true`.
--- Can be overridden by the `pointabilities` of the held item. --- Can be overridden by the `pointabilities` of the held item.
--- @type boolean --- @type boolean?
pointable = true, pointable = true,
--- `"cube"` / `"sprite"` / `"upright_sprite" / `"mesh" / `"wielditem"` / `"item"` --- `"cube"` / `"sprite"` / `"upright_sprite"` / `"mesh"` / `"wielditem"` / `"item"`
--- "cube" is a node-sized cube. --- "cube" is a node-sized cube.
--- "sprite" is a flat texture always facing the player. --- "sprite" is a flat texture always facing the player.
--- "upright_sprite" is a vertical flat texture. --- "upright_sprite" is a vertical flat texture.
@@ -80,16 +80,16 @@ local ObjectProperties = {
--- Wielditems are scaled a bit. If you want a wielditem to appear --- Wielditems are scaled a bit. If you want a wielditem to appear
--- to be as large as a node, use `0.667` in `visual_size` --- to be as large as a node, use `0.667` in `visual_size`
--- "item" is similar to "wielditem" but ignores the 'wield_image' parameter. --- "item" is similar to "wielditem" but ignores the 'wield_image' parameter.
--- @type string --- @type "cube"|"sprite"|"upright_sprite"|"mesh"|"wielditem"|"item"|nil
visual = '', visual = nil,
--- Multipliers for the visual size. If `z` is not specified, `x` will be used --- Multipliers for the visual size. If `z` is not specified, `x` will be used
--- to scale the entity along both horizontal axes. --- to scale the entity along both horizontal axes.
--- @type Position --- @type Position?
visual_size = {x = 1, y = 1, z = 1}, visual_size = {x = 1, y = 1, z = 1},
--- File name of mesh when using "mesh" visual --- File name of mesh when using "mesh" visual
--- @type string --- @type string?
mesh = "model.obj", mesh = "model.obj",
--- Number of required textures depends on visual. --- Number of required textures depends on visual.
@@ -98,114 +98,113 @@ local ObjectProperties = {
--- "upright_sprite" uses 2 textures: {front, back}. --- "upright_sprite" uses 2 textures: {front, back}.
--- "mesh" requires one texture for each mesh buffer/material (in order) --- "mesh" requires one texture for each mesh buffer/material (in order)
--- Deprecated usage of "wielditem" expects 'textures = {itemname}' (see 'visual' above). --- Deprecated usage of "wielditem" expects 'textures = {itemname}' (see 'visual' above).
--- @type string[] --- @type string[]?
textures = {}, textures = {},
--- Number of required colors depends on visual --- Number of required colors depends on visual
--- @type string[] --- @type string[]?
colors = {}, colors = {},
--- Use texture's alpha channel. --- Use texture's alpha channel.
--- Excludes "upright_sprite" and "wielditem". --- Excludes "upright_sprite" and "wielditem".
--- Note: currently causes visual issues when viewed through other --- Note: currently causes visual issues when viewed through other
--- semi-transparent materials such as water. --- semi-transparent materials such as water.
--- @type boolean --- @type boolean?
use_texture_alpha = false, use_texture_alpha = false,
--- Used with spritesheet textures for animation and/or frame selection --- Used with spritesheet textures for animation and/or frame selection
--- according to position relative to player. --- according to position relative to player.
--- Defines the number of columns and rows in the spritesheet: --- Defines the number of columns and rows in the spritesheet:
--- {columns, rows}. --- {columns, rows}.
--- @type {x:number, y:number} --- @type Position2d?
spritediv = {x = 1, y = 1}, spritediv = {x = 1, y = 1},
--- Used with spritesheet textures. --- Used with spritesheet textures.
--- Defines the {column, row} position of the initially used frame in the --- Defines the {column, row} position of the initially used frame in the
--- spritesheet. --- spritesheet.
--- @type {x:number, y:number} --- @type Position2d?
initial_sprite_basepos = {x = 0, y = 0}, initial_sprite_basepos = {x = 0, y = 0},
--- If false, object is invisible and can't be pointed. --- If false, object is invisible and can't be pointed.
--- @type boolean --- @type boolean?
is_visible = true, is_visible = true,
--- If true, is able to make footstep sounds of nodes --- If true, is able to make footstep sounds of nodes
--- (see node sound definition for details). --- (see node sound definition for details).
--- @type boolean --- @type boolean?
makes_footstep_sound = false, makes_footstep_sound = false,
--- Set constant rotation in radians per second, positive or negative. --- Set constant rotation in radians per second, positive or negative.
--- Object rotates along the local Y-axis, and works with set_rotation. --- Object rotates along the local Y-axis, and works with set_rotation.
--- Set to 0 to disable constant rotation. --- Set to 0 to disable constant rotation.
--- @type number --- @type number?
automatic_rotate = 0, automatic_rotate = 0,
--- If positive number, object will climb upwards when it moves --- If positive number, object will climb upwards when it moves
--- horizontally against a `walkable` node, if the height difference --- horizontally against a `walkable` node, if the height difference
--- is within `stepheight`. --- is within `stepheight`.
--- @type number --- @type number?
stepheight = 0, stepheight = 0,
--- Automatically set yaw to movement direction, offset in degrees. --- Automatically set yaw to movement direction, offset in degrees.
--- 'false' to disable. --- 'false' to disable.
--- @type number --- @type number?
automatic_face_movement_dir = 0.0, automatic_face_movement_dir = 0.0,
--- Limit automatic rotation to this value in degrees per second. --- Limit automatic rotation to this value in degrees per second.
--- No limit if value <= 0. --- No limit if value <= 0.
--- @type number --- @type number?
automatic_face_movement_max_rotation_per_sec = -1, automatic_face_movement_max_rotation_per_sec = -1,
--- Set to false to disable backface_culling for model --- Set to false to disable backface_culling for model
--- @type boolean --- @type boolean?
backface_culling = true, backface_culling = true,
--- Add this much extra lighting when calculating texture color. --- Add this much extra lighting when calculating texture color.
--- Value < 0 disables light's effect on texture color. --- Value < 0 disables light's effect on texture color.
--- For faking self-lighting, UI style entities, or programmatic coloring --- For faking self-lighting, UI style entities, or programmatic coloring
--- in mods. --- in mods.
--- @type number --- @type number?
glow = 0, glow = 0,
--- The name to display on the head of the object. By default empty. --- The name to display on the head of the object. By default empty.
--- If the object is a player, a nil or empty nametag is replaced by the player's name. --- If the object is a player, a nil or empty nametag is replaced by the player's name.
--- For all other objects, a nil or empty string removes the nametag. --- For all other objects, a nil or empty string removes the nametag.
--- To hide a nametag, set its color alpha to zero. That will disable it entirely. --- To hide a nametag, set its color alpha to zero. That will disable it entirely.
--- @type string --- @type string?
nametag = "", nametag = "",
--- Sets text color of nametag. See ColorSpec --- Sets text color of nametag. See ColorSpec
--- @type string --- @type ColorSpec?
nametag_color = "<ColorSpec>", nametag_color = "<ColorSpec>",
--- Sets background color of nametag. See ColorSpec --- Sets background color of nametag. See ColorSpec
--- `false` will cause the background to be set automatically based on user settings. --- `false` will cause the background to be set automatically based on user settings.
--- Default: false --- Default: false
--- @type string|boolean --- @type ColorSpec|boolean|nil
nametag_bgcolor = "<ColorSpec>", nametag_bgcolor = "<ColorSpec>",
--- Same as infotext for nodes. Empty by default --- Same as infotext for nodes. Empty by default
--- @type string --- @type string?
infotext = "", infotext = "",
--- If false, never save this object statically. It will simply be --- If false, never save this object statically. It will simply be
--- deleted when the block gets unloaded. --- deleted when the block gets unloaded.
--- The get_staticdata() callback is never called then. --- The get_staticdata() callback is never called then.
--- Defaults to 'true'. --- Defaults to 'true'.
--- @type boolean --- @type boolean?
--- @type string
static_save = true, static_save = true,
--- Texture modifier to be applied for a short duration when object is hit --- Texture modifier to be applied for a short duration when object is hit
--- @type string --- @type string?
damage_texture_modifier = "^[brighten", damage_texture_modifier = "^[brighten",
--- Setting this to 'false' disables diffuse lighting of entity --- Setting this to 'false' disables diffuse lighting of entity
--- @type boolean --- @type boolean?
shaded = true, shaded = true,
--- Defaults to true for players, false for other entities. --- Defaults to true for players, false for other entities.
--- If set to true the entity will show as a marker on the minimap. --- If set to true the entity will show as a marker on the minimap.
--- @type boolean --- @type boolean?
show_on_minimap = false, show_on_minimap = false,
} }