Add support for external mods to obtain and set mod storage values in this mod
See doc.txt for more information
This commit is contained in:
parent
dd3f79c199
commit
5ce96cc22e
14
doc.txt
14
doc.txt
@ -2,11 +2,6 @@
|
|||||||
=================== DOCUMENTATION ===================
|
=================== DOCUMENTATION ===================
|
||||||
=====================================================
|
=====================================================
|
||||||
This document list how the mod stores information.
|
This document list how the mod stores information.
|
||||||
|
|
||||||
Note that mod storage values cannot be obtainable
|
|
||||||
outside of this mod, an attribute counterpart will
|
|
||||||
eventually be added to the important values so it
|
|
||||||
will support external mods.
|
|
||||||
===================================================== PARTY
|
===================================================== PARTY
|
||||||
=== mod_storage:<playername>_party -- player's leadername -- rather than the actual party name, this value is the leadername because it makes it easier to obtain values below with <leadername>
|
=== mod_storage:<playername>_party -- player's leadername -- rather than the actual party name, this value is the leadername because it makes it easier to obtain values below with <leadername>
|
||||||
=== mod_storage:<playername>_officer -- if officer then true, else empty
|
=== mod_storage:<playername>_officer -- if officer then true, else empty
|
||||||
@ -14,7 +9,6 @@ will support external mods.
|
|||||||
=== mod_storage:<leadername>_leader -- <leader>'s party name
|
=== mod_storage:<leadername>_leader -- <leader>'s party name
|
||||||
=== mod_storage:<leadername>_lock -- join status of party <empty/active/request/private>
|
=== mod_storage:<leadername>_lock -- join status of party <empty/active/request/private>
|
||||||
=== mod_storage:<leadername>_home -- home of party <empty/active/request/private>
|
=== mod_storage:<leadername>_home -- home of party <empty/active/request/private>
|
||||||
=== mod_storage:<leadername>_colour -- colour of partytag, might return a nonsensical colour because there are no checks to ensure it is a real colour
|
|
||||||
-----------------------------------------------------
|
-----------------------------------------------------
|
||||||
=== attribute:partyinvite -- if invited, value is inviter's name
|
=== attribute:partyinvite -- if invited, value is inviter's name
|
||||||
=== attribute:partypending -- for request mode parties only, if player sends request to join a party, value is party's leadername
|
=== attribute:partypending -- for request mode parties only, if player sends request to join a party, value is party's leadername
|
||||||
@ -28,3 +22,11 @@ will support external mods.
|
|||||||
=== mod_storage:<playername>_squad_lock -- join status of squad <empty/private>
|
=== mod_storage:<playername>_squad_lock -- join status of squad <empty/private>
|
||||||
-----------------------------------------------------
|
-----------------------------------------------------
|
||||||
=== attribute:squadinvite -- if invited, value is inviter's name
|
=== attribute:squadinvite -- if invited, value is inviter's name
|
||||||
|
===================================================== OBTAINING MOD STORAGE VALUES
|
||||||
|
Mod storage values are local to this mod.
|
||||||
|
But global functions are added for you to obtain and set values.
|
||||||
|
Refer to the list above for a list of values obtainable.
|
||||||
|
|
||||||
|
party.get_value(<valuename>) will return mod_storage:get_string(<valuename>)
|
||||||
|
party.set_value(<valuename>, <newvalue>) will do mod_storage:set_string(<valuename>, <newvalue>)
|
||||||
|
=====================================================
|
10
init.lua
10
init.lua
@ -1057,3 +1057,13 @@ minetest.register_on_leaveplayer(function(player)
|
|||||||
player:set_attribute("partypending", nil)
|
player:set_attribute("partypending", nil)
|
||||||
player:set_attribute("partyinvite", nil)
|
player:set_attribute("partyinvite", nil)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
||||||
|
-- register some global functions to allow external mods to obtain and set mod storage values
|
||||||
|
party.get_value = function(value)
|
||||||
|
return mod_storage:get_string(value)
|
||||||
|
end
|
||||||
|
|
||||||
|
party.set_value = function(value, newvalue)
|
||||||
|
mod_storage:set_string(value, newvalue)
|
||||||
|
end
|
Loading…
x
Reference in New Issue
Block a user