Light block pick fix

This commit is contained in:
NSDeathman 2026-03-12 15:32:18 +03:00
parent 26a9d6adb7
commit daef2225bf
2 changed files with 52 additions and 18 deletions

View file

@ -4,25 +4,15 @@
#include "LightSourceTile.h" #include "LightSourceTile.h"
LightSourceTile::LightSourceTile(int id) LightSourceTile::LightSourceTile(int id)
: Tile(id, Material::air, /*isSolidRender=*/false) : Tile(id, Material::decoration, /*isSolidRender=*/false)
{ {
setLightEmission(1.0f); setLightEmission(1.0f);
setDestroyTime(0.0f); setDestroyTime(0.0f);
} }
AABB* LightSourceTile::getAABB(Level* level, int x, int y, int z)
{
return nullptr; // íåò ôèçè÷åñêîé êîëëèçèè
}
AABB* LightSourceTile::getTileAABB(Level* level, int x, int y, int z)
{
return nullptr; // íåò êîëëèçèè äëÿ âûäåëåíèÿ
}
bool LightSourceTile::isSolidRender(bool isServerLevel) bool LightSourceTile::isSolidRender(bool isServerLevel)
{ {
return false; // íå çàêðûâàåò ñîñåäíèå ãðàíè return false;
} }
bool LightSourceTile::isCubeShaped() bool LightSourceTile::isCubeShaped()
@ -32,10 +22,40 @@ bool LightSourceTile::isCubeShaped()
int LightSourceTile::getRenderShape() int LightSourceTile::getRenderShape()
{ {
return Tile::SHAPE_INVISIBLE; // ðåíäåð ïðîïóñêàåòñÿ return Tile::SHAPE_INVISIBLE;
}
AABB* LightSourceTile::getAABB(Level* level, int x, int y, int z)
{
return nullptr; // íåò ôèçè÷åñêîé êîëëèçèè
}
AABB* LightSourceTile::getTileAABB(Level* level, int x, int y, int z)
{
return nullptr; // íåò ðàìêè âûäåëåíèÿ
}
HitResult* LightSourceTile::clip(Level* level, int x, int y, int z, Vec3* a, Vec3* b)
{
return nullptr; // ëó÷ ïðîõîäèò ñêâîçü áëîê, ïðèöåë íå ðåàãèðóåò
}
float LightSourceTile::getDestroyProgress(shared_ptr<Player> player, Level* level, int x, int y, int z)
{
return 0.0f; // ïðîãðåññ ðàçðóøåíèÿ âñåãäà 0 — ñëîìàòü íåâîçìîæíî
}
bool LightSourceTile::mayPick()
{
return false; // íåëüçÿ ïîäîáðàòü ñðåäíåé êíîïêîé
}
int LightSourceTile::getResourceCount(Random* random)
{
return 0; // íå âûáðàñûâàåò íè÷åãî
} }
bool LightSourceTile::isPathfindable(LevelSource* level, int x, int y, int z) bool LightSourceTile::isPathfindable(LevelSource* level, int x, int y, int z)
{ {
return true; // ìîáû ïðîõîäÿò ñêâîçü áëîê return true; // ìîáû ïðîõîäÿò íàñêâîçü
} }

View file

@ -6,15 +6,29 @@ class LightSourceTile : public Tile
public: public:
LightSourceTile(int id); LightSourceTile(int id);
// Íĺň ęîëëčçčč
AABB* getAABB(Level* level, int x, int y, int z) override;
AABB* getTileAABB(Level* level, int x, int y, int z) override;
// Íåò âèçóàëà // Íåò âèçóàëà
bool isSolidRender(bool isServerLevel) override; bool isSolidRender(bool isServerLevel) override;
bool isCubeShaped() override; bool isCubeShaped() override;
int getRenderShape() override; int getRenderShape() override;
// Нет коллизии с сущностями
AABB* getAABB(Level* level, int x, int y, int z) override;
// Нет рамки выделения при наведении
AABB* getTileAABB(Level* level, int x, int y, int z) override;
// Нельзя навести прицел — луч сквозь блок
HitResult* clip(Level* level, int x, int y, int z, Vec3* a, Vec3* b) override;
// Нельзя сломать
float getDestroyProgress(shared_ptr<Player> player, Level* level, int x, int y, int z) override;
// Нельзя подобрать средней кнопкой мыши
bool mayPick() override;
// Не выбрасывает предметы при удалении
int getResourceCount(Random* random) override;
// Íå ìåøàåò äâèæåíèþ // Íå ìåøàåò äâèæåíèþ
bool isPathfindable(LevelSource* level, int x, int y, int z) override; bool isPathfindable(LevelSource* level, int x, int y, int z) override;
}; };