Skip to content

Commit d06ad1f

Browse files
committed
Add documentation for tool definitions
1 parent a40a439 commit d06ad1f

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

defns.lua

+11-5
Original file line numberDiff line numberDiff line change
@@ -511,11 +511,17 @@ function InvRef:get_location() end
511511
---@class PlayerMetaRef : MetaDataRef
512512
local PlayerMetaRef = {}
513513

514+
---@class ToolGroupEntry
515+
---@field maxlevel integer Indicates the maximum level of a node of this group that the item will be able to dig.
516+
---@field uses integer
517+
---@field times number[] 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.
518+
local ToolGroupEntry = { }
519+
514520
---@class ToolCapabilities
515-
---@field full_punch_interval number
516-
---@field max_drop_level integer
517-
---@field groupcaps table
518-
---@field damage_groups table
521+
---@field full_punch_interval number When used as a weapon, the item will do full damage if this time is spent between punches. If e.g. half the time is spent, the item will do half damage.
522+
---@field max_drop_level integer Suggests the maximum level of node, when dug with the item, that will drop its useful item. (e.g. iron ore to drop a lump of iron). This is not automated; it is the responsibility of the node definition to implement this.
523+
---@field groupcaps table<string, ToolGroupEntry>
524+
---@field damage_groups table<string, number>
519525
---@field punch_attack_uses integer | nil
520526
local ToolCapabilities = { }
521527

@@ -674,7 +680,7 @@ function PlayerObjectRef:get_player_control_bits() end
674680
function PlayerObjectRef:set_physics_override(override_table) end
675681
--- @return { speed: number, jump: number, gravity: number, sneak: boolean, sneak_glitch: boolean, new_move: boolean }
676682
function PlayerObjectRef:get_physics_override() end
677-
---@param definition any
683+
---@param definition HudDefn
678684
---@return number id on success
679685
function PlayerObjectRef:hud_add(definition) end
680686
---@param id number

0 commit comments

Comments
 (0)