blob: 4d6646250d7c30046edaeffd3bd99ae2ee3e2596 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
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
|