@@ -399,7 +399,7 @@ int ObjectRef::l_get_animation(lua_State *L)
399
399
if (sao == nullptr )
400
400
return 0 ;
401
401
402
- v2f frames = v2f (1 ,1 );
402
+ v2f frames = v2f (1 , 1 );
403
403
float frame_speed = 15 ;
404
404
float frame_blend = 0 ;
405
405
bool frame_loop = true ;
@@ -463,8 +463,8 @@ int ObjectRef::l_set_eye_offset(lua_State *L)
463
463
if (player == nullptr )
464
464
return 0 ;
465
465
466
- v3f offset_first = read_v3f (L, 2 );
467
- v3f offset_third = read_v3f (L, 3 );
466
+ v3f offset_first = readParam<v3f> (L, 2 , v3f ( 0 , 0 , 0 ) );
467
+ v3f offset_third = readParam<v3f> (L, 3 , v3f ( 0 , 0 , 0 ) );
468
468
469
469
// Prevent abuse of offset values (keep player always visible)
470
470
offset_third.X = rangelim (offset_third.X ,-10 ,10 );
@@ -537,9 +537,9 @@ int ObjectRef::l_set_bone_position(lua_State *L)
537
537
if (sao == nullptr )
538
538
return 0 ;
539
539
540
- std::string bone = readParam<std::string>(L, 2 );
541
- v3f position = check_v3f (L, 3 );
542
- v3f rotation = check_v3f (L, 4 );
540
+ std::string bone = readParam<std::string>(L, 2 , " " );
541
+ v3f position = readParam<v3f> (L, 3 , v3f ( 0 , 0 , 0 ) );
542
+ v3f rotation = readParam<v3f> (L, 4 , v3f ( 0 , 0 , 0 ) );
543
543
544
544
sao->setBonePosition (bone, position, rotation);
545
545
return 0 ;
@@ -554,7 +554,7 @@ int ObjectRef::l_get_bone_position(lua_State *L)
554
554
if (sao == nullptr )
555
555
return 0 ;
556
556
557
- std::string bone = readParam<std::string>(L, 2 );
557
+ std::string bone = readParam<std::string>(L, 2 , " " );
558
558
559
559
v3f position = v3f (0 , 0 , 0 );
560
560
v3f rotation = v3f (0 , 0 , 0 );
@@ -578,10 +578,10 @@ int ObjectRef::l_set_attach(lua_State *L)
578
578
if (sao == parent)
579
579
throw LuaError (" ObjectRef::set_attach: attaching object to itself is not allowed." );
580
580
581
- int parent_id = 0 ;
581
+ int parent_id;
582
582
std::string bone;
583
- v3f position = v3f ( 0 , 0 , 0 ) ;
584
- v3f rotation = v3f ( 0 , 0 , 0 ) ;
583
+ v3f position;
584
+ v3f rotation;
585
585
bool force_visible;
586
586
587
587
sao->getAttachment (&parent_id, &bone, &position, &rotation, &force_visible);
@@ -590,9 +590,9 @@ int ObjectRef::l_set_attach(lua_State *L)
590
590
old_parent->removeAttachmentChild (sao->getId ());
591
591
}
592
592
593
- bone = readParam<std::string>(L, 3 , " " );
594
- position = read_v3f (L, 4 );
595
- rotation = read_v3f (L, 5 );
593
+ bone = readParam<std::string>(L, 3 , " " );
594
+ position = readParam<v3f> (L, 4 , v3f ( 0 , 0 , 0 ) );
595
+ rotation = readParam<v3f> (L, 5 , v3f ( 0 , 0 , 0 ) );
596
596
force_visible = readParam<bool >(L, 6 , false );
597
597
598
598
sao->setAttachment (parent->getId (), bone, position, rotation, force_visible);
@@ -609,10 +609,10 @@ int ObjectRef::l_get_attach(lua_State *L)
609
609
if (sao == nullptr )
610
610
return 0 ;
611
611
612
- int parent_id = 0 ;
612
+ int parent_id;
613
613
std::string bone;
614
- v3f position = v3f ( 0 , 0 , 0 ) ;
615
- v3f rotation = v3f ( 0 , 0 , 0 ) ;
614
+ v3f position;
615
+ v3f rotation;
616
616
bool force_visible;
617
617
618
618
sao->getAttachment (&parent_id, &bone, &position, &rotation, &force_visible);
@@ -892,9 +892,6 @@ int ObjectRef::l_set_yaw(lua_State *L)
892
892
if (entitysao == nullptr )
893
893
return 0 ;
894
894
895
- if (isNaN (L, 2 ))
896
- throw LuaError (" ObjectRef::set_yaw: NaN value is not allowed." );
897
-
898
895
float yaw = readParam<float >(L, 2 ) * core::RADTODEG;
899
896
900
897
entitysao->setRotation (v3f (0 , yaw, 0 ));
@@ -2199,7 +2196,7 @@ int ObjectRef::l_set_minimap_modes(lua_State *L)
2199
2196
2200
2197
luaL_checktype (L, 2 , LUA_TTABLE);
2201
2198
std::vector<MinimapMode> modes;
2202
- s16 selected_mode = luaL_checkint (L, 3 );
2199
+ s16 selected_mode = readParam<s16> (L, 3 );
2203
2200
2204
2201
lua_pushnil (L);
2205
2202
while (lua_next (L, 2 ) != 0 ) {
0 commit comments