diff options
author | sfan5 <sfan5@live.de> | 2020-10-19 20:38:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-19 20:38:33 +0200 |
commit | 4f2303849e0f929524695a9e3719ec486b47ddd1 (patch) | |
tree | 66286a14f883a77e7d77bc0a6a20ae6470811fbb /src/server/serveractiveobject.h | |
parent | 660115c1abc76f3d4f6a6597ed0c4737465c6c55 (diff) | |
download | minetest-4f2303849e0f929524695a9e3719ec486b47ddd1.tar.gz minetest-4f2303849e0f929524695a9e3719ec486b47ddd1.tar.bz2 minetest-4f2303849e0f929524695a9e3719ec486b47ddd1.zip |
Implement unloading of static_save=false objects according to existing docs (#10485)
Diffstat (limited to 'src/server/serveractiveobject.h')
-rw-r--r-- | src/server/serveractiveobject.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/server/serveractiveobject.h b/src/server/serveractiveobject.h index 927009aef..2764d159e 100644 --- a/src/server/serveractiveobject.h +++ b/src/server/serveractiveobject.h @@ -125,6 +125,7 @@ public: assert(isStaticAllowed()); *result = ""; } + /* Return false in here to never save and instead remove object on unload. getStaticData() will not be called in that case. @@ -132,6 +133,14 @@ public: virtual bool isStaticAllowed() const {return true;} + /* + Return false here to never unload the object. + isStaticAllowed && shouldUnload -> unload when out of active block range + !isStaticAllowed && shouldUnload -> unload when block is unloaded + */ + virtual bool shouldUnload() const + { return true; } + // Returns tool wear virtual u16 punch(v3f dir, const ToolCapabilities *toolcap = nullptr, |