diff options
-rw-r--r-- | assets/opensb/scripts/opensb/player/commands.lua | 11 | ||||
-rw-r--r-- | source/game/StarPlayer.cpp | 2 | ||||
-rw-r--r-- | source/game/StarStatusController.cpp | 5 |
3 files changed, 16 insertions, 2 deletions
diff --git a/assets/opensb/scripts/opensb/player/commands.lua b/assets/opensb/scripts/opensb/player/commands.lua index 9696e0d..2d83106 100644 --- a/assets/opensb/scripts/opensb/player/commands.lua +++ b/assets/opensb/scripts/opensb/player/commands.lua @@ -36,4 +36,15 @@ register("run", function(src) end end) +register("headrotation", function(arg) + local key = "disableHeadRotation" + if status.statusProperty(key) == true then + status.setStatusProperty(key, nil) + return "Head rotation is now enabled for this character" + else + status.setStatusProperty(key, true) + return "Head rotation is now disabled for this character" + end +end) + module.register = register
\ No newline at end of file diff --git a/source/game/StarPlayer.cpp b/source/game/StarPlayer.cpp index c094bbb..af85cce 100644 --- a/source/game/StarPlayer.cpp +++ b/source/game/StarPlayer.cpp @@ -1086,7 +1086,7 @@ void Player::update(float dt, uint64_t) { } if (calculateHeadRotation) { // master or not an OpenStarbound player float headRotation = 0.f; - if (m_humanoid->primaryHandHoldingItem() || m_humanoid->altHandHoldingItem() || m_humanoid->dance()) { + if (Humanoid::globalHeadRotation() && (m_humanoid->primaryHandHoldingItem() || m_humanoid->altHandHoldingItem() || m_humanoid->dance())) { auto primary = m_tools->primaryHandItem(); auto alt = m_tools->altHandItem(); String const disableFlag = "disableHeadRotation"; diff --git a/source/game/StarStatusController.cpp b/source/game/StarStatusController.cpp index 26c83d0..d6635b6 100644 --- a/source/game/StarStatusController.cpp +++ b/source/game/StarStatusController.cpp @@ -132,7 +132,10 @@ Json StatusController::statusProperty(String const& name, Json const& def) const } void StatusController::setStatusProperty(String const& name, Json value) { - m_statusProperties.set(name, value); + if (value.isNull()) + m_statusProperties.remove(name); + else + m_statusProperties.set(name, value); } StringList StatusController::statNames() const { |