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:
parent
a0e33ba9ea
commit
85e717fcd1
17 changed files with 245 additions and 172 deletions
|
@ -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 (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue