diff options
Diffstat (limited to 'src/shared/world/block.cc')
| -rw-r--r-- | src/shared/world/block.cc | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/src/shared/world/block.cc b/src/shared/world/block.cc new file mode 100644 index 0000000..4d66462 --- /dev/null +++ b/src/shared/world/block.cc @@ -0,0 +1,85 @@ +#include "shared/world/block.hh" + +namespace shared { +namespace world { + +enum block::visibility +block::get_visibility(const enum block::type type) noexcept { + switch (type) { + case type::air: + return visibility::invisible; + case type::shrub: + case type::dead_shrub: + case type::leaves: + case type::snowy_leaves: + case type::snowy_shrub: + return visibility::partial; + case type::water: + return visibility::translucent; + default: + break; + } + return visibility::solid; +} + +bool block::is_tangible(const enum block::type type) noexcept { + switch (type) { + case type::air: + case type::shrub: + case type::dead_shrub: + case type::snowy_shrub: + return false; + default: + break; + } + return true; +} + +bool block::is_collidable(const enum block::type type) noexcept { + switch (type) { + case type::air: + case type::shrub: + case type::dead_shrub: + case type::snowy_shrub: + case type::water: + return false; + default: + break; + } + return true; +} + +bool block::is_liquid(const enum block::type type) noexcept { + switch (type) { + case type::water: + return true; + default: + break; + } + return false; +} + +bool block::is_replaceable(const enum block::type type) noexcept { + switch (type) { + case type::water: + case type::air: + return true; + default: + break; + } + return false; +} + +bool block::is_removable(const enum block::type type) noexcept { + switch (type) { + case type::water: + case type::air: + return false; + default: + break; + } + return true; +} + +} // namespace world +} // namespace shared |
