Skip to content

Commit

Permalink
fix: shooting gallery bugs (#1347)
Browse files Browse the repository at this point in the history
fix: reset some more vars

Co-authored-by: Aaron Kimbre <aronwk.aaron@gmail.com>
EmosewaMC and aronwk-aaron authored Dec 23, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 6b97985 commit 5e9355b
Showing 5 changed files with 15 additions and 4 deletions.
4 changes: 3 additions & 1 deletion dGame/Entity.cpp
Original file line number Diff line number Diff line change
@@ -166,7 +166,9 @@ void Entity::Initialize() {

if (!groupIDs.empty()) {
m_Groups = GeneralUtils::SplitString(groupIDs, ';');
m_Groups.erase(m_Groups.end() - 1);
if (!m_Groups.empty()) {
if (m_Groups.back().empty()) m_Groups.erase(m_Groups.end() - 1);
}
}

/**
2 changes: 2 additions & 0 deletions dGame/dComponents/ShootingGalleryComponent.cpp
Original file line number Diff line number Diff line change
@@ -24,6 +24,7 @@ void ShootingGalleryComponent::Serialize(RakNet::BitStream* outBitStream, bool i
outBitStream->Write<uint32_t>(0);
} else {
outBitStream->Write<uint32_t>(1);
outBitStream->Write<LWOOBJID>(m_CurrentPlayerID);
for (size_t i = 0; i < 10; i++) {
outBitStream->Write<float_t>(0.0f);
}
@@ -60,6 +61,7 @@ void ShootingGalleryComponent::Serialize(RakNet::BitStream* outBitStream, bool i
outBitStream->Write<LWOOBJID>(m_CurrentPlayerID);
outBitStream->Write<float_t>(m_DynamicParams.cannonTimeout);
outBitStream->Write<float_t>(m_DynamicParams.cannonFOV);
if (!isInitialUpdate) m_Dirty = false;
}
}

7 changes: 7 additions & 0 deletions dScripts/ai/MINIGAME/SG_GF/SERVER/SGCannon.cpp
Original file line number Diff line number Diff line change
@@ -1040,6 +1040,13 @@ void SGCannon::ResetVars(Entity* self) {
self->SetVar<std::vector<LOT>>(RewardsVariable, {});
self->SetVar<uint32_t>(TotalScoreVariable, 0);

self->SetVar<uint32_t>(u"m_curStreak", 0);
self->SetNetworkVar<float>(u"SuperChargeBar", 0);
self->SetVar<uint32_t>(u"LastSuperTotal", 0);
self->SetNetworkVar<float>(u"SuperChargeBar", 0.0f);
self->SetNetworkVar<bool>(u"ShowStreak", 0);
self->SetNetworkVar<bool>(u"UnMarkAll", true);

const_cast<std::vector<SGEnemy>&>(self->GetVar<std::vector<SGEnemy>>(ActiveSpawnsVariable)).clear();
self->SetVar<std::vector<SGEnemy>>(ActiveSpawnsVariable, {});

2 changes: 1 addition & 1 deletion dZoneManager/Level.cpp
Original file line number Diff line number Diff line change
@@ -83,7 +83,7 @@ void Level::MakeSpawner(SceneObject obj) {
if (data->GetKey() == u"groupID") { // Load object groups
std::string groupStr = data->GetValueAsString();
spawnInfo.groups = GeneralUtils::SplitString(groupStr, ';');
spawnInfo.groups.erase(spawnInfo.groups.end() - 1);
if (spawnInfo.groups.back().empty()) spawnInfo.groups.erase(spawnInfo.groups.end() - 1);
}
if (data->GetKey() == u"no_auto_spawn") {
spawnInfo.noAutoSpawn = static_cast<LDFData<bool>*>(data)->GetValue();
4 changes: 2 additions & 2 deletions dZoneManager/Zone.cpp
Original file line number Diff line number Diff line change
@@ -121,9 +121,9 @@ void Zone::LoadZoneIntoMemory() {
} else if (data->GetKey() == u"groupID") { // Load object group
std::string groupStr = data->GetValueAsString();
info.groups = GeneralUtils::SplitString(groupStr, ';');
info.groups.erase(info.groups.end() - 1);
if (info.groups.back().empty()) info.groups.erase(info.groups.end() - 1);
} else if (data->GetKey() == u"grpNameQBShowBricks") {
if (data->GetValueAsString() == "") continue;
if (data->GetValueAsString().empty()) continue;
/*std::string groupStr = data->GetValueAsString();
info.groups.push_back(groupStr);*/
info.grpNameQBShowBricks = data->GetValueAsString();

0 comments on commit 5e9355b

Please sign in to comment.