-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[no squash] Optimizations and code quality improvements #83
[no squash] Optimizations and code quality improvements #83
Conversation
Other than what I've commented on, I will apply those suggestions later. |
This eliminates the need of iterating the whole list for every protection operations. Note that the highest index isn't cached, i.e. the first or few (if there are many holes) operations would still suffer from the lag.
f83466e
to
c3c094a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good in general; only a few minor remarks.
c3c094a
to
b54f62e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✔ Area protection works
✔ ID counter works (gaps are filled after a server restart)
✔ Markers do spawn and are removed correctly
✔ Async area saving works
✘ Backwards compatibility does not work (see comment)
On newer Minetest servers, handles saving jobs in async environment. To prevent conflicts, the save file is locked whie saving, and if a code requests saving while the file is locked, data is saved again immediately after finishing the current save.
startTime is not used anywhere else, so localizing it makes sense and saves memory.
This may add lag, but stops saving entities (which lua_api.md discourages). This also eliminates areas.markPos{1,2} (which seemed to be internal) and integrates areas:setPos{1,2} with such function.
Merges "pos1" and "pos1only" into the same code.
b54f62e
to
a90e4f0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works. Will merge in a few days unless there are objections.
This PR optimizes some parts and improves code quality by following
lua_api.md
recommendations.Check individual commits for what this PR does and why the changes are made.
For "Prevent saving entities": Due to how
static_save = false
works, old entities may linger but disappear after punching them or restarting the server again.This PR is ready for review.