Don't do spatial logging on the server

This commit is contained in:
Kae 2023-06-28 00:50:47 +10:00
parent 152af87655
commit efa3872396
13 changed files with 52 additions and 25 deletions

View File

@ -21,5 +21,7 @@
"buttonClickSound" : [ "/sfx/interface/button/click.wav" ], "buttonClickSound" : [ "/sfx/interface/button/click.wav" ],
"buttonReleaseSound" : [ "/sfx/interface/button/release.wav" ], "buttonReleaseSound" : [ "/sfx/interface/button/release.wav" ],
"buttonHoverSound" : [ "/sfx/interface/button/hover.wav" ], "buttonHoverSound" : [ "/sfx/interface/button/hover.wav" ],
"buttonHoverOffSound" : [ "/sfx/interface/button/hover_off.wav" ] "buttonHoverOffSound" : [ "/sfx/interface/button/hover_off.wav" ],
"debugSpatialClearTime" : 0.0
} }

View File

@ -179,10 +179,15 @@ Deque<SpatialLogger::LogText> SpatialLogger::getText(char const* space, bool and
} }
void SpatialLogger::clear() { void SpatialLogger::clear() {
decltype(s_lines) lines;
decltype(s_points) points;
decltype(s_logText) logText;
{
MutexLocker locker(s_mutex); MutexLocker locker(s_mutex);
s_lines.clear(); lines = move(s_lines);
s_points.clear(); points = move(s_points);
s_logText.clear(); logText = move(s_logText);
} // Move while locked to deallocate contents while unlocked.
} }
Mutex SpatialLogger::s_mutex; Mutex SpatialLogger::s_mutex;

View File

