1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Improve warning message for registration table reuse

This commit is contained in:
sfan5 2025-03-24 20:45:44 +01:00
parent 8f8d7c4088
commit 915446417d
2 changed files with 50 additions and 33 deletions

View file

@ -5895,16 +5895,23 @@ Call these functions only at load time!
### Environment
* `core.register_node(name, node definition)`
* `core.register_craftitem(name, item definition)`
* `core.register_tool(name, item definition)`
* `core.register_node(name, nodedef)`
* register a node with its definition
* Note: you must pass a clean table that hasn't already been used for
another registration to this function, as it will be modified.
* `core.register_craftitem(name, itemdef)`
* register an item with its definition
* Note: (as above)
* `core.register_tool(name, tooldef)`
* register a tool item with its definition
* Note: (as above)
* `core.override_item(name, redefinition, del_fields)`
* `redefinition` is a table of fields `[name] = new_value`,
overwriting fields of or adding fields to the existing definition.
* `del_fields` is a list of field names to be set
to `nil` ("deleted from") the original definition.
* Overrides fields of an item registered with register_node/tool/craftitem.
* Note: Item must already be defined, (opt)depend on the mod defining it.
* Note: Item must already be defined.
* Example: `core.override_item("default:mese",
{light_source=core.LIGHT_MAX}, {"sounds"})`:
Overwrites the `light_source` field,
@ -5912,7 +5919,7 @@ Call these functions only at load time!
* `core.unregister_item(name)`
* Unregisters the item from the engine, and deletes the entry with key
`name` from `core.registered_items` and from the associated item table
according to its nature: `core.registered_nodes`, etc.
according to its nature (e.g. `core.registered_nodes`)
* `core.register_entity(name, entity definition)`
* `core.register_abm(abm definition)`
* `core.register_lbm(lbm definition)`