diff --git a/.gitignore b/.gitignore index dacef3a..fad4562 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,9 @@ whitelist/ .idea venv/ *.json +!win32/.vscode/tasks.json +!linux/.vscode/tasks.json +!darwin/.vscode/tasks.json *.buildings *.trackRecords PPYTHON_PATH diff --git a/README.md b/README.md index 870c58f..85efb4e 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ If you install Panda3D outside the default directory (or use the x86 installer), ## macOS 10.9+ [Panda3D Wheel for macOS 10.9+ (Python3.9, x86_64)](https://drive.google.com/file/d/1_6WJxrkNfwisK5pe5ubJJy1psEp0IIft/view?usp=sharing) -Installing the provided Panda3D wheel requires Python 3.9, which is not installed on your system by default whatsoever. We recommand installing Python 3.9 through [Homebrew](https://brew.sh/) (Make sure that the xcode command line tools are installed first `xcode-select --install`): +Installing the provided Panda3D wheel requires Python 3.9, which is not installed on your system by default whatsoever. We recommend installing Python 3.9 through [Homebrew](https://brew.sh/) (Make sure that the xcode command line tools are installed first `xcode-select --install`): ```shell $ brew install python@3.9 ``` @@ -37,12 +37,12 @@ To start the server and run the game locally, go to your platform directory (`wi `Astron Server -> UberDOG (UD) Server -> AI (District) Server -> Game Client` -Be sure to wait till the servers have finished booting before starting the next. If everything's done correctly, you should be able to make your toon and play the game! There is no support for Magic Words (commands) yet, [but it is currently in the works!](https://github.com/open-toontown/open-toontown/projects/1) +Be sure to wait till the servers have finished booting before starting the next. If done correctly, you should be able to make your toon and play the game! There is no support for Magic Words (commands) yet, [but it is currently in the works!](https://github.com/open-toontown/open-toontown/projects/1) # Contributing Submitting issues and Pull Requests are encouraged and welcome. -How you commit changes is your choice, but when committing, please include what you did as well as a basic description, just so we know exactly what you did. Here are some examples: +How you commit changes is your choice, but please include what you did and a basic description so that we know exactly what was modified. Here are some examples: * `minigames: Fix crash when entering the trolley` * `racing: Fix possible race condition when two racers tied` diff --git a/darwin/.vscode/tasks.json b/darwin/.vscode/tasks.json new file mode 100644 index 0000000..a926aee --- /dev/null +++ b/darwin/.vscode/tasks.json @@ -0,0 +1,47 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "tasks": [ + { + "label": "Darwin - Start Game", + "type": "shell", + "command": "./start-game.sh", + "group": "test", + "presentation": { + "reveal": "always", + "panel": "new" + } + }, + { + "label": "Darwin - Start AI Server", + "type": "shell", + "command": "./start-ai-server.sh", + "group": "test", + "presentation": { + "reveal": "always", + "panel": "new" + } + }, + { + "label": "Darwin - Start Astron Server", + "type": "shell", + "command": "./start-astron-server.sh", + "group": "test", + "presentation": { + "reveal": "always", + "panel": "new" + } + }, + { + "label": "Darwin - Start UberDOG Server", + "type": "shell", + "command": "./start-uberdog-server.sh", + "group": "test", + "presentation": { + "reveal": "always", + "panel": "new" + } + }, + ] +} diff --git a/etc/Configrc.prc b/etc/Configrc.prc index f076914..32c048c 100644 --- a/etc/Configrc.prc +++ b/etc/Configrc.prc @@ -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 diff --git a/linux/.vscode/tasks.json b/linux/.vscode/tasks.json new file mode 100755 index 0000000..3169d73 --- /dev/null +++ b/linux/.vscode/tasks.json @@ -0,0 +1,47 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "tasks": [ + { + "label": "Linux - Start Game", + "type": "shell", + "command": "./start-game.sh", + "group": "test", + "presentation": { + "reveal": "always", + "panel": "new" + } + }, + { + "label": "Linux - Start AI Server", + "type": "shell", + "command": "./start-ai-server.sh", + "group": "test", + "presentation": { + "reveal": "always", + "panel": "new" + } + }, + { + "label": "Linux - Start Astron Server", + "type": "shell", + "command": "./start-astron-server.sh", + "group": "test", + "presentation": { + "reveal": "always", + "panel": "new" + } + }, + { + "label": "Linux - Start UberDOG Server", + "type": "shell", + "command": "./start-uberdog-server.sh", + "group": "test", + "presentation": { + "reveal": "always", + "panel": "new" + } + }, + ] +} diff --git a/linux/start-ai-server.sh b/linux/start-ai-server.sh old mode 100644 new mode 100755 diff --git a/linux/start-astron-server.sh b/linux/start-astron-server.sh old mode 100644 new mode 100755 diff --git a/linux/start-game.sh b/linux/start-game.sh old mode 100644 new mode 100755 diff --git a/linux/start-uberdog-server.sh b/linux/start-uberdog-server.sh old mode 100644 new mode 100755 diff --git a/toontown/ai/ToontownAIRepository.py b/toontown/ai/ToontownAIRepository.py index 6e3ea8b..3fb3f20 100644 --- a/toontown/ai/ToontownAIRepository.py +++ b/toontown/ai/ToontownAIRepository.py @@ -50,6 +50,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): @@ -61,6 +62,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 @@ -111,6 +115,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() @@ -505,3 +512,7 @@ class ToontownAIRepository(ToontownInternalRepository): """ if __astron__: self.toontownFriendsManager.sendRequestSecret(requesterId) + + def setupFiles(self): + if not os.path.exists(self.dataFolder): + os.mkdir(self.dataFolder) diff --git a/toontown/building/DistributedBuildingMgrAI.py b/toontown/building/DistributedBuildingMgrAI.py index 9833900..d506656 100644 --- a/toontown/building/DistributedBuildingMgrAI.py +++ b/toontown/building/DistributedBuildingMgrAI.py @@ -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): diff --git a/toontown/racing/RaceManagerAI.py b/toontown/racing/RaceManagerAI.py index 3626432..b19e54f 100644 --- a/toontown/racing/RaceManagerAI.py +++ b/toontown/racing/RaceManagerAI.py @@ -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: diff --git a/toontown/suit/DistributedSuitPlannerAI.py b/toontown/suit/DistributedSuitPlannerAI.py index f1620a2..3acff76 100644 --- a/toontown/suit/DistributedSuitPlannerAI.py +++ b/toontown/suit/DistributedSuitPlannerAI.py @@ -633,7 +633,7 @@ class DistributedSuitPlannerAI(DistributedObjectAI.DistributedObjectAI, SuitPlan if oldestAge > timeout: self.notify.info('Street %d has %d buildings; reclaiming %0.2f-hour-old building.' % (self.zoneId, len(suitBuildings), oldestAge / 3600.0)) oldest.b_setVictorList([0, 0, 0, 0]) - oldest.updateSavedBy(None) + oldest.updateSavedBy([]) oldest.toonTakeOver() self.__waitForNextUpkeep() return Task.done diff --git a/vscode.code-workspace b/vscode.code-workspace new file mode 100644 index 0000000..18db2f1 --- /dev/null +++ b/vscode.code-workspace @@ -0,0 +1,36 @@ +{ + "folders": [ + { + "name": "Source", + "path": "." + }, + { + "name": "Windows Scripts", + "path": "win32" + }, + { + "name": "Linux Scripts", + "path": "linux" + }, + { + "name": "Darwin Scripts", + "path": "darwin" + } + ], + "settings": { + "files.exclude": { + "**/__pycache__": true, + "**/.idea": true, + "**/.pyc,**/*.pyo,**/*.pyd": true, + "**/*_buildings.json": true, + "**/darwin": true, + "**/errorCode": true, + "**/linux": true, + "**/news": true, + "**/resources": true, + "**/sign": true, + "**/whitelist": true, + "**/win32": true + } + } + } \ No newline at end of file diff --git a/win32/.vscode/tasks.json b/win32/.vscode/tasks.json new file mode 100644 index 0000000..4d60e2f --- /dev/null +++ b/win32/.vscode/tasks.json @@ -0,0 +1,47 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "tasks": [ + { + "label": "Windows - Start Game", + "type": "shell", + "command": "./start_game.bat", + "group": "test", + "presentation": { + "reveal": "always", + "panel": "new" + } + }, + { + "label": "Windows - Start AI Server", + "type": "shell", + "command": "./start_ai_server.bat", + "group": "test", + "presentation": { + "reveal": "always", + "panel": "new" + } + }, + { + "label": "Windows - Start Astron Server", + "type": "shell", + "command": "./start_astron_server.bat", + "group": "test", + "presentation": { + "reveal": "always", + "panel": "new" + } + }, + { + "label": "Windows - Start UberDOG Server", + "type": "shell", + "command": "./start_uberdog_server.bat", + "group": "test", + "presentation": { + "reveal": "always", + "panel": "new" + } + }, + ] + } \ No newline at end of file