Merge pull request #43 from NathanX-S/nathan-dev

general: "server-data-folder" config fixed
This commit is contained in:
John Cote 2021-08-01 20:13:15 -04:00 committed by GitHub
commit ed9ce47304
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 4 deletions

View file

@ -96,3 +96,4 @@ early-event-sphere 1
accept-clock-skew 1
text-minfilter linear_mipmap_linear
gc-save-all 0
server-data-folder data

View file

@ -49,6 +49,7 @@ from toontown.suit.SuitInvasionManagerAI import SuitInvasionManagerAI
from toontown.toon import NPCToons
from toontown.toonbase import ToontownGlobals
from toontown.uberdog.DistributedInGameNewsMgrAI import DistributedInGameNewsMgrAI
import os
class ToontownAIRepository(ToontownInternalRepository):
@ -60,6 +61,9 @@ class ToontownAIRepository(ToontownInternalRepository):
self.doLiveUpdates = config.GetBool('want-live-updates', True)
self.wantCogdominiums = config.GetBool('want-cogdominiums', True)
self.useAllMinigames = config.GetBool('want-all-minigames', True)
self.dataFolder = config.GetString('server-data-folder', '')
if self.dataFolder:
self.dataFolder = self.dataFolder + '/'
self.districtId = None
self.district = None
self.districtStats = None
@ -107,6 +111,9 @@ class ToontownAIRepository(ToontownInternalRepository):
self.notify.info('Declaring ownership...')
self.district.setAI(self.ourChannel)
# Setup necessary files and things.
self.setupFiles()
# Create our local objects.
self.notify.info('Creating local objects...')
self.createLocals()
@ -461,3 +468,7 @@ class ToontownAIRepository(ToontownInternalRepository):
def trueUniqueName(self, idString):
return self.uniqueName(idString)
def setupFiles(self):
if not os.path.exists(self.dataFolder):
os.mkdir(self.dataFolder)

View file

@ -11,7 +11,6 @@ import time, random
class DistributedBuildingMgrAI:
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedBuildingMgrAI')
serverDatafolder = simbase.config.GetString('server-data-folder', '')
def __init__(self, air, branchID, dnaStore, trophyMgr):
self.branchID = branchID
@ -231,7 +230,7 @@ class DistributedBuildingMgrAI:
return building
def getFileName(self):
f = '%s%s_%d_buildings.json' % (self.serverDatafolder, self.shard, self.branchID)
f = '%s%s_%d_buildings.json' % (self.air.dataFolder, self.shard, self.branchID)
return f
def saveTo(self, file):

View file

@ -9,7 +9,6 @@ import os, pickle
class RaceManagerAI(DirectObject.DirectObject):
notify = DirectNotifyGlobal.directNotify.newCategory('RaceManagerAI')
serverDataFolder = simbase.config.GetString('server-data-folder', '')
def __init__(self, air):
DirectObject.DirectObject.__init__(self)
@ -620,7 +619,7 @@ class RaceManagerAI(DirectObject.DirectObject):
self.notify.warning(str(sys.exc_info()[1]))
def getFilename(self):
return '%s%s.trackRecords' % (self.serverDataFolder, self.shard)
return '%s%s.trackRecords' % (self.air.dataFolder, self.shard)
def loadRecords(self):
try: