mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-10-18 21:38:08 +00:00
working basic behaviors
This commit is contained in:
@@ -16,7 +16,7 @@ ModelComponent::ModelComponent(Entity* parent) : Component(parent) {
|
||||
m_OriginalPosition = m_Parent->GetDefaultPosition();
|
||||
m_OriginalRotation = m_Parent->GetDefaultRotation();
|
||||
m_IsPaused = false;
|
||||
m_IsPickable = false;
|
||||
m_NumListeningInteract = 0;
|
||||
|
||||
m_userModelID = m_Parent->GetVarAs<LWOOBJID>(u"userModelID");
|
||||
RegisterMsg(MessageType::Game::REQUEST_USE, this, &ModelComponent::OnRequestUse);
|
||||
@@ -79,7 +79,7 @@ void ModelComponent::Serialize(RakNet::BitStream& outBitStream, bool bIsInitialU
|
||||
|
||||
//actual model component:
|
||||
outBitStream.Write1(); // Yes we are writing model info
|
||||
outBitStream.Write(m_IsPickable); // Is pickable
|
||||
outBitStream.Write(m_NumListeningInteract > 0); // Is pickable
|
||||
outBitStream.Write<uint32_t>(2); // Physics type
|
||||
outBitStream.Write(m_OriginalPosition); // Original position
|
||||
outBitStream.Write(m_OriginalRotation); // Original rotation
|
||||
@@ -158,3 +158,16 @@ std::array<std::pair<int32_t, std::string>, 5> ModelComponent::GetBehaviorsForSa
|
||||
}
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
void ModelComponent::AddInteract() {
|
||||
LOG("adding interact %i", m_NumListeningInteract);
|
||||
m_Dirty = true;
|
||||
m_NumListeningInteract++;
|
||||
}
|
||||
|
||||
void ModelComponent::RemoveInteract() {
|
||||
DluAssert(m_NumListeningInteract > 0);
|
||||
LOG("Removing interact %i", m_NumListeningInteract);
|
||||
m_Dirty = true;
|
||||
m_NumListeningInteract--;
|
||||
}
|
||||
|
@@ -119,7 +119,8 @@ public:
|
||||
|
||||
const std::vector<PropertyBehavior>& GetBehaviors() const { return m_Behaviors; };
|
||||
|
||||
void SetIsPickable(bool pickable) { m_Dirty = m_IsPickable == pickable; m_IsPickable = pickable; }
|
||||
void AddInteract();
|
||||
void RemoveInteract();
|
||||
|
||||
void Pause() { m_Dirty = true; m_IsPaused = true; }
|
||||
|
||||
@@ -127,7 +128,7 @@ public:
|
||||
private:
|
||||
bool m_Dirty{};
|
||||
|
||||
bool m_IsPickable{};
|
||||
uint32_t m_NumListeningInteract{};
|
||||
|
||||
bool m_IsPaused{};
|
||||
/**
|
||||
|
Reference in New Issue
Block a user