1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

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).
This commit is contained in:
CoderForTheBetter 2018-11-28 03:38:50 -05:00 committed by Loïc Blot
parent 9519d57017
commit faa358e797
18 changed files with 211 additions and 99 deletions

View file

@ -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;