diff --git a/source/client/core/ClientApplication.cpp b/source/client/core/ClientApplication.cpp
index 1e245d92..1e45f95c 100644
--- a/source/client/core/ClientApplication.cpp
+++ b/source/client/core/ClientApplication.cpp
@@ -54,6 +54,7 @@ void ClientApplication::init() {
m_argumentParser.addArgument("multiplayer", {"-m", "--multiplayer", "Start in multiplayer mode."});
m_argumentParser.addArgument("working-dir", {"-w", "--working-dir", "Change the working directory to
.", "dir"});
m_argumentParser.addArgument("texture-pack", {"-t", "--texture-pack", "Use texture pack .", "name"});
+ m_argumentParser.addArgument("username", {"-u", "--username", "Use when using -m or -s", "username"});
m_loggerHandler.setName("client");
@@ -79,6 +80,9 @@ void ClientApplication::init() {
Config::loadConfigFromFile("config/client.lua");
+ if (m_argumentParser.getArgument("username").isFound)
+ Config::defaultUsername = m_argumentParser.getArgument("username").parameter;
+
m_keyboardHandler.loadKeysFromFile("config/keys.lua");
gk::GamePad::init(m_keyboardHandler);
diff --git a/source/client/states/TitleScreenState.cpp b/source/client/states/TitleScreenState.cpp
index 74003bac..1b10e8c9 100644
--- a/source/client/states/TitleScreenState.cpp
+++ b/source/client/states/TitleScreenState.cpp
@@ -99,6 +99,7 @@ void TitleScreenState::startSingleplayer(bool showLoadingState, const std::strin
auto &serverLoadingState = m_stateStack->push(game, showLoadingState, "localhost", sf::Socket::AnyPort, this);
serverLoadingState.setTexturePack(m_texturePack);
+ serverLoadingState.setUsername(Config::defaultUsername);
if (m_thread.joinable())
m_thread.join();
@@ -119,6 +120,7 @@ void TitleScreenState::startMultiplayer(const std::string &host) {
auto &game = m_stateStack->push();
auto &serverLoadingState = m_stateStack->push(game, false, host, m_port, this);
serverLoadingState.setTexturePack(m_texturePack);
+ serverLoadingState.setUsername(Config::defaultUsername);
}
void TitleScreenState::onGuiScaleChanged(const GuiScaleChangedEvent &event) {
diff --git a/source/client/world/ClientPlayer.cpp b/source/client/world/ClientPlayer.cpp
index b0d721ba..2d31a788 100644
--- a/source/client/world/ClientPlayer.cpp
+++ b/source/client/world/ClientPlayer.cpp
@@ -39,10 +39,6 @@ ClientPlayer *ClientPlayer::s_instance = nullptr;
ClientPlayer::ClientPlayer(gk::Camera &camera) : m_camera(camera) {
m_cameraLocalPos = gk::Vector3f{0.f, 0.f, 1.625f};
- m_viewAngleH = -90.f;
- m_viewAngleV = 0.f;
- m_viewAngleRoll = 0.f;
-
updateCamera();
m_camera.setDPosition(m_x + m_cameraLocalPos.x, m_y + m_cameraLocalPos.y, m_z + m_cameraLocalPos.z);
diff --git a/source/common/world/Player.hpp b/source/common/world/Player.hpp
index 8efc0c7b..b35fde5d 100644
--- a/source/common/world/Player.hpp
+++ b/source/common/world/Player.hpp
@@ -79,7 +79,7 @@ class Player : public gk::ISerializable {
u16 m_dimension = 0;
- float m_viewAngleH = 0;
+ float m_viewAngleH = -90;
float m_viewAngleV = 0;
float m_viewAngleRoll = 0;
diff --git a/source/server/core/PlayerList.cpp b/source/server/core/PlayerList.cpp
index 42783c1d..3bd45323 100644
--- a/source/server/core/PlayerList.cpp
+++ b/source/server/core/PlayerList.cpp
@@ -62,6 +62,7 @@ void PlayerList::disconnectPlayer(const std::string &name) {
if (it != m_players.end()) {
it->second.setClient(nullptr);
it->second.setNewPlayer(false);
+ gkInfo() << name << "is offline";
}
}