bool pointable;
// Player can dig these
bool diggable;
+ // Player can climb these
+ bool climbable;
// Player can build on these
bool buildable_to;
// Whether the node has no liquid, source liquid or flowing liquid
walkable = true;
pointable = true;
diggable = true;
+ climbable = false;
buildable_to = false;
liquid_type = LIQUID_NONE;
wall_mounted = false;
in_water_stable = false;
}
+ /*
+ Check if player is climbing
+ */
+
+ try {
+ v3s16 pp = floatToInt(position + v3f(0,0.5*BS,0), BS);
+ v3s16 pp2 = floatToInt(position + v3f(0,-0.2*BS,0), BS);
+ is_climbing = (content_features(map.getNode(pp).d).climbable ||
+ content_features(map.getNode(pp2).d).climbable);
+ }
+ catch(InvalidPositionException &e)
+ {
+ is_climbing = false;
+ }
+
/*
Collision uncertainty radius
Make it a bit larger than the maximum distance of movement
Player is allowed to jump when this is true.
*/
touching_ground = false;
-
+
/*std::cout<<"Checking collisions for ("
<<oldpos_i.X<<","<<oldpos_i.Y<<","<<oldpos_i.Z
<<") -> ("
}
}
+ if (is_climbing) {
+ if (control.up || control.left || control.right || control.down) {
+ v3f speed = getSpeed();
+ speed.Y = 2*BS;
+ setSpeed(speed);
+ }
+ else {
+ v3f speed = getSpeed();
+ speed.Y = -2*BS;
+ setSpeed(speed);
+ }
+ }
+
// The speed of the player (Y is ignored)
if(superspeed)
speed = speed.normalize() * walkspeed_max * 5.0;