From 8e1eacf3a87a0cee39c8c27c3846828c12e73f9d Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Sat, 30 Jul 2011 23:33:57 +0300 Subject: [PATCH] Fixed handling of inventory in creative mode (normal inventory is not trashed anymore), fixed mese pick speed, added some forgotten stuff --- data/cooked_rat.png | Bin 0 -> 239 bytes data/nc_back.png | Bin 0 -> 303 bytes data/nc_front.png | Bin 0 -> 410 bytes data/nc_rb.png | Bin 0 -> 203 bytes data/nc_side.png | Bin 0 -> 260 bytes data/scorched_stuff.png | Bin 0 -> 233 bytes src/content_mapnode.cpp | 19 ++++++++++++++++- src/content_mapnode.h | 2 ++ src/mapgen.cpp | 45 ++++++++++++++++++++++++++++++++++++++++ src/mapnode.h | 3 +++ src/player.cpp | 11 ++++++++-- src/player.h | 2 ++ src/server.cpp | 10 +++++++++ 13 files changed, 89 insertions(+), 3 deletions(-) create mode 100644 data/cooked_rat.png create mode 100644 data/nc_back.png create mode 100644 data/nc_front.png create mode 100644 data/nc_rb.png create mode 100644 data/nc_side.png create mode 100644 data/scorched_stuff.png diff --git a/data/cooked_rat.png b/data/cooked_rat.png new file mode 100644 index 0000000000000000000000000000000000000000..daad3be0d19a741831bd9e1123846c19b580ca78 GIT binary patch literal 239 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`EX7WqAsj$Z!;#Vf4nJ z@ErkR#;MwT(m=t9o-U3d7QJVKqInM}2xzBh2{bVBBry0_96G?0kifLzpxuewC&!W% zBRADeeR3;XpJ9LFHJ!I)wt|enSA|Z?Hqo?4;cQcy?k98J gQ(9m5^L+tRu)W@od+PaZK*uq7y85}Sb4q9e0K#%s{r~^~ literal 0 HcmV?d00001 diff --git a/data/nc_back.png b/data/nc_back.png new file mode 100644 index 0000000000000000000000000000000000000000..f09f41658330f559dddc804e0f48fe94637d7e11 GIT binary patch literal 303 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`EX7WqAsj$Z!;#Vf4nJ z@ErkR#;MwT(m=tBo-U3d7QJ(W5Aq%|5csS*S0l)L!D5F5W-Crx3C_+=g=db9*^?cv zPX2V_r1f{y)b^Kl=HN8~pz$77t0;M3wzKW|Wr%E;|&*U|nBar-OEsOsDbx$6x@7?&$ z?}5vti`G{zF7el5nsn%j+cr(14V6B1T^lX>Od1MPR!9X`iz wIJjx|Wc7H=9e0#pEpvADlR;9$FbqZCx66gvE6|Iu zu)_`LMTiy7R8G`dEaHTibQlKBcw^~*Ju4BMFAn_goG&iG@1GO#IDjhm>%?ynj|qTT zlQ=AwWg4MI;xXao55>xnQVNn*qp&7DAUS4+vL1+q*@)EV4qcH%trasPWZ|oSWtt}3 z_hg6NO^ad%RHP@MJ`}g6ax3rP0T;OY4)Z4^%yl_ug1dtvwbACB8HVAZIHg2NslyKt zIy^}`+{JL)-QBqb&GlpXATx^$0ReIA1Y6_O{552PJR&M>0A0uBor^f<{7u))#Vl=8 z?~!qDpR%qwv$4(U_1ob7IT23-R>lrhR8Z_^q9=y*!fpF21Kh8L!)b#^K-3v;J5$Yj zz*@BlcgJjGvJp||E)HgfwI}YE?fGrLriy=BXFXs13k7}4h*nSCQ~&?~07*qoM6N<$ Ef`X^5s{jB1 literal 0 HcmV?d00001 diff --git a/data/nc_rb.png b/data/nc_rb.png new file mode 100644 index 0000000000000000000000000000000000000000..7ebc9930d42866f70bba6e07a6f7c4affd0bc3da GIT binary patch literal 203 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`EX7WqAsj$Z!;#Vf4nJ z@ErkR#;MwT(m=snPZ!4!i{7P|14SDY1Y9mknobN`&^4oxsqBJJnqgCRbFIAf{sXBG z8t%HS5U3C0I+J^a;nXAT`2y?=TbOena6EV4@i~!A;hxg|Bkt=MZ#aZ6IdE+uBjb$) u>n#foTRSjFUr4`oe=}RavQtT(zZf4Ts++F4S*!-Mn8DN4&t;ucLK6U8heQhi literal 0 HcmV?d00001 diff --git a/data/nc_side.png b/data/nc_side.png new file mode 100644 index 0000000000000000000000000000000000000000..f954045fbd9ce5fbc95a8da665575ed0574d4eb5 GIT binary patch literal 260 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`EX7WqAsj$Z!;#Vf4nJ z@ErkR#;MwT(m=swo-U3d7QJ(WZ}T2D;IJuBTXltZQs6I%h4)l)-MX%HN?o2Gw$x0` z&u>$Uz;os!jLsqqzwZgOGMxBSlfZxIVUM4Bg`KJ3<-%WuF`sHpl4DPwSm-%@wXF6O z`4BE&Mg||3*&I6=x;y-ftX?r}Fg^N8LVnMT11=}S)|D=q$l@b(ZEC4qeA1zy_ZNfC zO@A>-=BfU_JsZAG;nsg4o$p?+o$Iym?A)%;4$j=d#Wzp$P!f C^4nJ z@ErkR#;MwT(m=s(PZ!4!i{7(Aw|N^Bc=kx8CrU3%m7ccJUaVj2!iQ90r^Y+Y%n!~l zom|)Ll3BBU4pYMIlOi=fAyZ{}=IGoMZIBXd{JTfxa{^CC8{e+VMfdi0Tv)gvX{GPZ z)z$Y4E=g@Wwjk*7F5x9tOqZ+M98qYlWvJS;YO{IJ(;$YV{|-G*blK-~%Cl78x&8Ie aRy{$3__d~{M>YYS#o+1c=d#Wzp$Py!<5X<` literal 0 HcmV?d00001 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")) -- 2.30.2