Skip to content

Commit

Permalink
Remove unneeded ObjectRef setter return values (minetest#12179)
Browse files Browse the repository at this point in the history
  • Loading branch information
appgurueu committed Apr 10, 2022
1 parent 2d8eac4 commit 1f27bf6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 31 deletions.
1 change: 0 additions & 1 deletion doc/lua_api.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7023,7 +7023,6 @@ object you are working with still exists.
* `light_definition` is a table with the following optional fields:
* `shadows` is a table that controls ambient shadows
* `intensity` sets the intensity of the shadows from 0 (no shadows, default) to 1 (blackness)
* Returns true on success.
* `get_lighting()`: returns the current state of lighting for the player.
* Result is a table with the same fields as `light_definition` in `set_lighting`.

Expand Down
47 changes: 17 additions & 30 deletions src/script/lua_api/l_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -420,8 +420,7 @@ int ObjectRef::l_set_local_animation(lua_State *L)
float frame_speed = readParam<float>(L, 6, 30.0f);

getServer(L)->setLocalPlayerAnimations(player, frames, frame_speed);
lua_pushboolean(L, true);
return 1;
return 0;
}

// get_local_animation(self)
Expand Down Expand Up @@ -464,8 +463,7 @@ int ObjectRef::l_set_eye_offset(lua_State *L)
offset_third.Y = rangelim(offset_third.Y,-10,15); //1.5*BS

getServer(L)->setPlayerEyeOffset(player, offset_first, offset_third);
lua_pushboolean(L, true);
return 1;
return 0;
}

// get_eye_offset(self)
Expand Down Expand Up @@ -737,8 +735,7 @@ int ObjectRef::l_set_nametag_attributes(lua_State *L)

prop->validate();
sao->notifyObjectPropertiesModified();
lua_pushboolean(L, true);
return 1;
return 0;
}

// get_nametag_attributes(self)
Expand Down Expand Up @@ -1116,7 +1113,7 @@ int ObjectRef::l_set_look_vertical(lua_State *L)
float pitch = readParam<float>(L, 2) * core::RADTODEG;

playersao->setLookPitchAndSend(pitch);
return 1;
return 0;
}

// set_look_horizontal(self, radians)
Expand All @@ -1131,7 +1128,7 @@ int ObjectRef::l_set_look_horizontal(lua_State *L)
float yaw = readParam<float>(L, 2) * core::RADTODEG;

playersao->setPlayerYawAndSend(yaw);
return 1;
return 0;
}

// DEPRECATED
Expand All @@ -1151,7 +1148,7 @@ int ObjectRef::l_set_look_pitch(lua_State *L)
float pitch = readParam<float>(L, 2) * core::RADTODEG;

playersao->setLookPitchAndSend(pitch);
return 1;
return 0;
}

// DEPRECATED
Expand All @@ -1171,7 +1168,7 @@ int ObjectRef::l_set_look_yaw(lua_State *L)
float yaw = readParam<float>(L, 2) * core::RADTODEG;

playersao->setPlayerYawAndSend(yaw);
return 1;
return 0;
}

// set_fov(self, degrees, is_multiplier, transition_time)
Expand Down Expand Up @@ -1310,8 +1307,7 @@ int ObjectRef::l_set_inventory_formspec(lua_State *L)

player->inventory_formspec = formspec;
getServer(L)->reportInventoryFormspecModified(player->getName());
lua_pushboolean(L, true);
return 1;
return 0;
}

// get_inventory_formspec(self) -> formspec
Expand Down Expand Up @@ -1342,8 +1338,7 @@ int ObjectRef::l_set_formspec_prepend(lua_State *L)

player->formspec_prepend = formspec;
getServer(L)->reportFormspecPrependModified(player->getName());
lua_pushboolean(L, true);
return 1;
return 0;
}

// get_formspec_prepend(self)
Expand Down Expand Up @@ -1603,8 +1598,7 @@ int ObjectRef::l_hud_set_flags(lua_State *L)
if (!getServer(L)->hudSetFlags(player, flags, mask))
return 0;

lua_pushboolean(L, true);
return 1;
return 0;
}

// hud_get_flags(self)
Expand Down Expand Up @@ -1861,8 +1855,7 @@ int ObjectRef::l_set_sky(lua_State *L)
}

getServer(L)->setSky(player, sky_params);
lua_pushboolean(L, true);
return 1;
return 0;
}

static void push_sky_color(lua_State *L, const SkyboxParams &params)
Expand Down Expand Up @@ -1984,8 +1977,7 @@ int ObjectRef::l_set_sun(lua_State *L)
}

getServer(L)->setSun(player, sun_params);
lua_pushboolean(L, true);
return 1;
return 0;
}

//get_sun(self)
Expand Down Expand Up @@ -2038,8 +2030,7 @@ int ObjectRef::l_set_moon(lua_State *L)
}

getServer(L)->setMoon(player, moon_params);
lua_pushboolean(L, true);
return 1;
return 0;
}

// get_moon(self)
Expand Down Expand Up @@ -2094,8 +2085,7 @@ int ObjectRef::l_set_stars(lua_State *L)
}

getServer(L)->setStars(player, star_params);
lua_pushboolean(L, true);
return 1;
return 0;
}

// get_stars(self)
Expand Down Expand Up @@ -2162,8 +2152,7 @@ int ObjectRef::l_set_clouds(lua_State *L)
}

getServer(L)->setClouds(player, cloud_params);
lua_pushboolean(L, true);
return 1;
return 0;
}

int ObjectRef::l_get_clouds(lua_State *L)
Expand Down Expand Up @@ -2217,8 +2206,7 @@ int ObjectRef::l_override_day_night_ratio(lua_State *L)
}

getServer(L)->overrideDayNightRatio(player, do_override, ratio);
lua_pushboolean(L, true);
return 1;
return 0;
}

// get_day_night_ratio(self)
Expand Down Expand Up @@ -2313,8 +2301,7 @@ int ObjectRef::l_set_lighting(lua_State *L)
lua_pop(L, -1);

getServer(L)->setLighting(player, lighting);
lua_pushboolean(L, true);
return 1;
return 0;
}

// get_lighting(self)
Expand Down

0 comments on commit 1f27bf6

Please sign in to comment.