@ -1,5 +1,5 @@
#include "StarChatBubbleSeparation.hpp" #include "StarChatBubbleSeparation.hpp"
#include "StarLogging.hpp" //#include "StarLogging.hpp"
namespace Star { namespace Star {

View File

@ -814,11 +814,10 @@ void MainInterface::render() {
renderMonsterHealthBar(); renderMonsterHealthBar();
renderSpecialDamageBar(); renderSpecialDamageBar();
renderMainBar(); renderMainBar();
renderDebug();
renderWindows(); renderWindows();
renderCursor(); renderCursor();
renderDebug();
} }
Vec2F MainInterface::cursorWorldPosition() const { Vec2F MainInterface::cursorWorldPosition() const {

View File

@ -30,6 +30,10 @@ TitleScreen::TitleScreen(PlayerStoragePtr playerStorage, MixerPtr mixer)
auto randomWorld = m_celestialDatabase->findRandomWorld(10, 50, [this](CelestialCoordinate const& coordinate) { auto randomWorld = m_celestialDatabase->findRandomWorld(10, 50, [this](CelestialCoordinate const& coordinate) {
return is<TerrestrialWorldParameters>(m_celestialDatabase->parameters(coordinate)->visitableParameters()); return is<TerrestrialWorldParameters>(m_celestialDatabase->parameters(coordinate)->visitableParameters());
}).take(); }).take();
if (auto name = m_celestialDatabase->name(randomWorld))
Logger::info("Title world is {} @ CelestialWorld:{}", Text::stripEscapeCodes(*name), randomWorld);
SkyParameters skyParameters(randomWorld, m_celestialDatabase); SkyParameters skyParameters(randomWorld, m_celestialDatabase);
m_skyBackdrop = make_shared<Sky>(skyParameters, true); m_skyBackdrop = make_shared<Sky>(skyParameters, true);

View File

@ -80,6 +80,7 @@ void DamageManager::update() {
for (auto& damageSource : causingEntity->damageSources()) { for (auto& damageSource : causingEntity->damageSources()) {
if (damageSource.trackSourceEntity) if (damageSource.trackSourceEntity)
damageSource.translate(causingEntity->position()); damageSource.translate(causingEntity->position());
if (auto poly = damageSource.damageArea.ptr<PolyF>()) if (auto poly = damageSource.damageArea.ptr<PolyF>())
SpatialLogger::logPoly("world", *poly, Color::Orange.toRgba()); SpatialLogger::logPoly("world", *poly, Color::Orange.toRgba());
else if (auto line = damageSource.damageArea.ptr<Line2F>()) else if (auto line = damageSource.damageArea.ptr<Line2F>())

View File

@ -479,10 +479,10 @@ void Monster::update(uint64_t) {
m_networkedAnimatorDynamicTarget.updatePosition(position()); m_networkedAnimatorDynamicTarget.updatePosition(position());
m_scriptedAnimator.update(); m_scriptedAnimator.update();
}
SpatialLogger::logPoly("world", m_movementController->collisionBody(), { 255, 0, 0, 255 }); SpatialLogger::logPoly("world", m_movementController->collisionBody(), { 255, 0, 0, 255 });
} }
}
void Monster::render(RenderCallback* renderCallback) { void Monster::render(RenderCallback* renderCallback) {
for (auto& drawable : m_networkedAnimator.drawables(position())) { for (auto& drawable : m_networkedAnimator.drawables(position())) {

View File

@ -442,6 +442,7 @@ void Npc::update(uint64_t) {
tickShared(); tickShared();
} }
if (world()->isClient())
SpatialLogger::logPoly("world", m_movementController->collisionBody(), {0, 255, 0, 255}); SpatialLogger::logPoly("world", m_movementController->collisionBody(), {0, 255, 0, 255});
} }

View File

@ -959,6 +959,8 @@ void Player::update(uint64_t) {
else else
m_humanoid->setDance({}); m_humanoid->setDance({});
bool isClient = world()->isClient();
if (isClient)
m_armor->setupHumanoidClothingDrawables(*m_humanoid, forceNude()); m_armor->setupHumanoidClothingDrawables(*m_humanoid, forceNude());
m_tools->suppressItems(!canUseTool()); m_tools->suppressItems(!canUseTool());
@ -971,7 +973,9 @@ void Player::update(uint64_t) {
if (m_movementController->facingDirection() == Direction::Left) if (m_movementController->facingDirection() == Direction::Left)
m_effectsAnimator->scaleTransformationGroup("flip", Vec2F(-1, 1)); m_effectsAnimator->scaleTransformationGroup("flip", Vec2F(-1, 1));
if (world()->isClient()) {
if (isClient) {
m_effectsAnimator->update(WorldTimestep, &m_effectsAnimatorDynamicTarget); m_effectsAnimator->update(WorldTimestep, &m_effectsAnimatorDynamicTarget);
m_effectsAnimatorDynamicTarget.updatePosition(position() + m_techController->parentOffset()); m_effectsAnimatorDynamicTarget.updatePosition(position() + m_techController->parentOffset());
} else { } else {
@ -1009,6 +1013,7 @@ void Player::update(uint64_t) {
m_pendingMoves.clear(); m_pendingMoves.clear();
if (isClient)
SpatialLogger::logPoly("world", m_movementController->collisionBody(), isMaster() ? Color::Orange.toRgba() : Color::Yellow.toRgba()); SpatialLogger::logPoly("world", m_movementController->collisionBody(), isMaster() ? Color::Orange.toRgba() : Color::Yellow.toRgba());
} }

View File

@ -344,6 +344,7 @@ void Projectile::update(uint64_t) {
tickShared(); tickShared();
} }
if (world()->isClient())
SpatialLogger::logPoly("world", m_movementController->collisionBody(), Color::Red.toRgba()); SpatialLogger::logPoly("world", m_movementController->collisionBody(), Color::Red.toRgba());
} }

View File

@ -92,8 +92,12 @@ void Stagehand::update(uint64_t) {
if (isMaster() && m_scripted) if (isMaster() && m_scripted)
m_scriptComponent.update(m_scriptComponent.updateDt()); m_scriptComponent.update(m_scriptComponent.updateDt());
SpatialLogger::logPoly("world", PolyF(metaBoundBox().translated(position())), {0, 255, 255, 255}); if (world()->isClient()) {
SpatialLogger::logPoint("world", position(), {0, 255, 255, 255}); auto boundBox = metaBoundBox().translated(position());
SpatialLogger::logPoly("world", PolyF(boundBox), { 0, 255, 255, 255 });
SpatialLogger::logLine("world", boundBox.min(), boundBox.max(), {0, 255, 255, 255});
SpatialLogger::logLine("world", { boundBox.xMin(), boundBox.yMax() }, { boundBox.xMax(), boundBox.yMin() }, {0, 255, 255, 255});
}
} }
bool Stagehand::shouldDestroy() const { bool Stagehand::shouldDestroy() const {

View File

@ -315,6 +315,7 @@ void Vehicle::update(uint64_t) {
if (world()->isClient()) if (world()->isClient())
m_scriptedAnimator.update(); m_scriptedAnimator.update();
if (world()->isClient())
SpatialLogger::logPoly("world", m_movementController.collisionBody(), {255, 255, 0, 255}); SpatialLogger::logPoly("world", m_movementController.collisionBody(), {255, 255, 0, 255});
} }

View File

@ -137,7 +137,8 @@ void ActiveItem::update(FireMode fireMode, bool shifting, HashSet<MoveControlTyp
} }
} }
if (world()->isClient()) { bool isClient = world()->isClient();
if (isClient) {
m_itemAnimator.update(WorldTimestep, &m_itemAnimatorDynamicTarget); m_itemAnimator.update(WorldTimestep, &m_itemAnimatorDynamicTarget);
m_scriptedAnimator.update(m_scriptedAnimator.updateDt()); m_scriptedAnimator.update(m_scriptedAnimator.updateDt());
} else { } else {
@ -151,9 +152,11 @@ void ActiveItem::update(FireMode fireMode, bool shifting, HashSet<MoveControlTyp
for (auto shieldPoly : shieldPolys()) { for (auto shieldPoly : shieldPolys()) {
shieldPoly.translate(owner()->position()); shieldPoly.translate(owner()->position());
if (isClient)
SpatialLogger::logPoly("world", shieldPoly, {255, 255, 0, 255}); SpatialLogger::logPoly("world", shieldPoly, {255, 255, 0, 255});
} }
if (isClient) {
for (auto forceRegion : forceRegions()) { for (auto forceRegion : forceRegions()) {
if (auto dfr = forceRegion.ptr<DirectionalForceRegion>()) if (auto dfr = forceRegion.ptr<DirectionalForceRegion>())
SpatialLogger::logPoly("world", dfr->region, { 155, 0, 255, 255 }); SpatialLogger::logPoly("world", dfr->region, { 155, 0, 255, 255 });
@ -161,6 +164,7 @@ void ActiveItem::update(FireMode fireMode, bool shifting, HashSet<MoveControlTyp
SpatialLogger::logPoint("world", rfr->center, { 155, 0, 255, 255 }); SpatialLogger::logPoint("world", rfr->center, { 155, 0, 255, 255 });
} }
} }
}
List<DamageSource> ActiveItem::damageSources() const { List<DamageSource> ActiveItem::damageSources() const {
List<DamageSource> damageSources = m_damageSources.get(); List<DamageSource> damageSources = m_damageSources.get();