Datastore not loading

Status
Not open for further replies.

coersum

Plugin Developer
Plugin Developer
Oct 9, 2014
77
5
8
47
Parts Unknown
I hope I am posting this in the right section... since I started I have always had this problem and no idea what it could come from. Whenever I add something to DataStore, if I stop the server then start it again, that data is not loading (I use server.stop or quit to stop the server).

I made a simple test to see:
Python:
__author__ = 'Coersum'
__version__ = '1.0'
import clr
import sys
clr.AddReferenceByPartialName("UnityEngine")
clr.AddReferenceByPartialName("Pluton")
import UnityEngine
import Pluton


class testDS:
    def On_Command(self, cmd):
        if cmd.cmd == "adddata":
            cmd.User.Message("Adding data to DataStore")
            DataStore.Add("data_test", cmd.User.GameID, "this is data")
            if DataStore.ContainsKey("data_test", cmd.User.GameID):
                cmd.User.Message("Data was added successfully")
            else:
                cmd.User.Message("Data was not added...somehow")

        if cmd.cmd == "getdata":
            if DataStore.ContainsKey("data_test", cmd.User.GameID):
                cmd.User.Message("Data: " + DataStore.Get("data_test", cmd.User.GameID))
            else:
                cmd.User.Message("Data: not found!")

If I run /adddata in game, I get:

Adding data to DataStore
Data was added correctly

Then I run /getdata and I get:

Data: this is data
(which is correct and working great!)

Now if I stop the server, start it again and run /getdata I get:

Data: not found!

To make things worse, I know it was store, here is the PlutonDatastore.ds file:
Code:
    ÿÿÿÿ         System.Collections.Hashtable  
LoadFactorVersionComparerHashSizeKeysValuesequalityComparer    @?  
             
          data_test                 @?  
             
    2WÒ       this is data
So I know it's saved correctly...
 

xEnt

Retired Staff
Retired Staff
Sep 6, 2014
48
17
8
when loading the server, in the server console do you see 'DataStore Loaded from <path>" ?
 

coersum

Plugin Developer
Plugin Developer
Oct 9, 2014
77
5
8
47
Parts Unknown
No, the only loading in server console is the "Loading Save From server/myserver/etc...

Toward the top, I see one:
NullReferenceException: Object Reference not set to an instance of an object

I tried a fresh install of the server and moved files, patched ect and still same.
Trying on a different computer.
 

coersum

Plugin Developer
Plugin Developer
Oct 9, 2014
77
5
8
47
Parts Unknown
Looking in the output.txt file in the /server/Release/ folder where the .bat and RustDedicated.exe files are, I found:

DataStore Loaded from D:\RustServer\server\Release\server\myserver\Pluton\ServerData.ds
There are 2 .ds files in the Pluton folder: PlutonDataStore.ds and ServerData.ds

Is there a problem
 

coersum

Plugin Developer
Plugin Developer
Oct 9, 2014
77
5
8
47
Parts Unknown
Thank you! I still had the same problem while only doing a svn update, so I downloaded the zip instead and it worked... weird

I had tried a total reinstall of game/pluton.zip before your change and it didn't work so I know the change you made is what fixed it!

One thing I noticed.. if you use quit or server.stop, it doesn't save players position or inventory, the last Save stats in the console is where we go back to.

IE1: move around, get stuff in your inventory, use quit or server.stop just after a save shows up in console... everything is there and you respawn at the same spot with same inventory.
IE2: after an auto console save, get stuff in your inventory/move and use quit or server.stop before the next save, you will go back to where you where at the previous save.

I don't know if it was setup to work, I didn't notice that before... but never looked for it either. I didn't know stopping the server by hand meant not saving players too
 
Status
Not open for further replies.