Extracting Addon for LLS.
This commit is contained in:
59
definitions/ABMDefinition.lua
Normal file
59
definitions/ABMDefinition.lua
Normal file
@@ -0,0 +1,59 @@
|
||||
--- @class ABMDefinition
|
||||
local ABMDefinition = {
|
||||
--- Descriptive label for profiling purposes (optional).
|
||||
--- Definitions with identical labels will be listed as one.
|
||||
--- @type string
|
||||
label = "Lava cooling",
|
||||
|
||||
--- Apply `action` function to these nodes.
|
||||
--- `group:groupname` can also be used here.
|
||||
--- @type string[]
|
||||
nodenames = { "default:lava_source" },
|
||||
|
||||
--- Only apply `action` to nodes that have one of, or any
|
||||
--- combination of, these neighbors.
|
||||
--- If left out or empty, any neighbor will do.
|
||||
--- `group:groupname` can also be used here.
|
||||
--- @type string[]
|
||||
neighbors = { "default:water_source", "default:water_flowing" },
|
||||
|
||||
--- Only apply `action` to nodes that have no one of these neighbors.
|
||||
--- If left out or empty, it has no effect.
|
||||
--- `group:groupname` can also be used here.
|
||||
--- @type string[]
|
||||
without_neighbors = { "default:lava_source", "default:lava_flowing" },
|
||||
|
||||
--- Operation interval in seconds
|
||||
--- @type number
|
||||
interval = 10.0,
|
||||
|
||||
--- Probability of triggering `action` per-node per-interval is 1.0 / chance (integers only)
|
||||
--- @type number
|
||||
chance = 50,
|
||||
|
||||
--- min and max height levels where ABM will be processed (inclusive)
|
||||
--- can be used to reduce CPU usage
|
||||
--- @type number
|
||||
min_y = -32768,
|
||||
--- min and max height levels where ABM will be processed (inclusive)
|
||||
--- can be used to reduce CPU usage
|
||||
--- @type number
|
||||
max_y = 32767,
|
||||
|
||||
--- If true, catch-up behavior is enabled: The `chance` value is
|
||||
--- temporarily reduced when returning to an area to simulate time lost
|
||||
--- by the area being unattended. Note that the `chance` value can often
|
||||
--- be reduced to 1.
|
||||
--- @type boolean
|
||||
catch_up = true,
|
||||
|
||||
--- Function triggered for each qualifying node.
|
||||
--- `active_object_count` is number of active objects in the node's
|
||||
--- mapblock.
|
||||
--- `active_object_count_wider` is number of active objects in the node's
|
||||
--- mapblock plus all 26 neighboring mapblocks. If any neighboring
|
||||
--- mapblocks are unloaded an estimate is calculated for them based on
|
||||
--- loaded mapblocks.
|
||||
--- @type fun(pos:Position, node:NodeTable, active_object_count:number, active_object_count_wider:number)
|
||||
action = function(pos, node, active_object_count, active_object_count_wider) end,
|
||||
}
|
||||
54
definitions/AuthenticationHandlerDefinition.lua
Normal file
54
definitions/AuthenticationHandlerDefinition.lua
Normal file
@@ -0,0 +1,54 @@
|
||||
--- @diagnostic disable: missing-return
|
||||
|
||||
|
||||
---@class AuthenticationHandlerGetAuth
|
||||
---@field password string
|
||||
---@field privileges table<string,number>
|
||||
---@field last_login number|nil
|
||||
|
||||
-- Used by `minetest.register_authentication_handler`.
|
||||
---@class AuthenticationHandlerDefinition
|
||||
local AuthenticationHandlerDefinition = {
|
||||
--- Get authentication data for existing player `name` (`nil` if player
|
||||
--- doesn't exist).
|
||||
--- Returns following structure:
|
||||
--- `{password=<string>, privileges=<table>, last_login=<number or nil>}`
|
||||
---@type fun(name:string):AuthenticationHandlerGetAuth|nil
|
||||
get_auth = function(name) end,
|
||||
|
||||
--- Create new auth data for player `name`.
|
||||
--- Note that `password` is not plain-text but an arbitrary
|
||||
--- representation decided by the engine.
|
||||
---@type fun(name:string, password:string)
|
||||
create_auth = function(name, password) end,
|
||||
|
||||
--- Delete auth data of player `name`.
|
||||
--- Returns boolean indicating success (false if player is nonexistent).
|
||||
---@type fun(name:string)
|
||||
delete_auth = function(name) end,
|
||||
|
||||
--- Set password of player `name` to `password`.
|
||||
--- Auth data should be created if not present.
|
||||
---@type fun(name:string, password:string)
|
||||
set_password = function(name, password) end,
|
||||
|
||||
--- Set privileges of player `name`.
|
||||
--- `privileges` is in table form, auth data should be created if not
|
||||
--- present.
|
||||
---@type fun(name:string, priveleges:table<string,number>)
|
||||
set_privileges = function(name, privileges) end,
|
||||
|
||||
--- Reload authentication data from the storage location.
|
||||
--- Returns boolean indicating success.
|
||||
---@type fun():boolean
|
||||
reload = function() end,
|
||||
|
||||
--- Called when player joins, used for keeping track of last_login
|
||||
---@type fun(name:string)
|
||||
record_login = function(name) end,
|
||||
|
||||
--- Returns an iterator (use with `for` loops) for all player names
|
||||
--- currently in the auth database
|
||||
---@type fun():fun()
|
||||
iterate = function() end,
|
||||
}
|
||||
32
definitions/ChatCommandDefinition.lua
Normal file
32
definitions/ChatCommandDefinition.lua
Normal file
@@ -0,0 +1,32 @@
|
||||
--- @diagnostic disable: missing-return
|
||||
|
||||
|
||||
--- Used by `minetest.register_chatcommand`.
|
||||
--- @class ChatCommandDefinition
|
||||
local ChatCommandDefinition = {
|
||||
--- Short parameter description. Example: `"<name> <privilege>"`.
|
||||
--- Note that in params, use of symbols is as follows:
|
||||
--- * `<>` signifies a placeholder to be replaced when the command is used. For
|
||||
--- example, when a player name is needed: `<name>`
|
||||
--- * `[]` signifies param is optional and not required when the command is used.
|
||||
--- For example, if you require param1 but param2 is optional:
|
||||
--- `<param1> [<param2>]`
|
||||
--- * `|` signifies exclusive or. The command requires one param from the options
|
||||
--- provided. For example: `<param1> | <param2>`
|
||||
--- * `()` signifies grouping. For example, when param1 and param2 are both
|
||||
--- required, or only param3 is required: `(<param1> <param2>) | <param3>`
|
||||
--- @type string|nil
|
||||
params = nil,
|
||||
|
||||
--- @type string|nil Full description. Example: `"Remove privilege from player"`.
|
||||
description = nil,
|
||||
|
||||
--- @type table<string,boolean>|nil Require the "privs" privilege to run. Example: `{privs=true}`.
|
||||
privs = nil,
|
||||
|
||||
--- Called when command is run. Returns boolean success and text output.
|
||||
--- Special case: The help message is shown to the player if `func`
|
||||
--- returns false without a text output.
|
||||
--- @type fun(name:string, param:string):boolean,string
|
||||
func = function(name, param) end,
|
||||
}
|
||||
32
definitions/DetachedInventoryCallbacksDef.lua
Normal file
32
definitions/DetachedInventoryCallbacksDef.lua
Normal file
@@ -0,0 +1,32 @@
|
||||
--- @class DetachedInventoryCallbacksDef
|
||||
local DetachedInventoryCallbacksDef = {
|
||||
--- Called when a player wants to move items inside the inventory.
|
||||
--- Return value: number of items allowed to move.
|
||||
--- @type nil|fun(inv:InvRef, from_list:string, from_index:number, to_list:string, to_index:number, count:number, player:Player):number
|
||||
allow_move = 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 nil|fun(inv:InvRef, list_name:string, index:number, stack:ItemStack, player:Player):number
|
||||
allow_put = 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 nil|fun(inv:InvRef, list_name:string, index:number, stack:ItemStack, player:Player):number
|
||||
allow_take = nil,
|
||||
|
||||
--- Called after the actual action has happened, according to what was allowed (see `allow_move()`).
|
||||
--- No return value.
|
||||
--- @type nil|fun(inv:InvRef, from_list:string, from_index:number, to_list:string, to_index:number, count:number, player:Player):void
|
||||
on_move = nil,
|
||||
--- Called after the actual action has happened, according to what was allowed (see `allow_put()`).
|
||||
--- No return value.
|
||||
--- @type nil|fun(inv:InvRef, list_name:string, index:number, stack:ItemStack, player:Player)
|
||||
on_put = nil,
|
||||
--- Called after the actual action has happened, according to what was allowed (see `allow_take()`).
|
||||
--- No return value.
|
||||
--- @type nil|fun(inv:InvRef, list_name:string, index:number, stack:ItemStack, player:Player)
|
||||
on_take = nil,
|
||||
}
|
||||
73
definitions/EntityDefinition.lua
Normal file
73
definitions/EntityDefinition.lua
Normal file
@@ -0,0 +1,73 @@
|
||||
--- @diagnostic disable: missing-return
|
||||
|
||||
|
||||
--- Used by `core.register_entity`.
|
||||
--- The entity definition table becomes a metatable of a newly created per-entity luaentity table,
|
||||
--- meaning its fields (e.g. initial_properties) will be shared between all instances of an entity.
|
||||
--- @class EntityDefinition
|
||||
local EntityDefinition = {
|
||||
--- A table of object properties, see the `Object properties` section.
|
||||
--- The properties in this table are applied to the object
|
||||
--- once when it is spawned.
|
||||
--- @type ObjectProperties?
|
||||
initial_properties = nil,
|
||||
|
||||
|
||||
--- Called when the object is instantiated.
|
||||
--- @param static_data string passes from `get_staticdata()`
|
||||
--- @param dtime_s number time passed since the object was unloaded, which can be used for updating the entity state.
|
||||
on_activate = function(self, static_data, dtime_s) end,
|
||||
--- * Called when the object is about to get removed or unloaded.
|
||||
--- * `removal`: boolean indicating whether the object is about to get removed.
|
||||
--- Calling `object:remove()` on an active object will call this with `removal=true`.
|
||||
--- The mapblock the entity resides in being unloaded will call this with `removal=false`.
|
||||
--- * Note that this won't be called if the object hasn't been activated in the first place.
|
||||
--- In particular, `minetest.clear_objects({mode = "full"})` won't call this,
|
||||
--- whereas `minetest.clear_objects({mode = "quick"})` might call this.
|
||||
--- @param removal boolean
|
||||
on_deactivate = function(self, removal) end,
|
||||
--- * Called on every server tick, after movement and collision processing.
|
||||
--- * `dtime`: elapsed time since last call
|
||||
--- * `moveresult`: table with collision info (only available if physical=true)
|
||||
on_step = function(self, dtime, move_result) end,
|
||||
|
||||
--- * Called when somebody punches the object.
|
||||
--- * Note that you probably want to handle most punches using the automatic armor group system.
|
||||
--- * `puncher`: an `ObjectRef` (can be `nil`)
|
||||
--- * `time_from_last_punch`: Meant for disallowing spamming of clicks (can be `nil`).
|
||||
--- * `tool_capabilities`: capability table of used item (can be `nil`)
|
||||
--- * `dir`: unit vector of direction of punch. Always defined. Points from the puncher to the punched.
|
||||
--- * `damage`: damage that will be done to entity.
|
||||
--- * Can return `true` to prevent the default damage mechanism.
|
||||
--- @param puncher ObjectRef|Player|nil
|
||||
--- @param time_from_last_punch number|nil
|
||||
--- @param tool_capabilities table|nil
|
||||
--- @param dir vector
|
||||
--- @param damage number
|
||||
--- @return boolean
|
||||
on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, dir, damage) end,
|
||||
--- * Called when the object dies.
|
||||
--- * `killer`: an `ObjectRef` (can be `nil`)
|
||||
--- @param killer ObjectRef|Player
|
||||
on_death = function(self, killer) end,
|
||||
--- * Called when `clicker` pressed the 'place/use' key while pointing
|
||||
--- to the object (not necessarily an actual rightclick)
|
||||
--- * `clicker`: an `ObjectRef` (may or may not be a player)
|
||||
--- @param clicker ObjectRef|Player
|
||||
on_rightclick = function(self, clicker) end,
|
||||
--- * `child`: an `ObjectRef` of the child that attaches
|
||||
on_attach_child = function(self, child) end,
|
||||
--- * `child`: an `ObjectRef` of the child that detaches
|
||||
on_detach_child = function(self, child) end,
|
||||
--- * `parent`: an `ObjectRef` (can be `nil`) from where it got detached
|
||||
--- * This happens before the parent object is removed from the world
|
||||
--- @param parent ObjectRef
|
||||
on_detach = function(self, parent) end,
|
||||
--- * Should return a string that will be passed to `on_activate` when the object is instantiated the next time.
|
||||
--- @return string
|
||||
get_staticdata = function(self) end,
|
||||
|
||||
--- You can define arbitrary member variables here (see Item definition for more info) by using a '_' prefix
|
||||
--- @type any
|
||||
_custom_field = "whatever",
|
||||
}
|
||||
34
definitions/HTTPRequestDefinition.lua
Normal file
34
definitions/HTTPRequestDefinition.lua
Normal file
@@ -0,0 +1,34 @@
|
||||
--- Used by `HTTPApiTable.fetch` and `HTTPApiTable.fetch_async`.
|
||||
---@class HTTPRequest: table
|
||||
local HTTPRequest = {
|
||||
---@type string? @The URL to fetch. [required]
|
||||
url = "http://example.org",
|
||||
|
||||
---@type number? @Timeout for request to be completed in seconds. Default depends on engine settings.
|
||||
timeout = 10,
|
||||
|
||||
---@type string? @`"GET"`, `"POST"`, `"PUT"` or `"DELETE"`. The http method to use. Defaults to "GET".
|
||||
method = "GET",
|
||||
|
||||
--- Data for the POST, PUT or DELETE request.
|
||||
--- Accepts both a string and a table. If a table is specified, encodes
|
||||
--- table as x-www-form-urlencoded key-value pairs.
|
||||
---@type (string|table)? @`"Raw request data string"` or `{field1 = "data1", field2 = "data2"}`
|
||||
data = "example raw request",
|
||||
|
||||
---@type string? @Optional, if specified replaces the default minetest user agent with given string
|
||||
user_agent = "ExampleUserAgent",
|
||||
|
||||
---@type table? @Optional, if specified adds additional headers to the HTTP request. You must make sure that the
|
||||
--- header strings follow HTTP specification (`"Key: Value"`).
|
||||
extra_headers = { "Accept-Language: en-us", "Accept-Charset: utf-8" },
|
||||
|
||||
--- Default is false.
|
||||
--- Post only, data must be array
|
||||
---@type boolean? @Optional, if true performs a multipart HTTP request.
|
||||
multipart = false,
|
||||
|
||||
--- Deprecated, use `data` instead. Forces `method = "POST"`.
|
||||
---@type (string|table)? @`"Raw POST request data string"` or `{field1 = "data1", field2 = "data2"}`
|
||||
post_data = "Raw POST request data string",
|
||||
}
|
||||
18
definitions/HTTPRequestResultDefinition.lua
Normal file
18
definitions/HTTPRequestResultDefinition.lua
Normal file
@@ -0,0 +1,18 @@
|
||||
--- Passed to `HTTPApiTable.fetch` callback. Returned by `HTTPApiTable.fetch_async_get`.
|
||||
---@class HTTPRequestResult: table
|
||||
local HTTPRequestResult = {
|
||||
---@type boolean @If true, the request has finished (either succeeded, failed or timed out)
|
||||
completed = true,
|
||||
|
||||
---@type boolean @If true, the request was successful
|
||||
succeeded = true,
|
||||
|
||||
---@type boolean @If true, the request timed out
|
||||
timeout = false,
|
||||
|
||||
---@type number @HTTP status code
|
||||
code = 200,
|
||||
|
||||
---@type string
|
||||
data = "response",
|
||||
}
|
||||
174
definitions/HUDDefinition.lua
Normal file
174
definitions/HUDDefinition.lua
Normal file
@@ -0,0 +1,174 @@
|
||||
--- @class HudDefinition
|
||||
local HudDefinition = {
|
||||
--- Name of the HUD element.
|
||||
---
|
||||
--- The `name` field is not yet used, but should contain a description of what the HUD element represents.
|
||||
---
|
||||
--- @type string?
|
||||
name = "",
|
||||
|
||||
--- HUD element type, one of:
|
||||
--- * `"image"` - Displays an image on the HUD.
|
||||
--- * `"text"` - Displays text on the HUD.
|
||||
--- * `"statbar"` - Displays a horizontal bar made up of half-images with an optional background.
|
||||
--- * `"inventory"` - Displays an inventory list on the HUD.
|
||||
--- * `"hotbar"`
|
||||
--- * `"waypoint"` - Displays distance to selected world position.
|
||||
--- * `"image_waypoint"` Same as image, but does not accept a position;
|
||||
--- the position is instead determined by world_pos, the world position of the waypoint.
|
||||
--- * `"compass"` - Displays an image oriented or translated according to current heading direction.
|
||||
--- * `"minimap"` - Displays a minimap on the HUD.
|
||||
---
|
||||
--- @type string?
|
||||
type = "image",
|
||||
--- HUD element type: "image", "text", "statbar", "inventory", "waypoint", "image_waypoint".
|
||||
--- In case both are specified (`type` and `hud_elem_type`) `type` will be used.
|
||||
--- @deprecated
|
||||
--- @type string?
|
||||
hud_elem_type = "",
|
||||
|
||||
--- Position on the screen, range: `{x = 0..1, y = 0..1}`.
|
||||
--- Top left corner position of element.
|
||||
---
|
||||
--- To account for differing resolutions, the position coordinates are the percentage of the screen,
|
||||
--- ranging in value from `0` to `1`.
|
||||
---
|
||||
--- @type Position2d?
|
||||
position = {x = 0, y = 0},
|
||||
|
||||
--- Offset in pixels from the position.
|
||||
--- Contrary to position, the offset is not scaled to screen size.
|
||||
--- This allows for some precisely positioned items in the HUD.
|
||||
---
|
||||
--- **Note:** offset will adapt to screen DPI as well as user defined scaling factor!
|
||||
---
|
||||
--- @type Position2d?
|
||||
offset = {x = 0, y = 0},
|
||||
|
||||
--- Alignment anchor. Values: `{x = -1..1, y = -1..1}`.
|
||||
--- It is a table where `x` and `y` range from -1 to 1, with 0 being central.
|
||||
--- `-1` is moved to the left/up, and 1 is to the right/down. Fractional values can be used.
|
||||
--- @type Position2d?
|
||||
alignment = {x = 0, y = 0},
|
||||
|
||||
--- Direction: 0: left-right, 1: right-left, 2: top-bottom, 3: bottom-top.
|
||||
---
|
||||
--- The direction field is the direction in which something is drawn.
|
||||
--- `0` draws from left to right, `1` draws from right to left, `2` draws from top to bottom,
|
||||
--- and `3` draws from bottom to top.
|
||||
---
|
||||
--- @type number?
|
||||
direction = 0,
|
||||
|
||||
--- * For `type` == `"image"`:
|
||||
--- * * The scale of the image, with {x = 1, y = 1} being the original texture size.
|
||||
--- The x and y fields apply to the respective axes. Positive values scale the source image.
|
||||
--- Negative values represent percentages relative to screen dimensions.
|
||||
--- Example: {x = -20, y = 3} means the image will be drawn 20% of screen width wide,
|
||||
--- and 3 times as high as the source image is.
|
||||
---
|
||||
--- * For `type` == `"text"`:
|
||||
--- * * Defines the bounding rectangle of the text. A value such as {x=100, y=100} should work.
|
||||
---
|
||||
--- * For `type` == `"image_waypoint"`:
|
||||
--- * * The scale of the image, with {x = 1, y = 1} being the original texture size.
|
||||
--- The x and y fields apply to the respective axes.
|
||||
--- Positive values scale the source image.
|
||||
--- Negative values represent percentages relative to screen dimensions.
|
||||
--- Example: {x = -20, y = 3} means the image will be drawn 20% of screen width wide,
|
||||
--- and 3 times as high as the source image is.
|
||||
---
|
||||
--- * For `type` == `"compass"`:
|
||||
--- * * The size of this element.
|
||||
--- Negative values represent percentage of the screen; e.g. x=-100 means 100% (width).
|
||||
---
|
||||
--- @type Position2d?
|
||||
scale = {x = 1, y = 1},
|
||||
|
||||
--- Name of the text or image to display.
|
||||
--- * For "text": The text to be displayed in the HUD element.
|
||||
--- Supports core.translate (always) and core.colorize (since protocol version 44).
|
||||
--- * For "image"/"statbar"/"image_waypoint"/"compass": it's the texture name.
|
||||
--- * For "inventory": The name of the inventory list to be displayed.
|
||||
--- * For "waypoint": Distance suffix. Can be blank.
|
||||
---
|
||||
--- @type string?
|
||||
text = "",
|
||||
|
||||
--- * For "statbar": Optional texture name to enable a background / "off state" texture
|
||||
--- (useful to visualize the maximal value).
|
||||
--- Both textures must have the same size.
|
||||
---
|
||||
--- @type string?
|
||||
text2 = "",
|
||||
|
||||
--- * For "text": An integer containing the RGB value of the color used to draw the text.
|
||||
--- Specify 0xFFFFFF for white text, 0xFF0000 for red, and so on.
|
||||
--- * For "statbar": The number of half-textures that are displayed.
|
||||
--- If odd, will end with a vertically center-split texture.
|
||||
--- * For "inventory": Number of items in the inventory to be displayed.
|
||||
--- * For "waypoint": An integer containing the RGB value of the color used to draw the text.
|
||||
---
|
||||
--- @type number?
|
||||
number = 0,
|
||||
|
||||
--- * For "statbar": Same as `number` but for the "off state" texture.
|
||||
--- * For "inventory": Position of item that is selected.
|
||||
--- @type number?
|
||||
item = 0,
|
||||
|
||||
--- * For "text": size of the text. The player-set font size is multiplied by size.x (y value isn't used).
|
||||
--- * For "statbar": If used, will force full-image size to this value (override texture pack image size).
|
||||
--- * For "compass": The size of this element.
|
||||
--- Negative values represent percentage of the screen; e.g. x=-100 means 100% (width).
|
||||
--- * For "minimap": Size of the minimap to display. Minimap should be a square to avoid distortion.
|
||||
--- * - Negative values represent percentages of the screen.
|
||||
--- If either x or y is specified as a percentage, the resulting pixel size will be used for both x and y.
|
||||
--- Example: On a 1920x1080 screen, {x = 0, y = -25} will result in a 270x270 minimap.
|
||||
--- * - Negative values are supported starting with protocol version 45.
|
||||
---
|
||||
--- @type Position2d?
|
||||
size = {x=0, y=0},
|
||||
|
||||
--- Z index: lower z-index HUDs are displayed behind higher z-index HUDs
|
||||
---
|
||||
--- Specifies the order of HUD elements from back to front.
|
||||
--- Lower z-index elements are displayed behind higher z-index elements.
|
||||
--- Elements with same z-index are displayed in an arbitrary order.
|
||||
---
|
||||
--- Default 0. Supports negative values.
|
||||
---
|
||||
--- By convention, the following values are recommended:
|
||||
--- * -400: Graphical effects, such as vignette
|
||||
--- * -300: Name tags, waypoints
|
||||
--- * -200: Wieldhand
|
||||
--- * -100: Things that block the player's view, e.g. masks
|
||||
--- * 0: Default. For standard in-game HUD elements like crosshair, hotbar, minimap, builtin statbars, etc.
|
||||
--- * 100: Temporary text messages or notification icons
|
||||
--- * 1000: Full-screen effects such as full-black screen or credits. This includes effects that cover the entire screen
|
||||
---
|
||||
--- If your HUD element doesn't fit into any category, pick a number between the suggested values.
|
||||
---
|
||||
--- @type number?
|
||||
z_index = 0,
|
||||
|
||||
--- * For "text": determines font style Bitfield with 1 = bold, 2 = italic, 4 = monospace.
|
||||
---
|
||||
--- @type number?
|
||||
style = 0,
|
||||
|
||||
--- * For "waypoint": Waypoint precision, integer >= 0. Defaults to 10.
|
||||
--- If set to 0, distance is not shown. Shown value is floor(distance*precision)/precision.
|
||||
--- When the precision is an integer multiple of 10, there will be log_10(precision) digits after the decimal point.
|
||||
--- `precision = 1000`, for example, will show 3 decimal places (eg: `0.999`).
|
||||
--- `precision = 2` will show multiples of `0.5`;
|
||||
--- `precision = 5` will show multiples of `0.2` and so on: precision = n will show multiples of `1/n`.
|
||||
---
|
||||
--- @type number?
|
||||
precision = 10,
|
||||
|
||||
--- * For "waypoint"/"image_waypoint": World position of the waypoint.
|
||||
---
|
||||
--- @type Position?
|
||||
world_pos = {x=0, y=0, z=0},
|
||||
}
|
||||
240
definitions/ItemDefinition.lua
Normal file
240
definitions/ItemDefinition.lua
Normal file
@@ -0,0 +1,240 @@
|
||||
--- @class ItemDefinition: table
|
||||
local ItemDefinition = {
|
||||
--- Can contain new lines. "\n" has to be used as new line character.
|
||||
--- See also: `get_description` in [`ItemStack`]
|
||||
--- @type string?
|
||||
description = "",
|
||||
|
||||
--- Must not contain new lines.
|
||||
--- Defaults to nil.
|
||||
--- Use an [`ItemStack`] to get the short description, e.g.:
|
||||
--- ItemStack(itemname):get_short_description()
|
||||
--- @type string?
|
||||
short_description = "",
|
||||
|
||||
--- 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 table<string,number>?
|
||||
groups = {},
|
||||
|
||||
--- Texture shown in the inventory GUI
|
||||
--- Defaults to a 3D rendering of the node if left empty.
|
||||
--- @type string?
|
||||
inventory_image = "",
|
||||
|
||||
--- An overlay texture which is not affected by colorization
|
||||
--- @type string?
|
||||
inventory_overlay = "",
|
||||
|
||||
--- Texture shown when item is held in hand
|
||||
--- Defaults to a 3D rendering of the node if left empty.
|
||||
--- @type string?
|
||||
wield_image = "",
|
||||
|
||||
--- Like inventory_overlay but only used in the same situation as wield_image
|
||||
--- @type string?
|
||||
wield_overlay = "",
|
||||
|
||||
--- Scale for the item when held in hand
|
||||
--- @type Position? scale vector
|
||||
wield_scale = {x = 1, y = 1, z = 1},
|
||||
|
||||
--- 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?
|
||||
palette = "",
|
||||
|
||||
--- Color the item is colorized with. The palette overrides this.
|
||||
--- @type string|ColorSpec|nil
|
||||
--- Examples: "#ff0000", "#ff0000ff", {r=255,g=0,b=0,a=255}
|
||||
color = "#ffffffff",
|
||||
|
||||
--- Maximum amount of items that can be in a single stack.
|
||||
--- The default can be changed by the setting `default_stack_max`
|
||||
--- @type number?
|
||||
stack_max = 99,
|
||||
|
||||
--- Range of node and object pointing that is possible with this item held
|
||||
--- @type number?
|
||||
range = 4.0,
|
||||
|
||||
--- If true, item can point to all liquid nodes (`liquidtype ~= "none"`),
|
||||
--- even those for which `pointable = false`
|
||||
--- @type boolean?
|
||||
liquids_pointable = false,
|
||||
|
||||
--- 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 'minetest.LIGHT_MAX'.
|
||||
--- A value outside the range 0 to minetest.LIGHT_MAX causes undefined
|
||||
--- behavior.
|
||||
--- @type number?
|
||||
light_source = 0,
|
||||
|
||||
--- See "Tool Capabilities" section for an example including explanation
|
||||
--- @type table<string,any>?
|
||||
tool_capabilities = {
|
||||
--- Time between two uses of the tool (in seconds).
|
||||
--- For example, a value of 0.5 means the tool can be used twice per second.
|
||||
--- @type number?
|
||||
full_punch_interval = 1.0,
|
||||
--- Maximum level of items that can be dropped using this tool.
|
||||
--- For example, if max_drop_level = 1, items with level 2 or 3
|
||||
--- will not be dropped when the node is dug with this tool.
|
||||
--- @type number?
|
||||
max_drop_level = 0,
|
||||
--- Capabilities of the tool against each group of nodes.
|
||||
--- Each group has the following fields:
|
||||
--- - `times`: table of times it takes to dig nodes of the group
|
||||
--- for each level. The index is the level, the value is the time
|
||||
--- in seconds. Level 1 is the lowest level.
|
||||
--- - `uses`: number of uses the tool has against nodes of the group.
|
||||
--- When this number is exhausted, the tool breaks. 0 means infinite
|
||||
--- uses.
|
||||
--- - `maxlevel`: maximum level of nodes in the group that this tool
|
||||
--- can dig. For example, if maxlevel = 2, nodes of level 3 in
|
||||
--- this group cannot be dug with this tool.
|
||||
--- For example:
|
||||
--- `choppy = {times = {2.50, 1.40, 1.00}, uses = 20, maxlevel = 2}`,
|
||||
--- @type table<string,table<string,any>>
|
||||
groupcaps = {
|
||||
--- For example:
|
||||
choppy = {times = {2.50, 1.40, 1.00}, uses = 20, maxlevel = 2},
|
||||
},
|
||||
--- Damage dealt to players and entities when using the tool to punch
|
||||
--- them. The damage is specified in the same way as for entities,
|
||||
--- i.e. a table with damage groups as keys and damage values as values.
|
||||
--- Damage values must be between -32768 and 32767 (2^15)
|
||||
--- Negative values heal the entity instead of damaging it.
|
||||
--- If a damage group is not specified, the tool does no damage to that
|
||||
--- group.
|
||||
--- For example, to deal 7 damage to the "fleshy" group:
|
||||
--- `damage_groups = {fleshy = 7}`, or for 3 damage to "fleshy"
|
||||
--- and 1 damage to "crumbly":
|
||||
--- `damage_groups = {fleshy = 3, crumbly = 1}`
|
||||
--- If the tool should do no damage, use an empty table:
|
||||
--- `damage_groups = {}`
|
||||
--- @type table<string,number>
|
||||
damage_groups = {groupname = 7},
|
||||
|
||||
--- Amount of uses this tool has for attacking players and entities
|
||||
--- by punching them (0 = infinite uses).
|
||||
--- For compatibility, this is automatically set from the first
|
||||
--- suitable groupcap using the formula "uses * 3^(maxlevel - 1)".
|
||||
--- It is recommend to set this explicitly instead of relying on the
|
||||
--- fallback behavior.
|
||||
--- @type number?
|
||||
punch_attack_uses = 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?
|
||||
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.
|
||||
--- @type string?
|
||||
node_dig_prediction = "air",
|
||||
|
||||
--- Definition of item sounds to be played at various events.
|
||||
--- All fields in this table are optional.
|
||||
--- See also `minetest.registered_items[itemname].sound`
|
||||
--- @type table<string,SimpleSoundSpec>?
|
||||
sound = {
|
||||
|
||||
--- When tool breaks due to wear. Ignored for non-tools
|
||||
--- @type SimpleSoundSpec
|
||||
breaks = nil,
|
||||
|
||||
--- When item is eaten with `minetest.do_item_eat`
|
||||
--- @type SimpleSoundSpec
|
||||
eat = nil,
|
||||
|
||||
--- When item is used with the 'punch/mine' key pointing at a node or entity
|
||||
--- @type SimpleSoundSpec
|
||||
punch_use = nil,
|
||||
|
||||
--- When item is used with the 'punch/mine' key pointing at nothing (air)
|
||||
--- @type SimpleSoundSpec
|
||||
punch_use_air = nil,
|
||||
},
|
||||
|
||||
--- When the 'place' key was pressed with the item in hand and a node was pointed at.
|
||||
--- Shall place item and return the leftover itemstack or nil to not modify the inventory.
|
||||
--- Second return value: position of placed item/node.
|
||||
--- The placer may be any ObjectRef or nil.
|
||||
--- default: minetest.item_place
|
||||
--- @type (fun(itemstack:ItemStack, placer:Player|ObjectRef|nil, pointed_thing:pointed_thing):ItemStack|nil, Position|vector|nil)?
|
||||
on_place = minetest.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: nil
|
||||
--- @type fun(itemstack:ItemStack, user:Player|ObjectRef|nil, pointed_thing:pointed_thing)?
|
||||
on_secondary_use = nil,
|
||||
|
||||
--- Shall drop item and return the leftover itemstack.
|
||||
--- The dropper may be any ObjectRef or nil.
|
||||
--- default: minetest.item_drop
|
||||
--- @type (fun(itemstack:ItemStack|ItemStackString, dropper:Player|ObjectRef|nil, pos:Position):ItemStack)?
|
||||
on_drop = minetest.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.
|
||||
--- Parameters:
|
||||
--- * `itemstack`: The `ItemStack` to be picked up.
|
||||
--- * `picker`: Any `ObjectRef` or `nil`.
|
||||
--- * `pointed_thing` (optional): The dropped item (a `"__builtin:item"`
|
||||
--- luaentity) as `type="object"` `pointed_thing`.
|
||||
--- * `time_from_last_punch, ...` (optional): Other parameters from
|
||||
--- `luaentity:on_punch`.
|
||||
--- default: `minetest.item_pickup`
|
||||
--- @type fun(itemstack:ItemStack, picker:Player|ObjectRef|nil, pointed_thing:pointed_thing, time_from_last_punch, ...)?
|
||||
on_pickup = minetest.item_pickup,
|
||||
|
||||
--- default: nil
|
||||
--- When user pressed the 'punch/mine' 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
|
||||
--- Otherwise, the function is free to do what it wants.
|
||||
--- The user may be any ObjectRef or nil.
|
||||
--- The default functions handle regular use cases.
|
||||
--- @type (fun(itemstack:ItemStack, user:Player|ObjectRef|nil, pointed_thing:pointed_thing):ItemStack|nil)?
|
||||
on_use = nil,
|
||||
|
||||
--- default: nil
|
||||
--- If defined, should return an itemstack and will be called instead of
|
||||
--- wearing out the item (if tool). If returns nil, does nothing.
|
||||
--- If after_use doesn't exist, it is the same as:
|
||||
--- function(itemstack, user, node, digparams)
|
||||
--- itemstack:add_wear(digparams.wear)
|
||||
--- return itemstack
|
||||
--- end
|
||||
--- The user may be any ObjectRef or nil.
|
||||
--- @type fun(itemstack:ItemStack, user:Player|ObjectRef|nil, node, digparams)?
|
||||
after_use = nil,
|
||||
|
||||
--- Add your own custom fields. By convention, all custom field names
|
||||
--- should start with `_` to avoid naming collisions with future engine
|
||||
--- usage.
|
||||
--- @type any?
|
||||
_custom_field = "< whatever >",
|
||||
}
|
||||
648
definitions/NodeDefinition.lua
Normal file
648
definitions/NodeDefinition.lua
Normal file
@@ -0,0 +1,648 @@
|
||||
--- @class NodeDefinition: ItemDefinition
|
||||
local NodeDefinition = {
|
||||
|
||||
--- For last version see ["Node drawtypes"](https://api.luanti.org/nodes/#node-drawtypes)
|
||||
---
|
||||
--- There are a bunch of different looking node types.
|
||||
--- * `normal`
|
||||
--- * * A node-sized cube.
|
||||
--- * `airlike`
|
||||
--- * * Invisible, uses no texture.
|
||||
--- * `liquid`
|
||||
--- * * The cubic source node for a liquid.
|
||||
--- * * Faces bordering to the same node are never rendered.
|
||||
--- * * Connects to node specified in `liquid_alternative_flowing` if specified.
|
||||
--- * * Use `backface_culling = false` for the tiles you want to make
|
||||
--- visible when inside the node.
|
||||
--- * `flowingliquid`
|
||||
--- * * The flowing version of a liquid, appears with various heights and slopes.
|
||||
--- * * Faces bordering to the same node are never rendered.
|
||||
--- * * Connects to node specified in `liquid_alternative_source`.
|
||||
--- * * You *must* set `liquid_alternative_flowing` to the node's own name.
|
||||
--- * * Node textures are defined with `special_tiles` where the first tile
|
||||
--- is for the top and bottom faces and the second tile is for the side
|
||||
--- faces.
|
||||
--- * * `tiles` is used for the item/inventory/wield image rendering.
|
||||
--- * * Use `backface_culling = false` for the special tiles you want to make
|
||||
--- visible when inside the node
|
||||
--- * `glasslike`
|
||||
--- * * Often used for partially-transparent nodes.
|
||||
--- * * Only external sides of textures are visible.
|
||||
--- * `glasslike_framed`
|
||||
--- * * All face-connected nodes are drawn as one volume within a surrounding
|
||||
--- frame.
|
||||
--- * * The frame appearance is generated from the edges of the first texture
|
||||
--- specified in `tiles`. The width of the edges used are 1/16th of texture
|
||||
--- size: 1 pixel for 16x16, 2 pixels for 32x32 etc.
|
||||
--- * * The glass 'shine' (or other desired detail) on each node face is supplied
|
||||
--- by the second texture specified in `tiles`.
|
||||
--- * `glasslike_framed_optional`
|
||||
--- * * This switches between the above 2 drawtypes according to the menu setting
|
||||
--- 'Connected Glass'.
|
||||
--- * `allfaces`
|
||||
--- * * Often used for partially-transparent nodes.
|
||||
--- * * External sides of textures, and unlike other drawtypes, the external sides
|
||||
--- of other nodes, are visible from the inside.
|
||||
--- * `allfaces_optional`
|
||||
--- * * Often used for leaves nodes.
|
||||
--- * * This switches between `normal`, `glasslike` and `allfaces` according to
|
||||
--- the menu setting: Opaque Leaves / Simple Leaves / Fancy Leaves.
|
||||
--- * * With 'Simple Leaves' selected, the texture specified in `special_tiles`
|
||||
--- is used instead, if present. This allows a visually thicker texture to be
|
||||
--- used to compensate for how `glasslike` reduces visual thickness.
|
||||
--- * `torchlike`
|
||||
--- * * A single vertical texture.
|
||||
--- * * If `paramtype2="[color]wallmounted"`:
|
||||
--- * * * If placed on top of a node, uses the first texture specified in `tiles`.
|
||||
--- * * * If placed against the underside of a node, uses the second texture
|
||||
--- specified in `tiles`.
|
||||
--- * * * If placed on the side of a node, uses the third texture specified in
|
||||
--- `tiles` and is perpendicular to that node.
|
||||
--- * * If `paramtype2="none"`:
|
||||
--- * * * Will be rendered as if placed on top of a node (see
|
||||
--- above) and only the first texture is used.
|
||||
--- * `signlike`
|
||||
--- * * A single texture parallel to, and mounted against, the top, underside or
|
||||
--- side of a node.
|
||||
--- * * If `paramtype2="[color]wallmounted"`, it rotates according to `param2`
|
||||
--- * * If `paramtype2="none"`, it will always be on the floor.
|
||||
--- * `plantlike`
|
||||
--- * * Two vertical and diagonal textures at right-angles to each other.
|
||||
--- * * See `paramtype2 = "meshoptions"` above for other options.
|
||||
--- * `firelike`
|
||||
--- * * When above a flat surface, appears as 6 textures, the central 2 as
|
||||
--- `plantlike` plus 4 more surrounding those.
|
||||
--- * * If not above a surface the central 2 do not appear, but the texture
|
||||
--- appears against the faces of surrounding nodes if they are present.
|
||||
--- * `fencelike`
|
||||
--- * * A 3D model suitable for a wooden fence.
|
||||
--- * * One placed node appears as a single vertical post.
|
||||
--- * * Adjacently-placed nodes cause horizontal bars to appear between them.
|
||||
--- * `raillike`
|
||||
--- * * Often used for tracks for mining carts.
|
||||
--- * * Requires 4 textures to be specified in `tiles`, in order: Straight,
|
||||
--- curved, t-junction, crossing.
|
||||
--- * * Each placed node automatically switches to a suitable rotated texture
|
||||
--- determined by the adjacent `raillike` nodes, in order to create a
|
||||
--- continuous track network.
|
||||
--- * * Becomes a sloping node if placed against stepped nodes.
|
||||
--- * `nodebox`
|
||||
--- * * Often used for stairs and slabs.
|
||||
--- * * Allows defining nodes consisting of an arbitrary number of boxes.
|
||||
--- * * See [Node boxes] below for more information.
|
||||
--- * `mesh`
|
||||
--- * * Uses models for nodes.
|
||||
--- * * Tiles should hold model materials textures.
|
||||
--- * * Only static meshes are implemented.
|
||||
--- * * For supported model formats see Irrlicht engine documentation.
|
||||
--- * `plantlike_rooted`
|
||||
--- * * Enables underwater `plantlike` without air bubbles around the nodes.
|
||||
--- * * Consists of a base cube at the coordinates of the node plus a
|
||||
--- `plantlike` extension above
|
||||
--- * * If `paramtype2="leveled", the `plantlike` extension has a height
|
||||
--- of `param2 / 16` nodes, otherwise it's the height of 1 node
|
||||
--- * * If `paramtype2="wallmounted"`, the `plantlike` extension
|
||||
--- will be at one of the corresponding 6 sides of the base cube.
|
||||
--- Also, the base cube rotates like a `normal` cube would
|
||||
--- * * The `plantlike` extension visually passes through any nodes above the
|
||||
--- base cube without affecting them.
|
||||
--- * * The base cube texture tiles are defined as normal, the `plantlike`
|
||||
--- extension uses the defined special tile, for example:
|
||||
--- `special_tiles = {{name = "default_papyrus.png"}},`
|
||||
---
|
||||
--- `*_optional` drawtypes need less rendering time if deactivated(always client-side).
|
||||
---
|
||||
--- @type string?
|
||||
drawtype = "normal",
|
||||
|
||||
--- 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?
|
||||
visual_scale = 1.0,
|
||||
|
||||
--- {tile definition 1, def2, def3, def4, def5, def6}
|
||||
---
|
||||
--- Textures of node; +Y, -Y, +X, -X, +Z, -Z
|
||||
--- List can be shortened to needed length.
|
||||
--- @type (string[]|TileDefinition[])?
|
||||
tiles = nil,
|
||||
|
||||
--- {tile definition 1, def2, def3, def4, def5, def6}
|
||||
---
|
||||
--- 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[])?
|
||||
overlay_tiles = nil,
|
||||
|
||||
--- {tile definition 1, Tile definition 2},
|
||||
--- Special textures of node; used rarely.
|
||||
--- List can be shortened to needed length.
|
||||
--- @type (string[]|TileDefinition[])?
|
||||
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.
|
||||
--- @see ColorSpec
|
||||
--- @type (string|ColorSpec)?
|
||||
color = '',
|
||||
|
||||
--- 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
|
||||
--- * "blend": The alpha channel specifies how transparent a given pixel
|
||||
--- of the rendered node is
|
||||
--- The default is "opaque" for drawtypes normal, liquid and flowingliquid;
|
||||
--- "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?
|
||||
use_texture_alpha = "opaque",
|
||||
|
||||
--- 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?
|
||||
palette = "",
|
||||
|
||||
--- Screen tint if player is inside node, see "ColorSpec"
|
||||
--- @type string?
|
||||
post_effect_color = "#00000000",
|
||||
|
||||
--- See "Nodes"
|
||||
--- @type string?
|
||||
paramtype = "none",
|
||||
|
||||
--- See "Nodes"
|
||||
--- @type string?
|
||||
paramtype2 = "none",
|
||||
|
||||
--- Value for param2 that is set when player places node
|
||||
--- @type number?
|
||||
place_param2 = 0,
|
||||
|
||||
--- 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?
|
||||
is_ground_content = true,
|
||||
|
||||
--- If true, sunlight will go infinitely through this node
|
||||
--- @type boolean?
|
||||
sunlight_propagates = false,
|
||||
|
||||
--- If true, objects collide with node
|
||||
--- @type boolean?
|
||||
walkable = true,
|
||||
|
||||
--- If true, can be pointed at
|
||||
--- @type boolean?
|
||||
pointable = true,
|
||||
|
||||
--- If false, can never be dug
|
||||
--- @type boolean?
|
||||
diggable = true,
|
||||
|
||||
--- If true, can be climbed on like a ladder
|
||||
--- @type boolean?
|
||||
climbable = false,
|
||||
|
||||
--- 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?
|
||||
move_resistance = 0,
|
||||
|
||||
--- If true, placed nodes can replace this node
|
||||
--- @type boolean?
|
||||
buildable_to = false,
|
||||
|
||||
--- If true, liquids flow into and replace this node.
|
||||
--- Warning: making a liquid node 'floodable' will cause problems.
|
||||
--- @type boolean?
|
||||
floodable = false,
|
||||
|
||||
--- 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?
|
||||
liquidtype = "none",
|
||||
|
||||
--- 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 any of these is true:
|
||||
--- * `liquidtype ~= "none" or
|
||||
--- * `drawtype == "liquid" 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?
|
||||
liquid_alternative_flowing = "",
|
||||
|
||||
--- 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 any of these is true:
|
||||
--- * `liquidtype ~= "none" or
|
||||
--- * `drawtype == "liquid" 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?
|
||||
liquid_alternative_source = "",
|
||||
|
||||
--- 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?
|
||||
liquid_viscosity = 0,
|
||||
|
||||
--- If true, a new liquid source can be created by placing two or more
|
||||
--- sources nearby
|
||||
--- @type boolean?
|
||||
liquid_renewable = true,
|
||||
|
||||
--- 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?
|
||||
liquid_move_physics = 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?
|
||||
leveled = 0,
|
||||
|
||||
--- Maximum value for `leveled` (0-127), enforced in
|
||||
--- `minetest.set_node_level` and `minetest.add_node_level`.
|
||||
--- Values above 124 might causes collision detection issues.
|
||||
--- @type number?
|
||||
leveled_max = 127,
|
||||
|
||||
--- Maximum distance that flowing liquid nodes can spread around
|
||||
--- source on flat land;
|
||||
--- maximum = 8; set to 0 to disable liquid flow
|
||||
--- @type number?
|
||||
liquid_range = 8,
|
||||
|
||||
--- Player will take this amount of damage if no bubbles are left
|
||||
--- @type number?
|
||||
drowning = 0,
|
||||
|
||||
--- If player is inside node, this damage is caused
|
||||
--- @type number?
|
||||
damage_per_second = 0,
|
||||
|
||||
--- See "Node boxes"
|
||||
--- @type table?
|
||||
node_box = {type = "regular"},
|
||||
|
||||
--- 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 string[]?
|
||||
connects_to = {},
|
||||
|
||||
--- Tells connected nodebox nodes to connect only to these sides of this
|
||||
--- node. possible: "top", "bottom", "front", "left", "back", "right"
|
||||
--- @type string[]?
|
||||
connect_sides = {},
|
||||
|
||||
--- File name of mesh when using "mesh" drawtype
|
||||
--- @type string?
|
||||
mesh = "",
|
||||
|
||||
--- 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.
|
||||
--- see [Node boxes] for possibilities
|
||||
--- @type table?
|
||||
selection_box = {},
|
||||
|
||||
--- see [Node boxes] for possibilities
|
||||
--- 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?
|
||||
collision_box = {},
|
||||
|
||||
--- Support maps made in and before January 2012
|
||||
--- @type boolean?
|
||||
legacy_facedir_simple = false,
|
||||
--- Support maps made in and before January 2012
|
||||
--- @type boolean?
|
||||
legacy_wallmounted = false,
|
||||
|
||||
--- 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?
|
||||
waving = 0,
|
||||
|
||||
--- Definition of node sounds to be played at various events.
|
||||
--- All fields in this table are optional.
|
||||
--- @type nil|table<string,SimpleSoundSpec|string?>
|
||||
sounds = {
|
||||
|
||||
--- If walkable, played when object walks on it. If node is
|
||||
--- climbable or a liquid, played when object moves through it
|
||||
--- @type SimpleSoundSpec?
|
||||
footstep = nil,
|
||||
|
||||
--- While digging node.
|
||||
--- If `"__group"`, then the sound will be
|
||||
--- `{name = "default_dig_<groupname>", gain = 0.5}` , where `<groupname>` is the
|
||||
--- name of the item's digging group with the fastest digging time.
|
||||
--- In case of a tie, one of the sounds will be played (but we
|
||||
--- cannot predict which one)
|
||||
--- Default value: `"__group"`
|
||||
--- @type nil|SimpleSoundSpec|string
|
||||
dig = {} or "__group",
|
||||
|
||||
--- Node was dug
|
||||
--- @type SimpleSoundSpec?
|
||||
dug = nil,
|
||||
|
||||
--- Node was placed. Also played after falling
|
||||
--- @type SimpleSoundSpec?
|
||||
place = nil,
|
||||
|
||||
--- When node placement failed.
|
||||
--- Note: This happens if the _built-in_ node placement failed.
|
||||
--- This sound will still be played if the node is placed in the
|
||||
--- `on_place` callback manually.
|
||||
--- @type SimpleSoundSpec?
|
||||
place_failed = nil,
|
||||
|
||||
--- When node starts to fall or is detached
|
||||
--- @type SimpleSoundSpec?
|
||||
fall = 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 (string|table)?
|
||||
drop = {
|
||||
--- Maximum number of item lists to drop.
|
||||
--- The entries in 'items' are processed in order. For each:
|
||||
--- Item filtering is applied, chance of drop is applied, if both are
|
||||
--- successful the entire item list is dropped.
|
||||
--- Entry processing continues until the number of dropped item lists
|
||||
--- equals 'max_items'.
|
||||
--- Therefore, entries should progress from low to high drop chance.
|
||||
--- @type number
|
||||
max_items = 1,
|
||||
--- Examples:
|
||||
--- ```lua
|
||||
--- {
|
||||
--- -- 1 in 1000 chance of dropping a diamond.
|
||||
--- -- Default rarity is '1'.
|
||||
--- rarity = 1000,
|
||||
--- items = {"default:diamond"},
|
||||
--- },
|
||||
--- {
|
||||
--- -- Only drop if using an item whose name is identical to one
|
||||
--- -- of these.
|
||||
--- tools = {"default:shovel_mese", "default:shovel_diamond"},
|
||||
--- rarity = 5,
|
||||
--- items = {"default:dirt"},
|
||||
--- -- Whether all items in the dropped item list inherit the
|
||||
--- -- hardware coloring palette color from the dug node.
|
||||
--- -- Default is 'false'.
|
||||
--- inherit_color = true,
|
||||
--- },
|
||||
--- {
|
||||
--- -- Only drop if using an item whose name contains
|
||||
--- -- "default:shovel_" (this item filtering by string matching
|
||||
--- -- is deprecated, use tool_groups instead).
|
||||
--- tools = {"~default:shovel_"},
|
||||
--- rarity = 2,
|
||||
--- -- The item list dropped.
|
||||
--- items = {"default:sand", "default:desert_sand"},
|
||||
--- },
|
||||
--- {
|
||||
--- -- Only drop if using an item in the "magicwand" group, or
|
||||
--- -- an item that is in both the "pickaxe" and the "lucky"
|
||||
--- -- groups.
|
||||
--- tool_groups = {
|
||||
--- "magicwand",
|
||||
--- {"pickaxe", "lucky"}
|
||||
--- },
|
||||
--- items = {"default:coal_lump"},
|
||||
--- },
|
||||
--- ```
|
||||
items = {},
|
||||
},
|
||||
|
||||
--- 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, minetest.set_node can cause an
|
||||
--- infinite loop if it invokes the same callback.
|
||||
--- Consider using `minetest.swap_node()` instead.
|
||||
--- default: nil
|
||||
--- @type fun(pos:Position)?
|
||||
on_construct = nil,
|
||||
|
||||
--- Node destructor; called before removing node.
|
||||
--- Not called for bulk node placement.
|
||||
--- default: nil
|
||||
--- @type fun(pos:Position)?
|
||||
on_destruct = nil,
|
||||
|
||||
--- Node destructor; called after removing node.
|
||||
--- Not called for bulk node placement.
|
||||
--- default: nil
|
||||
--- @type fun(pos:Position, old_node)?
|
||||
after_destruct = nil,
|
||||
|
||||
--- Called when a liquid (new_node) is about to flood old_node, 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.
|
||||
--- @type fun(pos:Position, old_node, new_node)?
|
||||
on_flood = nil,
|
||||
|
||||
|
||||
--- Called when `old_node` 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.
|
||||
--- `old_meta` are the metadata fields (table) of the node before deletion.
|
||||
--- drops is a table of `ItemStacks`, so any metadata to be preserved can
|
||||
--- be added directly to one or more of the dropped items.
|
||||
--- @see ItemStackMetaRef
|
||||
--- default: nil
|
||||
--- @type fun(pos:Position, old_node, new_node, old_meta, drops:ItemStack[])?
|
||||
preserve_metadata = nil,
|
||||
|
||||
--- Called after constructing node when node was placed using
|
||||
--- minetest.item_place_node / minetest.place_node.
|
||||
--- If return true no item is taken from itemstack.
|
||||
--- `placer` may be any valid ObjectRef or nil.
|
||||
--- default: nil
|
||||
--- @type fun(pos:Position, placer:Player|ObjectRef|nil, itemstack:ItemStack, pointed_thing:pointed_thing)?
|
||||
after_place_node = nil,
|
||||
|
||||
--- oldmetadata is in table format.
|
||||
--- Called after destructing node when node was dug using
|
||||
--- minetest.node_dig / minetest.dig_node.
|
||||
--- default: nil
|
||||
--- @type fun(pos:Player, oldnode, oldmetadata, digger:Player|ObjectRef|nil)?
|
||||
after_dig_node = nil,
|
||||
|
||||
--- Returns true if node can be dug, or false if not.
|
||||
--- default: nil
|
||||
--- @type fun(pos:Position, player:Player|ObjectRef|nil)?
|
||||
can_dig = nil,
|
||||
|
||||
--- default: minetest.node_punch
|
||||
--- Called when puncher (an ObjectRef) punches the node at pos.
|
||||
--- By default calls minetest.register_on_punchnode callbacks.
|
||||
--- @type fun(pos:Position, node:NodeTable, puncher:Player|ObjectRef|nil, pointed_thing:pointed_thing)?
|
||||
on_punch = nil,
|
||||
|
||||
--- default: 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.
|
||||
--- This function does not get triggered by clients <=0.4.16 if the
|
||||
--- "formspec" node metadata field is set.
|
||||
--- @type (fun(pos:Position, node:NodeTable, clicker:Player|ObjectRef, itemstack:ItemStack, pointed_thing:pointed_thing|nil):ItemStack|nil)?
|
||||
on_rightclick = core.node_punch,
|
||||
|
||||
--- default: minetest.node_dig
|
||||
--- 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.
|
||||
--- @type (fun(pos:Position, node:NodeTable, digger:Player): boolean)?
|
||||
on_dig = nil,
|
||||
|
||||
--- default: nil
|
||||
--- called by NodeTimers, see minetest.get_node_timer and NodeTimerRef.
|
||||
--- elapsed is the total time passed since the timer was started.
|
||||
--- return true to run the timer for another cycle with the same timeout
|
||||
--- value.
|
||||
--- @type (fun(pos:Position, elapsed:number): boolean)?
|
||||
on_timer = nil,
|
||||
|
||||
--- fields = {name1 = value1, name2 = value2, ...}
|
||||
--- Called when an UI form (e.g. sign text input) returns data.
|
||||
--- See minetest.register_on_player_receive_fields for more info.
|
||||
--- default: nil
|
||||
--- @type fun(pos:Position, formname:string, fields:table, sender:Player)?
|
||||
on_receive_fields = nil,
|
||||
|
||||
--- Called when a player wants to move items inside the inventory.
|
||||
--- Return value: number of items allowed to move.
|
||||
--- @type (fun(pos:Position, from_list:string, from_index:number, to_list:string, to_index:number, count:number, player:Player): number)?
|
||||
allow_metadata_inventory_move = 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:Position, listname:string, index:number, stack:ItemStack, player:Player): number)?
|
||||
allow_metadata_inventory_put = 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:Position, listname:string, index:number, stack:ItemStack, player:Player): number)?
|
||||
allow_metadata_inventory_take = nil,
|
||||
|
||||
--- Called after the actual action has happened, according to what was
|
||||
--- allowed.
|
||||
--- No return value.
|
||||
--- @type (fun(pos:Position, from_list:string, from_index:number, to_list:string, to_index:number, count:number, player:Player): void)?
|
||||
on_metadata_inventory_move = nil,
|
||||
--- Called after the actual action has happened, according to what was
|
||||
--- allowed.
|
||||
--- No return value.
|
||||
--- @type (fun(pos:Position, listname:string, index:number, stack:ItemStack, player:Player): void)?
|
||||
on_metadata_inventory_put = nil,
|
||||
--- Called after the actual action has happened, according to what was
|
||||
--- allowed.
|
||||
--- No return value.
|
||||
--- @type (fun(pos:Position, listname:string, index:number, stack:ItemStack, player:Player): void)?
|
||||
on_metadata_inventory_take = nil,
|
||||
|
||||
--- intensity: 1.0 = mid range of regular TNT.
|
||||
--- If defined, called when an explosion touches the node, instead of
|
||||
--- removing the node.
|
||||
--- @type (fun(pos:Position, intensity:number): void)?
|
||||
on_blast = nil,
|
||||
|
||||
--- stores which mod actually registered a node
|
||||
--- If the source could not be determined it contains "??"
|
||||
--- Useful for getting which mod truly registered something
|
||||
--- example: if a node is registered as ":othermodname:nodename",
|
||||
--- nodename will show "othermodname", but mod_origin will say "modname"
|
||||
--- @type string?
|
||||
mod_origin = "modname",
|
||||
}
|
||||
127
definitions/NoiseParams.lua
Normal file
127
definitions/NoiseParams.lua
Normal file
@@ -0,0 +1,127 @@
|
||||
--- For 2D or 3D value noise or value noise maps:
|
||||
---
|
||||
--- ```lua
|
||||
--- np_terrain = {
|
||||
--- offset = 0,
|
||||
--- scale = 1,
|
||||
--- spread = {x = 500, y = 500, z = 500},
|
||||
--- seed = 571347,
|
||||
--- octaves = 5,
|
||||
--- persistence = 0.63,
|
||||
--- lacunarity = 2.0,
|
||||
--- flags = "defaults, absvalue",
|
||||
--- }
|
||||
--- ```
|
||||
---
|
||||
--- For 2D noise the Z component of `spread` is still defined but is ignored.
|
||||
--- A single noise parameter table can be used for 2D or 3D noise.
|
||||
--- @class NoiseParams
|
||||
local NoiseParams = {
|
||||
--- After the multiplication by `scale` this is added to the result and is the final
|
||||
--- step in creating the noise value.
|
||||
--- Can be positive or negative.
|
||||
--- @type number
|
||||
offset = 0,
|
||||
|
||||
--- Once all octaves have been combined, the result is multiplied by this.
|
||||
--- Can be positive or negative
|
||||
--- @type number
|
||||
scale = 1,
|
||||
|
||||
--- For octave1, this is roughly the change of input value needed for a very large
|
||||
--- variation in the noise value generated by octave1. It is almost like a
|
||||
--- 'wavelength' for the wavy noise variation.
|
||||
--- Each additional octave has a 'wavelength' that is smaller than the previous
|
||||
--- octave, to create finer detail. `spread` will therefore roughly be the typical
|
||||
--- size of the largest structures in the final noise variation.
|
||||
---
|
||||
--- `spread` is a vector with values for x, y, z to allow the noise variation to be
|
||||
--- stretched or compressed in the desired axes.
|
||||
--- Values are positive numbers.
|
||||
--- @type Position
|
||||
spread = {x=1,y=1,z=1},
|
||||
|
||||
--- This is a whole number that determines the entire pattern of the noise
|
||||
--- variation. Altering it enables different noise patterns to be created.
|
||||
--- With other parameters equal, different seeds produce different noise patterns
|
||||
--- and identical seeds produce identical noise patterns.
|
||||
---
|
||||
--- For this parameter you can randomly choose any whole number. Usually it is
|
||||
--- preferable for this to be different from other seeds, but sometimes it is useful
|
||||
--- to be able to create identical noise patterns.
|
||||
---
|
||||
--- In some noise APIs the world seed is added to the seed specified in noise
|
||||
--- parameters. This is done to make the resulting noise pattern vary in different
|
||||
--- worlds, and be 'world-specific'.
|
||||
--- @type number
|
||||
seed = 0,
|
||||
|
||||
--- The number of simple noise generators that are combined.
|
||||
--- A whole number, 1 or more.
|
||||
--- Each additional octave adds finer detail to the noise but also increases the
|
||||
--- noise calculation load.
|
||||
--- 3 is a typical minimum for a high quality, complex and natural-looking noise
|
||||
--- variation. 1 octave has a slight 'gridlike' appearance.
|
||||
---
|
||||
--- Choose the number of octaves according to the `spread` and `lacunarity`, and the
|
||||
--- size of the finest detail you require. For example:
|
||||
--- if `spread` is 512 nodes, `lacunarity` is 2.0 and finest detail required is 16
|
||||
--- nodes, octaves will be 6 because the 'wavelengths' of the octaves will be
|
||||
--- 512, 256, 128, 64, 32, 16 nodes.
|
||||
--- Warning: If the 'wavelength' of any octave falls below 1 an error will occur.
|
||||
--- @type number
|
||||
octaves = 1,
|
||||
|
||||
--- Each additional octave has an amplitude that is the amplitude of the previous
|
||||
--- octave multiplied by `persistence`, to reduce the amplitude of finer details,
|
||||
--- as is often helpful and natural to do so.
|
||||
--- Since this controls the balance of fine detail to large-scale detail
|
||||
--- `persistence` can be thought of as the 'roughness' of the noise.
|
||||
---
|
||||
--- A positive or negative non-zero number, often between 0.3 and 1.0.
|
||||
--- A common medium value is 0.5, such that each octave has half the amplitude of
|
||||
--- the previous octave.
|
||||
--- This may need to be tuned when altering `lacunarity`; when doing so consider
|
||||
--- that a common medium value is 1 / lacunarity.
|
||||
---
|
||||
--- Instead of `persistence`, the key `persist` may be used to the same effect.
|
||||
--- @type number
|
||||
persistence = 0.5,
|
||||
|
||||
|
||||
--- Each additional octave has a 'wavelength' that is the 'wavelength' of the
|
||||
--- previous octave multiplied by 1 / lacunarity, to create finer detail.
|
||||
--- 'lacunarity' is often 2.0 so 'wavelength' often halves per octave.
|
||||
---
|
||||
--- A positive number no smaller than 1.0.
|
||||
--- Values below 2.0 create higher quality noise at the expense of requiring more
|
||||
--- octaves to cover a particular range of 'wavelengths'.
|
||||
--- @type number
|
||||
lacunarity = 2.0,
|
||||
|
||||
--- Leave this field unset for no special handling.
|
||||
--- Currently supported are `defaults`, `eased` and `absvalue`:
|
||||
--- * `defaults` Specify this if you would like to keep auto-selection of eased/not-eased while
|
||||
--- specifying some other flags.
|
||||
--- * `eased`
|
||||
--- Maps noise gradient values onto a quintic S-curve before performing
|
||||
--- interpolation. This results in smooth, rolling noise.
|
||||
--- Disable this (`noeased`) for sharp-looking noise with a slightly gridded
|
||||
--- appearance.
|
||||
--- If no flags are specified (or defaults is), 2D noise is eased and 3D noise is
|
||||
--- not eased.
|
||||
--- Easing a 3D noise significantly increases the noise calculation load, so use
|
||||
--- with restraint.
|
||||
--- * `absvalue`
|
||||
--- The absolute value of each octave's noise variation is used when combining the
|
||||
--- octaves. The final value noise variation is created as follows:
|
||||
--- ```
|
||||
--- noise = offset + scale * (abs(octave1) +
|
||||
--- abs(octave2) * persistence +
|
||||
--- abs(octave3) * persistence ^ 2 +
|
||||
--- abs(octave4) * persistence ^ 3 +
|
||||
--- ...)
|
||||
--- ```
|
||||
--- @type string?
|
||||
flags = nil,
|
||||
}
|
||||
208
definitions/ObjectProperties.lua
Normal file
208
definitions/ObjectProperties.lua
Normal file
@@ -0,0 +1,208 @@
|
||||
--- @class ObjectProperties
|
||||
local ObjectProperties = {
|
||||
--- Defines the maximum and default HP of the entity
|
||||
--- For Lua entities the maximum is not enforced.
|
||||
--- For players this defaults to `minetest.PLAYER_MAX_HP_DEFAULT`.
|
||||
--- @type number
|
||||
hp_max = 10,
|
||||
|
||||
--- For players only. Defaults to `minetest.PLAYER_MAX_BREATH_DEFAULT`.
|
||||
--- @type number
|
||||
breath_max = 0,
|
||||
|
||||
--- For players only. Zoom FOV in degrees.
|
||||
--- Note that zoom loads and/or generates world beyond the server's
|
||||
--- maximum send and generate distances, so acts like a telescope.
|
||||
--- 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
|
||||
zoom_fov = 0.0,
|
||||
|
||||
--- For players only. Camera height above feet position in nodes.
|
||||
--- @type number
|
||||
eye_height = 1.625,
|
||||
|
||||
--- Collide with `walkable` nodes.
|
||||
--- @type boolean
|
||||
physical = false,
|
||||
|
||||
--- Collide with other objects if physical = true
|
||||
--- @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[]
|
||||
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.
|
||||
--- If not set, the selection box copies the collision box, and will also not rotate.
|
||||
--- If `rotate = false`, the selection box will not rotate with the object itself, remaining fixed to the axes.
|
||||
--- If `rotate = true`, it will match the object's rotation and any attachment rotations.
|
||||
--- 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}
|
||||
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
|
||||
pointable = true,
|
||||
|
||||
--- `"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.
|
||||
--- "mesh" uses the defined mesh model.
|
||||
--- "wielditem" is used for dropped items.
|
||||
--- (see builtin/game/item_entity.lua).
|
||||
--- For this use 'wield_item = itemname'.
|
||||
--- Setting 'textures = {itemname}' has the same effect, but is deprecated.
|
||||
--- If the item has a 'wield_image' the object will be an extrusion of
|
||||
--- that, otherwise:
|
||||
--- If 'itemname' is a cubic node or nodebox the object will appear
|
||||
--- identical to 'itemname'.
|
||||
--- If 'itemname' is a plantlike node the object will be an extrusion
|
||||
--- of its texture.
|
||||
--- Otherwise for non-node items, the object will be an extrusion of
|
||||
--- 'inventory_image'.
|
||||
--- If 'itemname' contains a ColorString or palette index (e.g. from
|
||||
--- `minetest.itemstring_with_palette()`), the entity will inherit the color.
|
||||
--- 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 = '',
|
||||
|
||||
--- Multipliers for the visual size. If `z` is not specified, `x` will be used
|
||||
--- to scale the entity along both horizontal axes.
|
||||
--- @type Position
|
||||
visual_size = {x = 1, y = 1, z = 1},
|
||||
|
||||
--- File name of mesh when using "mesh" visual
|
||||
--- @type string
|
||||
mesh = "model.obj",
|
||||
|
||||
--- Number of required textures depends on visual.
|
||||
--- "cube" uses 6 textures just like a node, but all 6 must be defined.
|
||||
--- "sprite" uses 1 texture.
|
||||
--- "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[]
|
||||
textures = {},
|
||||
|
||||
--- Number of required colors depends on visual
|
||||
--- @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
|
||||
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}
|
||||
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}
|
||||
initial_sprite_basepos = {x = 0, y = 0},
|
||||
|
||||
--- If false, object is invisible and can't be pointed.
|
||||
--- @type boolean
|
||||
is_visible = true,
|
||||
|
||||
--- If true, is able to make footstep sounds of nodes
|
||||
--- (see node sound definition for details).
|
||||
--- @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
|
||||
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
|
||||
stepheight = 0,
|
||||
|
||||
--- Automatically set yaw to movement direction, offset in degrees.
|
||||
--- 'false' to disable.
|
||||
--- @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
|
||||
automatic_face_movement_max_rotation_per_sec = -1,
|
||||
|
||||
--- Set to false to disable backface_culling for model
|
||||
--- @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
|
||||
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
|
||||
nametag = "",
|
||||
|
||||
--- Sets text color of nametag. See ColorSpec
|
||||
--- @type string
|
||||
nametag_color = "<ColorSpec>",
|
||||
|
||||
--- 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
|
||||
nametag_bgcolor = "<ColorSpec>",
|
||||
|
||||
--- Same as infotext for nodes. Empty by default
|
||||
--- @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
|
||||
static_save = true,
|
||||
|
||||
--- Texture modifier to be applied for a short duration when object is hit
|
||||
--- @type string
|
||||
damage_texture_modifier = "^[brighten",
|
||||
|
||||
--- Setting this to 'false' disables diffuse lighting of entity
|
||||
--- @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
|
||||
show_on_minimap = false,
|
||||
}
|
||||
44
definitions/PrivilegeDefinition.lua
Normal file
44
definitions/PrivilegeDefinition.lua
Normal file
@@ -0,0 +1,44 @@
|
||||
--- @diagnostic disable: missing-return
|
||||
|
||||
--- Used by `core.register_privilege`.
|
||||
--- @class PrivilegeDefinition
|
||||
local PrivilegeDefinition = {
|
||||
--- @type string? Privilege description
|
||||
description = "",
|
||||
|
||||
--- @type boolean? Whether to grant the privilege to singleplayer.
|
||||
give_to_singleplayer = true,
|
||||
|
||||
--- Whether to grant the privilege to the server admin.
|
||||
--- Uses value of 'give_to_singleplayer' by default.
|
||||
--- @type boolean?
|
||||
give_to_admin = true,
|
||||
|
||||
--- Called when given to player 'name' by 'granter_name'.
|
||||
--- 'granter_name' will be nil if the priv was granted by a mod.
|
||||
---
|
||||
--- Note that it will be called twice if a player is responsible,
|
||||
--- once with the player name, and then with a nil player name.
|
||||
---
|
||||
--- Return `true` to stop register_on_priv_grant or revoke being called.
|
||||
---
|
||||
--- @param name string for whom priv was granted
|
||||
--- @param granter_name string who gives the priv
|
||||
--- @return boolean
|
||||
--- @type nil|fun(name:string, granter_name:string):boolean
|
||||
on_grant = function(name, granter_name) end,
|
||||
|
||||
--- Called when taken from player 'name' by 'revoker_name'.
|
||||
--- 'revoker_name' will be nil if the priv was revoked by a mod.
|
||||
---
|
||||
--- Note that it will be called twice if a player is responsible,
|
||||
--- once with the player name, and then with a nil player name.
|
||||
---
|
||||
--- Return `true` to stop register_on_priv_grant or revoke being called.
|
||||
---
|
||||
--- @param name string for whom priv was granted
|
||||
--- @param revoker_name string who gives the priv
|
||||
--- @return boolean
|
||||
--- @type nil|fun(name:string, revoker_name:string):boolean
|
||||
on_revoke = function(name, revoker_name) end,
|
||||
}
|
||||
35
definitions/TileAnimationDefinition.lua
Normal file
35
definitions/TileAnimationDefinition.lua
Normal file
@@ -0,0 +1,35 @@
|
||||
--- @class TileAnimationDefinition: table
|
||||
local TileAnimationDefinition = {
|
||||
--- @type string one of {"vertical_frames"|"sheet_2d"}
|
||||
type = "",
|
||||
|
||||
--- Width of a frame in pixels.
|
||||
--- Only for `type == "vertical_frames"`
|
||||
--- @type number
|
||||
aspect_w = 16,
|
||||
|
||||
--- Height of a frame in pixels
|
||||
--- Only for `type == "vertical_frames"`
|
||||
--- @type number
|
||||
aspect_h = 16,
|
||||
|
||||
--- Full loop length
|
||||
--- Only for `type == "vertical_frames"`
|
||||
--- @type number
|
||||
length = 3.0,
|
||||
|
||||
--- Width in number of frames
|
||||
--- Only for `type == "sheet_2d"`
|
||||
--- @type number
|
||||
frames_w = 5,
|
||||
|
||||
--- Height in number of frames
|
||||
--- Only for `type == "sheet_2d"`
|
||||
--- @type number
|
||||
frames_h = 3,
|
||||
|
||||
--- Length of a single frame
|
||||
--- Only for `type == "sheet_2d"`
|
||||
--- @type number
|
||||
frame_length = 0.5,
|
||||
}
|
||||
36
definitions/TileDefinition.lua
Normal file
36
definitions/TileDefinition.lua
Normal file
@@ -0,0 +1,36 @@
|
||||
--- @class TileDefinition
|
||||
local TileDefinition = {
|
||||
--- @type string
|
||||
name = "image.png",
|
||||
|
||||
--- @type TileAnimationDefinition?
|
||||
animation = nil,
|
||||
|
||||
--- Backface culling enabled by default for most nodes.
|
||||
--- @type boolean?
|
||||
backface_culling = true,
|
||||
|
||||
--- One of `{"node"|"world"|"user"}`.
|
||||
---
|
||||
--- `align_style` determines whether the texture will be rotated with the node or kept aligned with its surroundings.
|
||||
---
|
||||
--- `"user"` means that client setting will be used, similar to `glasslike_framed_optional`.
|
||||
---
|
||||
--- **Note:** supported by solid nodes and nodeboxes only.
|
||||
--- @type string?
|
||||
align_style = "none",
|
||||
|
||||
--- `scale` is used to make texture span several (exactly scale) nodes, instead of just one, in each direction.
|
||||
---
|
||||
--- Works for world-aligned textures only.
|
||||
---
|
||||
--- **Note** that as the effect is applied on per-mapblock basis,
|
||||
--- 16 should be equally divisible by scale or you may get wrong results.
|
||||
--- @type number?
|
||||
scale = 1,
|
||||
|
||||
--- - the texture's color will be multiplied with this color.
|
||||
--- - the tile's color overrides the owning node's color in all cases.
|
||||
--- @type string|ColorSpec|nil
|
||||
color = ""
|
||||
}
|
||||
Reference in New Issue
Block a user