Make client-side NPC collisionPoly override opt-in

This commit is contained in:
Kae 2023-07-29 00:49:38 +10:00
parent f2afd91d0f
commit 5c650d7809

View File

@ -254,6 +254,7 @@ RectF Npc::collisionArea() const {
pair<ByteArray, uint64_t> Npc::writeNetState(uint64_t fromVersion) { pair<ByteArray, uint64_t> Npc::writeNetState(uint64_t fromVersion) {
// client-side npcs error nearby vanilla NPC scripts because callScriptedEntity // client-side npcs error nearby vanilla NPC scripts because callScriptedEntity
// for now, scrungle the collision poly to avoid their queries. hacky :( // for now, scrungle the collision poly to avoid their queries. hacky :(
if (m_npcVariant.overrides.getBool("overrideNetPoly", false)) {
if (auto mode = entityMode()) { if (auto mode = entityMode()) {
if (*mode == EntityMode::Master && connectionForEntity(entityId()) != ServerConnectionId) { if (*mode == EntityMode::Master && connectionForEntity(entityId()) != ServerConnectionId) {
PolyF poly = m_movementController->collisionPoly(); PolyF poly = m_movementController->collisionPoly();
@ -263,6 +264,7 @@ pair<ByteArray, uint64_t> Npc::writeNetState(uint64_t fromVersion) {
return result; return result;
} }
} }
}
return m_netGroup.writeNetState(fromVersion); return m_netGroup.writeNetState(fromVersion);
} }