Changeset View
Changeset View
Standalone View
Standalone View
source/simulation2/components/CCmpPosition.cpp
Show First 20 Lines • Show All 303 Lines • ▼ Show 20 Lines | public: | ||||
virtual std::set<entity_id_t>* GetTurrets() | virtual std::set<entity_id_t>* GetTurrets() | ||||
{ | { | ||||
return &m_Turrets; | return &m_Turrets; | ||||
} | } | ||||
virtual void SetTurretParent(entity_id_t id, const CFixedVector3D& offset) | virtual void SetTurretParent(entity_id_t id, const CFixedVector3D& offset) | ||||
{ | { | ||||
entity_angle_t angle = GetRotation().Y; | |||||
if (m_TurretParent != INVALID_ENTITY) | if (m_TurretParent != INVALID_ENTITY) | ||||
{ | { | ||||
CmpPtr<ICmpPosition> cmpPosition(GetSimContext(), m_TurretParent); | CmpPtr<ICmpPosition> cmpPosition(GetSimContext(), m_TurretParent); | ||||
if (cmpPosition) | if (cmpPosition) | ||||
cmpPosition->GetTurrets()->erase(GetEntityId()); | cmpPosition->GetTurrets()->erase(GetEntityId()); | ||||
} | } | ||||
m_TurretParent = id; | m_TurretParent = id; | ||||
m_TurretPosition = offset; | m_TurretPosition = offset; | ||||
if (m_TurretParent != INVALID_ENTITY) | if (m_TurretParent != INVALID_ENTITY) | ||||
{ | { | ||||
CmpPtr<ICmpPosition> cmpPosition(GetSimContext(), m_TurretParent); | CmpPtr<ICmpPosition> cmpPosition(GetSimContext(), m_TurretParent); | ||||
if (cmpPosition) | if (cmpPosition) | ||||
cmpPosition->GetTurrets()->insert(GetEntityId()); | cmpPosition->GetTurrets()->insert(GetEntityId()); | ||||
} | } | ||||
SetYRotation(angle); | |||||
UpdateTurretPosition(); | UpdateTurretPosition(); | ||||
} | } | ||||
virtual entity_id_t GetTurretParent() const | virtual entity_id_t GetTurretParent() const | ||||
{ | { | ||||
return m_TurretParent; | return m_TurretParent; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 644 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator