mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-11 17:51:04 +00:00
Minimap as HUD element with API control
Features: * Define Minimap available modes (surface/radar, scale) from Lua, using player:set_minimap_modes() * New HUD elements for displaying minimap with custom size and placing * New minimap mode for displaying a texture instead of the map
This commit is contained in:
parent
3068853e8a
commit
81c66d6efb
20 changed files with 470 additions and 144 deletions
|
@ -2662,6 +2662,23 @@ void Server::sendRequestedMedia(session_t peer_id,
|
|||
}
|
||||
}
|
||||
|
||||
void Server::SendMinimapModes(session_t peer_id,
|
||||
std::vector<MinimapMode> &modes, size_t wanted_mode)
|
||||
{
|
||||
RemotePlayer *player = m_env->getPlayer(peer_id);
|
||||
assert(player);
|
||||
if (player->getPeerId() == PEER_ID_INEXISTENT)
|
||||
return;
|
||||
|
||||
NetworkPacket pkt(TOCLIENT_MINIMAP_MODES, 0, peer_id);
|
||||
pkt << (u16)modes.size() << (u16)wanted_mode;
|
||||
|
||||
for (auto &mode : modes)
|
||||
pkt << (u16)mode.type << mode.label << mode.size << mode.texture << mode.scale;
|
||||
|
||||
Send(&pkt);
|
||||
}
|
||||
|
||||
void Server::sendDetachedInventory(Inventory *inventory, const std::string &name, session_t peer_id)
|
||||
{
|
||||
NetworkPacket pkt(TOCLIENT_DETACHED_INVENTORY, 0, peer_id);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue