f->dug_item = std::string("MaterialItem ")+itos(i)+" 1";
setStoneLikeDiggingProperties(f->digging_properties, 5.0);
+ i = CONTENT_NC;
+ f = &content_features(i);
+ f->param_type = CPT_FACEDIR_SIMPLE;
+ f->setAllTextures("nc_side.png");
+ f->setTexture(5, "nc_front.png"); // Z-
+ f->setTexture(4, "nc_back.png"); // Z+
+ f->setInventoryTexture("nc_front.png");
+ f->dug_item = std::string("MaterialItem ")+itos(i)+" 1";
+ setStoneLikeDiggingProperties(f->digging_properties, 3.0);
+
+ i = CONTENT_NC_RB;
+ f = &content_features(i);
+ f->setAllTextures("nc_rb.png");
+ f->setInventoryTexture("nc_rb.png");
+ f->dug_item = std::string("MaterialItem ")+itos(i)+" 1";
+ setStoneLikeDiggingProperties(f->digging_properties, 3.0);
+
// NOTE: Remember to add frequently used stuff to the texture atlas in tile.cpp
/*
Add MesePick to everything
*/
- for(u16 i=0; i<256; i++)
+ for(u16 i=0; i<=MAX_CONTENT; i++)
{
content_features(i).digging_properties.set("MesePick",
DiggingProperties(true, 0.0, 65535./1337));
#define CONTENT_BOOKSHELF 0x814 //29
#define CONTENT_JUNGLETREE 0x815
#define CONTENT_JUNGLEGRASS 0x816
+#define CONTENT_NC 0x817
+#define CONTENT_NC_RB 0x818
#endif
}
}
+static void make_nc(VoxelManipulator &vmanip, PseudoRandom &random)
+{
+ v3s16 dir;
+ u8 facedir_i = 0;
+ s32 r = random.range(0, 3);
+ if(r == 0){
+ dir = v3s16( 1, 0, 0);
+ facedir_i = 3;
+ }
+ if(r == 1){
+ dir = v3s16(-1, 0, 0);
+ facedir_i = 1;
+ }
+ if(r == 2){
+ dir = v3s16( 0, 0, 1);
+ facedir_i = 2;
+ }
+ if(r == 3){
+ dir = v3s16( 0, 0,-1);
+ facedir_i = 0;
+ }
+ v3s16 p = vmanip.m_area.MinEdge + v3s16(
+ 16+random.range(0,15),
+ 16+random.range(0,15),
+ 16+random.range(0,15));
+ vmanip.m_data[vmanip.m_area.index(p)] = MapNode(CONTENT_NC, facedir_i);
+ u32 length = random.range(3,15);
+ for(u32 j=0; j<length; j++)
+ {
+ p -= dir;
+ vmanip.m_data[vmanip.m_area.index(p)] = MapNode(CONTENT_NC_RB);
+ }
+}
+
/*
Noise functions. Make sure seed is mangled differently in each one.
*/
}
}
}
+
+ /*
+ Add NC
+ */
+ {
+ PseudoRandom ncrandom(blockseed+9324342);
+ if(ncrandom.range(0, 1000) == 0 && blockpos.Y <= -3)
+ {
+ make_nc(vmanip, ncrandom);
+ }
+ }
/*
Add top and bottom side of water to transforming_liquid queue
facedir: CPT_FACEDIR_SIMPLE param1 value
dir: The face for which stuff is wanted
return value: The face from which the stuff is actually found
+
+ NOTE: Currently this uses 2 bits for Z-,X-,Z+,X+, should there be Y+
+ and Y- too?
*/
v3s16 facedir_rotate(u8 facedir, v3s16 dir);
in_water(false),
in_water_stable(false),
swimming_up(false),
+ inventory_backup(NULL),
craftresult_is_preview(true),
hp(20),
peer_id(PEER_ID_INEXISTENT),
Player::~Player()
{
+ delete inventory_backup;
}
void Player::resetInventory()
args.writeLines(os);
os<<"PlayerArgsEnd\n";
-
- inventory.serialize(os);
+
+ // If actual inventory is backed up due to creative mode, save it
+ // instead of the dummy creative mode inventory
+ if(inventory_backup)
+ inventory_backup->serialize(os);
+ else
+ inventory.serialize(os);
}
void Player::deSerialize(std::istream &is)
bool swimming_up;
Inventory inventory;
+ // Actual inventory is backed up here when creative mode is used
+ Inventory *inventory_backup;
bool craftresult_is_preview;
// Reset inventory to creative if in creative mode
if(g_settings.getBool("creative_mode"))
{
+ // Warning: double code below
+ // Backup actual inventory
+ player->inventory_backup = new Inventory();
+ *(player->inventory_backup) = player->inventory;
+ // Set creative inventory
craft_set_creative_inventory(player);
}
if(g_settings.getBool("creative_mode"))
{
+ // Warning: double code above
+ // Backup actual inventory
+ player->inventory_backup = new Inventory();
+ *(player->inventory_backup) = player->inventory;
+ // Set creative inventory
craft_set_creative_inventory(player);
}
else if(g_settings.getBool("give_initial_stuff"))