forked from Mirrorlandia_minetest/minetest
Show status message when changing block bounds (#11556)
This commit is contained in:
parent
e7b05beb7d
commit
6fd8aede48
@ -2193,7 +2193,24 @@ void Game::toggleCinematic()
|
|||||||
void Game::toggleBlockBounds()
|
void Game::toggleBlockBounds()
|
||||||
{
|
{
|
||||||
if (client->checkPrivilege("basic_debug")) {
|
if (client->checkPrivilege("basic_debug")) {
|
||||||
hud->toggleBlockBounds();
|
enum Hud::BlockBoundsMode newmode = hud->toggleBlockBounds();
|
||||||
|
switch (newmode) {
|
||||||
|
case Hud::BLOCK_BOUNDS_OFF:
|
||||||
|
m_game_ui->showTranslatedStatusText("Block bounds hidden");
|
||||||
|
break;
|
||||||
|
case Hud::BLOCK_BOUNDS_CURRENT:
|
||||||
|
m_game_ui->showTranslatedStatusText("Block bounds shown for current block");
|
||||||
|
break;
|
||||||
|
case Hud::BLOCK_BOUNDS_NEAR:
|
||||||
|
m_game_ui->showTranslatedStatusText("Block bounds shown for nearby blocks");
|
||||||
|
break;
|
||||||
|
case Hud::BLOCK_BOUNDS_MAX:
|
||||||
|
m_game_ui->showTranslatedStatusText("Block bounds shown for all blocks");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
m_game_ui->showTranslatedStatusText("Can't show block bounds (need 'basic_debug' privilege)");
|
m_game_ui->showTranslatedStatusText("Can't show block bounds (need 'basic_debug' privilege)");
|
||||||
}
|
}
|
||||||
|
@ -857,13 +857,14 @@ void Hud::drawSelectionMesh()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Hud::toggleBlockBounds()
|
enum Hud::BlockBoundsMode Hud::toggleBlockBounds()
|
||||||
{
|
{
|
||||||
m_block_bounds_mode = static_cast<BlockBoundsMode>(m_block_bounds_mode + 1);
|
m_block_bounds_mode = static_cast<BlockBoundsMode>(m_block_bounds_mode + 1);
|
||||||
|
|
||||||
if (m_block_bounds_mode >= BLOCK_BOUNDS_MAX) {
|
if (m_block_bounds_mode >= BLOCK_BOUNDS_MAX) {
|
||||||
m_block_bounds_mode = BLOCK_BOUNDS_OFF;
|
m_block_bounds_mode = BLOCK_BOUNDS_OFF;
|
||||||
}
|
}
|
||||||
|
return m_block_bounds_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Hud::disableBlockBounds()
|
void Hud::disableBlockBounds()
|
||||||
@ -890,7 +891,7 @@ void Hud::drawBlockBounds()
|
|||||||
|
|
||||||
v3f offset = intToFloat(client->getCamera()->getOffset(), BS);
|
v3f offset = intToFloat(client->getCamera()->getOffset(), BS);
|
||||||
|
|
||||||
s8 radius = m_block_bounds_mode == BLOCK_BOUNDS_ALL ? 2 : 0;
|
s8 radius = m_block_bounds_mode == BLOCK_BOUNDS_NEAR ? 2 : 0;
|
||||||
|
|
||||||
v3f halfNode = v3f(BS, BS, BS) / 2.0f;
|
v3f halfNode = v3f(BS, BS, BS) / 2.0f;
|
||||||
|
|
||||||
|
@ -35,6 +35,14 @@ struct ItemStack;
|
|||||||
class Hud
|
class Hud
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
enum BlockBoundsMode
|
||||||
|
{
|
||||||
|
BLOCK_BOUNDS_OFF,
|
||||||
|
BLOCK_BOUNDS_CURRENT,
|
||||||
|
BLOCK_BOUNDS_NEAR,
|
||||||
|
BLOCK_BOUNDS_MAX
|
||||||
|
} m_block_bounds_mode = BLOCK_BOUNDS_OFF;
|
||||||
|
|
||||||
video::SColor crosshair_argb;
|
video::SColor crosshair_argb;
|
||||||
video::SColor selectionbox_argb;
|
video::SColor selectionbox_argb;
|
||||||
|
|
||||||
@ -51,7 +59,7 @@ public:
|
|||||||
Inventory *inventory);
|
Inventory *inventory);
|
||||||
~Hud();
|
~Hud();
|
||||||
|
|
||||||
void toggleBlockBounds();
|
enum BlockBoundsMode toggleBlockBounds();
|
||||||
void disableBlockBounds();
|
void disableBlockBounds();
|
||||||
void drawBlockBounds();
|
void drawBlockBounds();
|
||||||
|
|
||||||
@ -127,14 +135,6 @@ private:
|
|||||||
|
|
||||||
scene::SMeshBuffer m_rotation_mesh_buffer;
|
scene::SMeshBuffer m_rotation_mesh_buffer;
|
||||||
|
|
||||||
enum BlockBoundsMode
|
|
||||||
{
|
|
||||||
BLOCK_BOUNDS_OFF,
|
|
||||||
BLOCK_BOUNDS_CURRENT,
|
|
||||||
BLOCK_BOUNDS_ALL,
|
|
||||||
BLOCK_BOUNDS_MAX
|
|
||||||
} m_block_bounds_mode = BLOCK_BOUNDS_OFF;
|
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
HIGHLIGHT_BOX,
|
HIGHLIGHT_BOX,
|
||||||
|
Loading…
Reference in New Issue
Block a user