mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-09 20:24:16 +00:00
format codebase
This commit is contained in:
@@ -13,8 +13,7 @@ BouncerComponent::BouncerComponent(Entity* parent) : Component(parent) {
|
||||
m_PetBouncerEnabled = false;
|
||||
m_PetSwitchLoaded = false;
|
||||
|
||||
if (parent->GetLOT() == 7625)
|
||||
{
|
||||
if (parent->GetLOT() == 7625) {
|
||||
LookupPetSwitch();
|
||||
}
|
||||
}
|
||||
@@ -22,68 +21,56 @@ BouncerComponent::BouncerComponent(Entity* parent) : Component(parent) {
|
||||
BouncerComponent::~BouncerComponent() {
|
||||
}
|
||||
|
||||
void BouncerComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags){
|
||||
void BouncerComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) {
|
||||
outBitStream->Write(m_PetEnabled);
|
||||
if (m_PetEnabled) {
|
||||
outBitStream->Write(m_PetBouncerEnabled);
|
||||
}
|
||||
}
|
||||
|
||||
Entity* BouncerComponent::GetParentEntity() const
|
||||
{
|
||||
Entity* BouncerComponent::GetParentEntity() const {
|
||||
return m_Parent;
|
||||
}
|
||||
|
||||
void BouncerComponent::SetPetEnabled(bool value)
|
||||
{
|
||||
void BouncerComponent::SetPetEnabled(bool value) {
|
||||
m_PetEnabled = value;
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
}
|
||||
|
||||
void BouncerComponent::SetPetBouncerEnabled(bool value)
|
||||
{
|
||||
void BouncerComponent::SetPetBouncerEnabled(bool value) {
|
||||
m_PetBouncerEnabled = value;
|
||||
|
||||
GameMessages::SendBouncerActiveStatus(m_Parent->GetObjectID(), value, UNASSIGNED_SYSTEM_ADDRESS);
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
|
||||
if (value)
|
||||
{
|
||||
if (value) {
|
||||
GameMessages::SendPlayFXEffect(m_Parent->GetObjectID(), 1513, u"create", "PetOnSwitch", LWOOBJID_EMPTY, 1, 1, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
GameMessages::SendStopFXEffect(m_Parent, true, "PetOnSwitch");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool BouncerComponent::GetPetEnabled() const
|
||||
{
|
||||
bool BouncerComponent::GetPetEnabled() const {
|
||||
return m_PetEnabled;
|
||||
}
|
||||
|
||||
bool BouncerComponent::GetPetBouncerEnabled() const
|
||||
{
|
||||
bool BouncerComponent::GetPetBouncerEnabled() const {
|
||||
return m_PetBouncerEnabled;
|
||||
}
|
||||
|
||||
void BouncerComponent::LookupPetSwitch()
|
||||
{
|
||||
void BouncerComponent::LookupPetSwitch() {
|
||||
const auto& groups = m_Parent->GetGroups();
|
||||
|
||||
for (const auto& group : groups)
|
||||
{
|
||||
for (const auto& group : groups) {
|
||||
const auto& entities = EntityManager::Instance()->GetEntitiesInGroup(group);
|
||||
|
||||
for (auto* entity : entities)
|
||||
{
|
||||
for (auto* entity : entities) {
|
||||
auto* switchComponent = entity->GetComponent<SwitchComponent>();
|
||||
|
||||
if (switchComponent != nullptr)
|
||||
{
|
||||
if (switchComponent != nullptr) {
|
||||
switchComponent->SetPetBouncer(this);
|
||||
|
||||
m_PetSwitchLoaded = true;
|
||||
@@ -96,12 +83,11 @@ void BouncerComponent::LookupPetSwitch()
|
||||
}
|
||||
}
|
||||
|
||||
if (!m_PetSwitchLoaded)
|
||||
{
|
||||
if (!m_PetSwitchLoaded) {
|
||||
Game::logger->Log("BouncerComponent", "Failed to load pet bouncer");
|
||||
|
||||
m_Parent->AddCallbackTimer(0.5f, [this]() {
|
||||
LookupPetSwitch();
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user