1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-06 17:41:04 +00:00

Add persistent unique identifiers for objects (#14135)

This commit is contained in:
sfence 2025-07-09 10:40:26 +02:00 committed by GitHub
parent e0f8243629
commit 4f42b4308c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 257 additions and 19 deletions

View file

@ -5811,6 +5811,8 @@ Utilities
remove_item_match_meta = true,
-- The HTTP API supports the HEAD and PATCH methods (5.12.0)
httpfetch_additional_methods = true,
-- objects have get_guid method (5.13.0)
object_guids = true,
}
```
@ -7861,8 +7863,12 @@ Global tables
* Values in this table may be modified directly.
Note: changes to initial properties will only affect entities spawned afterwards,
as they are only read when spawning.
* `core.objects_by_guid`
* Map of active object references, indexed by object GUID
* `core.object_refs`
* Map of object references, indexed by active object id
* **Obsolete:** Use `core.objects_by_guid` instead.
GUIDs are strictly more useful than active object IDs.
* Map of active object references, indexed by active object id
* `core.luaentities`
* Map of Lua entities, indexed by active object id
* `core.registered_abms`
@ -8560,6 +8566,14 @@ child will follow movement and rotation of that bone.
-- Default: false
}
```
* `get_guid()`: returns a global unique identifier (a string)
* For players, this is a player name.
* For Lua entities, this is a uniquely generated string, guaranteed not to collide with player names.
* example: `@bGh3p2AbRE29Mb4biqX6OA`
* GUIDs only use printable ASCII characters.
* GUIDs persist between object reloads, and their format is guaranteed not to change.
Thus you can use the GUID to identify an object in a particular world online and offline.
#### Lua entity only (no-op for other objects)