JimmyCushnie / JECS

Jimmy's Epic Config System
Do What The F*ck You Want To Public License
154 stars 16 forks source link

Allow base types to be loaded when serialized as a complex type #26

Closed JimmyCushnie closed 4 years ago

JimmyCushnie commented 4 years ago

Consider the following type.

struct Color
{
    public byte r;
    public byte g;
    public byte b;
}

If we save it as SUCC, it will look something like this:

color:
    r: 120
    g: 142
    b: 69

Now suppose later we make Color a base type, saving and loading it as a hex code:

color: 788e45

At this point, SUCC will be unable to load the first example, as base types must ALWAYS be saved and loaded as their single-line value.

Proposal: if SUCC tries to load a node as a base type, and that node has child nodes, SUCC should treat the base type as a complex type.

JimmyCushnie commented 4 years ago

Also: if a node has a value and no children, but it fails to load as a base type, try loading it using complex type shortcuts.

JimmyCushnie commented 4 years ago

Added this feature in 97b6974 :D not sure why it didn't automatically close the issue.