aboutsummaryrefslogtreecommitdiff
path: root/src/client/localplayer.cpp
diff options
context:
space:
mode:
authorElias Fleckenstein <eliasfleckenstein@web.de>2022-05-17 20:05:52 +0200
committerElias Fleckenstein <eliasfleckenstein@web.de>2022-05-17 20:05:52 +0200
commitb09fc5de5cdb021f43ad32b7e3f50dc75c0bc622 (patch)
treed0b0d2df7557620fb23cd25fcb59b2520a66ca03 /src/client/localplayer.cpp
parentd404517d2ba38594722b8f58aaeb2f8d4aeb0c38 (diff)
downloaddragonfireclient-b09fc5de5cdb021f43ad32b7e3f50dc75c0bc622.tar.xz
Add spider
Diffstat (limited to 'src/client/localplayer.cpp')
-rw-r--r--src/client/localplayer.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/client/localplayer.cpp b/src/client/localplayer.cpp
index 0a0a57cce..ca61f3a11 100644
--- a/src/client/localplayer.cpp
+++ b/src/client/localplayer.cpp
@@ -279,6 +279,25 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
nodemgr->get(node2.getContent()).climbable) && !free_move;
}
+ if (!is_climbing && !free_move && g_settings->getBool("spider")) {
+ v3s16 spider_positions[4] = {
+ floatToInt(position + v3f(+1.0f, +0.0f, 0.0f) * BS, BS),
+ floatToInt(position + v3f(-1.0f, +0.0f, 0.0f) * BS, BS),
+ floatToInt(position + v3f( 0.0f, +0.0f, +1.0f) * BS, BS),
+ floatToInt(position + v3f( 0.0f, +0.0f, -1.0f) * BS, BS),
+ };
+
+ for (v3s16 sp : spider_positions) {
+ bool is_valid;
+ MapNode node = map->getNode(sp, &is_valid);
+
+ if (is_valid && nodemgr->get(node.getContent()).walkable) {
+ is_climbing = true;
+ break;
+ }
+ }
+ }
+
/*
Collision uncertainty radius
Make it a bit larger than the maximum distance of movement