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

Rework object attachment handling to fix bugs (#14825)

This commit is contained in:
sfan5 2024-08-12 15:32:18 +02:00 committed by GitHub
parent a0e33ba9ea
commit 85e717fcd1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 245 additions and 172 deletions

View file

@ -85,23 +85,13 @@ void RemoteClient::ResendBlockIfOnWire(v3s16 p)
}
}
LuaEntitySAO *getAttachedObject(PlayerSAO *sao, ServerEnvironment *env)
static LuaEntitySAO *getAttachedObject(PlayerSAO *sao, ServerEnvironment *env)
{
if (!sao->isAttached())
return nullptr;
ServerActiveObject *ao = sao;
while (ao->getParent())
ao = ao->getParent();
int id;
std::string bone;
v3f dummy;
bool force_visible;
sao->getAttachment(&id, &bone, &dummy, &dummy, &force_visible);
ServerActiveObject *ao = env->getActiveObject(id);
while (id && ao) {
ao->getAttachment(&id, &bone, &dummy, &dummy, &force_visible);
if (id)
ao = env->getActiveObject(id);
}
return dynamic_cast<LuaEntitySAO *>(ao);
return ao == sao ? nullptr : dynamic_cast<LuaEntitySAO*>(ao);
}
void RemoteClient::GetNextBlocks (