1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Implement unloading of static_save=false objects according to existing docs (#10485)

This commit is contained in:
sfan5 2020-10-19 20:38:33 +02:00 committed by GitHub
parent 660115c1ab
commit 4f2303849e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 3 deletions

View file

@ -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,