Cleanup lls
This commit is contained in:
parent
bb5815f4df
commit
c0c021a19f
|
@ -3,13 +3,10 @@
|
|||
.* export-ignore
|
||||
assets export-ignore
|
||||
scripts export-ignore
|
||||
bin export-ignore
|
||||
docs export-ignore
|
||||
types export-ignore
|
||||
*.zip export-ignore
|
||||
bitbucket-pipelines.yml export-ignore
|
||||
package.json export-ignore
|
||||
package-lock.json export-ignore
|
||||
screenshot*.png export-ignore
|
||||
i18n.py export-ignore
|
||||
config.ld export-ignore
|
||||
|
|
100
.luarc.json
100
.luarc.json
|
@ -1,100 +0,0 @@
|
|||
{
|
||||
"$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json",
|
||||
"runtime": {
|
||||
"version": "Lua 5.1",
|
||||
"path": [
|
||||
"?.lua",
|
||||
"?/init.lua"
|
||||
],
|
||||
"pathStrict": true
|
||||
},
|
||||
"workspace": {
|
||||
"maxPreload": 1600,
|
||||
"preloadFileSize": 1000,
|
||||
"ignoreDir": [
|
||||
"/locale/",
|
||||
"/libs/",
|
||||
"/3rd",
|
||||
"/.vscode",
|
||||
"/meta",
|
||||
"/.git",
|
||||
"/docs",
|
||||
"/bin"
|
||||
],
|
||||
"checkThirdParty": false
|
||||
},
|
||||
"typeFormat": {
|
||||
"config": {
|
||||
"format_line": "false"
|
||||
}
|
||||
},
|
||||
"type": {
|
||||
"castNumberToInteger": true
|
||||
},
|
||||
"doc": {
|
||||
"privateName": [
|
||||
"_*"
|
||||
]
|
||||
},
|
||||
"diagnostics": {
|
||||
"disable": [
|
||||
"close-non-object"
|
||||
],
|
||||
"groupFileStatus": {
|
||||
"ambiguity": "Any",
|
||||
"await": "Any",
|
||||
"duplicate": "Any",
|
||||
"global": "Any",
|
||||
"luadoc": "Any",
|
||||
"redefined": "Any",
|
||||
"strict": "Any",
|
||||
"type-check": "Any",
|
||||
"unbalanced": "Any",
|
||||
"unused": "Any"
|
||||
},
|
||||
"ignoredFiles": "Disable",
|
||||
"libraryFiles": "Disable",
|
||||
"neededFileStatus": {
|
||||
"codestyle-check": "Any"
|
||||
},
|
||||
"disableScheme": [
|
||||
"git",
|
||||
"type"
|
||||
],
|
||||
"globals": [
|
||||
"DIR_DELIM",
|
||||
"INIT",
|
||||
"minetest",
|
||||
"core",
|
||||
"dump",
|
||||
"dump2",
|
||||
"Raycast",
|
||||
"Settings",
|
||||
"PseudoRandom",
|
||||
"PerlinNoise",
|
||||
"VoxelManip",
|
||||
"SecureRandom",
|
||||
"VoxelArea",
|
||||
"PerlinNoiseMap",
|
||||
"PcgRandom",
|
||||
"ItemStack",
|
||||
"AreaStore",
|
||||
"unpack",
|
||||
"vector",
|
||||
"player_monoids",
|
||||
"playerphysics",
|
||||
"hb",
|
||||
"mesecon",
|
||||
"armor",
|
||||
"default",
|
||||
"i3",
|
||||
"unified_inventory",
|
||||
"player_api",
|
||||
"u_skins",
|
||||
"wardrobe",
|
||||
"3d_armor",
|
||||
"skinsdb",
|
||||
"skins"
|
||||
]
|
||||
}
|
||||
}
|
Binary file not shown.
|
@ -13,7 +13,6 @@ pipelines:
|
|||
- nvm install v17.2.0
|
||||
- npm i -g npm@8
|
||||
- npm ci
|
||||
# - parallel:
|
||||
- step:
|
||||
name: Lua Check
|
||||
script:
|
||||
|
@ -22,15 +21,6 @@ pipelines:
|
|||
- apt-get -y install luarocks
|
||||
- luarocks install luacheck
|
||||
- luacheck .
|
||||
# - step:
|
||||
# name: Lua Diagnostics
|
||||
# caches:
|
||||
# - node-modules
|
||||
# - npm
|
||||
# - nvm
|
||||
# script:
|
||||
# - nvm use v17.2.0
|
||||
# - npm run lua-diagnostics
|
||||
tags:
|
||||
"*":
|
||||
- step:
|
||||
|
@ -43,7 +33,6 @@ pipelines:
|
|||
- nvm install v17.2.0
|
||||
- npm i -g npm@8
|
||||
- npm ci
|
||||
# - parallel:
|
||||
- step:
|
||||
name: Lua Check
|
||||
script:
|
||||
|
@ -52,15 +41,6 @@ pipelines:
|
|||
- apt-get -y install luarocks
|
||||
- luarocks install luacheck
|
||||
- luacheck .
|
||||
# - step:
|
||||
# name: Lua Diagnostics
|
||||
# caches:
|
||||
# - node-modules
|
||||
# - npm
|
||||
# - nvm
|
||||
# script:
|
||||
# - nvm use v17.2.0
|
||||
# - npm run lua-diagnostics
|
||||
- step:
|
||||
name: Deploy to ContentDB
|
||||
caches:
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
file = {"docs"}
|
||||
title = "x_bows API documentation"
|
||||
description = "Minetest mod"
|
||||
format = "markdown"
|
||||
dir = "docs/build"
|
||||
readme = "README.md"
|
||||
project = "x_bows"
|
||||
ext = "html"
|
|
@ -1,126 +0,0 @@
|
|||
----
|
||||
-- Base XBows class
|
||||
-- @author SaKeL
|
||||
-- @license LGPL-2.1-or-later
|
||||
-- @classmod XBows
|
||||
XBows = {
|
||||
--- `enable_pvp` setting, default `false`
|
||||
pvp = false,
|
||||
--- `creative_mode` setting, default `false`
|
||||
creative = false,
|
||||
--- `mesecons` check if MOD enabled or exists
|
||||
mesecons = false,
|
||||
--- `playerphysics` check if MOD enabled or exists
|
||||
playerphysics = false,
|
||||
--- `player_monoids` check if MOD enabled or exists
|
||||
player_monoids = false,
|
||||
--- table with key/value pairs, `key` is the item name (e.g. `x_bows:bow_wood`), `value` is the definition passed to XBows register method
|
||||
registered_bows = {},
|
||||
--- table with key/value pairs, `key` is the item name (e.g. `x_bows:arrow_wood`), `value` is the definition passed to XBows register method
|
||||
registered_arrows = {},
|
||||
--- table with key/value pairs, `key` is the item name (e.g. `x_bows:quiver`), `value` is the definition passed to XBows register method
|
||||
registered_quivers = {},
|
||||
--- registered particle spawners for internal use
|
||||
registered_particle_spawners = {},
|
||||
--- sneaking players when bow is charged
|
||||
player_bow_sneak = {},
|
||||
--- `Settings` from minetest
|
||||
settings = {
|
||||
--- `x_bows_attach_arrows_to_entities` setting, default: `false`
|
||||
x_bows_attach_arrows_to_entities = false
|
||||
},
|
||||
--- table of `after` jobs
|
||||
charge_sound_after_job = {}
|
||||
}
|
||||
|
||||
---Check if creative is enabled or if player has creative priv
|
||||
-- @param self XBows
|
||||
-- @param name string
|
||||
-- @return boolean
|
||||
function XBows.is_creative(self, name) end
|
||||
|
||||
---Updates `allowed_ammunition` definition on already registered item, so MODs can add new ammunitions to this list.
|
||||
-- @param self XBows
|
||||
-- @param name string
|
||||
-- @param allowed_ammunition string[]
|
||||
-- @return nil
|
||||
function XBows.update_bow_allowed_ammunition(self, name, allowed_ammunition) end
|
||||
|
||||
---Reset charged bow to uncharged bow, this will return the arrow item to the inventory also
|
||||
-- @param self XBows
|
||||
-- @param player ObjectRef Player Ref
|
||||
-- @param includeWielded? boolean Will include reset for wielded bow also. default: `false`
|
||||
-- @return nil
|
||||
function XBows.reset_charged_bow(self, player, includeWielded) end
|
||||
|
||||
---Register bows
|
||||
-- @param self XBows
|
||||
-- @param name string
|
||||
-- @param def ItemDef | BowItemDefCustom
|
||||
-- @param override? boolean MOD everride
|
||||
-- @return boolean|nil
|
||||
function XBows.register_bow(self, name, def, override) end
|
||||
|
||||
---Register arrows
|
||||
-- @param self XBows
|
||||
-- @param name string
|
||||
-- @param def ItemDef | ArrowItemDefCustom
|
||||
-- @return boolean|nil
|
||||
function XBows.register_arrow(self, name, def) end
|
||||
|
||||
---Register quivers
|
||||
-- @param self XBows
|
||||
-- @param name string
|
||||
-- @param def ItemDef | QuiverItemDefCustom
|
||||
-- @return boolean|nil
|
||||
function XBows.register_quiver(self, name, def) end
|
||||
|
||||
---Load bow
|
||||
-- @param self XBows
|
||||
-- @param itemstack ItemStack
|
||||
-- @param user ObjectRef
|
||||
-- @param pointed_thing PointedThingDef
|
||||
-- @return ItemStack
|
||||
function XBows.load(self, itemstack, user, pointed_thing) end
|
||||
|
||||
---Shoot bow
|
||||
-- @param self XBows
|
||||
-- @param itemstack ItemStack
|
||||
-- @param user ObjectRef
|
||||
-- @param pointed_thing? PointedThingDef
|
||||
-- @return ItemStack
|
||||
function XBows.shoot(self, itemstack, user, pointed_thing) end
|
||||
|
||||
---Add new particle to XBow registration
|
||||
-- @param self XBows
|
||||
-- @param name string
|
||||
-- @param def ParticlespawnerDef|ParticlespawnerDefCustom
|
||||
-- @return nil
|
||||
function XBows.register_particle_effect(self, name, def) end
|
||||
|
||||
---Get particle effect from registered spawners table
|
||||
-- @param self XBows
|
||||
-- @param name string
|
||||
-- @param pos Vector
|
||||
-- @return number|boolean
|
||||
function XBows.get_particle_effect_for_arrow(self, name, pos) end
|
||||
|
||||
---Check if ammunition is allowed to charge this weapon
|
||||
-- @param self XBows
|
||||
-- @param weapon_name string
|
||||
-- @param ammo_name string
|
||||
-- @return boolean
|
||||
function XBows.is_allowed_ammunition(self, weapon_name, ammo_name) end
|
||||
|
||||
---Register new projectile entity
|
||||
-- @param self XBows
|
||||
-- @param name string
|
||||
-- @param def XBowsEntityDef
|
||||
function XBows.register_entity(self, name, def) end
|
||||
|
||||
---Open quiver
|
||||
-- @param self XBows
|
||||
-- @param itemstack ItemStack
|
||||
-- @param user ObjectRef
|
||||
-- @return ItemStack
|
||||
function XBows.open_quiver(self, itemstack, user) end
|
|
@ -1,88 +0,0 @@
|
|||
----
|
||||
-- XBowsQuiver class extended from XBows
|
||||
-- @author SaKeL
|
||||
-- @license LGPL-2.1-or-later
|
||||
-- @classmod XBowsQuiver
|
||||
XBowsQuiver = {
|
||||
--- IDs of added HUDs
|
||||
hud_item_ids = {},
|
||||
--- `after` job tables
|
||||
after_job = {}
|
||||
}
|
||||
|
||||
---Close one or all open quivers in players inventory
|
||||
-- @param self XBowsQuiver
|
||||
-- @param player ObjectRef
|
||||
-- @param quiver_id? string If `nil` then all open quivers will be closed
|
||||
-- @return nil
|
||||
function XBowsQuiver.close_quiver(self, player, quiver_id) end
|
||||
|
||||
---Swap item in player inventory indicating open quiver. Preserve all ItemStack definition and meta.
|
||||
-- @param self XBowsQuiver
|
||||
-- @param from_stack ItemStack transfer data from this item
|
||||
-- @param to_item_name string transfer data to this item
|
||||
-- @return ItemStack ItemStack replacement item
|
||||
function XBowsQuiver.get_replacement_item(self, from_stack, to_item_name) end
|
||||
|
||||
---Gets arrow from quiver
|
||||
-- @param self XBowsQuiver
|
||||
-- @param player ObjectRef
|
||||
-- @return {["found_arrow_stack"]: ItemStack|nil, ["quiver_id"]: string|nil, ["quiver_name"]: string|nil, ["found_arrow_stack_idx"]: number}
|
||||
function XBowsQuiver.get_itemstack_arrow_from_quiver(self, player) end
|
||||
|
||||
---Remove all added HUDs
|
||||
-- @param self XBowsQuiver
|
||||
-- @param player ObjectRef
|
||||
-- @return nil
|
||||
function XBowsQuiver.remove_hud(self, player) end
|
||||
|
||||
---Update or create quiver HUD
|
||||
-- @param self XBowsQuiver
|
||||
-- @param player ObjectRef
|
||||
-- @param inv_list ItemStack[]
|
||||
-- @param idx? number
|
||||
-- @return nil
|
||||
-- @todo implement hud_change?
|
||||
function XBowsQuiver.udate_or_create_hud(self, player, inv_list, idx) end
|
||||
|
||||
---Get existing detached inventory or create new one
|
||||
-- @param self XBowsQuiver
|
||||
-- @param quiver_id string
|
||||
-- @param player_name string
|
||||
-- @param quiver_items? string
|
||||
-- @return InvRef
|
||||
function XBowsQuiver.get_or_create_detached_inv(self, quiver_id, player_name, quiver_items) end
|
||||
|
||||
---Create formspec
|
||||
-- @param self XBowsQuiver
|
||||
-- @param name string name of the form
|
||||
-- @return string
|
||||
function XBowsQuiver.get_formspec(self, name) end
|
||||
|
||||
---Convert inventory of itemstacks to serialized string
|
||||
-- @param self XBowsQuiver
|
||||
-- @param inv InvRef
|
||||
-- @return {['inv_string']: string, ['content_description']: string}
|
||||
function XBowsQuiver.get_string_from_inv(self, inv) end
|
||||
|
||||
---Set items from serialized string to inventory
|
||||
-- @param self XBowsQuiver
|
||||
-- @param inv InvRef inventory to add items to
|
||||
-- @param str string previously stringified inventory of itemstacks
|
||||
-- @return nil
|
||||
function XBowsQuiver.set_string_to_inv(self, inv, str) end
|
||||
|
||||
---Save quiver inventory to itemstack meta
|
||||
-- @param self XBowsQuiver
|
||||
-- @param inv InvRef
|
||||
-- @param player ObjectRef
|
||||
-- @param quiver_is_closed? boolean
|
||||
-- @return nil
|
||||
function XBowsQuiver.save(self, inv, player, quiver_is_closed) end
|
||||
|
||||
---Check if we are allowing actions in the correct quiver inventory
|
||||
-- @param self XBowsQuiver
|
||||
-- @param inv InvRef
|
||||
-- @param player ObjectRef
|
||||
-- @return boolean
|
||||
function XBowsQuiver.quiver_can_allow(self, inv, player) end
|
File diff suppressed because it is too large
Load Diff
|
@ -13,8 +13,7 @@
|
|||
},
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"push:ci": "node ./scripts/deploy",
|
||||
"lua-diagnostics": "node ./scripts/lls-check"
|
||||
"push:ci": "node ./scripts/deploy"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -27,7 +26,6 @@
|
|||
},
|
||||
"homepage": "https://bitbucket.org/minetest_gamers/x_bows#readme",
|
||||
"devDependencies": {
|
||||
"jaguar": "^6.0.1",
|
||||
"node-fetch": "^3.2.10",
|
||||
"yargs": "^17.6.1"
|
||||
}
|
||||
|
|
|
@ -1,111 +0,0 @@
|
|||
/**
|
||||
* Run LUA diagnostics in continuous integration
|
||||
* Copyright (C) 2023 SaKeL <juraj.vajda@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to juraj.vajda@gmail.com
|
||||
*/
|
||||
|
||||
import * as path from 'node:path'
|
||||
import * as fs from 'node:fs'
|
||||
import {exec} from 'node:child_process'
|
||||
import yargs from 'yargs/yargs'
|
||||
import {hideBin} from 'yargs/helpers'
|
||||
import jaguar from 'jaguar'
|
||||
|
||||
const argv = yargs(hideBin(process.argv)).argv
|
||||
const cwd = process.cwd()
|
||||
const logPath = path.join(cwd, 'logs')
|
||||
|
||||
// Extract lua language server
|
||||
const from = path.join(cwd, 'bin/lua-language-server-3.5.6-linux-x64.tar.gz');
|
||||
const to = path.join(cwd, 'bin', 'lua-language-server-3.5.6-linux-x64');
|
||||
const extract = jaguar.extract(from, to)
|
||||
|
||||
// extract.on('file', (name) => {
|
||||
// console.log(name)
|
||||
// })
|
||||
|
||||
extract.on('start', () => {
|
||||
console.log('Extracting...')
|
||||
})
|
||||
|
||||
// extract.on('progress', (percent) => {
|
||||
// console.log(percent + '%')
|
||||
// })
|
||||
|
||||
extract.on('error', (error) => {
|
||||
console.error(error)
|
||||
process.exit(1)
|
||||
})
|
||||
|
||||
extract.on('end', () => {
|
||||
console.log('Extracting: Done')
|
||||
|
||||
// Delete directory recursively
|
||||
try {
|
||||
fs.rmSync(logPath, { recursive: true, force: true })
|
||||
console.log(`Removed folder: ${logPath}`)
|
||||
} catch (err) {
|
||||
console.error(`Error while deleting ${logPath}.`)
|
||||
console.error(err)
|
||||
}
|
||||
|
||||
let command = './bin/lua-language-server-3.5.6-linux-x64/bin/lua-language-server'
|
||||
|
||||
if (argv.local) {
|
||||
command = 'lua-language-server'
|
||||
}
|
||||
|
||||
exec(`${command} --logpath "${logPath}" --check "${cwd}"`, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
console.log(`error: ${error.message}`)
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
if (stderr) {
|
||||
console.log(`stderr: ${stderr}`)
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
console.log(`\n${stdout}`)
|
||||
|
||||
if (fs.existsSync('./logs/check.json')) {
|
||||
const rawdata = fs.readFileSync('./logs/check.json')
|
||||
const diagnosticsJson = JSON.parse(rawdata)
|
||||
|
||||
Object.keys(diagnosticsJson).forEach((key) => {
|
||||
console.log(key)
|
||||
|
||||
diagnosticsJson[key].forEach((errObj) => {
|
||||
console.log(`line: ${errObj.range.start.line} - ${errObj.message}`)
|
||||
})
|
||||
})
|
||||
|
||||
console.error('Fix the errors/warnings above.')
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
// Delete directory recursively
|
||||
const llsFolder = path.join(cwd, 'bin', 'lua-language-server-3.5.6-linux-x64')
|
||||
|
||||
try {
|
||||
fs.rmSync(llsFolder, { recursive: true, force: true })
|
||||
console.log(`Removed folder: ${llsFolder}`)
|
||||
} catch (err) {
|
||||
console.error(`Error while deleting ${llsFolder}.`)
|
||||
console.error(err)
|
||||
process.exit(1)
|
||||
}
|
||||
})
|
||||
})
|
|
@ -1,12 +0,0 @@
|
|||
---@diagnostic disable: codestyle-check
|
||||
---https://github.com/sumneko/lua-language-server/wiki
|
||||
|
||||
---@alias ColorSpec string|ColorSpecTable A ColorSpec specifies a 32-bit color. It can be written in any of the following forms: `colorspec = {a=255, r=0, g=255, b=0}`, numerical form: The raw integer value of an ARGB8 quad: `colorspec = 0xFF00FF00`, string form: A ColorString (defined above): `colorspec = "green"`
|
||||
---@alias ColorString string `#RGB` defines a color in hexadecimal format. `#RGBA` defines a color in hexadecimal format and alpha channel. `#RRGGBB` defines a color in hexadecimal format. `#RRGGBBAA` defines a color in hexadecimal format and alpha channel. Named colors are also supported and are equivalent to [CSS Color Module Level 4](https://www.w3.org/TR/css-color-4/#named-color). To specify the value of the alpha channel, append `#A` or `#AA` to the end of the color name (e.g. `colorname#08`).
|
||||
|
||||
---A ColorSpec table form: Each element ranging from 0..255 (a, if absent, defaults to 255):
|
||||
---@class ColorSpecTable
|
||||
---@field a number
|
||||
---@field r number
|
||||
---@field g number
|
||||
---@field b number
|
|
@ -1,12 +0,0 @@
|
|||
---@diagnostic disable: codestyle-check
|
||||
---https://github.com/sumneko/lua-language-server/wiki
|
||||
|
||||
---Crafting recipes
|
||||
---@class CraftRecipeDef
|
||||
---@field type string (optional) specifies recipe type as shaped, e.g. "shaped", "shapeless", "toolrepair", "cooking", "fuel", default: "shaped"
|
||||
---@field output string Itemstring of output itemstack (item counts >= 1 are allowed)
|
||||
---@field recipe table<integer|number, string>[]|string A 2-dimensional matrix of items, with a width *w* and height *h*. *w* and *h* are chosen by you, they don't have to be equal but must be at least 1. The matrix is specified as a table containing tables containing itemnames. The inner tables are the rows. There must be *h* tables, specified from the top to the bottom row. Values inside of the inner table are the columns. Each inner table must contain a list of *w* items, specified from left to right. Empty slots *must* be filled with the empty string.
|
||||
---@field replacements string[] (optional) Allows you to replace input items with some other items when something is crafted. Provided as a list of item pairs of the form `{ old_item, new_item }` where `old_item` is the input item to replace (same syntax as for a regular input slot; groups are allowed) and `new_item` is an itemstring for the item stack it will become. When the output is crafted, Minetest iterates through the list of input items if the crafting grid. For each input item stack, it checks if it matches with an `old_item` in the item pair list. If it matches, the item will be replaced. Also, this item pair will *not* be applied again for the remaining items. If it does not match, the item is consumed (reduced by 1) normally. The `new_item` will appear in one of 3 places: Crafting grid, if the input stack size was exactly 1, Player inventory, if input stack size was larger, Drops as item entity, if it fits neither in craft grid or inventory.
|
||||
---@field additional_wear number|integer For `{type = "toolrepair"}` only. Adds a shapeless recipe for *every* tool that doesn't have the `disable_repair=1` group. If this recipe is used, repairing is possible with any crafting grid with at least 2 slots. The player can put 2 equal tools in the craft grid to get one "repaired" tool back. The wear of the output is determined by the wear of both tools, plus a 'repair bonus' given by `additional_wear`. To reduce the wear (i.e. 'repair'), you want `additional_wear` to be negative. The formula used to calculate the resulting wear is: 65536 * (1 - ( (1 - tool_1_wear) + (1 - tool_2_wear) + additional_wear )) The result is rounded and can't be lower than 0. If the result is 65536 or higher, no crafting is possible.
|
||||
---@field cooktime number|integer For `{type = "cooking"}` only. (optional) Time it takes to cook this item, in seconds. A floating-point number. (default: 3.0)
|
||||
---@field burntime number|integer For `{type = "fuel"}` only. (optional) Burning time this item provides, in seconds. A floating-point number. (default: 1.0)
|
|
@ -1,9 +0,0 @@
|
|||
---@diagnostic disable: codestyle-check
|
||||
---https://github.com/sumneko/lua-language-server/wiki
|
||||
|
||||
---The varying types of decorations that can be placed.
|
||||
---@class DecorationDef
|
||||
---@field deco_type 'simple'|'schematic' `simple`: Creates a 1 times `H` times 1 column of a specified node (or a random node from a list, if a decoration list is specified). Can specify a certain node it must spawn next to, such as water or lava, for example. Can also generate a decoration of random height between a specified lower and upper bound. This type of decoration is intended for placement of grass, flowers, cacti, papyri, waterlilies and so on. `schematic`: Copies a box of `MapNodes` from a specified schematic file (or raw description). Can specify a probability of a node randomly appearing when placed. This decoration type is intended to be used for multi-node sized discrete structures, such as trees, cave spikes, rocks, and so on.
|
||||
---@field biomes any List of biomes in which this decoration occurs. Occurs in all biomes if this is omitted, and ignored if the Mapgen being used does not support biomes. Can be a list of (or a single) biome names, IDs, or definitions.
|
||||
---@field decoration string| string[] The node name used as the decoration. If instead a list of strings, a randomly selected node from the list is placed as the decoration.
|
||||
---@field place_on string| string[] Node (or list of nodes) that the decoration can be placed on
|
|
@ -1,17 +0,0 @@
|
|||
---@diagnostic disable: codestyle-check
|
||||
---https://github.com/sumneko/lua-language-server/wiki
|
||||
|
||||
---Entity definition
|
||||
---@class EntityDef
|
||||
---@field initial_properties ObjectProperties A table of object properties. The properties in this table are applied to the object once when it is spawned. `dtime_s` is the time passed since the object was unloaded, which can be used for updating the entity state.
|
||||
---@field on_activate fun(self: table, staticdata: string, dtime_s: integer|number): nil Function receive a "luaentity" table as `self`. Called when the object is instantiated.
|
||||
---@field on_deactivate fun(self: table, removal: boolean): nil Function receive a "luaentity" table as `self`. 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.
|
||||
---@field on_step fun(self: table, dtime: integer|number, moveresult?: table): nil Function receive a "luaentity" table as `self`. 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).
|
||||
---@field on_punch fun(self: table, puncher: ObjectRef|nil, time_from_last_punch: number|integer|nil, tool_capabilities: ToolCapabilitiesDef|nil, dir: Vector, damage: number|integer): boolean|nil Function receive a "luaentity" table as `self`. Called when somebody punches the object. Note that you probably want to handle most punches using the automatic armor group system. Can return `true` to prevent the default damage mechanism.
|
||||
---@field on_death fun(self: table, killer: ObjectRef|nil): nil Function receive a "luaentity" table as `self`. Called when the object dies.
|
||||
---@field on_rightclick fun(self: table, clicker: ObjectRef): nil Function receive a "luaentity" table as `self`. Called when `clicker` pressed the 'place/use' key while pointing to the object (not neccessarily an actual rightclick). `clicker`: an `ObjectRef` (may or may not be a player)
|
||||
---@field on_attach_child fun(self: table, child: ObjectRef): nil Function receive a "luaentity" table as `self`. `child`: an `ObjectRef` of the child that attaches
|
||||
---@field on_detach_child fun(self: table, child: ObjectRef): nil Function receive a "luaentity" table as `self`. `child`: an `ObjectRef` of the child that detaches
|
||||
---@field on_detach fun(self: table, parent: ObjectRef|nil): nil Function receive a "luaentity" table as `self`. `parent`: an `ObjectRef` (can be `nil`) from where it got detached. This happens before the parent object is removed from the world.
|
||||
---@field get_staticdata fun(self: table) Function receive a "luaentity" table as `self`. Should return a string that will be passed to `on_activate` when the object is instantiated the next time.
|
||||
---@field drops table Custom for mob drops
|
|
@ -1,4 +0,0 @@
|
|||
---@diagnostic disable: codestyle-check
|
||||
---https://github.com/sumneko/lua-language-server/wiki
|
||||
|
||||
---@alias Dump fun(obj: any, dumped?: any): string returns a string which makes `obj` human-readable, `obj`: arbitrary variable, `dumped`: table, default: `{}`
|
|
@ -1,21 +0,0 @@
|
|||
---@diagnostic disable: codestyle-check
|
||||
---https://github.com/sumneko/lua-language-server/wiki
|
||||
|
||||
--An `InvRef` is a reference to an inventory.
|
||||
---@class InvRef
|
||||
---@field add_item fun(self: InvRef, listname: string, stack: string|ItemStack): ItemStack Add item somewhere in list, returns leftover `ItemStack`.
|
||||
---@field contains_item fun(self: InvRef, listname: string, stack: string|ItemStack, match_meta?: boolean): boolean Returns `true` if the stack of items can be fully taken from the list. If `match_meta` is false, only the items' names are compared, default: `false`
|
||||
---@field get_list fun(self: InvRef, listname: string): ItemStack[] Return full list, list of `ItemStack`s
|
||||
---@field room_for_item fun(self: InvRef, listname: string, stack: string|ItemStack): boolean Returns `true` if the stack of items can be fully added to the list
|
||||
---@field set_stack fun(self: InvRef, listname: string, i: integer, stack: string|ItemStack): nil Copy `stack` to index `i` in list
|
||||
---@field is_empty fun(self: InvRef, listname: string): boolean Return `true` if list is empty
|
||||
---@field get_size fun(self: InvRef, listname: string): integer Get size of a list
|
||||
---@field set_size fun(self: InvRef, listname: string, size: integer): boolean Set size of a list, returns `false` on error, e.g. invalid `listname` or `size`
|
||||
---@field get_width fun(self: InvRef, listname: string): boolean Get width of a list
|
||||
---@field set_width fun(self: InvRef, listname: string, width: integer): nil Set width of list; currently used for crafting
|
||||
---@field get_stack fun(self: InvRef, listname: string, i: integer): ItemStack Get a copy of stack index `i` in list
|
||||
---@field set_list fun(self: InvRef, listname: string, list: ItemStack[]): nil Set full list, size will not change
|
||||
---@field get_lists fun(): table Returns table that maps listnames to inventory lists
|
||||
---@field set_lists fun(self: InvRef, lists: table): nil Sets inventory lists, size will not change
|
||||
---@field remove_item fun(self: InvRef, listname: string, stack: string|ItemStack): nil Take as many items as specified from the list, returns the items that were actually removed, as an `ItemStack`, note that any item metadata is ignored, so attempting to remove a specific unique item this way will likely remove the wrong one, to do that use `set_stack` with an empty `ItemStack`.
|
||||
---@field get_location fun(self: InvRef): {['type']: 'player'|'node'|'detached'|'undefined', ['name']: string|nil, ['pos']: Vector|nil} returns a location compatible to `minetest.get_inventory(location)`. returns `{type="undefined"}` in case location is not known
|
|
@ -1,55 +0,0 @@
|
|||
---@diagnostic disable: codestyle-check
|
||||
---https://github.com/sumneko/lua-language-server/wiki
|
||||
|
||||
---Minetest item definition. Used by `minetest.register_node`, `minetest.register_craftitem`, and `minetest.register_tool`.
|
||||
---Add your own custom fields. By convention, all custom field names. Should start with `_` to avoid naming collisions with future engine usage.
|
||||
---@class ItemDef
|
||||
---@field description string Can contain new lines. "\n" has to be used as new line character.
|
||||
---@field short_description string|nil Must not contain new lines. Defaults to nil.
|
||||
---@field groups table<string, string|number|integer|boolean> 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}
|
||||
---@field inventory_image string Texture shown in the inventory GUI. Defaults to a 3D rendering of the node if left empty.
|
||||
---@field inventory_overlay string An overlay texture which is not affected by colorization
|
||||
---@field wield_image string Texture shown when item is held in hand. Defaults to a 3D rendering of the node if left empty.
|
||||
---@field wield_overlay string Like inventory_overlay but only used in the same situation as wield_image
|
||||
---@field wield_scale table<string, number|integer> Scale for the item when held in hand
|
||||
---@field palette string 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.
|
||||
---@field color string Color the item is colorized with. The palette overrides this.
|
||||
---@field stack_max integer|number Maximum amount of items that can be in a single stack.
|
||||
---@field range integer|number Range of node and object pointing that is possible with this item held.
|
||||
---@field liquids_pointable boolean If true, item can point to all liquid nodes (`liquidtype ~= "none"`), even those for which `pointable = false`
|
||||
---@field light_source integer|number 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.
|
||||
---@field tool_capabilities ToolCapabilitiesDef
|
||||
---@field node_placement_prediction string|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.
|
||||
---@field node_dig_prediction string 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.
|
||||
---@field sound ItemSoundDef
|
||||
---@field on_place fun(itemstack: ItemStack, placer: ObjectRef|nil, pointed_thing: PointedThingDef): ItemStack|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. The placer may be any ObjectRef or nil. default: minetest.item_place
|
||||
---@field on_secondary_use fun(itemstack: ItemStack, user: ObjectRef|nil, pointed_thing: PointedThingDef): ItemStack|nil 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
|
||||
---@field on_drop fun(itemstack: ItemStack, dropper: ObjectRef|nil, pos: Vector): ItemStack|nil Shall drop item and return the leftover itemstack. The dropper may be any ObjectRef or nil. default: minetest.item_drop
|
||||
---@field on_pickup fun(itemstack: ItemStack, picker: ObjectRef|nil, pointed_thing?: PointedThingDef, time_from_last_punch?: number|integer, rest?: any): ItemStack|nil 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. `rest` are other parameters from `luaentity:on_punch`. default: `minetest.item_pickup`
|
||||
---@field on_use fun(itemstack: ItemStack, user: ObjectRef|nil, pointed_thing: PointedThingDef): ItemStack|nil 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.
|
||||
---@field after_use fun(itemstack: ItemStack, user: ObjectRef|nil, node: NodeDef, digparams: DigParamsDef): ItemStack|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.
|
||||
---@field soil table Only for farming
|
||||
|
||||
---Tool capabilities definition
|
||||
---@class ToolCapabilitiesDef
|
||||
---@field full_punch_interval number|integer
|
||||
---@field max_drop_level number|integer
|
||||
---@field groupcaps GroupCapsDef
|
||||
---@field damage_groups table<string, number|integer> Damage values must be between -32768 and 32767 (2^15)
|
||||
---@field punch_attack_uses number|integer|nil 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 forumla "uses * 3^(maxlevel - 1)". It is recommend to set this explicitly instead of relying on the fallback behavior.
|
||||
|
||||
---Known damage and digging time defining groups
|
||||
---@class GroupCapsDef
|
||||
---@field crumbly number|GroupCapsItemDef dirt, sand
|
||||
---@field cracky number|GroupCapsItemDef tough but crackable stuff like stone.
|
||||
---@field snappy number|GroupCapsItemDef something that can be cut using things like scissors, shears, bolt cutters and the like, e.g. leaves, small plants, wire, sheets of metal
|
||||
---@field choppy number|GroupCapsItemDef something that can be cut using force; e.g. trees, wooden planks
|
||||
---@field fleshy number|GroupCapsItemDef Living things like animals and the player. This could imply some blood effects when hitting.
|
||||
---@field explody number|GroupCapsItemDef Especially prone to explosions
|
||||
---@field oddly_breakable_by_hand number|GroupCapsItemDef Can be added to nodes that shouldn't logically be breakable by the hand but are. Somewhat similar to `dig_immediate`, but times are more like `{[1]=3.50,[2]=2.00,[3]=0.70}` and this does not override the digging speed of an item if it can dig at a faster speed than this suggests for the hand.
|
||||
|
||||
---Known damage and digging time defining groups
|
||||
---@class GroupCapsItemDef
|
||||
---@field maxlevel number|integer Tells what is the maximum level of a node of this group that the item will be able to dig.
|
||||
---@field uses number|integer Tools only. Determines how many uses the tool has when it is used for digging a node, of this group, of the maximum level. The maximum supported number of uses is 65535. The special number 0 is used for infinite uses. For lower leveled nodes, the use count is multiplied by `3^leveldiff`. `leveldiff` is the difference of the tool's `maxlevel` `groupcaps` and the node's `level` group. The node cannot be dug if `leveldiff` is less than zero.
|
||||
---@field times table<number|integer, number|integer> List of digging times for different ratings of the group, for nodes of the maximum level. For example, as a Lua table, `times={[2]=2.00, [3]=0.70}`. This would result in the item to be able to dig nodes that have a rating of `2` or `3` for this group, and unable to dig the rating `1`, which is the toughest. Unless there is a matching group that enables digging otherwise. If the result digging time is 0, a delay of 0.15 seconds is added between digging nodes; If the player releases LMB after digging, this delay is set to 0, i.e. players can more quickly click the nodes away instead of holding LMB.
|
|
@ -1,36 +0,0 @@
|
|||
---@diagnostic disable: codestyle-check
|
||||
---https://github.com/sumneko/lua-language-server/wiki
|
||||
|
||||
---A native C++ format with many helper methods. Useful for converting between formats.
|
||||
---An `ItemStack` is a stack of items.
|
||||
---It can be created via `ItemStack(x)`, where x is an `ItemStack`, an itemstring, a table or `nil`.
|
||||
---@class ItemStack
|
||||
---@field is_empty fun(): boolean Returns `true` if stack is empty.
|
||||
---@field get_name fun(): string returns item name (e.g. `"default:stone"`).
|
||||
---@field set_name fun(self: ItemStack, item_name: string): boolean Returns a boolean indicating whether the item was cleared.
|
||||
---@field get_count fun(): integer Returns number of items on the stack.
|
||||
---@field set_count fun(self: ItemStack, count: integer): boolean Returns a boolean indicating whether the item was cleared
|
||||
---@field get_wear fun(): integer Returns tool wear (`0`-`65535`), `0` for non-tools.
|
||||
---@field set_wear fun(self: ItemStack, wear: integer): boolean Returns boolean indicating whether item was cleared
|
||||
---@field get_meta fun(): ItemStackMetaRef Returns `ItemStackMetaRef`.
|
||||
---@field get_description fun(): string Returns the description shown in inventory list tooltips. The engine uses this when showing item descriptions in tooltips. Fields for finding the description, in order: `description` in item metadata.
|
||||
---@field get_short_description fun(): string|nil Returns the short description or nil. Unlike the description, this does not include new lines. Fields for finding the short description, in order: `short_description` in item metadata. Returns nil if none of the above are set.
|
||||
---@field clear fun(): nil Removes all items from the stack, making it empty.
|
||||
---@field replace fun(self: ItemStack, item: string|table)`: replace the contents of this stack. `item` can also be an itemstring or table.
|
||||
---@field to_string fun(): string Returns the stack in itemstring form.
|
||||
---@field to_table fun(): table Returns the stack in Lua table form.
|
||||
---@field get_stack_max fun(): integer Returns the maximum size of the stack (depends on the item).
|
||||
---@field get_free_space fun(): integer Returns `get_stack_max() - get_count()`.
|
||||
---@field is_known fun(): boolean Returns `true` if the item name refers to a defined item type.
|
||||
---@field get_definition fun(): table Returns the item definition table.
|
||||
---@field get_tool_capabilities fun(): table Returns the digging properties of the item, or those of the hand if none are defined for this item type
|
||||
---@field add_wear fun(self: ItemStack, amount: integer|number): nil Increases wear by `amount` if the item is a tool, otherwise does nothing. Valid `amount` range is [0,65536] `amount`: number, integer
|
||||
---@field add_wear_by_uses fun(self: ItemStack, max_uses: integer|number): nil Increases wear in such a way that, if only this function is called, the item breaks after `max_uses` times. Valid `max_uses` range is [0,65536] Does nothing if item is not a tool or if `max_uses` is 0
|
||||
---@field add_item fun(self: ItemStack, item: string|table): ItemStack Returns leftover `ItemStack` Put some item or stack onto this stack
|
||||
---@field item_fits fun(self: ItemStack, item: string|table): boolean Returns `true` if item or stack can be fully added to this one.
|
||||
---@field take_item fun(self: ItemStack, n?: integer|number): ItemStack Returns taken `ItemStack` Take (and remove) up to `n` items from this stack `n`: number, default: `1`
|
||||
---@field peek_item fun(self: ItemStack, n: integer|number): ItemStack Returns taken `ItemStack` Copy (don't remove) up to `n` items from this stack `n`: number, default: `1`
|
||||
---@field name string
|
||||
---@field count integer
|
||||
---@field wear string
|
||||
---@field metadata string
|
|
@ -1,39 +0,0 @@
|
|||
---@diagnostic disable: codestyle-check
|
||||
---https://github.com/sumneko/lua-language-server/wiki
|
||||
|
||||
--- In a game, a certain number of these must be set to tell core mapgens which of the game's nodes are to be used for core mapgen generation.
|
||||
---@alias MapgenAliasesNonV6
|
||||
---| '"mapgen_stone"'
|
||||
---| '"mapgen_water_source"'
|
||||
---| '"mapgen_river_water_source"'
|
||||
---| '"mapgen_river_water_source"' # is required for mapgens with sloping rivers where it is necessary to have a river liquid node with a short `liquid_range` and `liquid_renewable = false` to avoid flooding.
|
||||
---| '"mapgen_lava_source"' # Optional, Fallback lava node used if cave liquids are not defined in biome definitions. Deprecated, define cave liquids in biome definitions instead.
|
||||
---| '"mapgen_cobble"' # Optional, Fallback node used if dungeon nodes are not defined in biome definitions. Deprecated, define dungeon nodes in biome definitions instead.
|
||||
|
||||
--- In a game, a certain number of these must be set to tell core mapgens which of the game's nodes are to be used for core mapgen generation.
|
||||
---@alias MapgenAliasesV6
|
||||
---| '"mapgen_stone"'
|
||||
---| '"mapgen_water_source"'
|
||||
---| '"mapgen_lava_source"'
|
||||
---| '"mapgen_dirt"'
|
||||
---| '"mapgen_dirt_with_grass"'
|
||||
---| '"mapgen_sand"'
|
||||
---| '"mapgen_tree"'
|
||||
---| '"mapgen_leaves"'
|
||||
---| '"mapgen_apple"'
|
||||
---| '"mapgen_cobble"'
|
||||
---| '"mapgen_gravel"' # Optional, (falls back to stone)
|
||||
---| '"mapgen_desert_stone"' # Optional, (falls back to stone)
|
||||
---| '"mapgen_desert_sand"' # Optional, (falls back to sand)
|
||||
---| '"mapgen_dirt_with_snow"' # Optional, (falls back to dirt_with_grass)
|
||||
---| '"mapgen_snowblock"' # Optional, (falls back to dirt_with_grass)
|
||||
---| '"mapgen_snow"' # Optional, (not placed if missing)
|
||||
---| '"mapgen_ice"' # Optional, (falls back to water_source)
|
||||
---| '"mapgen_jungletree"' # Optional, (falls back to tree)
|
||||
---| '"mapgen_jungleleaves"' # Optional, (falls back to leaves)
|
||||
---| '"mapgen_junglegrass"' # Optional, (not placed if missing)
|
||||
---| '"mapgen_pine_tree"' # Optional, (falls back to tree)
|
||||
---| '"mapgen_pine_needles"' # Optional, (falls back to leaves)
|
||||
---| '"mapgen_stair_cobble"' # Optional, (falls back to cobble)
|
||||
---| '"mapgen_mossycobble"' # Optional, (falls back to cobble)
|
||||
---| '"mapgen_stair_desert_stone"' # Optional, (falls backto desert_stone)
|
|
@ -1,8 +0,0 @@
|
|||
---@diagnostic disable: codestyle-check, duplicate-doc-alias
|
||||
---https://github.com/sumneko/lua-language-server/wiki
|
||||
|
||||
---@alias mathlib mathlib|MathAbstract
|
||||
|
||||
---Math helpers
|
||||
---@class MathAbstract
|
||||
---@field round fun(x: number): number Returns `x` rounded to the nearest integer. At a multiple of 0.5, rounds away from zero.
|
|
@ -1,36 +0,0 @@
|
|||
---@diagnostic disable: codestyle-check
|
||||
---https://github.com/sumneko/lua-language-server/wiki
|
||||
|
||||
---@alias ItemStackMetaRef MetaDataRef|ItemStackMetaRefAbstract
|
||||
---@alias NodeMetaRef MetaDataRef|NodeMetaRefAbstract
|
||||
---@alias PlayerMetaRef MetaDataRef|PlayerMetaRefAbstract
|
||||
---@alias StorageRef MetaDataRef|StorageRefAbstract
|
||||
|
||||
---Base class used by [`StorageRef`], [`NodeMetaRef`], [`ItemStackMetaRef`], and [`PlayerMetaRef`].
|
||||
---@class MetaDataRef
|
||||
---@field contains fun(self: MetaDataRef, key: string): boolean|nil Returns true if key present, otherwise false. Returns `nil` when the MetaData is inexistent.
|
||||
---@field get fun(self: MetaDataRef, key: string): string|nil Returns `nil` if key not present, else the stored string.
|
||||
---@field set_string fun(self: MetaDataRef, key: string, value: string): string Value of `""` will delete the key.
|
||||
---@field get_string fun(self: MetaDataRef, key: string): string Returns `""` if key not present.
|
||||
---@field set_int fun(self: MetaDataRef, key: string, value: integer): nil
|
||||
---@field get_int fun(self: MetaDataRef, key: string): integer|number Returns `0` if key not present.
|
||||
---@field set_float fun(self: MetaDataRef, key: string, value: number): nil
|
||||
---@field get_float fun(self: MetaDataRef, key): integer|number Returns `0` if key not present.
|
||||
---@field to_table fun(): nil Returns `nil` or a table with keys: `fields`: key-value storage `inventory`: `{list1 = {}, ...}}` (NodeMetaRef only)
|
||||
---@field from_table fun(self: MetaDataRef, t: nil|table): boolean Any non-table value will clear the metadata. Returns `true` on success
|
||||
---@field equals fun(self: MetaDataRef, other: any): boolean Returns `true` if this metadata has the same key-value pairs as `other`
|
||||
|
||||
---ItemStack metadata: reference extra data and functionality stored in a stack. Can be obtained via `item:get_meta()`.
|
||||
---@class ItemStackMetaRefAbstract
|
||||
---@field set_tool_capabilities fun(self: ItemStackMetaRef, tool_capabilities?: table): nil Overrides the item's tool capabilities. A nil value will clear the override data and restore the original behavior.
|
||||
|
||||
---Node metadata: reference extra data and functionality stored in a node. Can be obtained via `minetest.get_meta(pos)`.
|
||||
---@class NodeMetaRefAbstract
|
||||
---@field get_inventory fun(self: NodeMetaRef): InvRef
|
||||
---@field mark_as_private fun(self: NodeMetaRef, name: string | table<string[]>) Mark specific vars as private This will prevent them from being sent to the client. Note that the "private" status will only be remembered if an associated key-value pair exists, meaning it's best to call this when initializing all other meta (e.g. `on_construct`).
|
||||
|
||||
---Player metadata. Uses the same method of storage as the deprecated player attribute API, so data there will also be in player meta. Can be obtained using `player:get_meta()`.
|
||||
---@class PlayerMetaRefAbstract
|
||||
|
||||
---Mod metadata: per mod metadata, saved automatically. Can be obtained via `minetest.get_mod_storage()` during load time. WARNING: This storage backend is incapable of saving raw binary data due to restrictions of JSON.
|
||||
---@class StorageRefAbstract
|
|
@ -1,168 +0,0 @@
|
|||
---@diagnostic disable: codestyle-check
|
||||
---https://github.com/sumneko/lua-language-server/wiki
|
||||
|
||||
---Minetest globals
|
||||
---@class Minetest
|
||||
---@field item_drop fun(itemstack: string|ItemStack, dropper: ObjectRef, pos: Vector): ItemStack Drop the item, returns the leftover itemstack
|
||||
---@field get_us_time fun(): integer|number Returns time with microsecond precision. May not return wall time.
|
||||
---@field get_modpath fun(modname: string): string|nil Returns the directory path for a mod, e.g. `"/home/user/.minetest/usermods/modname"`. Returns nil if the mod is not enabled or does not exist (not installed). Works regardless of whether the mod has been loaded yet. Useful for loading additional `.lua` modules or static data from a mod, or checking if a mod is enabled.
|
||||
---@field check_player_privs fun(player_or_name: ObjectRef|string, privs: table|string[]): boolean Returns `bool, missing_privs`. A quickhand for checking privileges. `player_or_name`: Either a Player object or the name of a player. `privs` is either a list of strings, e.g. `"priva", "privb"` or a table, e.g. `{ priva = true, privb = true }`.
|
||||
---@field register_on_joinplayer fun(f: fun(player: ObjectRef, last_login: number|integer|nil)): nil Called when a player joins the game. `last_login`: The timestamp of the previous login, or nil if player is new
|
||||
---@field register_tool fun(name: string, item_definition: ItemDef): nil Registers the item in the engine
|
||||
---@field colorize fun(color: string, message: string): nil
|
||||
---@field register_craft fun(recipe: CraftRecipeDef): nil
|
||||
---@field register_craftitem fun(name: string, item_definition: ItemDef): nil
|
||||
---@field add_entity fun(pos: Vector, name: string, staticdata?: string): ObjectRef|nil Spawn Lua-defined entity at position. Returns `ObjectRef`, or `nil` if failed.
|
||||
---@field get_node fun(pos: Vector): NodeDef Returns the node at the given position as table in the format `{name="node_name", param1=0, param2=0}`, returns `{name="ignore", param1=0, param2=0}` for unloaded areas.
|
||||
---@field registered_nodes table<string, NodeDef|ItemDef> Map of registered node definitions, indexed by name
|
||||
---@field after fun(time: number|integer, func: fun(...), ...): JobTable Call the function `func` after `time` seconds, may be fractional. Optional: Variable number of arguments that are passed to `func`.
|
||||
---@field sound_play fun(spec: SimpleSoundSpec|string, parameters: SoundParamDef, ephemeral?: boolean): any Returns a `handle`. Ephemeral sounds will not return a handle and can't be stopped or faded. It is recommend to use this for short sounds that happen in response to player actions (e.g. door closing).
|
||||
---@field add_particlespawner fun(particlespawner_definition: ParticlespawnerDef): number|integer Add a `ParticleSpawner`, an object that spawns an amount of particles over `time` seconds. Returns an `id`, and -1 if adding didn't succeed.
|
||||
---@field register_globalstep fun(func: fun(dtime: number|integer)): nil Called every server step, usually interval of 0.1s
|
||||
---@field get_connected_players fun(): ObjectRef[] Returns list of `ObjectRefs`
|
||||
---@field serialize fun(t: table): string Convert a table containing tables, strings, numbers, booleans and `nil`s into string form readable by `minetest.deserialize`. Example: `serialize({foo="bar"})`, returns `'return { ["foo"] = "bar" }'`.
|
||||
---@field dir_to_yaw fun(dir: Vector): number|integer Convert a vector into a yaw (angle)
|
||||
---@field settings MinetestSettings Settings object containing all of the settings from the main config file (`minetest.conf`).
|
||||
---@field register_entity fun(name: string, entity_definition: EntityDef): nil
|
||||
---@field deserialize fun(s: string, safe?: boolean): table Returns a table. Convert a string returned by `minetest.serialize` into a table `string` is loaded in an empty sandbox environment. Will load functions if safe is false or omitted. Although these functions cannot directly access the global environment, they could bypass this restriction with maliciously crafted Lua bytecode if mod security is disabled. This function should not be used on untrusted data, regardless of the value of `safe`. It is fine to serialize then deserialize user-provided data, but directly providing user input to deserialize is always unsafe.
|
||||
---@field raycast fun(pos1: Vector, pos2: Vector, objects: boolean, liquids: boolean): Raycast `pos1`: start of the ray, `pos2`: end of the ray, `objects`: if false, only nodes will be returned. Default is true. `liquids`: if false, liquid nodes (`liquidtype ~= "none"`) won't be returned. Default is false.
|
||||
---@field calculate_knockback fun(player: ObjectRef, hitter: ObjectRef, time_from_last_punch: number|integer, tool_capabilities: ToolCapabilitiesDef, dir: Vector, distance: number|integer, damage: number|integer): integer|number Returns the amount of knockback applied on the punched player. Arguments are equivalent to `register_on_punchplayer`, except the following: `distance`: distance between puncher and punched player. This function can be overriden by mods that wish to modify this behaviour. You may want to cache and call the old function to allow multiple mods to change knockback behaviour.
|
||||
---@field get_player_by_name fun(name: string): ObjectRef Get an `ObjectRef` to a player
|
||||
---@field get_node_timer fun(pos: Vector): NodeTimerRef Get `NodeTimerRef`
|
||||
---@field get_objects_inside_radius fun(pos: Vector, radius: number|integer): ObjectRef[] Returns a list of ObjectRefs. `radius`: using an euclidean metric.
|
||||
---@field register_node fun(name: string, node_definition: NodeDef): nil
|
||||
---@field get_meta fun(pos: Vector): NodeMetaRef Get a `NodeMetaRef` at that position
|
||||
---@field pos_to_string fun(pos: Vector, decimal_places?: number|integer): string returns string `"(X,Y,Z)"`, `pos`: table {x=X, y=Y, z=Z}. Converts the position `pos` to a human-readable, printable string. `decimal_places`: number, if specified, the x, y and z values of the position are rounded to the given decimal place.
|
||||
---@field get_node_light fun(pos: Vector, timeofday: number|integer|nil): number|integer|nil Gets the light value at the given position. Note that the light value "inside" the node at the given position is returned, so you usually want to get the light value of a neighbor. `pos`: The position where to measure the light. `timeofday`: `nil` for current time, `0` for night, `0.5` for day. Returns a number between `0` and `15` or `nil`. `nil` is returned e.g. when the map isn't loaded at `pos`.
|
||||
---@field set_node fun(pos: Vector, node: SetNodeTable): nil Set node at position `pos`, `node`: table `{name=string, param1=number, param2=number}`, If param1 or param2 is omitted, it's set to `0`. e.g. `minetest.set_node({x=0, y=10, z=0}, {name="default:wood"})`
|
||||
---@field place_schematic fun(pos: Vector, schematic, rotation?: '0'|'90'|'180'|'270'|'random', replacements?: table<string, string>, force_placement?: boolean, flags?: string): nil Place the schematic specified by schematic at `pos`. `rotation` can equal `"0"`, `"90"`, `"180"`, `"270"`, or `"random"`. If the `rotation` parameter is omitted, the schematic is not rotated. `replacements` = `{["old_name"] = "convert_to", ...}`. `force_placement` is a boolean indicating whether nodes other than `air` and `ignore` are replaced by the schematic. Returns nil if the schematic could not be loaded. **Warning**: Once you have loaded a schematic from a file, it will be cached. Future calls will always use the cached version and the replacement list defined for it, regardless of whether the file or the replacement list parameter have changed. The only way to load the file anew is to restart the server. `flags` is a flag field with the available flags: place_center_x, place_center_y, place_center_z
|
||||
---@field log fun(level?: 'none'|'error'|'warning'|'action'|'info'|'verbose', text: string): nil
|
||||
---@field get_item_group fun(name: string, group): any returns a rating. Get rating of a group of an item. (`0` means: not in group)
|
||||
---@field get_biome_data fun(pos: Vector): BiomeData|nil
|
||||
---@field get_biome_name fun(biome_id: string|number|integer): string|nil Returns the biome name string for the provided biome id, or `nil` on failure. If no biomes have been registered, such as in mgv6, returns `default`.
|
||||
---@field find_nodes_in_area fun(pos1: Vector, pos2: Vector, nodenames: string|string[], grouped?: boolean): Vector[] `pos1` and `pos2` are the min and max positions of the area to search. `nodenames`: e.g. `{"ignore", "group:tree"}` or `"default:dirt"` If `grouped` is true the return value is a table indexed by node name which contains lists of positions. If `grouped` is false or absent the return values are as follows: first value: Table with all node positions, second value: Table with the count of each node with the node name as index, Area volume is limited to 4,096,000 nodes
|
||||
---@field find_nodes_in_area_under_air fun(pos1: Vector, pos2: Vector, nodenames: string|string[]): table returns a list of positions. `nodenames`: e.g. `{"ignore", "group:tree"}` or `"default:dirt"`. Return value: Table with all node positions with a node air above. Area volume is limited to 4,096,000 nodes.
|
||||
---@field registered_decorations table<any, DecorationDef> Map of registered decoration definitions, indexed by the `name` field. If `name` is nil, the key is the object handle returned by `minetest.register_schematic`.
|
||||
---@field swap_node fun(pos: Vector, node: NodeDef): nil Set node at position, but don't remove metadata
|
||||
---@field item_eat fun(hp_change: number, replace_with_item?: string): fun(itemstack: ItemStack, user: ObjectRef, pointed_thing: PointedThingDef) Returns `function(itemstack, user, pointed_thing)` as a function wrapper for `minetest.do_item_eat`. `replace_with_item` is the itemstring which is added to the inventory. If the player is eating a stack, then replace_with_item goes to a different spot.
|
||||
---@field override_item fun(name: string, redefinition: ItemDef|NodeDef): nil Overrides fields of an item registered with register_node/tool/craftitem. Note: Item must already be defined, (opt)depend on the mod defining it. Example: `minetest.override_item("default:mese", {light_source=minetest.LIGHT_MAX})`
|
||||
---@field register_decoration fun(decoration_definition: DecorationDef): number|integer Returns an integer object handle uniquely identifying the registered decoration on success. To get the decoration ID, use `minetest.get_decoration_id`. The order of decoration registrations determines the order of decoration generation.
|
||||
---@field find_node_near fun(pos: Vector, radius: number, nodenames: string[], search_center?: boolean): Vector|nil returns pos or `nil`. `radius`: using a maximum metric, `nodenames`: e.g. `{"ignore", "group:tree"}` or `"default:dirt"`, `search_center` is an optional boolean (default: `false`) If true `pos` is also checked for the nodes
|
||||
---@field remove_node fun(pos: Vector): nil By default it does the same as `minetest.set_node(pos, {name="air"})`
|
||||
---@field get_node_or_nil fun(pos: Vector): NodeDef|nil Same as `get_node` but returns `nil` for unloaded areas.
|
||||
---@field facedir_to_dir fun(facedir: number): Vector Convert a facedir back into a vector aimed directly out the "back" of a node.
|
||||
---@field record_protection_violation fun(pos: Vector, name: string): nil This function calls functions registered with `minetest.register_on_protection_violation`.
|
||||
---@field dir_to_facedir fun(dir: Vector, is6d?: any): number Convert a vector to a facedir value, used in `param2` for `paramtype2="facedir"`. passing something non-`nil`/`false` for the optional second parameter causes it to take the y component into account.
|
||||
---@field register_lbm fun(lbm_definition: LbmDef): nil
|
||||
---@field rotate_node fun(itemstack: ItemStack, placer: ObjectRef, pointed_thing: PointedThingDef): nil calls `rotate_and_place()` with `infinitestacks` set according to the state of the creative mode setting, checks for "sneak" to set the `invert_wall` parameter and `prevent_after_place` set to `true`.
|
||||
---@field global_exists fun(name: string): nil Checks if a global variable has been set, without triggering a warning.
|
||||
---@field register_alias fun(alias: string|MapgenAliasesV6|MapgenAliasesNonV6, original_name: string): nil Also use this to set the 'mapgen aliases' needed in a game for the core mapgens. See [Mapgen aliases] section above.
|
||||
---@field register_alias_force fun(alias: string|MapgenAliasesV6|MapgenAliasesNonV6, original_name: string): nil
|
||||
---@field add_item fun(pos: Vector, item: ItemStack): ObjectRef|nil Spawn item. Returns `ObjectRef`, or `nil` if failed.
|
||||
---@field registered_items table<string, ItemDef> Map of registered items, indexed by name
|
||||
---@field add_node fun(pos: Vector, node: SetNodeTable): nil alias to `minetest.set_node`, Set node at position `pos`, `node`: table `{name=string, param1=number, param2=number}`, If param1 or param2 is omitted, it's set to `0`. e.g. `minetest.set_node({x=0, y=10, z=0}, {name="default:wood"})`
|
||||
---@field string_to_pos fun(string: string): Vector|nil If the string can't be parsed to a position, nothing is returned.
|
||||
---@field chat_send_player fun(name: string, text: string): nil
|
||||
---@field create_detached_inventory fun(name: string, callbacks: DetachedInventoryCallbacks, player_name?: string): InvRef Creates a detached inventory. If it already exists, it is cleared. `callbacks`: See [Detached inventory callbacks], `player_name`: Make detached inventory available to one player exclusively, by default they will be sent to every player (even if not used). Note that this parameter is mostly just a workaround and will be removed in future releases.
|
||||
---@field get_mod_storage fun(): StorageRef Mod metadata: per mod metadata, saved automatically. Can be obtained via `minetest.get_mod_storage()` during load time.
|
||||
---@field show_formspec fun(playername: string, formname: string, formspec: string): nil `playername`: name of player to show formspec, `formname`: name passed to `on_player_receive_fields` callbacks. It should follow the `"modname:<whatever>"` naming convention. `formspec`: formspec to display
|
||||
---@field register_on_player_receive_fields fun(func: fun(player: ObjectRef, formname: string, fields: table)): nil Called when the server received input from `player` in a formspec with the given `formname`. Specifically, this is called on any of the following events: a button was pressed, Enter was pressed while the focus was on a text field, a checkbox was toggled, something was selected in a dropdown list, a different tab was selected, selection was changed in a textlist or table, an entry was double-clicked in a textlist or table, a scrollbar was moved, or the form was actively closed by the player.
|
||||
---@field get_inventory fun(location: {['"type"']: 'player'|'node'|'detached', ['"name"']: string|nil, ['"pos"']: Vector|nil}): InvRef
|
||||
---@field dir_to_wallmounted fun(dir: Vector): number Convert a vector to a wallmounted value, used for `paramtype2="wallmounted"`
|
||||
---@field item_place_node fun(itemstack: ItemStack, placer: ObjectRef, pointed_thing: PointedThingDef, param2?: string , prevent_after_place?: boolean): Vector|nil Place item as a node, `param2` overrides `facedir` and wallmounted `param2`, `prevent_after_place`: if set to `true`, `after_place_node` is not called or the newly placed node to prevent a callback and placement loop. returns `itemstack, position`, `position`: the location the node was placed to. `nil` if nothing was placed.
|
||||
---@field unregister_item fun(name: string): nil Unregisters the item from the engine, and deletes the entry with key `name` from `minetest.registered_items` and from the associated item table according to its nature: `minetest.registered_nodes`, etc.
|
||||
---@field register_allow_player_inventory_action fun(func: fun(player: ObjectRef, action: string, inventory: InvRef, inventory_info: {["from_list"]: string, ["to_list"]: string, ["from_index"]: number, ["to_index"]: number, ["count"]: number} | {["listname"]: string, ["index"]: number, ["stack"]: ItemStack}): number): nil Determines how much of a stack may be taken, put or moved to a player inventory. `player` (type `ObjectRef`) is the player who modified the inventory, `inventory` (type `InvRef`). List of possible `action` (string) values and their `inventory_info` (table) contents: `move`: `{from_list=string, to_list=string, from_index=number, to_index=number, count=number}`, `put`: `{listname=string, index=number, stack=ItemStack}`, `take`: Same as `put`. Return a numeric value to limit the amount of items to be taken, put or moved. A value of `-1` for `take` will make the source stack infinite.
|
||||
---@field register_on_player_inventory_action fun(func: fun(player: ObjectRef, action: string, inventory: InvRef, inventory_info: {["from_list"]: string, ["to_list"]: string, ["from_index"]: number, ["to_index"]: number, ["count"]: number} | {["listname"]: string, ["index"]: number, ["stack"]: ItemStack}): nil): nil Called after a take, put or move event from/to/in a player inventory. Function arguments: see `minetest.register_allow_player_inventory_action`. Does not accept or handle any return value.
|
||||
---@field formspec_escape fun(str: string): string returns a string, escapes the characters "[", "]", "\", "," and ";", which can not be used in formspecs.
|
||||
---@field get_translator fun(textdomain: string): any
|
||||
---@field get_current_modname fun(): string returns the currently loading mod's name, when loading a mod.
|
||||
---@field get_pointed_thing_position fun(pointed_thing: PointedThingDef, above?: boolean): Vector | nil Returns the position of a `pointed_thing` or `nil` if the `pointed_thing` does not refer to a node or entity. If the optional `above` parameter is true and the `pointed_thing` refers to a node, then it will return the `above` position of the `pointed_thing`.
|
||||
---@field item_place fun(itemstack: ItemStack, placer: ObjectRef, pointed_thing: PointedThingDef, param2?: string|number): ItemStack Wrapper that calls `minetest.item_place_node` if appropriate. Calls `on_rightclick` of `pointed_thing.under` if defined instead **Note**: is not called when wielded item overrides `on_place`, `param2` overrides facedir and wallmounted `param2`, returns `itemstack, position`, `position`: the location the node was placed to. `nil` if nothing was placed.
|
||||
---@field node_dig fun(pos: Vector, node: NodeDef, digger: ObjectRef): nil Checks if node can be dug, puts item into inventory, removes node. Calls functions registered by `minetest.registered_on_dignodes()`
|
||||
---@field delete_particlespawner fun(id: number, player?: ObjectRef): nil Delete `ParticleSpawner` with `id` (return value from `minetest.add_particlespawner`). If playername is specified, only deletes on the player's client, otherwise on all clients.
|
||||
---@field is_area_protected fun(pos1: Vector, pos2: Vector, player_name: ObjectRef, interval: number): Vector | boolean Returns the position of the first node that `player_name` may not modify in the specified cuboid between `pos1` and `pos2`. Returns `false` if no protections were found. Applies `is_protected()` to a 3D lattice of points in the defined volume. The points are spaced evenly throughout the volume and have a spacing similar to, but no larger than, `interval`. All corners and edges of the defined volume are checked. `interval` defaults to 4. `interval` should be carefully chosen and maximised to avoid an excessive number of points being checked. Like `minetest.is_protected`, this function may be extended or overwritten by mods to provide a faster implementation to check the cuboid for intersections.
|
||||
---@field is_protected fun(pos: Vector, name: string): boolean Returning `true` restricts the player `name` from modifying (i.e. digging, placing) the node at position `pos`. `name` will be `""` for non-players or unknown players. This function should be overridden by protection mods. It is highly recommended to grant access to players with the `protection_bypass` privilege. Cache and call the old version of this function if the position is not protected by the mod. This will allow using multiple protection mods.
|
||||
---@field register_on_mods_loaded fun(func: fun(): nil): nil Called after mods have finished loading and before the media is cached or the aliases handled.
|
||||
---@field register_on_leaveplayer fun(func: fun(player: ObjectRef, timed_out: number): nil): nil Called when a player leaves the game `timed_out`: True for timeout, false for other reasons.
|
||||
---@field place_node fun(pos: Vector, node: SetNodeTable): nil Place node with the same effects that a player would cause
|
||||
---@field add_particle fun(def: ParticleDef): nil
|
||||
|
||||
---Minetest settings
|
||||
---@class MinetestSettings
|
||||
---@field get fun(self: MinetestSettings, key: string): string|number|integer Returns a value
|
||||
---@field get_bool fun(self: MinetestSettings, key: string, default?: boolean): boolean|nil Returns a boolean. `default` is the value returned if `key` is not found. Returns `nil` if `key` is not found and `default` not specified.
|
||||
---@field get_np_group fun(self: MinetestSettings, key: string): table Returns a NoiseParams table
|
||||
---@field get_flags fun(self: MinetestSettings, key: string): table Returns `{flag = true/false, ...}` according to the set flags. Is currently limited to mapgen flags `mg_flags` and mapgen-specific flags like `mgv5_spflags`.
|
||||
---@field set fun(self: MinetestSettings, key: string, value: string|integer|number): nil Setting names can't contain whitespace or any of `="{}#`. Setting values can't contain the sequence `\n"""`. Setting names starting with "secure." can't be set on the main settings object (`minetest.settings`).
|
||||
---@field set_bool fun(self: MinetestSettings, key: string, value: boolean): nil Setting names can't contain whitespace or any of `="{}#`. Setting values can't contain the sequence `\n"""`. Setting names starting with "secure." can't be set on the main settings object (`minetest.settings`).
|
||||
---@field set_np_group fun(self: MinetestSettings, key: string, value: table): nil `value` is a NoiseParams table.
|
||||
---@field remove fun(self: MinetestSettings, key: string): boolean Returns a boolean (`true` for success)
|
||||
---@field get_names fun(): table Returns `{key1,...}`
|
||||
---@field write fun(): boolean Returns a boolean (`true` for success). Writes changes to file.
|
||||
---@field to_table fun(): table Returns `{[key1]=value1,...}`
|
||||
|
||||
--- Set node table
|
||||
---@class SetNodeTable
|
||||
---@field name string
|
||||
---@field param1 number
|
||||
---@field param2 number
|
||||
|
||||
--- Detached inventory callbacks
|
||||
---@class DetachedInventoryCallbacks
|
||||
---@field allow_move fun(inv: InvRef, from_list: string, from_index: number, to_list: string, to_index: number, count: number, player: ObjectRef): number Called when a player wants to move items inside the inventory. Return value: number of items allowed to move.
|
||||
---@field allow_put fun(inv: InvRef, listname: string, index: number, stack: ItemStack, player: ObjectRef): number 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.
|
||||
---@field allow_take fun(inv: InvRef, listname: string, index: number, stack: ItemStack, player: ObjectRef): number 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.
|
||||
---@field on_move fun(inv: InvRef, from_list: string, from_index: number, to_list: string, to_index: number, count: number, player: ObjectRef): nil
|
||||
---@field on_put fun(inv: InvRef, listname: string, index: number, stack: ItemStack, player: ObjectRef): nil
|
||||
---@field on_take fun(inv: InvRef, listname: string, index: number, stack: ItemStack, player: ObjectRef): nil Called after the actual action has happened, according to what was allowed. No return value.
|
||||
|
||||
--- Job table
|
||||
---@class JobTable
|
||||
---@field cancel fun(self: JobTable) Cancels the job function from being called
|
||||
|
||||
--- Biome data
|
||||
---@class BiomeData
|
||||
---@field biome string|number|integer the biome id of the biome at that position
|
||||
---@field heat string|number|integer the heat at the position
|
||||
---@field humidity string|number|integer the humidity at the position
|
||||
|
||||
--- LBM (LoadingBlockModifier) definition. A loading block modifier (LBM) is used to define a function that is called for specific nodes (defined by `nodenames`) when a mapblock which contains such nodes gets activated (not loaded!)
|
||||
---@class LbmDef
|
||||
---@field label string Descriptive label for profiling purposes (optional). Definitions with identical labels will be listed as one.
|
||||
---@field name string Identifier of the LBM, should follow the modname:<whatever> convention
|
||||
---@field nodenames string[] List of node names to trigger the LBM on. Names of non-registered nodes and groups (as group:groupname) will work as well.
|
||||
---@field run_at_every_load boolean Whether to run the LBM's action every time a block gets activated, and not only the first time the block gets activated after the LBM was introduced.
|
||||
---@field action fun(pos: Vector, node: NodeDef): nil Function triggered for each qualifying node.
|
||||
|
||||
--- Sound parameters.
|
||||
--- Looped sounds must either be connected to an object or played locationless to one player using `to_player = name`. A positional sound will only be heard by players that are within `max_hear_distance` of the sound position, at the start of the sound. `exclude_player = name` can be applied to locationless, positional and object-bound sounds to exclude a single player from hearing them.
|
||||
---@class SoundParamDef
|
||||
---@field to_player string Name
|
||||
---@field gain number|integer
|
||||
---@field fade number|integer Change to a value > 0 to fade the sound in
|
||||
---@field pitch number|integer
|
||||
---@field loop boolean
|
||||
---@field pos Vector
|
||||
---@field max_hear_distance number|integer
|
||||
---@field object ObjectRef
|
||||
---@field exclude_player string Name
|
||||
|
||||
---Partcile definition
|
||||
---@class ParticleDef
|
||||
---@field pos Vector
|
||||
---@field velocity Vector
|
||||
---@field acceleration Vector Spawn particle at pos with velocity and acceleration
|
||||
---@field expirationtime number Disappears after expirationtime seconds
|
||||
---@field size number Scales the visual size of the particle texture. If `node` is set, size can be set to 0 to spawn a randomly-sized particle (just like actual node dig particles).
|
||||
---@field collisiondetection boolean If true collides with `walkable` nodes and, depending on the `object_collision` field, objects too.
|
||||
---@field collision_removal boolean If true particle is removed when it collides. Requires collisiondetection = true to have any effect.
|
||||
---@field object_collision boolean If true particle collides with objects that are defined as `physical = true,` and `collide_with_objects = true,`. Requires collisiondetection = true to have any effect.
|
||||
---@field vertical boolean If true faces player using y axis only
|
||||
---@field texture string The texture of the particle v5.6.0 and later: also supports the table format described in the following section
|
||||
---@field playername string | nil Optional, if specified spawns particle only on the player's client
|
||||
---@field animation TileAnimationDef | nil Optional, specifies how to animate the particle texture
|
||||
---@field glow number | nil Optional, specify particle self-luminescence in darkness. Values 0-14.
|
||||
---@field node {["name"]: string, ["param2"]: number} | nil Optional, if specified the particle will have the same appearance as node dig particles for the given node. `texture` and `animation` will be ignored if this is set.
|
||||
---@field node_tile number | nil Optional, only valid in combination with `node` If set to a valid number 1-6, specifies the tile from which the particle texture is picked. Otherwise, the default behavior is used. (currently: any random tile)
|
||||
---@field drag Vector | nil v5.6.0 and later: Optional drag value, consult the following section
|
||||
---@field bounce {["min"]: number, ["max"]: number, ["bias"]: number} | nil v5.6.0 and later: Optional bounce range, consult the following section
|
|
@ -1,6 +0,0 @@
|
|||
---@diagnostic disable: codestyle-check
|
||||
---https://github.com/sumneko/lua-language-server/wiki
|
||||
|
||||
---Minetest game creative mod
|
||||
---@class MtgCreative
|
||||
---@field is_enabled_for fun(name: string): boolean Returning `true` means that Creative Mode is enabled for player `name`. `name` will be `""` for non-players or if the player is unknown. By default, this function returns `true` if the setting `creative_mode` is `true` and `false` otherwise.
|
|
@ -1,40 +0,0 @@
|
|||
---@diagnostic disable: codestyle-check
|
||||
---https://github.com/sumneko/lua-language-server/wiki
|
||||
|
||||
---Minetest game default mod
|
||||
---@class MtgDefault
|
||||
---@field LIGHT_MAX number|integer The maximum light level. Maximum light to grow.
|
||||
---@field can_grow fun(pos: Vector): boolean Grow trees from saplings
|
||||
---@field grow_new_apple_tree fun(pos: Vector): nil
|
||||
---@field grow_new_jungle_tree fun(pos: Vector): nil
|
||||
---@field grow_new_emergent_jungle_tree fun(pos: Vector): nil
|
||||
---@field grow_new_acacia_tree fun(pos: Vector): nil
|
||||
---@field grow_new_aspen_tree fun(pos: Vector): nil
|
||||
---@field grow_new_snowy_pine_tree fun(pos: Vector): nil
|
||||
---@field grow_new_pine_tree fun(pos: Vector): nil
|
||||
---@field grow_bush fun(pos: Vector): nil
|
||||
---@field grow_acacia_bush fun(pos: Vector): nil
|
||||
---@field grow_pine_bush fun(pos: Vector): nil
|
||||
---@field grow_blueberry_bush fun(pos: Vector): nil
|
||||
---@field grow_papyrus fun(pos: Vector, node: NodeDef): nil
|
||||
---@field grow_large_cactus fun(pos: Vector, node: NodeDef): nil
|
||||
---@field sapling_on_place fun(itemstack: ItemStack, placer: ObjectRef, pointed_thing: PointedThingDef, sapling_name: string, minp_relative: Vector, maxp_relative: Vector, interval: number): nil Sapling 'on place' function to check protection of node and resulting tree volume
|
||||
---@field register_leafdecay fun(def: RegisterLeafdecayDef): nil
|
||||
---@field after_place_leaves fun(pos: Vector, placer: ObjectRef, itemstack?: ItemStack, pointed_thing?: PointedThingDef): nil Prevent decay of placed leaves
|
||||
---@field node_sound_defaults fun(table?: NodeSoundDef): NodeSoundDef
|
||||
---@field node_sound_stone_defaults fun(table?: NodeSoundDef): NodeSoundDef
|
||||
---@field node_sound_dirt_defaults fun(table?: NodeSoundDef): NodeSoundDef
|
||||
---@field node_sound_sand_defaults fun(table?: NodeSoundDef): NodeSoundDef
|
||||
---@field node_sound_wood_defaults fun(table?: NodeSoundDef): NodeSoundDef
|
||||
---@field node_sound_leaves_defaults fun(table?: NodeSoundDef): NodeSoundDef
|
||||
---@field node_sound_glass_defaults fun(table?: NodeSoundDef): NodeSoundDef
|
||||
---@field node_sound_metal_defaults fun(table?: NodeSoundDef): NodeSoundDef
|
||||
---@field node_sound_ice_defaults fun(table?: NodeSoundDef): NodeSoundDef
|
||||
---@field node_sound_gravel_defaults fun(table?: NodeSoundDef): NodeSoundDef
|
||||
---@field get_hotbar_bg fun(x: number, y: number): nil Get the hotbar background as string, containing the formspec elements. x: Horizontal position in the formspec, y: Vertical position in the formspec.
|
||||
|
||||
--- Leaf decay definition
|
||||
---@class RegisterLeafdecayDef
|
||||
---@field trunks string[]
|
||||
---@field leaves string[]
|
||||
---@field radius number
|
|
@ -1,15 +0,0 @@
|
|||
---@diagnostic disable: codestyle-check
|
||||
---https://github.com/sumneko/lua-language-server/wiki
|
||||
|
||||
---Minetest game dungeon loot mod API
|
||||
---@class MtgDungeonLoot
|
||||
---@field register fun(loot_definition: MtgDungeonLootDef): nil Registers one or more loot items, `def` Can be a single loot_definition or a list of them.
|
||||
---@field registered_loot table Table of all registered loot, not to be modified manually
|
||||
|
||||
---Loot definition
|
||||
---@class MtgDungeonLootDef
|
||||
---@field name string
|
||||
---@field chance number chance value from 0.0 to 1.0 that the item will appear in the chest when chosen, Due to an extra step in the selection process, 0.5 does not(!) mean that on average every second chest will have this item
|
||||
---@field count number[]|nil table with minimum and maximum amounts of this item, optional, defaults to always single item
|
||||
---@field y number[]|nil table with minimum and maximum heights this item can be found at, optional, defaults to no height restrictions
|
||||
---@field types string[]|nil table with types of dungeons this item can be found in supported types: "normal" (the cobble/mossycobble one), "sandstone", "desert" and "ice", optional, defaults to no type restrictions
|
|
@ -1,17 +0,0 @@
|
|||
---@diagnostic disable: codestyle-check
|
||||
---https://github.com/sumneko/lua-language-server/wiki
|
||||
|
||||
---Minetest game farming mod
|
||||
---@class MtgFarming
|
||||
---@field hoe_on_use fun(itemstack: ItemStack, user: ObjectRef, pointed_thing: PointedThingDef, uses: number): ItemStack | nil
|
||||
---@field place_seed fun(itemstack: ItemStack, placer: ObjectRef, pointed_thing: PointedThingDef, plantname: string): ItemStack Seed placement
|
||||
---@field grow_plant fun(pos: Vector, elapsed: number): nil
|
||||
---@field register_plant fun(name: string, def: table): nil
|
||||
|
||||
----Node definition. Used by `minetest.register_node`.
|
||||
---@class NodeDefMtgFarming
|
||||
---@field fertility string[]|nil Used in default farming mod, defines biome name list where plants can grow
|
||||
---@field steps number How many steps the plant has to grow, until it can be harvested
|
||||
---@field minlight number Minimum light to grow
|
||||
---@field maxlight number Maximum light to grow
|
||||
---@field on_timer fun(pos: Vector, elapsed: number): boolean 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.
|
|
@ -1,33 +0,0 @@
|
|||
---@diagnostic disable: codestyle-check
|
||||
---The player API can register player models and update the player's appearance.
|
||||
---@class MtgPlayerApi
|
||||
---@field globalstep fun(dtime: number, ...): nil The function called by the globalstep that controls player animations. You can override this to replace the globalstep with your own implementation. Receives all args that minetest.register_globalstep() passes
|
||||
---@field register_model fun(name: string, def: MtgPlayerApiModelDef): nil Register a new model to be used by players, `name`: model filename such as "character.x", "foo.b3d", etc., `def`: see [#Model definition] Saved to player_api.registered_models
|
||||
---@field registered_models string[] Get a model's definition, `name`: model filename See [#Model definition]
|
||||
---@field set_model fun(player: ObjectRef, model_name: string): nil Change a player's model, `player`: PlayerRef, `model_name`: model registered with `player_api.register_model`
|
||||
---@field set_animation fun(player: ObjectRef, anim_name: string, speed: number): nil Applies an animation to a player if speed or anim_name differ from the currently playing animation, `player`: PlayerRef, `anim_name`: name of the animation, `speed`: keyframes per second. If nil, the default from the model def is used
|
||||
---@field set_textures fun(player: ObjectRef, textures: string[]): nil Sets player textures `player`: PlayerRef, `textures`: array of textures. If nil, the default from the model def is used
|
||||
---@field set_texture fun(player: ObjectRef, index: number, texture: string): nil Sets one of the player textures, `player`: PlayerRef, `index`: Index into array of all textures, `texture`: the texture string
|
||||
---@field get_textures fun(player: ObjectRef): string[] Returns player textures table
|
||||
---@field get_animation fun(player: ObjectRef): {["model"]: string | nil, ["textures"]: string[] | nil, ["animation"]: table | nil} Returns a table containing fields `model`, `textures` and `animation`. Any of the fields of the returned table may be nil, `player`: PlayerRef
|
||||
---@field player_attached table<string, boolean> A table that maps a player name to a boolean. If the value for a given player is set to true, the default player animations (walking, digging, ...) will no longer be updated, and knockback from damage is prevented for that player. Example of usage: A mod sets a player's value to true when attached to a vehicle.
|
||||
|
||||
|
||||
---Model Definition
|
||||
---@class MtgPlayerApiModelDef
|
||||
---@field animation_speed number Default: 30, animation speed, in keyframes per second
|
||||
---@field textures string[] Default `{"character.png"}`, array of textures
|
||||
---@field animations table<string, MtgPlayerApiAnimationDef>
|
||||
---@field visual_size {["x"]: number, ["y"]: number}
|
||||
---@field collisionbox number[]
|
||||
---@field stepheight number
|
||||
---@field eye_height number
|
||||
|
||||
|
||||
---Model Animation definition
|
||||
---@class MtgPlayerApiAnimationDef
|
||||
---@field x number start frame
|
||||
---@field y number end frame
|
||||
---@field collisionbox number[] | nil
|
||||
---@field eye_height number | nil model eye height
|
||||
---@field override_local boolean | nil suspend client side animations while this one is active (optional)
|
|
@ -1,6 +0,0 @@
|
|||
---@diagnostic disable: codestyle-check
|
||||
---https://github.com/sumneko/lua-language-server/wiki
|
||||
|
||||
---Minetest game screwdriver mod
|
||||
---@class MtgScrewdriver
|
||||
---@field disallow fun(): boolean Returns `false`
|
|
@ -1,26 +0,0 @@
|
|||
---@diagnostic disable: codestyle-check
|
||||
---Sfinv API
|
||||
---@class Sfinv
|
||||
---@field register_page fun(name: string, def: SfinvDef): nil Register a page
|
||||
---@field make_formspec fun(player: ObjectRef, contex: SfinvContext, content: string, show_inv?: boolean, size?: string): nil Adds a theme to a formspec show_inv, defaults to false. Whether to show the player's main inventory size, defaults to `size[8,8.6]` if not specified
|
||||
---@field get_or_create_context fun(player: ObjectRef): SfinvContext Gets the player's context
|
||||
---@field set_context fun(player: ObjectRef, context: SfinvContext): nil
|
||||
---@field get_formspec fun(player: ObjectRef, context: SfinvContext): string Builds current page's formspec
|
||||
---@field set_player_inventory_formspec fun(player: ObjectRef): string (re)builds page formspec and calls set_inventory_formspec().
|
||||
|
||||
|
||||
---Sfinv Definition
|
||||
---@class SfinvDef
|
||||
---@field title string Human readable page name (required)
|
||||
---@field get fun(self: Sfinv, player: ObjectRef, context: SfinvContext): string Returns a formspec string. See formspec variables. (required)
|
||||
---@field is_in_nav fun(self: Sfinv, player: ObjectRef, context: SfinvContext): boolean Return true to show in the navigation (the tab header, by default)
|
||||
---@field on_player_receive_fields fun(self: Sfinv, player: ObjectRef, context: SfinvContext, fields: table): nil On formspec submit.
|
||||
---@field on_enter fun(self: Sfinv, player: ObjectRef, context: SfinvContext): nil Called when the player changes pages, usually using the tabs.
|
||||
---@field on_leave fun(self: Sfinv, player: ObjectRef, context: SfinvContext): nil When leaving this page to go to another, called before other's on_enter
|
||||
|
||||
---Sfinv Context, including: any thing you want to store, sfinv will clear the stored data on log out / log in
|
||||
---@class SfinvContext
|
||||
---@field page string Current page name
|
||||
---@field nav string[] A list of page names
|
||||
---@field nav_titles string[] A list of page titles
|
||||
---@field nav_idx number Current nav index (in nav and nav_titles)
|
|
@ -1,6 +0,0 @@
|
|||
---@diagnostic disable: codestyle-check
|
||||
---https://github.com/sumneko/lua-language-server/wiki
|
||||
|
||||
---Minetest game stairs mod
|
||||
---@class MtgStairs
|
||||
---@field register_stair_and_slab fun(subname: string, recipeitem?: string, groups: GroupCapsDef, images: NodeTilesDef, desc_stair: string, desc_slab: string, sounds: NodeSoundDef, worldaligntex?: boolean, desc_stair_inner?: string, desc_stair_outer?: string): nil `subname`: Basically the material name (e.g. cobble) used for the stair name. Nodename pattern: "stairs:stair_subname", `recipeitem`: Item used in the craft recipe, e.g. "default:cobble", may be `nil`, `groups`: damage and digging time defining groups, `worldaligntex`: A bool to set all textures world-aligned. Default false.
|
|
@ -1,53 +0,0 @@
|
|||
---@diagnostic disable: codestyle-check
|
||||
---https://github.com/sumneko/lua-language-server/wiki
|
||||
|
||||
---@alias NodeDef NodeDefAbstract | NodeDefMtgFarming
|
||||
|
||||
---Node definition. Used by `minetest.register_node`.
|
||||
---@class NodeDefAbstract
|
||||
---@field name string
|
||||
---@field next_plant string|nil
|
||||
---@field liquidtype 'none'|'source'|'flowing' 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" and `liquid_range > 0`, then both `liquid_alternative_*` fields must be specified
|
||||
---@field on_rightclick fun(pos: Vector, node: NodeDef, clicker: ObjectRef, itemstack: ItemStack, pointed_thing?: PointedThingDef): ItemStack default: nil, Called when clicker (an ObjectRef) used the 'place/build' key not neccessarily 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.
|
||||
---@field place_param2 number Value for param2 that is set when player places node
|
||||
---@field param2 number Value for param2 that is set when player places node
|
||||
---@field buildable_to boolean If true, placed nodes can replace this node. default: `false`
|
||||
---@field tiles string|NodeTilesDef Textures of node; +Y, -Y, +X, -X, +Z, -Z. List can be shortened to needed length.
|
||||
---@field sound NodeSoundDef Definition of node sounds to be played at various events.
|
||||
---@field drawtype NodeDrawTypes
|
||||
---@field liquid_viscosity number|integer 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`)
|
||||
---@field walkable boolean If true, objects collide with node.
|
||||
---@field after_dig_node fun(pos: Vector, oldnode: NodeDef, oldmetadata: table, digger: ObjectRef): nil oldmetadata is in table format. Called after destructing node when node was dug using minetest.node_dig / minetest.dig_node., default: nil
|
||||
---@field paramtype2 string
|
||||
---@field palette string Image
|
||||
|
||||
---Textures of node; +Y, -Y, +X, -X, +Z, -Z. List can be shortened to needed length.
|
||||
---@class NodeTilesDef
|
||||
---@field name string
|
||||
---@field animation TileAnimationDef
|
||||
---@field backface_culling boolean backface culling enabled by default for most nodes
|
||||
---@field align_style '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.
|
||||
---@field scale number|integer 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.
|
||||
---@field color ColorSpec the texture's color will be multiplied with this color. the tile's color overrides the owning node's color in all cases.
|
||||
|
||||
---There are a bunch of different looking node types. `*_optional` drawtypes need less rendering time if deactivated (always client-side).
|
||||
---@alias NodeDrawTypes
|
||||
---| '"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`. 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`. 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 and internal sides of textures are visible.
|
||||
---| '"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 `par
|
||||
---| '"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 co-ordinates 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"}},`
|
|
@ -1,12 +0,0 @@
|
|||
---@diagnostic disable: codestyle-check
|
||||
---https://github.com/sumneko/lua-language-server/wiki
|
||||
|
||||
---Node Timers: a high resolution persistent per-node timer. Can be gotten via `minetest.get_node_timer(pos)`.
|
||||
---@class NodeTimerRef
|
||||
---@field set fun(self: NodeTimerRef, timeout: integer|number, elapsed: integer|number): nil Set a timer's state. `timeout` is in seconds, and supports fractional values (0.1 etc). `elapsed` is in seconds, and supports fractional values (0.1 etc). Will trigger the node's `on_timer` function after `(timeout - elapsed)` seconds.
|
||||
---@field start fun(self: NodeTimerRef, timeout: integer|number): nil Start a timer. Equivalent to `set(timeout,0)`.
|
||||
---@field stop fun(): nil Stops the timer
|
||||
---@field get_timeout fun(): number|integer Returns current timeout in seconds.
|
||||
---@field get_elapsed fun(): number|integer Returns current elapsed time in seconds.
|
||||
---@field is_started fun(): boolean Returns boolean state of timer. Returns `true` if timer is started, otherwise `false`.
|
||||
---@field get_meta fun(pos: Vector): MetaDataRef Get a `NodeMetaRef` at that position
|
|
@ -1,89 +0,0 @@
|
|||
---@diagnostic disable: codestyle-check
|
||||
---https://github.com/sumneko/lua-language-server/wiki
|
||||
|
||||
---@alias ObjectRef ObjectRefAbstract | ObjectRefLuaEntityRef
|
||||
|
||||
---Moving things in the game are generally these.
|
||||
---This is basically a reference to a C++ `ServerActiveObject`.
|
||||
---@class ObjectRefAbstract
|
||||
---@field get_pos fun(): Vector Position of player
|
||||
---@field get_inventory fun(): InvRef|nil Returns an `InvRef` for players, otherwise returns `nil`
|
||||
---@field get_wield_index fun(): integer Returns the index of the wielded item
|
||||
---@field get_wielded_item fun(): ItemStack Returns an `ItemStack`
|
||||
---@field set_acceleration fun(self: ObjectRef, acc: Vector): nil
|
||||
---@field set_yaw fun(self: ObjectRef, yaw: integer|number): nil Sets the yaw in radians (heading).
|
||||
---@field get_player_name fun(self: ObjectRef): string Returns `""` if is not a player.
|
||||
---@field set_fov fun(self: ObjectRef, fov: number|integer, is_multiplier: boolean, transition_time: number|integer): nil Sets player's FOV. `fov`: FOV value. `is_multiplier`: Set to `true` if the FOV value is a multiplier. Defaults to `false`. `transition_time`: If defined, enables smooth FOV transition. Interpreted as the time (in seconds) to reach target FOV. If set to 0, FOV change is instantaneous. Defaults to 0. Set `fov` to 0 to clear FOV override.
|
||||
---@field get_hp fun(self: ObjectRef): number|integer Returns number of health points
|
||||
---@field is_player fun(self: ObjectRef): boolean returns true for players, false otherwise
|
||||
---@field get_luaentity fun(self: ObjectRef): table
|
||||
---@field get_armor_groups fun(self: ObjectRef): ObjectRefArmorGroups returns a table with the armor group ratings
|
||||
---@field punch fun(self: ObjectRef, puncher: ObjectRef, time_from_last_punch: integer|number, tool_capabilities: ToolCapabilitiesDef, direction: Vector|nil): nil
|
||||
---@field add_velocity fun(self: ObjectRef, vel: Vector): nil `vel` is a vector, e.g. `{x=0.0, y=2.3, z=1.0}`. In comparison to using get_velocity, adding the velocity and then using set_velocity, add_velocity is supposed to avoid synchronization problems. Additionally, players also do not support set_velocity. If a player: Does not apply during free_move. Note that since the player speed is normalized at each move step, increasing e.g. Y velocity beyond what would usually be achieved (see: physics overrides) will cause existing X/Z velocity to be reduced. Example: `add_velocity({x=0, y=6.5, z=0})` is equivalent to pressing the jump key (assuming default settings)
|
||||
---@field get_properties fun(self: ObjectRef): table Returns object property table
|
||||
---@field get_children fun(self: ObjectRef): ObjectRef[] Returns a list of ObjectRefs that are attached to the object.
|
||||
---@field set_properties fun(self: ObjectRef, object_properties: ObjectProperties): nil For entities; disables the regular damage mechanism for players punching it by hand or a non-tool item, so that it can do something else than take damage.
|
||||
---@field get_look_dir fun(self: ObjectRef): Vector get camera direction as a unit vector
|
||||
---@field get_meta fun(self: ObjectRef): MetaDataRef returns a PlayerMetaRef.
|
||||
---@field hud_add fun(self: ObjectRef, hud_definition: table): number|integer|nil add a HUD element described by HUD def, returns ID number on success
|
||||
---@field hud_remove fun(self: ObjectRef, id: number|integer): nil remove the HUD element of the specified id
|
||||
---@field hud_change fun(self: ObjectRef, id: number|integer, stat: string, value: any): nil change a value of a previously added HUD element. `stat` supports the same keys as in the hud definition table except for `"hud_elem_type"`.
|
||||
---@field set_wielded_item fun(self: ObjectRef, item: ItemStack): boolean replaces the wielded item, returns `true` if successful.
|
||||
---@field move_to fun(self: ObjectRef, pos: Vector, continuous?: boolean): nil Does an interpolated move for Lua entities for visually smooth transitions. If `continuous` is true, the Lua entity will not be moved to the current position before starting the interpolated move. For players this does the same as `set_pos`,`continuous` is ignored.
|
||||
---@field set_hp fun(self: ObjectRef, hp: number, reason: table): nil set number of health points See reason in register_on_player_hpchange Is limited to the range of 0 ... 65535 (2^16 - 1) For players: HP are also limited by `hp_max` specified in object properties
|
||||
---@field set_animation fun(self: ObjectRef, frame_range?: {["x"]: number, ["y"]: number}, frame_speed?: number, frame_blend?: number, frame_loop?: boolean): nil `frame_range`: table {x=num, y=num}, default: `{x=1, y=1}`, `frame_speed`: number, default: `15.0`, `frame_blend`: number, default: `0.0`, `frame_loop`: boolean, default: `true`
|
||||
---@field get_velocity fun(self: ObjectRef): Vector returns the velocity, a vector.
|
||||
---@field set_rotation fun(self: ObjectRef, rot: Vector): nil `rot` is a vector (radians). X is pitch (elevation), Y is yaw (heading) and Z is roll (bank).
|
||||
---@field set_pos fun(self: ObjectRef, pos: Vector): nil
|
||||
|
||||
|
||||
---Moving things in the game are generally these.
|
||||
---This is basically a reference to a C++ `ServerActiveObject`.
|
||||
---@class ObjectRefLuaEntityRef
|
||||
---@field set_velocity fun(self: ObjectRef, vel: Vector): nil `vel` is a vector, e.g. `{x=0.0, y=2.3, z=1.0}`
|
||||
---@field remove fun(): nil remove object, The object is removed after returning from Lua. However the `ObjectRef` itself instantly becomes unusable with all further method calls having no effect and returning `nil`.
|
||||
---@field get_rotation fun(self: ObjectRef): Vector returns the rotation, a vector (radians)
|
||||
---@field get_attach fun(self: ObjectRef): any Returns parent, bone, position, rotation, forced_visible, or nil if it isn't attached.
|
||||
---@field set_attach fun(self: ObjectRef, parent: ObjectRef, bone?: string, position?: Vector, rotation?: Vector, forced_visible?: boolean): any Returns parent, bone, position, rotation, forced_visible, or nil if it isn't attached.
|
||||
|
||||
---`ObjectRef` armor groups
|
||||
---@class ObjectRefArmorGroups
|
||||
---@field immortal number|integer Skips all damage and breath handling for an object. This group will also hide the integrated HUD status bars for players. It is automatically set to all players when damage is disabled on the server and cannot be reset (subject to change).
|
||||
---@field fall_damage_add_percent number|integer Modifies the fall damage suffered by players when they hit the ground. It is analog to the node group with the same name. See the node group above for the exact calculation.
|
||||
---@field punch_operable number|integer For entities; disables the regular damage mechanism for players punching it by hand or a non-tool item, so that it can do something else than take damage.
|
||||
|
||||
---Used by `ObjectRef` methods. Part of an Entity definition. These properties are not persistent, but are applied automatically to the corresponding Lua entity using the given registration fields. Player properties need to be saved manually.
|
||||
---@class ObjectProperties
|
||||
---@field hp_max integer 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`.
|
||||
---@field breath_max integer For players only. Defaults to `minetest.PLAYER_MAX_BREATH_DEFAULT`.
|
||||
---@field zoom_fov number 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.
|
||||
---@field eye_height number For players only. Camera height above feet position in nodes.
|
||||
---@field physical boolean Collide with `walkable` nodes.
|
||||
---@field collide_with_objects boolean Collide with other objects if physical = true
|
||||
---@field collisionbox number[]|integer[]
|
||||
---@field selectionbox number[]|integer[] Selection box uses collision box dimensions when not set. For both boxes: {xmin, ymin, zmin, xmax, ymax, zmax} in nodes from object position.
|
||||
---@field pointable boolean Whether the object can be pointed at
|
||||
---@field visual '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' (Deprecated: 'textures = {itemname}'). 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. "item" is similar to "wielditem" but ignores the 'wield_image' parameter.
|
||||
---@field visual_size {['x']: integer|number, ['y']: integer|number, ['z']: integer|number} Multipliers for the visual size. If `z` is not specified, `x` will be used to scale the entity along both horizontal axes.
|
||||
---@field mesh string File name of mesh when using "mesh" visual
|
||||
---@field textures table 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}. "wielditem" expects 'textures = {itemname}'. "mesh" requires one texture for each mesh buffer/material (in order)
|
||||
---@field colors table Number of required colors depends on visual
|
||||
---@field use_texture_alpha boolean 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.
|
||||
---@field spritediv {['x']: integer|number, ['y']: integer|number} 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}.
|
||||
---@field initial_sprite_basepos {['x']: integer|number, ['y']: integer|number} Used with spritesheet textures. Defines the {column, row} position of the initially used frame in the spritesheet.
|
||||
---@field is_visible boolean If false, object is invisible and can't be pointed.
|
||||
---@field makes_footstep_sound boolean If true, is able to make footstep sounds of nodes
|
||||
---@field automatic_rotate number|integer 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.
|
||||
---@field stepheight number|integer If positive number, object will climb upwards when it moves horizontally against a `walkable` node, if the height difference is within `stepheight`.
|
||||
---@field automatic_face_movement_dir number|integer Automatically set yaw to movement direction, offset in degrees. 'false' to disable.
|
||||
---@field automatic_face_movement_max_rotation_per_sec number|integer Limit automatic rotation to this value in degrees per second. No limit if value <= 0.
|
||||
---@field backface_culling boolean Set to false to disable backface_culling for model
|
||||
---@field glow number|integer 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.
|
||||
---@field nametag string 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.
|
||||
---@field nametag_color ColorSpec Sets text color of nametag
|
||||
---@field nametag_bgcolor ColorSpec Sets background color of nametag `false` will cause the background to be set automatically based on user settings. Default: false
|
||||
---@field infotext string Same as infotext for nodes. Empty by default
|
||||
---@field static_save boolean 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'.
|
||||
---@field damage_texture_modifier string Texture modifier to be applied for a short duration when object is hit
|
||||
---@field shaded boolean Setting this to 'false' disables diffuse lighting of entity
|
||||
---@field show_on_minimap boolean Defaults to true for players, false for other entities. If set to true the entity will show as a marker on the minimap.
|
|
@ -1,50 +0,0 @@
|
|||
---@diagnostic disable: codestyle-check
|
||||
---https://github.com/sumneko/lua-language-server/wiki
|
||||
|
||||
--- ParticleSpawner definition
|
||||
---@class ParticlespawnerDef
|
||||
---@field amount number|integer Number of particles spawned over the time period `time`.
|
||||
---@field time number|integer Lifespan of spawner in seconds. If time is 0 spawner has infinite lifespan and spawns the `amount` on a per-second basis.
|
||||
---@field collisiondetection boolean If true collide with `walkable` nodes and, depending on the `object_collision` field, objects too.
|
||||
---@field collision_removal boolean If true particles are removed when they collide. Requires collisiondetection = true to have any effect.
|
||||
---@field object_collision boolean If true particles collide with objects that are defined as `physical = true,` and `collide_with_objects = true,`. Requires collisiondetection = true to have any effect.
|
||||
---@field attached ObjectRef If defined, particle positions, velocities and accelerations are relative to this object's position and yaw
|
||||
---@field vertical boolean If true face player using y axis only
|
||||
---@field texture string The texture of the particle. e,g, `"image.png"`
|
||||
---@field playername string Optional, if specified spawns particles only on the player's client
|
||||
---@field animation TileAnimationDef Optional, specifies how to animate the particles' texture. v5.6.0 and later: set length to -1 to sychronize the length of the animation with the expiration time of individual particles. (-2 causes the animation to be played twice, and so on)
|
||||
---@field glow number|integer Optional, specify particle self-luminescence in darkness. Values 0-14.
|
||||
---@field node table<string, string|number|integer> e.g. `{name = "ignore", param2 = 0}`. Optional, if specified the particles will have the same appearance as node dig particles for the given node. Texture` and `animation` will be ignored if this is set.
|
||||
---@field node_tile number|integer Optional, only valid in combination with `node`. If set to a valid number 1-6, specifies the tile from which the particle texture is picked. Otherwise, the default behavior is used. (currently: any random tile)
|
||||
---@field minpos Vector Legacy definition field
|
||||
---@field maxpos Vector Legacy definition field
|
||||
---@field minvel Vector Legacy definition field
|
||||
---@field maxvel Vector Legacy definition field
|
||||
---@field minacc Vector Legacy definition field
|
||||
---@field maxacc Vector Legacy definition field
|
||||
---@field minexptime number|integer Legacy definition field
|
||||
---@field maxexptime number|integer Legacy definition field
|
||||
---@field minsize number|integer Legacy definition field
|
||||
---@field maxsize number|integer Legacy definition field
|
||||
---@field pos number|integer|Vector|ParticlespawnerPosDef As `number`: absolute value - all components of every particle's position vector will be set to this. As `Vector`: vec3 - all particles will appear at this exact position throughout the lifetime of the particlespawner. As `ParticlespawnerPosDef`: vec3 range - the particle will appear at a position that is picked at random from within a cubic range.
|
||||
|
||||
--- ParticleSpawner pos definition
|
||||
---@class ParticlespawnerPosDef
|
||||
---@field min Vector The minimum value this property will be set to in particles spawned by the generator.
|
||||
---@field max Vector The maximum value this property will be set to in particles spawned by the generator.
|
||||
---@field bias number|integer When `bias` is 0, all random values are exactly as likely as any other. When it is positive, the higher it is, the more likely values will appear towards the minimum end of the allowed spectrum. When it is negative, the lower it is, the more likely values will appear towards the maximum end of the allowed spectrum. The curve is exponential and there is no particular maximum or minimum value.
|
||||
---@field pos_tween ParticlespawnerPosTweenDef A tween table should consist of a list of frames in the same form as the untweened pos property above, which the engine will interpolate between, and optionally a number of properties that control how the interpolation takes place. Currently **only two frames**, the first and the last, are used, but extra frames are accepted for the sake of forward compatibility. Any of the above definition styles can be used here as well in any combination supported by the property type.
|
||||
|
||||
--- ParticleSpawner pos_tween definition
|
||||
---@class ParticlespawnerPosTweenDef
|
||||
---@field style string e.g. "fwd": linear animation from first to last frame (default), "rev": linear animation from last to first frame, "pulse": linear animation from first to last then back to first again, "flicker": like "pulse", but slightly randomized to add a bit of stutter
|
||||
---@field reps number|integer Number of times the animation is played over the particle's lifespan
|
||||
---@field start number|integer Point in the spawner's lifespan at which the animation begins. 0 is the very beginning, 1 is the very end.
|
||||
---@field frames number|integer|Vector|ParticlespawnerPosDef Frames can be defined in a number of different ways, depending on the underlying type of the property. For now, all but the first and last frame are ignored.
|
||||
|
||||
--- Tile animation definition
|
||||
---@class TileAnimationDef
|
||||
---@field type string e.g. "vertical_frames", "sheet_2d"
|
||||
---@field aspect_w number|integer Width of a frame in pixels
|
||||
---@field aspect_h number|integer Height of a frame in pixels
|
||||
---@field length number|integer e.g. 3.0 Full loop length, 0.5 Length of a single frame
|
|
@ -1,12 +0,0 @@
|
|||
---@diagnostic disable: codestyle-check
|
||||
---https://github.com/sumneko/lua-language-server/wiki
|
||||
|
||||
---Pointed thing definition
|
||||
---@class PointedThingDef
|
||||
---@field type string e.g. `{type="nothing"}` `{type="node"}` `{type="object"}`
|
||||
---@field under Vector Refers to the node position behind the pointed face.
|
||||
---@field above Vector Refers to the node position in front of the pointed face.
|
||||
---@field ref ObjectRef e.g. `{type="object", ref=ObjectRef}`
|
||||
---@field intersection_point Vector Exact pointing location (currently only `Raycast` supports these field). The absolute world coordinates of the point on the selection box which is pointed at. May be in the selection box if the pointer is in the box too.
|
||||
---@field box_id number|integer Exact pointing location (currently only `Raycast` supports these field). The ID of the pointed selection box (counting starts from 1).
|
||||
---@field intersection_normal Vector Exact pointing location (currently only `Raycast` supports these field). Unit vector, points outwards of the selected selection box. This specifies which face is pointed at. Is a null vector `vector.zero()` when the pointer is inside the selection box.
|
|
@ -1,6 +0,0 @@
|
|||
---@diagnostic disable: codestyle-check
|
||||
---https://github.com/sumneko/lua-language-server/wiki
|
||||
|
||||
---A raycast on the map. It works with selection boxes. The map is loaded as the ray advances. If the map is modified after the `Raycast` is created, the changes may or may not have an effect on the object.
|
||||
---@class Raycast
|
||||
---@field next fun(): PointedThingDef Returns a `pointed_thing` with exact pointing location. Returns the next thing pointed by the ray or nil.
|
|
@ -1,28 +0,0 @@
|
|||
---@diagnostic disable: codestyle-check
|
||||
---https://github.com/sumneko/lua-language-server/wiki
|
||||
|
||||
---Specifies a sound name, gain (=volume) and pitch. This is either a string or a table. In string form, you just specify the sound name or the empty string for no sound.
|
||||
---@class SimpleSoundSpec
|
||||
---@field name string Sound name.
|
||||
---@field gain number|integer Volume (`1.0` = 100%). Optional and default to `1.0`.
|
||||
---@field pitch number|integer Pitch (`1.0` = 100%). Optional and default to `1.0`.
|
||||
|
||||
--- Definition of node sounds to be played at various events.
|
||||
---@class NodeSoundDef
|
||||
---@field name string Sound name.
|
||||
---@field footstep SimpleSoundSpec If walkable, played when object walks on it. If node is climbable or a liquid, played when object moves through it
|
||||
---@field dig SimpleSoundSpec|'__group' While digging node. If `"__group"`, then the sound will be `default_dig_<groupname>`, 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"`
|
||||
---@field dug SimpleSoundSpec Node was dug
|
||||
---@field place SimpleSoundSpec Node was placed. Also played after falling
|
||||
---@field place_failed SimpleSoundSpec 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.
|
||||
---@field fall SimpleSoundSpec When node starts to fall or is detached
|
||||
|
||||
---Definition of item sounds to be played at various events. All fields in this table are optional.
|
||||
---@class ItemSoundDef
|
||||
---@field breaks SimpleSoundSpec|string When tool breaks due to wear. Ignored for non-tools
|
||||
---@field eat SimpleSoundSpec|string When item is eaten with `minetest.do_item_eat`
|
||||
---@field punch_use SimpleSoundSpec|string When item is used with the 'punch/mine' key pointing at a node or entity
|
||||
---@field punch_use_air SimpleSoundSpec|string When item is used with the 'punch/mine' key pointing at nothing (air)
|
||||
|
||||
---Dig params definition.
|
||||
---@class DigParamsDef
|
|
@ -1,8 +0,0 @@
|
|||
---@diagnostic disable: codestyle-check, duplicate-doc-alias
|
||||
---https://github.com/sumneko/lua-language-server/wiki
|
||||
|
||||
---@alias string string|StringAbstract
|
||||
|
||||
---String helpers
|
||||
---@class StringAbstract
|
||||
---@field split fun(self: string, str: string, separator?: string, include_empty?: boolean, max_splits?: number, sep_is_pattern?: boolean): table `separator`: string, default: `","`, `include_empty`: boolean, default: `false`, `max_splits`: number, if it's negative, splits aren't limited, default: `-1`, `sep_is_pattern`: boolean, it specifies whether separator is a plain string or a pattern (regex), default: `false`. e.g. `"a,b":split","` returns `{"a","b"}`
|
|
@ -1,8 +0,0 @@
|
|||
---@diagnostic disable: codestyle-check, duplicate-doc-alias
|
||||
---https://github.com/sumneko/lua-language-server/wiki
|
||||
|
||||
---@alias tablelib tablelib|TableAbstract
|
||||
|
||||
---Table helpers
|
||||
---@class TableAbstract
|
||||
---@field copy fun(table: table): table returns a deep copy of `table`
|
|
@ -1,8 +0,0 @@
|
|||
---@diagnostic disable: codestyle-check
|
||||
---Base class Unified Inventory
|
||||
---@class UnifiedInventory
|
||||
---@field set_inventory_formspec fun(player: ObjectRef, formspecname: string): nil
|
||||
---@field register_button fun(name: string, def: table): nil
|
||||
---@field single_slot fun(x: number, y: number): nil
|
||||
---@field register_page fun(name: string, def: table): nil
|
||||
---@field style_full table
|
|
@ -1,17 +0,0 @@
|
|||
---@diagnostic disable: codestyle-check
|
||||
---https://github.com/sumneko/lua-language-server/wiki
|
||||
|
||||
------All `vector.*` functions allow vectors `{x = X, y = Y, z = Z}` without metatables. Returned vectors always have a metatable set.
|
||||
---@class Vector
|
||||
---@field x integer|number Pitch
|
||||
---@field y integer|number Yaw
|
||||
---@field z integer|number Roll
|
||||
---@field multiply fun(v: Vector, s: number|integer): Vector Returns a scaled vector. Deprecated: If `s` is a vector: Returns the Schur product.
|
||||
---@field subtract fun(v: Vector, x: number|integer|Vector): Vector Returns a vector. If `x` is a vector: Returns the difference of `v` subtracted by `x`. If `x` is a number: Subtracts `x` from each component of `v`.
|
||||
---@field add fun(v: Vector, x: number|integer|Vector): Vector Returns a vector. If `x` is a vector: Returns the sum of `v` and `x`. If `x` is a number: Adds `x` to each component of `v`.
|
||||
---@field normalize fun(v: Vector): Vector Returns a vector of length 1 with direction of vector `v`. If `v` has zero length, returns `(0, 0, 0)`.
|
||||
---@field distance fun(p1: Vector, p2: Vector): number|integer Returns zero or a positive number, the distance between `p1` and `p2`.
|
||||
---@field round fun(v: Vector): Vector Returns a vector, each dimension rounded to nearest integer. At a multiple of 0.5, rounds away from zero.
|
||||
---@field new fun(a, b?, c?): Vector Returns a new vector `(a, b, c)`.
|
||||
---@field direction fun(p1: Vector, p2: Vector): Vector Returns a vector of length 1 with direction `p1` to `p2`. If `p1` and `p2` are identical, returns `(0, 0, 0)`.
|
||||
---@field divide fun(v: Vector, s: Vector | number): Vector Returns a scaled vector. Deprecated: If `s` is a vector: Returns the Schur quotient.
|
|
@ -1,210 +0,0 @@
|
|||
---@diagnostic disable: codestyle-check
|
||||
---Base class XBows
|
||||
---@class XBows
|
||||
---@field pvp boolean
|
||||
---@field creative boolean
|
||||
---@field mesecons string|nil
|
||||
---@field playerphysics string|nil
|
||||
---@field player_monoids string|nil
|
||||
---@field u_skins string|nil
|
||||
---@field wardrobe string|nil
|
||||
---@field _3d_armor string|nil
|
||||
---@field skinsdb string|nil
|
||||
---@field player_api string|nil
|
||||
---@field registered_bows table<string, ItemDef|BowItemDefCustom>
|
||||
---@field registered_arrows table<string, ItemDef|ArrowItemDefCustom>
|
||||
---@field registered_quivers table<string, ItemDef|QuiverItemDefCustom>
|
||||
---@field registered_particle_spawners table<string, ParticlespawnerDef|ParticlespawnerDefCustom>
|
||||
---@field registered_entities table<string, XBowsEntityDef>
|
||||
---@field player_bow_sneak table<string, table<string, boolean>>
|
||||
---@field settings {["x_bows_attach_arrows_to_entities"]: boolean | nil, ["x_bows_show_damage_numbers"]: boolean | nil, ["x_bows_show_3d_quiver"]: boolean | nil}
|
||||
---@field quiver table Quiver class
|
||||
---@field charge_sound_after_job table<string, JobTable>
|
||||
---@field is_allowed_ammunition fun(self: XBows, weapon_name: string, ammo_name: string): boolean Check if ammunition is allowed to charge this weapon
|
||||
---@field is_creative fun(self: XBows, name: string): boolean Check if creative is enabled or if player has creative priv
|
||||
---@field get_particle_effect_for_arrow fun(self: XBows, name: string, pos: Vector): number|boolean Get particle effect from registered spawners table
|
||||
---@field register_entity fun(self: EntityDef|XBows, name: string, def: XBowsEntityDef): nil Register new projectile entity
|
||||
---@field update_bow_allowed_ammunition fun(self: XBows, name: string, def: string[]): nil Updates `allowed_ammunition` definition on already registered item, so MODs can add new ammunitions to this list.
|
||||
---@field reset_charged_bow fun(self: XBows, player: ObjectRef, includeWielded?: boolean): nil Reset charged bow to uncharged bow, this will return the arrow item to the inventory also
|
||||
---@field register_bow fun(self: XBows, name: string, def: ItemDef | BowItemDefCustom, mod_override?: boolean): boolean|nil Register new bow/gun.
|
||||
---@field register_arrow fun(self: XBows, name: string, def: ItemDef | ArrowItemDefCustom): boolean|nil Register new arrow/projectile.
|
||||
---@field register_quiver fun(self: XBows, name: string, def: ItemDef | ArrowItemDefCustom): boolean|nil Register new quiver.
|
||||
---@field load fun(self: XBows, itemstack: ItemStack, user: ObjectRef, pointed_thing: PointedThingDef): ItemStack Load bow
|
||||
---@field shoot fun(self: XBows, itemstack: ItemStack, user: ObjectRef, pointed_thing?: PointedThingDef): ItemStack Shoot bow
|
||||
---@field register_particle_effect fun(self: XBows, name: string, def: ParticlespawnerDef|ParticlespawnerDefCustom): nil Add new particle to XBow registration
|
||||
---@field open_quiver fun(self: XBowsQuiver, itemstack: ItemStack, user: ObjectRef): ItemStack Open quiver
|
||||
---@field uuid fun(): string Creates UUID
|
||||
---@field fallback_quiver boolean If no invenotory mod is detected then fallback solution will be used
|
||||
---@field show_damage_numbers fun(self: XBows, pos: Vector, damaga: number, is_crit?: boolean): nil Builds textures and shows textures in particle spawner
|
||||
|
||||
|
||||
---XBowsQuiver class extended from XBows
|
||||
---@alias XBowsQuiver XBowsQuiverBase|XBows
|
||||
---@class XBowsQuiverBase
|
||||
---@field hud_item_ids table
|
||||
---@field after_job table<string, JobTable>
|
||||
---@field udate_or_create_hud fun(self: XBowsQuiver, player: ObjectRef, inv_list: ItemStack[], idx?: number): nil Update or create quiver HUD
|
||||
---@field get_or_create_detached_inv fun(self: XBowsQuiver, quiver_id: string, player_name: string, quiver_items?: string): InvRef Get existing detached inventory or create new one
|
||||
---@field save fun(self: XBowsQuiver, inv: InvRef, player: ObjectRef, quiver_is_closed?: boolean): nil Save quiver inventory to itemstack meta
|
||||
---@field close_quiver fun(self: XBowsQuiver, player: ObjectRef, quiver_id?: string): nil Close one or all open quivers in players inventory
|
||||
---@field get_replacement_item fun(self: XBowsQuiver, from_stack: ItemStack, to_item_name: string): ItemStack Swap item in player inventory indicating open quiver. Preserve all ItemStack definition and meta.
|
||||
---@field get_itemstack_arrow_from_quiver fun(self: XBowsQuiver, player: ObjectRef, to_item_name: string): {["found_arrow_stack"]: ItemStack|nil, ["quiver_id"]: string|nil, ["quiver_name"]: string|nil, ["found_arrow_stack_idx"]: number} Gets arrow from quiver
|
||||
---@field remove_hud fun(self: XBowsQuiver, player: ObjectRef): nil Remove all added HUDs
|
||||
---@field get_formspec fun(self: XBowsQuiver, name: string): string Create formspec
|
||||
---@field get_string_from_inv fun(self: XBowsQuiver, inv: InvRef): {['inv_string']: string, ['content_description']: string} Convert inventory of itemstacks to serialized string
|
||||
---@field set_string_to_inv fun(self: XBowsQuiver, inv: InvRef, str: string): nil Set items from serialized string to inventory
|
||||
---@field quiver_can_allow fun(self: XBowsQuiver, inv: InvRef, player: ObjectRef): boolean Check if we are allowing actions in the correct quiver inventory
|
||||
---@field show_3d_quiver fun(self: XBowsQuiver, player: ObjectRef, props?: {["is_empty"]: boolean|nil}): nil Applies full/empty quiver textures
|
||||
---@field hide_3d_quiver fun(self: XBowsQuiver, player: ObjectRef): nil Applies blank quiver textures - hiding the quiver
|
||||
---@field sfinv_register_page fun(): nil register inventoy mod page
|
||||
---@field i3_register_page fun(): nil register inventoy mod page
|
||||
---@field ui_register_page fun(): nil register inventoy mod page
|
||||
|
||||
|
||||
---Custom field in ParticlespawnerDef
|
||||
---@class ParticlespawnerDefCustom
|
||||
---@field custom ParticlespawnerDefCustomAttr
|
||||
|
||||
---Custom field attributes in ParticlespawnerDef
|
||||
---@class ParticlespawnerDefCustomAttr
|
||||
---@field minpos Vector
|
||||
---@field maxpos Vector
|
||||
|
||||
---Custom field in ItemDef
|
||||
---@class BowItemDefCustom
|
||||
---@field custom BowItemDefCustomAttr
|
||||
|
||||
---Custom field attributes in ItemDef
|
||||
---@class BowItemDefCustomAttr
|
||||
---@field crit_chance number `crit_chance` 10% chance, 5 is 20% chance, (1 / crit_chance) * 100 = % chance
|
||||
---@field inventory_image_charged string
|
||||
---@field recipe table
|
||||
---@field fuel_burntime number
|
||||
---@field name_charged string
|
||||
---@field name string
|
||||
---@field mod_name string
|
||||
---@field uses number
|
||||
---@field strength number How strong is the bow. Defines how far the arrow will fly.
|
||||
---@field strength_min number|nil How strong is the bow. Defines how far the arrow will fly.
|
||||
---@field strength_max number|nil How strong is the bow. Defines how far the arrow will fly.
|
||||
---@field allowed_ammunition string[]|nil
|
||||
---@field wield_image_charged string|nil
|
||||
---@field acc_x_min number|nil
|
||||
---@field acc_y_min number|nil
|
||||
---@field acc_z_min number|nil
|
||||
---@field acc_x_max number|nil
|
||||
---@field acc_y_max number|nil
|
||||
---@field acc_z_max number|nil
|
||||
---@field sound_load string
|
||||
---@field sound_hit string
|
||||
---@field sound_shoot string
|
||||
---@field sound_shoot_crit string
|
||||
---@field gravity number
|
||||
|
||||
---Custom field in ItemDef
|
||||
---@class ArrowItemDefCustom
|
||||
---@field custom ArrowItemDefCustomAttr
|
||||
|
||||
---Custom field attributes in ItemDef
|
||||
---@class ArrowItemDefCustomAttr
|
||||
---@field tool_capabilities ToolCapabilitiesDef
|
||||
---@field craft_count number
|
||||
---@field recipe table
|
||||
---@field fuel_burntime number
|
||||
---@field name string
|
||||
---@field mod_name string
|
||||
---@field particle_effect string|nil
|
||||
---@field particle_effect_crit string|nil
|
||||
---@field particle_effect_fast string|nil
|
||||
---@field projectile_entity string
|
||||
---@field on_hit_node fun(self: table, pointed_thing_ref: table)
|
||||
---@field on_hit_entity fun(self: table, pointed_thing_ref: table)
|
||||
---@field on_hit_player fun(self: table, pointed_thing_ref: table)
|
||||
---@field on_after_activate fun(self: table)
|
||||
---@field description_abilities string
|
||||
|
||||
|
||||
---Custom field in ItemDef
|
||||
---@class QuiverItemDefCustom
|
||||
---@field custom QuiverItemDefCustomAttr
|
||||
|
||||
---Custom field attributes in ItemDef
|
||||
---@class QuiverItemDefCustomAttr
|
||||
---@field recipe table
|
||||
---@field recipe_count number
|
||||
---@field faster_arrows number
|
||||
---@field add_damage number
|
||||
---@field fuel_burntime number
|
||||
---@field inventory_image_open string
|
||||
---@field wield_image_open string
|
||||
---@field name string
|
||||
|
||||
|
||||
---Custom field in EntityDef
|
||||
---@alias XBowsEntityDef EntityDef|EntityDefCustom|XBows
|
||||
---@class EntityDefCustom
|
||||
---@field on_death fun(self: XBowsEntityDef, selfObj: table, killer: ObjectRef|nil): nil Function receive a "luaentity" table as `self`. Called when the object dies.
|
||||
---@field on_punch fun(self: XBowsEntityDef, selfObj: table, puncher: ObjectRef|nil, time_from_last_punch: number|integer|nil, tool_capabilities: ToolCapabilitiesDef|nil, dir: Vector, damage: number|integer): boolean|nil Function receive a "luaentity" table as `self`. Called when somebody punches the object. Note that you probably want to handle most punches using the automatic armor group system. Can return `true` to prevent the default damage mechanism.
|
||||
---@field _custom EntityDefCustomAttr
|
||||
|
||||
---@alias EntityDefCustomAttr EntityDefCustomAttrDef|EntityDef
|
||||
---@class EntityDefCustomAttrDef
|
||||
---@field name string
|
||||
---@field mod_name string
|
||||
---@field animations EntityAnimationDef
|
||||
---@field rotation_factor number|fun(): number
|
||||
|
||||
---Entity animation definition
|
||||
---@class EntityAnimationDef
|
||||
---@field idle {frame_range?: {["x"]: number, ["y"]: number}, frame_speed?: number, frame_blend?: number, frame_loop?: boolean}
|
||||
---@field on_hit_node {frame_range?: {["x"]: number, ["y"]: number}, frame_speed?: number, frame_blend?: number, frame_loop?: boolean}
|
||||
|
||||
---Arrow object and custom attributes
|
||||
---@class EnityCustomAttrDef
|
||||
---@field object ObjectRef
|
||||
---@field _velocity Vector
|
||||
---@field _old_pos Vector
|
||||
---@field _attached boolean
|
||||
---@field _attached_to {["type"]: string, ["pos"]: Vector | nil}
|
||||
---@field _has_particles boolean
|
||||
---@field _lifetimer number
|
||||
---@field _nodechecktimer number
|
||||
---@field _is_drowning boolean
|
||||
---@field _in_liquid boolean
|
||||
---@field _shot_from_pos Vector
|
||||
---@field _arrow_name string
|
||||
---@field _bow_name string
|
||||
---@field _user_name string
|
||||
---@field _user ObjectRef
|
||||
---@field _tflp number
|
||||
---@field _tool_capabilities ToolCapabilitiesDef
|
||||
---@field _is_critical_hit boolean
|
||||
---@field _faster_arrows_multiplier number
|
||||
---@field _add_damage number
|
||||
---@field _caused_damage number
|
||||
---@field _caused_knockback number
|
||||
---@field _arrow_particle_effect string
|
||||
---@field _arrow_particle_effect_crit string
|
||||
---@field _arrow_particle_effect_fast string
|
||||
---@field _sound_hit string
|
||||
---@field _player_look_dir Vector
|
||||
---@field _acc_x number
|
||||
---@field _acc_y number
|
||||
---@field _acc_z number
|
||||
---@field _strength number
|
||||
---@field name string
|
||||
---@field _rotation_factor number | fun(): number
|
||||
---@field _step_count number
|
||||
---@field _x_enchanting table<string, {["value"]: number | nil}>
|
||||
|
||||
---Staticdata attributes
|
||||
---@class EnityStaticDataAttrDef
|
||||
---@field _arrow_name string
|
||||
---@field _bow_name string
|
||||
---@field _user_name string
|
||||
---@field _is_critical_hit boolean
|
||||
---@field _tool_capabilities ToolCapabilitiesDef
|
||||
---@field _tflp number
|
||||
---@field _add_damage number
|
||||
---@field _faster_arrows_multiplier number | nil
|
||||
---@field _x_enchanting table<string, {["value"]: number | nil}>
|
Ŝarĝante…
Reference in New Issue