From ad58a960e458e596e2a7a9f037487dbe8f4538cc Mon Sep 17 00:00:00 2001 From: Kae <80987908+Novaenia@users.noreply.github.com> Date: Fri, 30 Jun 2023 11:44:42 +1000 Subject: bring player inspection back! --- source/game/StarPlayer.cpp | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'source/game/StarPlayer.cpp') diff --git a/source/game/StarPlayer.cpp b/source/game/StarPlayer.cpp index fc2a9a7..af8a2ed 100644 --- a/source/game/StarPlayer.cpp +++ b/source/game/StarPlayer.cpp @@ -1,4 +1,5 @@ #include "StarPlayer.hpp" +#include "StarEncode.hpp" #include "StarJsonExtra.hpp" #include "StarRoot.hpp" #include "StarSongbook.hpp" @@ -102,10 +103,6 @@ Player::Player(PlayerConfigPtr config, Uuid uuid) { m_techs = make_shared(); m_log = make_shared(); - m_description = strf("This {} seems to have nothing to say for {}self.", - m_identity.gender == Gender::Male ? "guy" : "gal", - m_identity.gender == Gender::Male ? "him" : "her"); - setModeType(PlayerMode::Casual); m_useDown = false; @@ -1524,6 +1521,10 @@ String Player::description() const { return m_description; } +void Player::setDescription(String const& description) { + m_description = description; +} + Direction Player::walkingDirection() const { return m_movementController->movingDirection(); } @@ -2107,6 +2108,19 @@ List Player::pullPendingChatActions() { return take(m_pendingChatActions); } +Maybe Player::inspectionLogName() const { + auto identifier = uniqueId(); + if (String* str = identifier.ptr()) { + auto hash = XXH3_128bits(str->utf8Ptr(), str->utf8Size()); + return String("Player #") + hexEncode((const char*)&hash, sizeof(hash)); + } + return identifier; +} + +Maybe Player::inspectionDescription(String const& species) const { + return m_description; +} + float Player::beamGunRadius() const { return m_tools->beamGunRadius(); } @@ -2228,6 +2242,10 @@ void Player::finalizeCreation() { m_statusController->resetAllResources(); m_effectEmitter->reset(); + + m_description = strf("This {} seems to have nothing to say for {}self.", + m_identity.gender == Gender::Male ? "guy" : "gal", + m_identity.gender == Gender::Male ? "him" : "her"); } bool Player::invisible() const { -- cgit v1.2.3