From e5a12d31babc80d125c6a37185edb52a58023b51 Mon Sep 17 00:00:00 2001 From: Vanic Date: Sun, 8 Feb 2026 20:36:51 +0300 Subject: [PATCH] Make `ObjectProperties` fields optional --- definitions/ObjectProperties.lua | 71 ++++++++++++++++---------------- 1 file changed, 35 insertions(+), 36 deletions(-) diff --git a/definitions/ObjectProperties.lua b/definitions/ObjectProperties.lua index d148d75..b25c118 100644 --- a/definitions/ObjectProperties.lua +++ b/definitions/ObjectProperties.lua @@ -6,11 +6,11 @@ local ObjectProperties = { --- Defines the maximum and default HP of the entity --- For Lua entities the maximum is not enforced. --- For players this defaults to `core.PLAYER_MAX_HP_DEFAULT`. - --- @type number + --- @type number? hp_max = 10, --- For players only. Defaults to `core.PLAYER_MAX_BREATH_DEFAULT`. - --- @type number + --- @type number? breath_max = 0, --- For players only. Zoom FOV in degrees. @@ -19,26 +19,26 @@ local ObjectProperties = { --- Smaller zoom_fov values increase the distance loaded/generated. --- Defaults to 15 in creative mode, 0 in survival mode. --- zoom_fov = 0 disables zooming for the player. - --- @type number + --- @type number? zoom_fov = 0.0, --- For players only. Camera height above feet position in nodes. - --- @type number + --- @type number? eye_height = 1.625, --- Collide with `walkable` nodes. - --- @type boolean + --- @type boolean? physical = false, --- Collide with other objects if physical = true - --- @type boolean + --- @type boolean? collide_with_objects = true, --- { xmin, ymin, zmin, xmax, ymax, zmax } in nodes from object position. --- 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. --- 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 }, --- { xmin, ymin, zmin, xmax, ymax, zmax } in nodes from object position. --- 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. --- For server-side raycasts to work correctly, --- 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 }, --- 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. - --- @type boolean + --- @type boolean? pointable = true, - --- `"cube"` / `"sprite"` / `"upright_sprite" / `"mesh" / `"wielditem"` / `"item"` + --- `"cube"` / `"sprite"` / `"upright_sprite"` / `"mesh"` / `"wielditem"` / `"item"` --- "cube" is a node-sized cube. --- "sprite" is a flat texture always facing the player. --- "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 --- to be as large as a node, use `0.667` in `visual_size` --- "item" is similar to "wielditem" but ignores the 'wield_image' parameter. - --- @type string - visual = '', + --- @type "cube"|"sprite"|"upright_sprite"|"mesh"|"wielditem"|"item"|nil + visual = nil, --- Multipliers for the visual size. If `z` is not specified, `x` will be used --- to scale the entity along both horizontal axes. - --- @type Position + --- @type Position? visual_size = {x = 1, y = 1, z = 1}, --- File name of mesh when using "mesh" visual - --- @type string + --- @type string? mesh = "model.obj", --- Number of required textures depends on visual. @@ -98,114 +98,113 @@ local ObjectProperties = { --- "upright_sprite" uses 2 textures: {front, back}. --- "mesh" requires one texture for each mesh buffer/material (in order) --- Deprecated usage of "wielditem" expects 'textures = {itemname}' (see 'visual' above). - --- @type string[] + --- @type string[]? textures = {}, --- Number of required colors depends on visual - --- @type string[] + --- @type string[]? colors = {}, --- Use texture's alpha channel. --- Excludes "upright_sprite" and "wielditem". --- Note: currently causes visual issues when viewed through other --- semi-transparent materials such as water. - --- @type boolean + --- @type boolean? use_texture_alpha = false, --- Used with spritesheet textures for animation and/or frame selection --- according to position relative to player. --- Defines the number of columns and rows in the spritesheet: --- {columns, rows}. - --- @type {x:number, y:number} + --- @type Position2d? spritediv = {x = 1, y = 1}, --- Used with spritesheet textures. --- Defines the {column, row} position of the initially used frame in the --- spritesheet. - --- @type {x:number, y:number} + --- @type Position2d? initial_sprite_basepos = {x = 0, y = 0}, --- If false, object is invisible and can't be pointed. - --- @type boolean + --- @type boolean? is_visible = true, --- If true, is able to make footstep sounds of nodes --- (see node sound definition for details). - --- @type boolean + --- @type boolean? makes_footstep_sound = false, --- Set constant rotation in radians per second, positive or negative. --- Object rotates along the local Y-axis, and works with set_rotation. --- Set to 0 to disable constant rotation. - --- @type number + --- @type number? automatic_rotate = 0, --- If positive number, object will climb upwards when it moves --- horizontally against a `walkable` node, if the height difference --- is within `stepheight`. - --- @type number + --- @type number? stepheight = 0, --- Automatically set yaw to movement direction, offset in degrees. --- 'false' to disable. - --- @type number + --- @type number? automatic_face_movement_dir = 0.0, --- Limit automatic rotation to this value in degrees per second. --- No limit if value <= 0. - --- @type number + --- @type number? automatic_face_movement_max_rotation_per_sec = -1, --- Set to false to disable backface_culling for model - --- @type boolean + --- @type boolean? backface_culling = true, --- Add this much extra lighting when calculating texture color. --- Value < 0 disables light's effect on texture color. --- For faking self-lighting, UI style entities, or programmatic coloring --- in mods. - --- @type number + --- @type number? glow = 0, --- 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. --- 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. - --- @type string + --- @type string? nametag = "", --- Sets text color of nametag. See ColorSpec - --- @type string + --- @type ColorSpec? nametag_color = "", --- Sets background color of nametag. See ColorSpec --- `false` will cause the background to be set automatically based on user settings. --- Default: false - --- @type string|boolean + --- @type ColorSpec|boolean|nil nametag_bgcolor = "", --- Same as infotext for nodes. Empty by default - --- @type string + --- @type string? infotext = "", --- If false, never save this object statically. It will simply be --- deleted when the block gets unloaded. --- The get_staticdata() callback is never called then. --- Defaults to 'true'. - --- @type boolean - --- @type string + --- @type boolean? static_save = true, --- Texture modifier to be applied for a short duration when object is hit - --- @type string + --- @type string? damage_texture_modifier = "^[brighten", --- Setting this to 'false' disables diffuse lighting of entity - --- @type boolean + --- @type boolean? shaded = true, --- Defaults to true for players, false for other entities. --- If set to true the entity will show as a marker on the minimap. - --- @type boolean + --- @type boolean? show_on_minimap = false, }