Skip to content

Fixed 2 issues with savemap - #548

Closed
NovaAstral wants to merge 2 commits into
wiremod:masterfrom
NovaAstral:master
Closed

NovaAstral wants to merge 2 commits into
wiremod:masterfrom
NovaAstral:master

Conversation

@NovaAstral

@NovaAstral NovaAstral commented Jul 19, 2026

Copy link
Copy Markdown
  • Fixed an issue in Savemap caused by PR Fixed/improved map save #521 where it didn't load from the same file path as it saved to, causing confusion about the function not working at all, This also caused it to load the same file on every map
  • Fixed an issue in Savemap where it pasted too early on dedicated servers, causing some entities to not spawn at all, now it will only start spawning 5 seconds after the first player joins the server (5 seconds in my testing is enough time to allow all entities to spawn properly, some don't at only 1 second)

- 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
Comment thread lua/autorun/server/advdupe2_sv_init.lua Outdated
print("[AdvDupe2Notify]\tMap save pasted.")
end
hook.Add("InitPostEntity", "AdvDupe2_PasteMap", PasteMap)
hook.Add("InitPostEntity", "AdvDupe2_PasteMap", timer.Simple(5,PasteMap))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the timer for? This is a lua error btw. Should be function() timer.Simple(5, PasteMap) end

@NovaAstral NovaAstral Jul 20, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@NovaAstral NovaAstral Jul 22, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should honestly just be "advdupe2/maps/"..mapname..".txt" and have the cvar deleted.

@NovaAstral NovaAstral Jul 20, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The we keep the cvar, its help text should be updated to specify this format.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@NovaAstral NovaAstral Jul 22, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@Astralcircle

Copy link
Copy Markdown
Member

I don't see any point in this PR

@0x57e11a

Copy link
Copy Markdown

I don't see any point in this PR

it fixes 2 issues?

@Astralcircle

Copy link
Copy Markdown
Member

None of them are issues at all

@0x57e11a

Copy link
Copy Markdown

explain

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants