Garry's Mod

Garry's Mod

MapPatcher Enhanced
This topic has been locked
save compat?
using this to make saves, however i noticed that they don't change per save and are based on maps, this means they won't appear if other people load my save even if they have the addon. is there a file containing the brushes somewhere?

edit: nvm i found the file and it does seem per map, i guess i'll just have to make people download my mp .dat file
Last edited by Dango The Mochi; 14 Apr @ 3:43am
< >
Showing 1-15 of 18 comments
$10,000  [developer] 16 Apr @ 12:35am 
Yes, the addon saves all data in <steam directory>\steamapps\common\GarrysMod\garrysmod\data\mappatcher_enhanced\<name of your current map>.dat
Glad you found this directory, if you have any other questions feel free to ask.
Originally posted by Двигатель шарами:
Yes, the addon saves all data in <steam directory>\steamapps\common\GarrysMod\garrysmod\data\mappatcher_enhanced\<name of your current map>.dat
Glad you found this directory, if you have any other questions feel free to ask.
i do, is it possible to turn the .dat file into an addon that can be subscribed to, so that people don't have to manually download it and insert it into the mappatcher_enhanced file
$10,000  [developer] 23 Apr @ 5:24am 
Sorry for the long reply, I didn't get a notification of your reply. I think I have an idea, I'll check it out today
$10,000  [developer] 23 Apr @ 8:33am 
I was able to make a system where the save files are copied to the user when they subscribe.
I added you as a friend so you can access the addon with this system. You can extract the code from the gma file yourself or I can send it to you any other way.
If there are any problems or questions, write to private messages or this forum
Last edited by $10,000; 23 Apr @ 8:39am
alr ill give it a try
So I tried it and got this error

[MapPatcherDataTest] lua/autorun/init.lua:20: attempt to index local 'f' (a nil value)
1. unknown - lua/autorun/init.lua:20

extracted it and referenced the path directly with the "MOD" search path instead of the addon name, and it did print but didn't copy the dat file into mappatcher_enhanced. srry if i messed something up, i usually only work with Luau


Originally posted by Двигатель шарами:
I was able to make a system where the save files are copied to the user when they subscribe.
I added you as a friend so you can access the addon with this system. You can extract the code from the gma file yourself or I can send it to you any other way.
If there are any problems or questions, write to private messages or this forum
$10,000  [developer] 24 Apr @ 5:34am 
I am so sorry, somehow I messed up and didn't upload the latest version that worked... I'll upload new version soon
$10,000  [developer] 24 Apr @ 6:35am 
I've uploaded a fix, try it, please uninstall and install the addon again just in case.
$10,000  [developer] 24 Apr @ 6:48am 
After you make sure that my test addon works correctly:

How to make your own addon with your .dat files:
1. Extract my addon code, delete the test file in the addon directory /data_static/maps/gm_flatgrass.dat, then upload your files to the same directory.
2. Set the title in the addon.json file with the name of your future addon.
3. Edit the file /lua/autorun/init.lua, write the title of your addon in the addonTitle variable:
local addonTitle = “<Your title>”
4. Create a .gma file and upload to the workshop.
(Files will be written to the /data/mappatcher_enhanced directory when user joins a server (singleplayer or multiplayer)

Be careful, if you change the title on the workshop page, you will need to change the addonTitle variable too.

Feel free to ask any questions if you have them :sans:
Last edited by $10,000; 24 Apr @ 6:50am
Thanks! works like a charm, I'm holding off on uploading it because I haven't actually finished my save file yet. One thing I'm worried about is that the data files will remain even after they've played my save and unsubscribed from the addon (but not mappatcher)
$10,000  [developer] 26 Apr @ 2:51am 
I'm glad it's finally working. Yes, the data files will remain, but that happens with every addon, plus the data files aren't that big to worry about.
$10,000  [developer] 26 Apr @ 3:03am 
And by the way, if you want to update your future addon, keep in mind that the addon will not overwrite files for users who already have those map files in /data/mappatcher_enhanced/.

For example: I subscribed to your addon, started a singleplayer map, and the file /data/mappatcher_enhanced/gm_flatgrass.dat was created. Then you updated the addon with a newer gm_flatgrass.dat file, the addon will not overwrite my local gm_flatgrass.dat file with your new file.

There are a couple ways to solve this situation, please let me know if this is an issue for you.
I did think about that and I added a concmd to remove dat files that are in both the addon and mappatcher_enhanced since I couldn't find a way to remove dat files on game exit.

Either way there could be rare cases where it deletes the user's mpe dat files that aren't related to my addon.

It's a little too much for my smooth brain to comprehend rn so I'm hoping that including some warnings in the addon description about potential issues like this will suffice
$10,000  [developer] 26 Apr @ 4:33pm 
I think your system will work well. I can't think of a simpler and more viable solution.
But if there was a way to know that the user didn't edit the save locally, you could automatically update the .dat file, I think users wouldn't mind it.
Last edited by $10,000; 26 Apr @ 4:35pm
$10,000  [developer] 26 Apr @ 5:10pm 
You could create a /data_static/version.json file and store the maps' version data like this:
{ "maps": { "gm_flatgrass": { "version": "2", "timestamps": { "1": "1745710703", "2": "1745712345" } }, "gm_construct": { "version": "coolversion2025", "timestamps": { "lameversion2024": "1714164903", "coolversion2025": "1745710703" } } } }
Alternative minimal data structure that has the same function:
{ "maps": { "gm_flatgrass": ["1745710703", "1745712345"], "gm_construct": ["1714164903", "1745710703"] } }

You only have to go through all timestamps of a map and if the modify timestamp* of the user's file is not equal to timestamp of any version, then the user has edited the file.
(Don't forget to convert json timestamps to numbers)

(Of course, you will have to change the version file every addon update, but the system should work).

How do you like the idea? I am waiting for your feedback :)

* Use http://wiki.facepunch.com/gmod/file.Time to get file's modify timestamp in unix time
Last edited by $10,000; 26 Apr @ 5:58pm
< >
Showing 1-15 of 18 comments
Per page: 1530 50