diff --git a/doc.txt b/doc.txt index b4ac743..79be76c 100644 --- a/doc.txt +++ b/doc.txt @@ -2,11 +2,6 @@ =================== DOCUMENTATION =================== ===================================================== 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 === mod_storage:_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 === mod_storage:_officer -- if officer then true, else empty @@ -14,7 +9,6 @@ will support external mods. === mod_storage:_leader -- 's party name === mod_storage:_lock -- join status of party === mod_storage:_home -- home of party -=== mod_storage:_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:partypending -- for request mode parties only, if player sends request to join a party, value is party's leadername @@ -27,4 +21,12 @@ will support external mods. === mod_storage:_squad_leader -- if player is leader, value == squad name === mod_storage:_squad_lock -- join status of squad ----------------------------------------------------- -=== attribute:squadinvite -- if invited, value is inviter's name \ No newline at end of file +=== 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() will return mod_storage:get_string() +party.set_value(, ) will do mod_storage:set_string(, ) +===================================================== \ No newline at end of file diff --git a/init.lua b/init.lua index 5493d24..474dc6f 100644 --- a/init.lua +++ b/init.lua @@ -1056,4 +1056,14 @@ minetest.register_on_leaveplayer(function(player) -- delete invite/join request status when player leaves player:set_attribute("partypending", nil) player:set_attribute("partyinvite", nil) -end) \ No newline at end of file +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 \ No newline at end of file