space + space dust (oerkki dust + mithril dust)

This commit is contained in:
darkrose 2016-01-25 02:35:15 +10:00
parent 39b46f03fb
commit 609112acdb
16 changed files with 244 additions and 27 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 795 B

After

Width:  |  Height:  |  Size: 819 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 788 B

After

Width:  |  Height:  |  Size: 819 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 709 B

BIN
data/textures/spacerock.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -54,7 +54,7 @@ void content_clothesitem_init()
f->type = CT_PANTS;
f->armour = 0.10;
f->warmth = 0.20;
f->vacuum = 0.30;
f->vacuum = 1.0;
f->durability = 20;
{
u16 r[9] = {
@ -76,7 +76,7 @@ void content_clothesitem_init()
f->type = CT_JACKET;
f->armour = 0.10;
f->warmth = 0.20;
f->vacuum = 0.30;
f->vacuum = 1.0;
f->durability = 20;
{
u16 r[9] = {
@ -98,7 +98,7 @@ void content_clothesitem_init()
f->type = CT_HAT;
f->armour = 0.05;
f->warmth = 0.15;
f->vacuum = 0.20;
f->vacuum = 1.0;
f->suffocate = 1.0;
f->durability = 20;
crafting::setHelmetRecipe(CONTENT_CRAFTITEM_CANVAS_SHEET,i);
@ -114,7 +114,7 @@ void content_clothesitem_init()
f->type = CT_BOOTS;
f->armour = 0.05;
f->warmth = 0.20;
f->vacuum = 0.20;
f->vacuum = 1.0;
f->durability = 20;
crafting::setBootsRecipe(CONTENT_CRAFTITEM_CANVAS_SHEET,i);
lists::add("craftguide",i);

View File

@ -1564,4 +1564,22 @@ void content_craftitem_init()
f->name = "salt_dust";
f->description = wgettext("Salt");
lists::add("creative",i);
i = CONTENT_CRAFTITEM_OERKKI_DUST_SPACE;
f = &g_content_craftitem_features[i];
f->content = CONTENT_CRAFTITEM_OERKKI_DUST_SPACE;
f->texture = "oerkki_dust_space.png";
f->name = "oerkki_dust_space";
f->description = wgettext("Space Dust");
f->drop_count = 1;
f->teleports = PLAYERFLAG_JUMP; // teleports player up 1500
{
u16 r[9] = {
CONTENT_IGNORE, CONTENT_CRAFTITEM_OERKKI_DUST, CONTENT_IGNORE,
CONTENT_CRAFTITEM_OERKKI_DUST, CONTENT_CRAFTITEM_MITHRILDUST, CONTENT_CRAFTITEM_OERKKI_DUST,
CONTENT_IGNORE, CONTENT_CRAFTITEM_OERKKI_DUST, CONTENT_IGNORE
};
crafting::setRecipe(r,CONTENT_CRAFTITEM_OERKKI_DUST_SPACE,1);
}
lists::add("creative",i);
}

View File

@ -235,5 +235,6 @@ CraftItemFeatures & content_craftitem_features(std::string subname);
#define CONTENT_CRAFTITEM_SAPPHIRE (CONTENT_CRAFTITEM_MASK | 0x85)
#define CONTENT_CRAFTITEM_SUNSTONE (CONTENT_CRAFTITEM_MASK | 0x86)
#define CONTENT_CRAFTITEM_SALT (CONTENT_CRAFTITEM_MASK | 0x87)
#define CONTENT_CRAFTITEM_OERKKI_DUST_SPACE (CONTENT_CRAFTITEM_MASK | 0x88)
#endif

View File

@ -251,6 +251,21 @@ void content_mapnode_init(bool repeat)
lists::add("cooking",i);
lists::add("decrafting",i);
i = CONTENT_SPACEROCK;
f = &content_features(i);
f->description = wgettext("Space Rock");
f->setAllTextures("spacerock.png");
f->setInventoryTextureCube("spacerock.png", "spacerock.png", "spacerock.png");
f->param_type = CPT_MINERAL;
f->draw_type = CDT_CUBELIKE;
f->is_ground_content = true;
f->often_contains_mineral = true;
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
f->type = CMT_STONE;
f->hardness = 1.1;
if (invisible_stone)
f->solidness = 0; // For debugging, hides regular stone
i = CONTENT_MARBLE;
f = &content_features(i);
f->description = wgettext("Marble");

View File

@ -58,7 +58,7 @@ MapNode mapnode_translate_to_internal(MapNode n_from, u8 version);
#define CONTENT_WATERSOURCE 0x009
#define CONTENT_FORGE_FIRE 0x00A
#define CONTENT_MARBLE 0x00B
// FREE 0x00C
#define CONTENT_SPACEROCK 0x00C
#define CONTENT_SAFE 0x00D
#define CONTENT_SIGN_WALL 0x00E
#define CONTENT_CHEST 0x00F

View File

@ -2597,6 +2597,7 @@ void ServerEnvironment::step(float dtime)
std::vector<content_t> search;
bool found = false;
search.push_back(CONTENT_WATER);
search.push_back(CONTENT_VACUUM);
search.push_back(CONTENT_WATERSOURCE);
if (p.Y > 60 && p.Y < 1024) {
found = true;

View File

@ -1863,7 +1863,8 @@ void the_game(
float time_brightness = (float)decode_light((daynight_ratio * LIGHT_SUN) / 1000) / 255.0;
float direct_brightness = 0;
bool sunlight_seen = false;
if (free_move) {
bool in_space = (client.getLocalPlayer()->getPosition().Y>(1024*BS));
if (in_space || free_move) {
direct_brightness = time_brightness;
sunlight_seen = true;
}else{
@ -1895,7 +1896,7 @@ void the_game(
float moon_phase = client.getEnv().getMoonPhase();
sky->update(time_of_day_smooth, moon_phase, time_brightness, direct_brightness, sunlight_seen);
sky->update(time_of_day_smooth, moon_phase, time_brightness, direct_brightness, sunlight_seen, in_space);
video::SColor bgcolor = sky->getBgColor();
video::SColor skycolor = sky->getSkyColor();

View File

@ -1170,12 +1170,29 @@ double tree_amount_2d(uint64_t seed, v2s16 p)
0.5+(float)p.X/125, 0.5+(float)p.Y/125,
seed+2, 4, 0.66);
double zeroval = -0.39;
if(noise < zeroval)
if (noise < zeroval)
return 0;
else
return 0.04 * (noise-zeroval) / (1.0-zeroval);
}
// used in space
double debris_amount_2d(uint64_t seed, v2s16 p)
{
double noise = noise2d_perlin(
0.5+(float)p.X/125,
0.5+(float)p.Y/125,
seed+2,
4,
0.7
);
double zeroval = -0.41;
if (noise < zeroval)
return 0;
return 0.037 * (noise-zeroval) / (1.0-zeroval);
}
double surface_humidity_2d(uint64_t seed, v2s16 p)
{
double noise = noise2d_perlin(
@ -1327,11 +1344,159 @@ bool get_have_sand(uint64_t seed, v2s16 p2d)
return (sandnoise > -0.15);
}
void make_space(BlockMakeData *data)
{
v3s16 blockpos = data->blockpos;
ManualMapVoxelManipulator &vmanip = *(data->vmanip);
// Area of center block
v3s16 node_min = blockpos*MAP_BLOCKSIZE;
v3s16 node_max = (blockpos+v3s16(1,1,1))*MAP_BLOCKSIZE-v3s16(1,1,1);
// Full allocated area
v3s16 full_node_min = (blockpos-1)*MAP_BLOCKSIZE;
// Area of a block
double block_area_nodes = MAP_BLOCKSIZE*MAP_BLOCKSIZE;
v2s16 p2d_center(node_min.X+MAP_BLOCKSIZE/2, node_min.Z+MAP_BLOCKSIZE/2);
u32 blockseed = (u32)(data->seed%0x100000000ULL) + full_node_min.Z*38134234 + full_node_min.Y*42123 + full_node_min.X*23;
for (s16 x=node_min.X; x<=node_max.X; x++)
for (s16 z=node_min.Z; z<=node_max.Z; z++) {
// Node position
v2s16 p2d(x,z);
{
// Use fast index incrementing
v3s16 em = vmanip.m_area.getExtent();
u32 i = vmanip.m_area.index(v3s16(p2d.X, node_min.Y, p2d.Y));
for (s16 y=node_min.Y; y<=node_max.Y; y++) {
vmanip.m_data[i] = MapNode(CONTENT_VACUUM);
data->vmanip->m_area.add_y(em, i, 1);
}
}
}
u32 debris_amount = block_area_nodes*debris_amount_2d(blockseed,p2d_center);
if (debris_amount < 10)
return;
NoiseBuffer noisebuf_mineral;
{
v3f minpos_f(node_min.X, node_min.Y, node_min.Z);
v3f maxpos_f(node_max.X, node_max.Y, node_max.Z);
// Sample length
v3f sl(2.5, 2.5, 2.5);
noisebuf_mineral.create(
get_ground_wetness_params(data->seed),
minpos_f.X, minpos_f.Y, minpos_f.Z,
maxpos_f.X, maxpos_f.Y+5, maxpos_f.Z,
sl.X, sl.Y, sl.Z
);
}
{
PseudoRandom debrisrandom(blockseed);
u32 count = debris_amount/6;
for (u32 i=0; i<count; i++) {
s16 x = debrisrandom.range(node_min.X, node_max.X);
s16 y = debrisrandom.range(node_min.Y, node_max.Y);
s16 z = debrisrandom.range(node_min.Z, node_max.Z);
MapNode new_content(CONTENT_VACUUM);
float mineral_noise = noisebuf_mineral.get(x,y,z);
if (mineral_noise < -0.1) {
new_content = MapNode(CONTENT_SPACEROCK, MINERAL_IRON);
}else if (mineral_noise > 0.4) {
new_content = MapNode(CONTENT_SPACEROCK, MINERAL_SILVER);
}else if (mineral_noise > 0.3) {
new_content = MapNode(CONTENT_SPACEROCK, MINERAL_QUARTZ);
}else if (mineral_noise > 0.2) {
new_content = MapNode(CONTENT_SPACEROCK, MINERAL_COPPER);
}else if (mineral_noise > 0.1) {
new_content = MapNode(CONTENT_SPACEROCK, MINERAL_TIN);
}else if (mineral_noise > 0.0) {
new_content = MapNode(CONTENT_SPACEROCK, MINERAL_GOLD);
}
u32 vi = vmanip.m_area.index(v3s16(x,y,z));
if (vmanip.m_data[vi].getContent() == CONTENT_VACUUM)
vmanip.m_data[vi] = new_content;
}
}
if (debris_amount < 13)
return;
{
v3s16 pos = node_min+(MAP_BLOCKSIZE/2);
u16 comet_size = debris_amount-11;
if (comet_size > 5)
comet_size = 5;
s16 comet_min = -comet_size;
s16 comet_max = comet_size;
MapNode new_content(CONTENT_SPACEROCK);
float mineral_noise = noisebuf_mineral.get(pos.X,pos.Y,pos.Z);
if (mineral_noise < -0.5) {
new_content = MapNode(CONTENT_LAVASOURCE);
}else if (mineral_noise < -0.3) {
new_content = MapNode(CONTENT_ICE);
}else if (mineral_noise < -0.1) {
new_content = MapNode(CONTENT_STEEL);
}else if (mineral_noise > 0.4) {
new_content = MapNode(CONTENT_SILVER);
}else if (mineral_noise > 0.3) {
new_content = MapNode(CONTENT_MITHRIL_BLOCK);
}else if (mineral_noise > 0.2) {
new_content = MapNode(CONTENT_COPPER);
}else if (mineral_noise > 0.1) {
new_content = MapNode(CONTENT_TIN);
}else if (mineral_noise > 0.0) {
new_content = MapNode(CONTENT_GOLD);
}
for (s16 x=comet_min; x<=comet_max; x++) {
for (s16 y=comet_min; y<=comet_max; y++) {
for (s16 z=comet_min; z<=comet_max; z++) {
int edge = 0;
if (x == comet_min || x == comet_max)
edge++;
if (y == comet_min || y == comet_max)
edge++;
if (z == comet_min || z == comet_max)
edge++;
if (edge > 1)
continue;
u32 vi = vmanip.m_area.index(pos+v3s16(x,y,z));
if (vmanip.m_data[vi].getContent() != CONTENT_VACUUM)
continue;
if (edge) {
vmanip.m_data[vi] = MapNode(CONTENT_SPACEROCK);
continue;
}
vmanip.m_data[vi] = new_content;
}
}
}
}
}
void make_block(BlockMakeData *data)
{
if (data->no_op)
return;
if ((data->blockpos.Y*MAP_BLOCKSIZE) > 1200) {
make_space(data);
return;
}
v3s16 blockpos = data->blockpos;
ManualMapVoxelManipulator &vmanip = *(data->vmanip);

View File

@ -341,6 +341,9 @@ bool Player::getHome(s8 i, v3f &h)
return false;
h = m_flag[i];
return true;
}else if (i == PLAYERFLAG_JUMP) {
h = m_position+intToFloat(v3s16(0,1500,0),BS);
return true;
}
return false;
}

View File

@ -65,6 +65,7 @@
#define PLAYERFLAG_YELLOW 6
#define PLAYERFLAG_BLACK 7
#define PLAYERFLAG_COUNT 8
#define PLAYERFLAG_JUMP PLAYERFLAG_COUNT
#define PLAYER_FEET 0x01
#define PLAYER_LLEG 0x02
@ -332,7 +333,7 @@ public:
continue;
break;
case PLAYER_TORSO:
if (j != 1)
if (j != 1 && j != 2)
continue;
break;
case PLAYER_HANDS:

View File

@ -42,6 +42,7 @@ Sky::Sky(scene::ISceneNode* parent, scene::ISceneManager* mgr, s32 id):
m_cloud_brightness(0.5),
m_moon_phase(0.0),
m_moon_phase_pending(0.0),
m_space(false),
m_bgcolor_bright_f(1,1,1,1),
m_skycolor_bright_f(1,0,0,0),
m_cloudcolor_bright_f(1,1,1,1)
@ -193,7 +194,11 @@ void Sky::render()
m_moon_phase = m_moon_phase_pending;
}
float f = 0.0;
// Stars
if (m_space) {
f = 120.0;
}else{
float starbrightness = MYMAX(
0,
MYMIN(
@ -203,7 +208,8 @@ void Sky::render()
)) * 10
)
);
float f = starbrightness*120;
f = starbrightness*120;
}
if (f >= m_skycolor.getBlue()) {
driver->setMaterial(m_materials[1]);
video::SColor starcolor(255, f,f,f);
@ -234,7 +240,8 @@ void Sky::update(
float moon_phase,
float time_brightness,
float direct_brightness,
bool sunlight_seen
bool sunlight_seen,
bool in_space
)
{
// Stabilize initial brightness and color values by flooding updates
@ -242,7 +249,7 @@ void Sky::update(
m_first_update = false;
m_moon_phase = moon_phase;
for (u32 i=0; i<100; i++) {
update(time_of_day, moon_phase, time_brightness, direct_brightness, sunlight_seen);
update(time_of_day, moon_phase, time_brightness, direct_brightness, sunlight_seen, in_space);
}
return;
}
@ -252,7 +259,9 @@ void Sky::update(
m_time_brightness = time_brightness;
m_sunlight_seen = sunlight_seen;
bool is_dawn = (time_brightness >= 0.20 && time_brightness < 0.50);
m_space = in_space;
bool is_dawn = (!in_space && time_brightness >= 0.20 && time_brightness < 0.50);
video::SColorf bgcolor_bright_normal_f(170./255,200./255,230./255, 1.0);
video::SColorf bgcolor_bright_indoor_f(100./255,100./255,100./255, 1.0);
@ -264,7 +273,9 @@ void Sky::update(
video::SColorf cloudcolor_bright_normal_f = video::SColor(255, 240,240,255);
video::SColorf cloudcolor_bright_dawn_f(1.0, 0.7, 0.5, 1.0);
if (sunlight_seen) {
if (in_space) {
m_brightness = 0.02;
}else if (sunlight_seen) {
if (fabs(time_brightness - m_brightness) < 0.2) {
m_brightness = m_brightness * 0.95 + time_brightness * 0.05;
}else{
@ -276,7 +287,7 @@ void Sky::update(
m_brightness = m_brightness * 0.98 + direct_brightness * 0.02;
}
m_clouds_visible = true;
m_clouds_visible = !in_space;
float color_change_fraction = 0.98;
if (sunlight_seen) {
if (is_dawn) {

View File

@ -54,7 +54,7 @@ public:
virtual u32 getMaterialCount() const
{ return SKY_MATERIAL_COUNT; }
void update(float time_of_day, float moon_phase, float time_brightness, float direct_brightness, bool sunlight_seen);
void update(float time_of_day, float moon_phase, float time_brightness, float direct_brightness, bool sunlight_seen, bool in_space);
float getBrightness(){ return m_brightness; }
video::SColor getBgColor(){ return m_bgcolor; }
@ -76,6 +76,7 @@ private:
bool m_clouds_visible;
float m_moon_phase;
float m_moon_phase_pending;
bool m_space;
video::SColorf m_bgcolor_bright_f;
video::SColorf m_skycolor_bright_f;
video::SColorf m_cloudcolor_bright_f;