diff --git a/data/cooked_rat.png b/data/cooked_rat.png new file mode 100644 index 00000000..daad3be0 Binary files /dev/null and b/data/cooked_rat.png differ diff --git a/data/nc_back.png b/data/nc_back.png new file mode 100644 index 00000000..f09f4165 Binary files /dev/null and b/data/nc_back.png differ diff --git a/data/nc_front.png b/data/nc_front.png new file mode 100644 index 00000000..cad9edab Binary files /dev/null and b/data/nc_front.png differ diff --git a/data/nc_rb.png b/data/nc_rb.png new file mode 100644 index 00000000..7ebc9930 Binary files /dev/null and b/data/nc_rb.png differ diff --git a/data/nc_side.png b/data/nc_side.png new file mode 100644 index 00000000..f954045f Binary files /dev/null and b/data/nc_side.png differ diff --git a/data/scorched_stuff.png b/data/scorched_stuff.png new file mode 100644 index 00000000..9ced2fbe Binary files /dev/null and b/data/scorched_stuff.png differ diff --git a/src/content_mapnode.cpp b/src/content_mapnode.cpp index db036ebd..b6b7a6e5 100644 --- a/src/content_mapnode.cpp +++ b/src/content_mapnode.cpp @@ -474,13 +474,30 @@ void content_mapnode_init() 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)); diff --git a/src/content_mapnode.h b/src/content_mapnode.h index 5fdbf45f..7be26518 100644 --- a/src/content_mapnode.h +++ b/src/content_mapnode.h @@ -70,6 +70,8 @@ MapNode mapnode_translate_to_internal(MapNode n_from, u8 version); #define CONTENT_BOOKSHELF 0x814 //29 #define CONTENT_JUNGLETREE 0x815 #define CONTENT_JUNGLEGRASS 0x816 +#define CONTENT_NC 0x817 +#define CONTENT_NC_RB 0x818 #endif diff --git a/src/mapgen.cpp b/src/mapgen.cpp index 0ba7f91a..5dec7d84 100644 --- a/src/mapgen.cpp +++ b/src/mapgen.cpp @@ -976,6 +976,40 @@ static void make_dungeon1(VoxelManipulator &vmanip, PseudoRandom &random) } } +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; jserialize(os); + else + inventory.serialize(os); } void Player::deSerialize(std::istream &is) diff --git a/src/player.h b/src/player.h index a7a2433c..29460e1e 100644 --- a/src/player.h +++ b/src/player.h @@ -121,6 +121,8 @@ public: bool swimming_up; Inventory inventory; + // Actual inventory is backed up here when creative mode is used + Inventory *inventory_backup; bool craftresult_is_preview; diff --git a/src/server.cpp b/src/server.cpp index 07f9875c..503d60b8 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -4130,6 +4130,11 @@ Player *Server::emergePlayer(const char *name, const char *password, u16 peer_id // 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); } @@ -4183,6 +4188,11 @@ Player *Server::emergePlayer(const char *name, const char *password, u16 peer_id 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"))