Manually Save

This commit is contained in:
Noah committed 2022-05-16 00:16:46 +02:00
1 parent 46b68c71c9
commit 768f259d24
6 files changed
+852 -7

No files matched your search

+7
View File
@@ -46,6 +46,7 @@ public class Server
//[0] = 6: player ready
//[0] = 7: player position update
//[0] = 8: player rotation update
//[0] = 9: Save the World
private void Receive()
{
@@ -242,6 +243,12 @@ public class Server
}
}
}
//Save the World
if (data[0] == 9)
{
world.SaveWorld();
}
}
catch (Exception e)
{
+2 -2
View File
@@ -276,12 +276,12 @@ public class World : MonoBehaviour
private void OnApplicationQuit()
{
//SaveWorld();
SaveWorld();
server.Disconnect();
}
private void SaveWorld()
public void SaveWorld()
{
StreamWriter writer = new StreamWriter(Application.dataPath + "\\save.world", false);
for (int xChunk = 0; xChunk < worldSize; xChunk++)