-- [ʞ] store.lua
-- ~ lexi hale <lexi@hale.su>
-- © EUPLv1.2
-- ? defines serialization datatypes that don't belong to
-- any individual class
local lib = starlit.mod.lib
local T,G = lib.marshal.t, lib.marshal.g
starlit.store = {} -- the serialization equivalent of .type
-------------
-- persona --
------------- -----------------------------------------------
-- a Persona is a structure that defines the nature of --
-- an (N)PC and how it interacts with the Starsoul-managed --
-- portion of the game world -- things like name, species, --
-- stat values, physical characteristics, and so forth --
local statStructFields = {}
for k,v in pairs(starlit.world.stats) do
statStructFields[k] = v.srzType or (
(v.base == true or v.base > 0) and T.s16 or T.u16
)
end
starlit.store.compilerJob = G.struct {
schematic = T.str;
progress = T.clamp;
}
starlit.store.persona = G.struct {
name = T.str;
species = T.str;
speciesVariant = T.str;
background = T.str;
bodyParams = G.array(8, G.struct {id = T.str, value = T.str}); --variant
statDeltas = G.struct(statStructFields);
facts = G.array(32, G.array(8, T.str));
-- facts stores information the player has discovered and narrative choices
-- she has made.
-- parametric facts are encoded as horn clauses
-- non-parametric facts are encoded as {'fact-mod:fact-id'}
}
starlit.store.suitMeta = lib.marshal.metaStore {
batteries = {key = 'starlit:suit_slots_bat', type = T.inventoryList};
chips = {key = 'starlit:suit_slots_chips', type = T.inventoryList};
elements = {key = 'starlit:suit_slots_elem', type = T.inventoryList};
guns = {key = 'starlit:suit_slots_gun', type = T.inventoryList};
ammo = {key = 'starlit:suit_slots_ammo', type = T.inventoryList};
}