Add spider

master
Elias Fleckenstein 2022-05-17 20:05:52 +02:00
parent d404517d2b
commit b09fc5de5c
No known key found for this signature in database
GPG Key ID: 06927A5199D6C9B2
4 changed files with 23 additions and 0 deletions

View File

@ -13,6 +13,7 @@ core.cheats = {
["JetPack"] = "jetpack",
["AntiSlip"] = "antislip",
["AirJump"] = "airjump",
["Spider"] = "spider",
},
["Render"] = {
["Xray"] = "xray",

View File

@ -2375,3 +2375,5 @@ tool_range (Additional Tool Range) int 2
reach (Reach) bool false
airjump (AirJump) bool false
spider (Spider) bool false

View File

@ -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

View File

@ -126,6 +126,7 @@ void set_default_settings()
settings->setDefault("scaffold", "false");
settings->setDefault("killaura", "false");
settings->setDefault("airjump", "false");
settings->setDefault("spider", "false");
// Keymap
settings->setDefault("remote_port", "30000");