Make objects fall through the planet and warp around the edges

Disable clouds by default
master
Jeija 2016-09-10 20:29:38 +02:00
parent dd68d76216
commit f66044be43
3 changed files with 30 additions and 2 deletions

View File

@ -255,13 +255,14 @@ collisionMoveResult collisionMoveSimple(Environment *env, IGameDef *gamedef,
bool any_position_valid = false;
int planet_circumference = ceil(g_settings->getU16("planet_radius") * M_PI) * 2 * MAP_BLOCKSIZE;
for(s16 x = min_x; x <= max_x; x++)
for(s16 y = min_y; y <= max_y; y++)
for(s16 z = min_z; z <= max_z; z++)
{
v3s16 p(x,y,z);
if (g_settings->getBool("planet_enable")) {
int planet_circumference = ceil(g_settings->getU16("planet_radius") * M_PI) * 2 * MAP_BLOCKSIZE;
if (p.X >= planet_circumference / 2) p.X -= planet_circumference;
if (p.Z >= planet_circumference / 2) p.Z -= planet_circumference;
if (p.X < -planet_circumference / 2) p.X += planet_circumference;

View File

@ -284,6 +284,33 @@ void LuaEntitySAO::step(float dtime, bool send_recommended)
m_velocity += dtime * m_acceleration;
}
/*
Handle Planet
*/
if (g_settings->getBool("planet_enable")) {
int planet_radius = g_settings->getU16("planet_radius") * MAP_BLOCKSIZE * BS;
int planet_circumference = ceil(g_settings->getU16("planet_radius") * M_PI) * 2 * MAP_BLOCKSIZE * BS;
// Teleport items to other side of planet at planet edges
if (m_base_position.X > planet_circumference / 2 - 0.5 * BS)
m_base_position.X = -(float)planet_circumference / 2 - 0.5 * BS;
if (m_base_position.X < -planet_circumference / 2 - 0.5 * BS)
m_base_position.X = (float)planet_circumference / 2 - 0.5 * BS;
if (m_base_position.Z > planet_circumference / 2 - 0.5 * BS)
m_base_position.Z = -(float)planet_circumference / 2 - 0.5 * BS;
if (m_base_position.Z < -planet_circumference / 2 - 0.5 * BS)
m_base_position.Z = (float)planet_circumference / 2 - 0.5 * BS;
// Make objects fall through the planet center
if (g_settings->getBool("planet_fallthrough_enable")) {
if (m_base_position.Y < -planet_radius) {
m_base_position.Y = -planet_radius + BS;
m_base_position.X += planet_circumference / 2. * (m_base_position.X < 0 ? 1 : -1);
m_velocity.Y *= -1;
}
}
}
if((m_prop.automatic_face_movement_dir) &&
(fabs(m_velocity.Z) > 0.001 || fabs(m_velocity.X) > 0.001))
{

View File

@ -126,7 +126,7 @@ void set_default_settings(Settings *settings)
settings->setDefault("cinematic_camera_smoothing", "0.7");
settings->setDefault("fast_move", "false");
settings->setDefault("invert_mouse", "false");
settings->setDefault("enable_clouds", "true");
settings->setDefault("enable_clouds", "false");
settings->setDefault("screenshot_path", ".");
settings->setDefault("screenshot_format", "png");
settings->setDefault("screenshot_quality", "0");