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:
@@ -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())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user