1
0
forked from mirrors/0ad

Allow actors to override the entity's anchor type

Optionally let actor templates define their own anchor types.
These override the default value defined in the template.
Useful for actors without their own entity template.

Reviewed-By: Itms
Reviewed-On: https://gitea.wildfiregames.com/0ad/0ad/pulls/7542
This commit is contained in:
Vantha
2025-01-23 21:47:26 +01:00
committed by Nicolas Auvray
parent 0ce889ca6d
commit eb2f59eeaa
8 changed files with 67 additions and 22 deletions
@@ -464,7 +464,7 @@ public:
if (!m_Unit || !m_Unit->GetAnimation() || !m_Unit->GetID())
return;
m_Unit->GetAnimation()->SetAnimationState(m_AnimName, m_AnimOnce, m_AnimSpeed.ToFloat(), m_AnimDesync.ToFloat(), m_SoundGroup.c_str());
m_Unit->GetAnimation()->SetAnimationState(m_AnimName, m_AnimOnce, m_AnimSpeed.ToFloat(), m_AnimDesync.ToFloat(), m_SoundGroup.c_str());
}
void SelectMovementAnimation(const std::string& name, fixed speed) override
@@ -638,10 +638,15 @@ void CCmpVisualActor::InitModel()
model.ToCModelDecal()->RemoveShadowsReceive();
}
CStr anchor = m_Unit->GetObject().m_Base->m_Properties.m_AnchorType;
bool floating = m_Unit->GetObject().m_Base->m_Properties.m_FloatOnWater;
CmpPtr<ICmpPosition> cmpPosition(GetEntityHandle());
if (cmpPosition)
{
if (!anchor.empty())
cmpPosition->SetActorAnchor(anchor);
cmpPosition->SetActorFloating(floating);
}
if (!m_ModelTag.valid())
{