Fixed 2 issues with savemap - #548
NovaAstral wants to merge 2 commits into
Conversation
- Fixed an issue in Savemap where it didn't load from the same file path as it saved to - Fixed an issue in Savemap where it pasted too early on dedicated servers, causing some entities to not spawn at all
| print("[AdvDupe2Notify]\tMap save pasted.") | ||
| end | ||
| hook.Add("InitPostEntity", "AdvDupe2_PasteMap", PasteMap) | ||
| hook.Add("InitPostEntity", "AdvDupe2_PasteMap", timer.Simple(5,PasteMap)) |
There was a problem hiding this comment.
What's the timer for? This is a lua error btw. Should be function() timer.Simple(5, PasteMap) end
There was a problem hiding this comment.
Didn't error for me, timer is to delay the paste because on dedicated servers, trying to paste as soon as the server starts causes many things to not spawn at all
The reason its specifically "5 seconds after the first player joins" is because by default, the server pauses when noone is online, so all timers pause and only start running once a player starts joining the server, and 5 seconds should be enough time for things to be sufficiently unpaused, as it seems 1 second in my testing wasn't enough time for a few things to spawn properly
There was a problem hiding this comment.
What do you mean by "some entities don't spawn at all"? If SENTS register themselves in InitPostEntity or later, it's their fault they register themselves so late
There was a problem hiding this comment.
Its a simple fix, and it doesn't exactly affect anything as players are still going to be loading into the server when everything spawns, so its not exactly an issue I feel, this way gives the most support to addons even if they are made "incorrect" and the only issue is maybe having to wait a few seconds if you use the savemap function on singleplayer
| end | ||
|
|
||
| if(not file.Exists("advdupe2/"..filename..".txt", "DATA"))then | ||
| if(not file.Exists("advdupe2/maps/"..mapname.."/"..filename..".txt", "DATA"))then |
There was a problem hiding this comment.
This should honestly just be "advdupe2/maps/"..mapname..".txt" and have the cvar deleted.
There was a problem hiding this comment.
Methinks some people might want to have multiple different saves for a single map
I think the ideal solution would be to implement some kind of save select system like the normal advdupe2 menu so you dont have to futz around with concommands, but that's out of my depth
There was a problem hiding this comment.
The we keep the cvar, its help text should be updated to specify this format.
There was a problem hiding this comment.
What stops you from just setting your AdvDupe2_MapFileName to something like maps/gm_mymap/mysave.txt
Currently this change simply limits the files that can be used for map saves to the maps/ folder
There was a problem hiding this comment.
Probably not much (Other than it seems to refuse to save files with / in their name), but your change made it so it saves to a different folder than it loads from, so when I tried to use the savemap function in this addon, I thought it was simply broken until I looked at the code, you'd have to move the file to the maps/ folder anyway as it currently is
it saving to the maps/ folder also separates it from normal dupes if someone were to use it on their client for whatever reason.
And I can't think of many reasons why someone would want to use the same save on multiple maps
Maybe a better solution would've been to update the wiki and give the cvar a description, but this way is the most intuitive I feel; save map with name, load save with the same name on the same map
|
I don't see any point in this PR |
it fixes 2 issues? |
|
None of them are issues at all |
|
explain |
Uh oh!
There was an error while loading. Please reload this page.