mirror of
https://github.com/rollerozxa/voxelmanip-wiki
synced 2024-05-05 08:01:02 -07:00
PlayerMetaData: edit
This commit is contained in:
parent
710f4c89d7
commit
40ff7bb7c5
@ -2,27 +2,17 @@ PlayerMetaData is a per-world, per-player persistent string key-value store impl
|
||||
|
||||
The granularity of the persisted snapshots is determined by the `map_save_interval` setting.
|
||||
|
||||
NOTE: Since PlayerMetaData is shared across all mods,
|
||||
it is considered good practice to prefix the keys set by your mod with your mod name plus a delimiter
|
||||
such as `:` to avoid collisions: The `score` field of a quest mod and a mobs mod f.E. might
|
||||
be called `fancy_quests:score` and `fancy_mobs:score` respectively.
|
||||
NOTE: Since PlayerMetaData is shared across all mods, it is considered good practice to prefix the keys set by your mod with your mod name plus a delimiter such as `:` to avoid collisions: The `score` field of a quest mod and a mobs mod f.E. might be called `fancy_quests:score` and `fancy_mobs:score` respectively.
|
||||
|
||||
## `player:get_meta()`
|
||||
Used to obtain a mutable PlayerMetaData reference.
|
||||
|
||||
### Arguments
|
||||
**Arguments:**
|
||||
- `player`: A valid Player object
|
||||
|
||||
NOTE: Minetest requiring a valid `player` object means PlayerMetaData is only accessible
|
||||
while players are online; if you need per-player storage while players are offline,
|
||||
you can use ModStorage and save either a serialized table per-player or concatenate
|
||||
the keys of the per-player entries with the playername using a delimiter.
|
||||
Reusing the above example, `fancy_quests:score` might be stored as `<playername>:score`
|
||||
or as key-value pair with key `<playername>` and value `minetest.write_json{score = ...}`
|
||||
(or `minetest.serialize`) in ModStorage.
|
||||
NOTE: Minetest requiring a valid `player` object means PlayerMetaData is only accessible while players are online; if you need per-player storage while players are offline, you can use ModStorage and save either a serialized table per-player or concatenate the keys of the per-player entries with the playername using a delimiter. Reusing the above example, `fancy_quests:score` might be stored as `<playername>:score` or as key-value pair with key `<playername>` and value `minetest.write_json{score = ...}` (or `minetest.serialize`) in ModStorage.
|
||||
|
||||
A [feature request](https://github.com/minetest/minetest/issues/6193)
|
||||
to make PlayerMetaData available for offline players exists;
|
||||
A [feature request](https://github.com/minetest/minetest/issues/6193) to make PlayerMetaData available for offline players exists;
|
||||
|
||||
### Returns
|
||||
**Returns:**
|
||||
- `meta` - PlayerMetaData: Public & shared PlayerMetaData object for the player
|
Loading…
x
Reference in New Issue
Block a user