Khaligufzel / Dimensionfall

A survival game inspired by Cataclysm: Dark Days Ahead and Bright Nights.
MIT License
13 stars 5 forks source link

save load player skills #220

Closed snipercup closed 4 months ago

snipercup commented 4 months ago

Fixes #214

It does what was suggested in the issue. THe json that was saved looks like this:

{
    "head_health": 100,
    "hunger": 0,
    "is_alive": true,
    "left_arm_health": 100,
    "left_leg_health": 100,
    "nutrition": 100,
    "pain": null,
    "right_arm_health": 100,
    "right_leg_health": 100,
    "skills": {
        "archery": {
            "level": 1,
            "xp": 0
        },
        "athletics": {
            "level": 1,
            "xp": 0
        },
        "bashing": {
            "level": 1,
            "xp": 0
        },
        "chemistry": {
            "level": 1,
            "xp": 0
        },
        "computer": {
            "level": 1,
            "xp": 0
        },
        "cooking": {
            "level": 1,
            "xp": 0
        },
        "cutting": {
            "level": 1,
            "xp": 0
        },
        "dodge": {
            "level": 1,
            "xp": 0
        },
        "driving": {
            "level": 1,
            "xp": 0
        },
        "electronics": {
            "level": 1,
            "xp": 0
        },
        "fabrication": {
            "level": 1,
            "xp": 0
        },
        "firstaid": {
            "level": 1,
            "xp": 0
        },
        "gun": {
            "level": 1,
            "xp": 0
        },
        "handguns": {
            "level": 1,
            "xp": 0
        },
        "launcher": {
            "level": 1,
            "xp": 0
        },
        "mechanics": {
            "level": 1,
            "xp": 0
        },
        "melee": {
            "level": 1,
            "xp": 0
        },
        "rifle": {
            "level": 2,
            "xp": 16
        },
        "shotgun": {
            "level": 1,
            "xp": 0
        },
        "smg": {
            "level": 1,
            "xp": 0
        },
        "speech": {
            "level": 1,
            "xp": 0
        },
        "survival": {
            "level": 1,
            "xp": 0
        },
        "swimming": {
            "level": 1,
            "xp": 0
        },
        "tailoring": {
            "level": 1,
            "xp": 0
        },
        "throw": {
            "level": 1,
            "xp": 0
        },
        "trapping": {
            "level": 1,
            "xp": 0
        },
        "unarmed": {
            "level": 1,
            "xp": 0
        }
    },
    "stamina": 100,
    "thirst": 0,
    "torso_health": 100
}

You can see that the rifle skill is at level 2 and 16 xp and it is also loaded as such.