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" ],
"buttonReleaseSound" : [ "/sfx/interface/button/release.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() {
MutexLocker locker(s_mutex);
s_lines.clear();
s_points.clear();
s_logText.clear();
decltype(s_lines) lines;
decltype(s_points) points;
decltype(s_logText) logText;
{
MutexLocker locker(s_mutex);
lines = move(s_lines);
points = move(s_points);
logText = move(s_logText);
} // Move while locked to deallocate contents while unlocked.
}
Mutex SpatialLogger::s_mutex;

View File

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

View File

@ -814,11 +814,10 @@ void MainInterface::render() {
renderMonsterHealthBar();
renderSpecialDamageBar();
renderMainBar();
renderDebug();
renderWindows();
renderCursor();
renderDebug();
}
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) {
return is<TerrestrialWorldParameters>(m_celestialDatabase->parameters(coordinate)->visitableParameters());
}).take();
if (auto name = m_celestialDatabase->name(randomWorld))
Logger::info("Title world is {} @ CelestialWorld:{}", Text::stripEscapeCodes(*name), randomWorld);
SkyParameters skyParameters(randomWorld, m_celestialDatabase);
m_skyBackdrop = make_shared<Sky>(skyParameters, true);

View File

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

View File

@ -479,9 +479,9 @@ void Monster::update(uint64_t) {
m_networkedAnimatorDynamicTarget.updatePosition(position());
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) {

View File

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

View File

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

View File

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

View File

@ -92,8 +92,12 @@ void Stagehand::update(uint64_t) {
if (isMaster() && m_scripted)
m_scriptComponent.update(m_scriptComponent.updateDt());
SpatialLogger::logPoly("world", PolyF(metaBoundBox().translated(position())), {0, 255, 255, 255});
SpatialLogger::logPoint("world", position(), {0, 255, 255, 255});
if (world()->isClient()) {
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 {

View File

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

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_scriptedAnimator.update(m_scriptedAnimator.updateDt());
} else {
@ -151,14 +152,17 @@ void ActiveItem::update(FireMode fireMode, bool shifting, HashSet<MoveControlTyp
for (auto shieldPoly : shieldPolys()) {
shieldPoly.translate(owner()->position());
SpatialLogger::logPoly("world", shieldPoly, {255, 255, 0, 255});
if (isClient)
SpatialLogger::logPoly("world", shieldPoly, {255, 255, 0, 255});
}
for (auto forceRegion : forceRegions()) {
if (auto dfr = forceRegion.ptr<DirectionalForceRegion>())
SpatialLogger::logPoly("world", dfr->region, {155, 0, 255, 255});
else if (auto rfr = forceRegion.ptr<RadialForceRegion>())
SpatialLogger::logPoint("world", rfr->center, {155, 0, 255, 255});
if (isClient) {
for (auto forceRegion : forceRegions()) {
if (auto dfr = forceRegion.ptr<DirectionalForceRegion>())
SpatialLogger::logPoly("world", dfr->region, { 155, 0, 255, 255 });
else if (auto rfr = forceRegion.ptr<RadialForceRegion>())
SpatialLogger::logPoint("world", rfr->center, { 155, 0, 255, 255 });
}
}
}