diff options
author | CoderForTheBetter <marcumjp@gmail.com> | 2018-11-28 03:38:50 -0500 |
---|---|---|
committer | Loïc Blot <nerzhul@users.noreply.github.com> | 2018-11-28 09:38:50 +0100 |
commit | faa358e797128ab07bb5644ce305a832d59e5596 (patch) | |
tree | dcf05ef0611b839503c4845fd89ad9519ee1c4bb /src/remoteplayer.cpp | |
parent | 9519d57017cfa28eb4f2fbf3c780f826017bbb00 (diff) | |
download | minetest-faa358e797128ab07bb5644ce305a832d59e5596.tar.gz minetest-faa358e797128ab07bb5644ce305a832d59e5596.tar.bz2 minetest-faa358e797128ab07bb5644ce305a832d59e5596.zip |
Add Lua methods 'set_rotation()' and 'get_rotation()' (#7395)
* Adds Lua methods 'set_rotation()' and 'get_rotation'. Also changed some method names to be more clear. Instead of an f32 being sent over network for yaw, now a v3f is sent for rotation on xyz axes. Perserved Lua method set_yaw/setyaw so that old mods still work, other wise to set yaw they would need to switch to set_rotation(0, yaw, 0).
Diffstat (limited to 'src/remoteplayer.cpp')
-rw-r--r-- | src/remoteplayer.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/remoteplayer.cpp b/src/remoteplayer.cpp index 3a72106de..d54caf924 100644 --- a/src/remoteplayer.cpp +++ b/src/remoteplayer.cpp @@ -110,10 +110,10 @@ void RemotePlayer::deSerialize(std::istream &is, const std::string &playername, } catch (SettingNotFoundException &e) {} try { - sao->setPitch(args.getFloat("pitch")); + sao->setLookPitch(args.getFloat("pitch")); } catch (SettingNotFoundException &e) {} try { - sao->setYaw(args.getFloat("yaw")); + sao->setPlayerYaw(args.getFloat("yaw")); } catch (SettingNotFoundException &e) {} try { @@ -172,8 +172,8 @@ void RemotePlayer::serialize(std::ostream &os) assert(m_sao); args.setS32("hp", m_sao->getHP()); args.setV3F("position", m_sao->getBasePosition()); - args.setFloat("pitch", m_sao->getPitch()); - args.setFloat("yaw", m_sao->getYaw()); + args.setFloat("pitch", m_sao->getLookPitch()); + args.setFloat("yaw", m_sao->getRotation().Y); args.setS32("breath", m_sao->getBreath()); std::string extended_attrs; |