aboutsummaryrefslogtreecommitdiff
path: root/src/shared/world/block.cc
diff options
context:
space:
mode:
authorNicolas James <Eele1Ephe7uZahRie@tutanota.com>2025-02-12 21:57:46 +1100
committerNicolas James <Eele1Ephe7uZahRie@tutanota.com>2025-02-12 21:57:46 +1100
commite4483eca01b48b943cd0461e24a74ae1a3139ed4 (patch)
treeed58c3c246e3af1af337697695d780aa31f6ad9a /src/shared/world/block.cc
parent1cc08c51eb4b0f95c30c0a98ad1fc5ad3459b2df (diff)
Update to most recent version (old initial commit)
Diffstat (limited to 'src/shared/world/block.cc')
-rw-r--r--src/shared/world/block.cc85
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