Example #1
0
    public void Save()
    {
        if (!isServer)
        {
            return;
        }

        // Save all tile layers to file.
        TileMap.SaveAll();

        // Save the player inventory:
        // This will only save the host's inventory. TODO support other clients saving inventory data.
        InventoryIO.SaveInventory(RealityName);

        // Save current gear held and worn by local player. TODO see above.
        InventoryIO.SaveGear(RealityName, Player.Local);

        // Save currently held item. TODO see above.
        InventoryIO.SaveHolding(RealityName, Player.Local);

        // Save player state (position, health, etc.)
        PlayerIO.SavePlayerState(RealityName, Player.Local);

        // Save all world items to file.
        ItemIO.ItemsToFile(RealityName, GameObject.FindObjectsOfType <Item>());

        // Save placed furniture...
        FurnitureIO.SaveFurniture(RealityName, Furniture.GetAllFurniture());

        // Save the building inventory...
        BuildingIO.SaveBuildingInventory(RealityName, Player.Local);

        // Save the world state to file.
        WorldIO.SaveWorldState(this);
    }