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); }
public void Load() { if (!isServer) { return; } // Load world state from file. WorldIO.LoadWorldState(this); // Load player state (position, health, etc.) PlayerIO.LoadPlayerState(RealityName, Player.Local); // Load all world items to map. ItemIO.FileToWorldItems(RealityName, true); // Load the player inventory. // This will only load the host's inventory. TODO support other clients loading inventory data. InventoryIO.LoadInventory(RealityName); // Save current gear held and worn by local player. TODO see above. InventoryIO.LoadGear(RealityName, Player.Local); // Load currently held item. TODO see above. InventoryIO.LoadHolding(RealityName, Player.Local); // Load furniture... FurnitureIO.LoadFurniture(this); // Load player building inventory... BuildingIO.LoadBuildingInventory(RealityName, Player.Local); // No need to load tile layers, this is done all the time passively. // Call post-load PostLoad(); }