@@ -1016,27 +1016,61 @@ int ObjectRef::l_get_look_dir(lua_State *L)
1016
1016
Player *player = getplayer (ref);
1017
1017
if (player == NULL ) return 0 ;
1018
1018
// Do it
1019
- float pitch = player->getRadPitch ();
1020
- float yaw = player->getRadYaw ();
1019
+ float pitch = player->getRadPitchDep ();
1020
+ float yaw = player->getRadYawDep ();
1021
1021
v3f v (cos (pitch)*cos (yaw), sin (pitch), cos (pitch)*sin (yaw));
1022
1022
push_v3f (L, v);
1023
1023
return 1 ;
1024
1024
}
1025
1025
1026
+ // DEPRECATED
1026
1027
// get_look_pitch(self)
1027
1028
int ObjectRef::l_get_look_pitch (lua_State *L)
1028
1029
{
1029
1030
NO_MAP_LOCK_REQUIRED;
1031
+
1032
+ log_deprecated (L,
1033
+ " Deprecated call to get_look_pitch, use get_look_vertical instead" );
1034
+
1030
1035
ObjectRef *ref = checkobject (L, 1 );
1031
1036
Player *player = getplayer (ref);
1032
1037
if (player == NULL ) return 0 ;
1033
1038
// Do it
1034
- lua_pushnumber (L, player->getRadPitch ());
1039
+ lua_pushnumber (L, player->getRadPitchDep ());
1035
1040
return 1 ;
1036
1041
}
1037
1042
1043
+ // DEPRECATED
1038
1044
// get_look_yaw(self)
1039
1045
int ObjectRef::l_get_look_yaw (lua_State *L)
1046
+ {
1047
+ NO_MAP_LOCK_REQUIRED;
1048
+
1049
+ log_deprecated (L,
1050
+ " Deprecated call to get_look_yaw, use get_look_horizontal instead" );
1051
+
1052
+ ObjectRef *ref = checkobject (L, 1 );
1053
+ Player *player = getplayer (ref);
1054
+ if (player == NULL ) return 0 ;
1055
+ // Do it
1056
+ lua_pushnumber (L, player->getRadYawDep ());
1057
+ return 1 ;
1058
+ }
1059
+
1060
+ // get_look_pitch2(self)
1061
+ int ObjectRef::l_get_look_vertical (lua_State *L)
1062
+ {
1063
+ NO_MAP_LOCK_REQUIRED;
1064
+ ObjectRef *ref = checkobject (L, 1 );
1065
+ Player *player = getplayer (ref);
1066
+ if (player == NULL ) return 0 ;
1067
+ // Do it
1068
+ lua_pushnumber (L, player->getRadPitch ());
1069
+ return 1 ;
1070
+ }
1071
+
1072
+ // get_look_yaw2(self)
1073
+ int ObjectRef::l_get_look_horizontal (lua_State *L)
1040
1074
{
1041
1075
NO_MAP_LOCK_REQUIRED;
1042
1076
ObjectRef *ref = checkobject (L, 1 );
@@ -1047,10 +1081,41 @@ int ObjectRef::l_get_look_yaw(lua_State *L)
1047
1081
return 1 ;
1048
1082
}
1049
1083
1084
+ // set_look_vertical(self, radians)
1085
+ int ObjectRef::l_set_look_vertical (lua_State *L)
1086
+ {
1087
+ NO_MAP_LOCK_REQUIRED;
1088
+ ObjectRef *ref = checkobject (L, 1 );
1089
+ PlayerSAO* co = getplayersao (ref);
1090
+ if (co == NULL ) return 0 ;
1091
+ float pitch = luaL_checknumber (L, 2 ) * core::RADTODEG;
1092
+ // Do it
1093
+ co->setPitch (pitch);
1094
+ return 1 ;
1095
+ }
1096
+
1097
+ // set_look_horizontal(self, radians)
1098
+ int ObjectRef::l_set_look_horizontal (lua_State *L)
1099
+ {
1100
+ NO_MAP_LOCK_REQUIRED;
1101
+ ObjectRef *ref = checkobject (L, 1 );
1102
+ PlayerSAO* co = getplayersao (ref);
1103
+ if (co == NULL ) return 0 ;
1104
+ float yaw = luaL_checknumber (L, 2 ) * core::RADTODEG;
1105
+ // Do it
1106
+ co->setYaw (yaw);
1107
+ return 1 ;
1108
+ }
1109
+
1110
+ // DEPRECATED
1050
1111
// set_look_pitch(self, radians)
1051
1112
int ObjectRef::l_set_look_pitch (lua_State *L)
1052
1113
{
1053
1114
NO_MAP_LOCK_REQUIRED;
1115
+
1116
+ log_deprecated (L,
1117
+ " Deprecated call to set_look_pitch, use set_look_vertical instead." );
1118
+
1054
1119
ObjectRef *ref = checkobject (L, 1 );
1055
1120
PlayerSAO* co = getplayersao (ref);
1056
1121
if (co == NULL ) return 0 ;
@@ -1060,10 +1125,15 @@ int ObjectRef::l_set_look_pitch(lua_State *L)
1060
1125
return 1 ;
1061
1126
}
1062
1127
1128
+ // DEPRECATED
1063
1129
// set_look_yaw(self, radians)
1064
1130
int ObjectRef::l_set_look_yaw (lua_State *L)
1065
1131
{
1066
1132
NO_MAP_LOCK_REQUIRED;
1133
+
1134
+ log_deprecated (L,
1135
+ " Deprecated call to set_look_yaw, use set_look_horizontal instead." );
1136
+
1067
1137
ObjectRef *ref = checkobject (L, 1 );
1068
1138
PlayerSAO* co = getplayersao (ref);
1069
1139
if (co == NULL ) return 0 ;
@@ -1754,6 +1824,10 @@ const luaL_reg ObjectRef::methods[] = {
1754
1824
luamethod (ObjectRef, get_look_dir),
1755
1825
luamethod (ObjectRef, get_look_pitch),
1756
1826
luamethod (ObjectRef, get_look_yaw),
1827
+ luamethod (ObjectRef, get_look_vertical),
1828
+ luamethod (ObjectRef, get_look_horizontal),
1829
+ luamethod (ObjectRef, set_look_horizontal),
1830
+ luamethod (ObjectRef, set_look_vertical),
1757
1831
luamethod (ObjectRef, set_look_yaw),
1758
1832
luamethod (ObjectRef, set_look_pitch),
1759
1833
luamethod (ObjectRef, get_breath),
0 commit comments