mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-11 17:51:04 +00:00
Add some missing getter functions to the lua API
ObjectRef: get_properties get_armor_groups get_animation get_attach get_bone_position Players: get_physics_override hud_get_hotbar_itemcount hud_get_hotbar_image hud_get_hotbar_selected_image get_sky get_day_night_ratio get_local_animation get_eye_offset Global: minetest.get_gen_notify minetest.get_noiseparams
This commit is contained in:
parent
990a96578f
commit
c0335f7d13
17 changed files with 665 additions and 8 deletions
|
@ -2915,31 +2915,54 @@ bool Server::hudSetHotbarItemcount(Player *player, s32 hotbar_itemcount) {
|
|||
if (hotbar_itemcount <= 0 || hotbar_itemcount > HUD_HOTBAR_ITEMCOUNT_MAX)
|
||||
return false;
|
||||
|
||||
player->setHotbarItemcount(hotbar_itemcount);
|
||||
std::ostringstream os(std::ios::binary);
|
||||
writeS32(os, hotbar_itemcount);
|
||||
SendHUDSetParam(player->peer_id, HUD_PARAM_HOTBAR_ITEMCOUNT, os.str());
|
||||
return true;
|
||||
}
|
||||
|
||||
s32 Server::hudGetHotbarItemcount(Player *player) {
|
||||
if (!player)
|
||||
return 0;
|
||||
return player->getHotbarItemcount();
|
||||
}
|
||||
|
||||
void Server::hudSetHotbarImage(Player *player, std::string name) {
|
||||
if (!player)
|
||||
return;
|
||||
|
||||
player->setHotbarImage(name);
|
||||
SendHUDSetParam(player->peer_id, HUD_PARAM_HOTBAR_IMAGE, name);
|
||||
}
|
||||
|
||||
std::string Server::hudGetHotbarImage(Player *player) {
|
||||
if (!player)
|
||||
return "";
|
||||
return player->getHotbarImage();
|
||||
}
|
||||
|
||||
void Server::hudSetHotbarSelectedImage(Player *player, std::string name) {
|
||||
if (!player)
|
||||
return;
|
||||
|
||||
player->setHotbarSelectedImage(name);
|
||||
SendHUDSetParam(player->peer_id, HUD_PARAM_HOTBAR_SELECTED_IMAGE, name);
|
||||
}
|
||||
|
||||
std::string Server::hudGetHotbarSelectedImage(Player *player) {
|
||||
if (!player)
|
||||
return "";
|
||||
|
||||
return player->getHotbarSelectedImage();
|
||||
}
|
||||
|
||||
bool Server::setLocalPlayerAnimations(Player *player, v2s32 animation_frames[4], f32 frame_speed)
|
||||
{
|
||||
if (!player)
|
||||
return false;
|
||||
|
||||
player->setLocalAnimations(animation_frames, frame_speed);
|
||||
SendLocalPlayerAnimations(player->peer_id, animation_frames, frame_speed);
|
||||
return true;
|
||||
}
|
||||
|
@ -2949,6 +2972,8 @@ bool Server::setPlayerEyeOffset(Player *player, v3f first, v3f third)
|
|||
if (!player)
|
||||
return false;
|
||||
|
||||
player->eye_offset_first = first;
|
||||
player->eye_offset_third = third;
|
||||
SendEyeOffset(player->peer_id, first, third);
|
||||
return true;
|
||||
}
|
||||
|
@ -2959,6 +2984,7 @@ bool Server::setSky(Player *player, const video::SColor &bgcolor,
|
|||
if (!player)
|
||||
return false;
|
||||
|
||||
player->setSky(bgcolor, type, params);
|
||||
SendSetSky(player->peer_id, bgcolor, type, params);
|
||||
return true;
|
||||
}
|
||||
|
@ -2969,6 +2995,7 @@ bool Server::overrideDayNightRatio(Player *player, bool do_override,
|
|||
if (!player)
|
||||
return false;
|
||||
|
||||
player->overrideDayNightRatio(do_override, ratio);
|
||||
SendOverrideDayNightRatio(player->peer_id, do_override, ratio);
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue