From 958f037983e3e7a3a307ec9a64d87072c39e0477 Mon Sep 17 00:00:00 2001 From: darkrose Date: Sat, 24 Jun 2017 21:08:25 +1000 Subject: [PATCH] new chests pt1 --- data/textures/chests_back.png | Bin 0 -> 719 bytes data/textures/chests_front.png | Bin 0 -> 823 bytes data/textures/chests_side.png | Bin 0 -> 857 bytes data/textures/chests_top.png | Bin 0 -> 527 bytes data/textures/junglewood.png | Bin 741 -> 1133 bytes data/textures/wood.png | Bin 1793 -> 1368 bytes src/CMakeLists.txt | 1 + src/config_default.c | 8 +- src/content_mapnode.h | 9 +- src/content_mapnode_special.cpp | 148 +++++++-- src/content_nodemeta.h | 37 ++- src/content_toolitem.cpp | 1 + src/inventory.cpp | 8 +- src/map.cpp | 4 +- src/mapgen.cpp | 3 +- src/nodemeta/content_nodemeta_storage.cpp | 305 ++++++++++++++++++ src/nodemeta/content_nodemeta_storage_old.cpp | 72 ++--- src/nodemetadata.cpp | 15 +- src/player.cpp | 5 + src/server.cpp | 21 +- 20 files changed, 540 insertions(+), 97 deletions(-) create mode 100644 data/textures/chests_back.png create mode 100644 data/textures/chests_front.png create mode 100644 data/textures/chests_side.png create mode 100644 data/textures/chests_top.png create mode 100644 src/nodemeta/content_nodemeta_storage.cpp diff --git a/data/textures/chests_back.png b/data/textures/chests_back.png new file mode 100644 index 0000000000000000000000000000000000000000..c2baeac7fd430de0509d366af33baf652ba3244a GIT binary patch literal 719 zcmV;=0xPx#32;bRa{vGf6951U69E94oEQKA00(qQO+^Rc1{ewq0z?f%p#T5^VM#}*uI+SyrqIk$fJYyv16T9`79+g|Dl! zKhE!fZbo5f1c>J80Q;P5rugDUa=r=QnsIv`c%Mnc`4ZfYB2$pxfBaN41w~;4?Oz{E zg^+@PRAX_-C}Jk-qU<9v0k>kLfCGo1D`cMphLt1QK@1aPL~yw%&*x-zu+7o&Gzull zSO;VYJ%X&jnh+E&$zvvXk`6tT>t?7pJr&fj3AbaAT`_T*3HTsQm=VmH2*vY$P*s!^ zRO04Ah4SY=|DL*!|M>a4dhCIhDE$Mb;J7C{frfyb??L94G#tHdjnogghSM-h{MaYo zZhrdzZi0#8Lki~k9!MF~aP+b?Y^l=$Mu+Qa=zZ_Rp&uZDa_a+)DC`3g(W^F+Lfg_(3Zy7J4{17 zh!Wl|M$O<$4Px#32;bRa{vGf6951U69E94oEQKA00(qQO+^Rc1{ewpFvFXK<^TW!$w@>(R9M5s zmb;D}MG%I+s_LFOd(N`Rj1iHBGT35nDJ-gB9m z?y4f#Cpbo$t+Z9GPj&h0mmlBl6P(}v_(xbV-hZ>tIUF5}kg2R4O9mcEi4d;Gx;j8r zs8&#b)6!N4uoT<{oq9(Q)+Y!e0==q&$oexNV(hLAokbXj^#MGSmVu54bM(~#wwr;z z1UfCwptd@|>2bkYQpQo4PU}}dH%4NpJBY^W08{U5OesS#g7t^+rW%LyOj&y1et8Q% zeE5*VF!1u_OCBB`xVyW%NK6iM5+M|&6C%8Sw@)^p%hQ9Y;F91FY77O!6Ys$|D6KWz zosSh2(fe=!?GZ{fEXr5b7#9%&gV{FlDesAI~$1-X^agbg~gpn$Ex5Y zMS@cgC_xlh{0ZRo>({(^@q%$2u?~m15sP9{s3uSvVM2GOXGciR$C=C|B_V@i#YtCw z{qwJjO8CRimiPDfym|A6h~Sss|Gp^yr|-Yc)8v#CW%-OPD5bF9?@?8b$K%EM^D&rk ziVMhR$iS;tub8HZ$Hzx*Z*MQo@0*}bg|gdJ{yi@jfAIG0+y8e$yJ6;(dFp(*DXZ&1 zF~LMBO%nS0N*L0}R?zKGu_0FnXbbE{Lyyyf&-x54P!3B&-4lBTM|7=~Akmv`i(+0N;3&c4d7+eoAD~`W2pCLgXJ@xFS_CDPz64g4;}R52 zB%st}K03#_@x>L?lF)_2xzjulQK|}8mdt>O@E=5EdQ)kTUIYLD002ovPDHLkV1nLY BdP)EQ literal 0 HcmV?d00001 diff --git a/data/textures/chests_side.png b/data/textures/chests_side.png new file mode 100644 index 0000000000000000000000000000000000000000..cf08bbf45705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TX$AiEYkzFJ|bnUIzaGDu(s<>D1vI00000NkvXXu0mjfXM`fJ delta 725 zcmV;`0xJFO2;~JciBL{Q4GJ0x0000DNk~Le0000G0000G2m$~A0FaSrHUIzs24YJ` zL;wH)0002_L%V;GE*^j00Tve?0AbpECIA2ea!Eu%R47vg!Aox2I2ZunpFc^7ltk-g zw~3P!XwlW|21PgB%uVJDJx5Q`^9(Ru4+ecDLF2@hZ7G&yQGE6L$mdUg&9m3j%o+6% zhJL0Dy!YG9c71&@YX5SXamoot0_4}P9i~ztA|l8%Dr>dA%7uRv{W!HJ(6du%JWl2` zYHK}b>~I*#$G_j8_f4lMgkg4h8drs+7!b*6vdc;!5G2fbc<#+KY1X#W)usCL=0#Z~ z&ig3hW_HHvU;#*A5mzd$S2ci-h1l;}1|G6hT&~O2sw9-Pht>z5$fed3B@~b%dOe-@ z%`>2*G-7$~iYk8%A#9&oGuvV4oeNRi%{Is+qCkJ%?*JSi5ivUB>4$e~7g%@f32{Dn zDP>WrBF{KO=R%f=;QW98Z!^ihes8L(U}%fCzyg$XLX248bs&L<|`sT;D8;Toq-~9Y^A2w)3Q_|;Vk0J1s6r^$K7#}@+6RIsg}#4 zUKK)8XTxFt{IJ#0{wmTWX`qjm667FKAg)}R$00000NkvXX Hu0mjfnzc;> diff --git a/data/textures/wood.png b/data/textures/wood.png index faa1ab331c5201cbbfea07c8244f7c3b3c2c8a3c..7948e8c1d2b52abbacfc688c4de555edb70da4b3 100644 GIT binary patch delta 1360 zcmV-W1+V&n4%iBi8Gix*008_L?V|ty00DDSM?wIu&K&6g000SaNLh0L01FcU01FcV z0GgZ_00007bV*G`2jK=72`2>ESf!)@00inuL_t(Y$CZ}Bj@-x*L?g12>>ll4frSAZ zF!t!Hf5kuKul30{TYy&6)2zyfJtT+HQR-8JD6+C5UqlxF{eQ22mMlYtB*V+FO)?3B z5fMZXBPb(?pIV>)_}i}$vF}mKk6DsP+J4zL096$cGHj0^0066$BS=114f5-A?it${ zWd{&Mzp|u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0$YK$E1L(|3yG+o>)XEs(&bsN2*@CL~VGsRE}J@RIqPflN>RG zam|N_U6JiACgnl~5#fjsD)ty#^QgRf9+_3G!ZmAb4u#4akcoX#Eq%rcO z9zoFyLV>y7MDziD1=I6XZVJ=cOi%)|3G7bs?&DC!kuws z4w#-NnaeqT!#INo5J_JEI9(`mF+PItCOpny4aaKwg@!|c5{u>F7rCQc>{sFU9ZVGy zRor2^GkaX55f%ZF1YHh3!39)d#jigTRVhB+213T_E`LkN>}!jh=Y?@qD{_sZr)$|2ue3s4fTv8$@pi?&QvL1^<@N!O1=AO;WPy(%m}K!U4hWb! z_T`okiDXZnD(3;kC0$Sx2}rG9XMeIgd zFcD!cu8=7F>_OG6Fd>WVr)Bs&R{D7#f9A%_2LvB)4hG z@$$f|2(<-k2y&@KAc(*K#50;d9%)45+FXn98InTvSa{@=$P|h>pIgeG3G5cgCH3yY zW5$J^VD3+A460^)_K3`XJ%2@MI(+>UzKgz0L=}F{6e_Axm$M={veoo^t@%DeSSu(c zTWS~YL;~y6@d;u|cPCU~CCkTxz2@w$NQYbjk23>ky%qfOf$kaOOHq6{Ke}U0*(^7G zwij}3QN_el3Ag>p`trI+OblFW;5?mQ54e4Q&*56m;{j_|%oiV3X`5V^&|JHf z)Rfs1iN{*lZg0o~p>?0ZedX;K0@de;E@ppU%|a6T`>$t~fKv0;yVrtTs;9(jdescription = gettext("Chest"); + f->draw_type = CDT_NODEBOX_META; + f->setAllTextures("wood.png^chests_side.png"); + f->setTexture(0, "wood.png^chests_top.png"); + f->setTexture(1, "wood.png^chests_top.png"); + f->setTexture(4, "wood.png^chests_back.png"); + f->setTexture(5, "wood.png^chests_front.png"); // Z- + f->param_type = CPT_LIGHT; + f->param2_type = CPT_FACEDIR_SIMPLE; + f->light_propagates = true; + f->sunlight_propagates = true; + f->air_equivalent = true; + f->rotate_tile_with_nodebox = true; + //-0.5*BS,-0.5*BS,-0.4375*BS,0.5*BS,0.4375*BS,0.4375*BS + f->setNodeBox(NodeBox( + -0.5*BS,-0.5*BS,-0.4375*BS,0.5*BS,0.3125*BS,0.4375*BS + )); + f->addNodeBox(NodeBox( + -0.5*BS,0.3125*BS,-0.3125*BS,0.5*BS,0.375*BS,0.3125*BS + )); + f->addNodeBox(NodeBox( + -0.5*BS,0.375*BS,-0.125*BS,0.5*BS,0.4375*BS,0.125*BS + )); + f->addNodeBox(NodeBox( + -0.0625*BS,-0.0625*BS,-0.5*BS,0.0625*BS,0.125*BS,-0.4375*BS + )); + f->setInventoryTextureNodeBox(i,"wood.png^chests_top.png", "wood.png^chests_front.png", "wood.png^chests_side.png"); + f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1"; + if (f->initial_metadata == NULL) + f->initial_metadata = new ChestNodeMetadata(); + f->sound_access = "open-chest"; + f->type = CMT_WOOD; + f->hardness = 1.0; + f->pressure_type = CST_SOLID; + crafting::setRoundRecipe(CONTENT_WOOD,CONTENT_CHEST); + content_list_add("craftguide",i,1,0); + content_list_add("creative",i,1,0); + + i = CONTENT_CHEST_PINE; + f = &content_features(i); + f->description = gettext("Chest"); + f->draw_type = CDT_NODEBOX_META; + f->setAllTextures("pine.png^chests_side.png"); + f->setTexture(0, "pine.png^chests_top.png"); + f->setTexture(1, "pine.png^chests_top.png"); + f->setTexture(4, "pine.png^chests_back.png"); + f->setTexture(5, "pine.png^chests_front.png"); // Z- + f->param_type = CPT_LIGHT; + f->param2_type = CPT_FACEDIR_SIMPLE; + f->light_propagates = true; + f->sunlight_propagates = true; + f->air_equivalent = true; + f->rotate_tile_with_nodebox = true; + //-0.5*BS,-0.5*BS,-0.4375*BS,0.5*BS,0.4375*BS,0.4375*BS + f->setNodeBox(NodeBox( + -0.5*BS,-0.5*BS,-0.4375*BS,0.5*BS,0.3125*BS,0.4375*BS + )); + f->addNodeBox(NodeBox( + -0.5*BS,0.3125*BS,-0.3125*BS,0.5*BS,0.375*BS,0.3125*BS + )); + f->addNodeBox(NodeBox( + -0.5*BS,0.375*BS,-0.125*BS,0.5*BS,0.4375*BS,0.125*BS + )); + f->addNodeBox(NodeBox( + -0.0625*BS,-0.0625*BS,-0.5*BS,0.0625*BS,0.125*BS,-0.4375*BS + )); + f->setInventoryTextureNodeBox(i,"pine.png^chests_top.png", "pine.png^chests_front.png", "pine.png^chests_side.png"); + f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1"; + if (f->initial_metadata == NULL) + f->initial_metadata = new ChestNodeMetadata(); + f->sound_access = "open-chest"; + f->type = CMT_WOOD; + f->hardness = 1.0; + f->pressure_type = CST_SOLID; + crafting::setRoundRecipe(CONTENT_WOOD_PINE,CONTENT_CHEST_PINE); + content_list_add("craftguide",i,1,0); + content_list_add("creative",i,1,0); + + i = CONTENT_CHEST_JUNGLE; + f = &content_features(i); + f->description = gettext("Chest"); + f->draw_type = CDT_NODEBOX_META; + f->setAllTextures("junglewood.png^chests_side.png"); + f->setTexture(0, "junglewood.png^chests_top.png"); + f->setTexture(1, "junglewood.png^chests_top.png"); + f->setTexture(4, "junglewood.png^chests_back.png"); + f->setTexture(5, "junglewood.png^chests_front.png"); // Z- + f->param_type = CPT_LIGHT; + f->param2_type = CPT_FACEDIR_SIMPLE; + f->light_propagates = true; + f->sunlight_propagates = true; + f->air_equivalent = true; + f->rotate_tile_with_nodebox = true; + //-0.5*BS,-0.5*BS,-0.4375*BS,0.5*BS,0.4375*BS,0.4375*BS + f->setNodeBox(NodeBox( + -0.5*BS,-0.5*BS,-0.4375*BS,0.5*BS,0.3125*BS,0.4375*BS + )); + f->addNodeBox(NodeBox( + -0.5*BS,0.3125*BS,-0.3125*BS,0.5*BS,0.375*BS,0.3125*BS + )); + f->addNodeBox(NodeBox( + -0.5*BS,0.375*BS,-0.125*BS,0.5*BS,0.4375*BS,0.125*BS + )); + f->addNodeBox(NodeBox( + -0.0625*BS,-0.0625*BS,-0.5*BS,0.0625*BS,0.125*BS,-0.4375*BS + )); + f->setInventoryTextureNodeBox(i,"junglewood.png^chests_top.png", "junglewood.png^chests_front.png", "junglewood.png^chests_side.png"); + f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1"; + if (f->initial_metadata == NULL) + f->initial_metadata = new ChestNodeMetadata(); + f->sound_access = "open-chest"; + f->type = CMT_WOOD; + f->hardness = 1.0; + f->pressure_type = CST_SOLID; + crafting::setRoundRecipe(CONTENT_JUNGLEWOOD,CONTENT_CHEST_JUNGLE); + content_list_add("craftguide",i,1,0); + content_list_add("creative",i,1,0); + + i = CONTENT_CHEST_DEPRECATED; + f = &content_features(i); + f->description = gettext("Chest"); f->param_type = CPT_FACEDIR_SIMPLE; f->draw_type = CDT_CUBELIKE; f->setAllTextures("chest_side.png"); @@ -1248,18 +1368,13 @@ void content_mapnode_special(bool repeat) f->setTexture(5, "chest_front.png"); // Z- f->setInventoryTexture("chest_top.png"); f->setInventoryTextureCube("chest_top.png", "chest_front.png", "chest_side.png"); - f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1"; + f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_CHEST)+" 1"; if(f->initial_metadata == NULL) - f->initial_metadata = new ChestNodeMetadata(); + f->initial_metadata = new DeprecatedChestNodeMetadata(); f->sound_access = "open-chest"; f->type = CMT_WOOD; f->hardness = 1.0; f->pressure_type = CST_SOLID; - f->alternate_lockstate_node = CONTENT_LOCKABLE_CHEST; - crafting::setRoundRecipe(CONTENT_WOOD,CONTENT_CHEST); - crafting::setRoundRecipe(CONTENT_JUNGLEWOOD,CONTENT_CHEST); - content_list_add("craftguide",i,1,0); - content_list_add("creative",i,1,0); i = CONTENT_CREATIVE_CHEST; f = &content_features(i); @@ -1282,7 +1397,7 @@ void content_mapnode_special(bool repeat) content_list_add("player-creative",i,1,0); content_list_add("creative",i,1,0); - i = CONTENT_LOCKABLE_CHEST; + i = CONTENT_LOCKABLE_CHEST_DEPRECATED; f = &content_features(i); f->description = gettext("Locking Chest"); f->param_type = CPT_FACEDIR_SIMPLE; @@ -1293,25 +1408,14 @@ void content_mapnode_special(bool repeat) f->setTexture(5, "chest_lock.png"); // Z- f->setInventoryTexture("chest_lock.png"); f->setInventoryTextureCube("chest_top.png", "chest_lock.png", "chest_side.png"); - f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1"; + f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_CHEST)+" 1"; + /* TODO: give padlock */ if(f->initial_metadata == NULL) - f->initial_metadata = new LockingChestNodeMetadata(); + f->initial_metadata = new LockingDeprecatedChestNodeMetadata(); f->sound_access = "open-chest"; f->type = CMT_WOOD; f->hardness = 1.0; f->pressure_type = CST_SOLID; - f->alternate_lockstate_node = CONTENT_CHEST; - crafting::setFilledRoundRecipe(CONTENT_WOOD,CONTENT_CRAFTITEM_STEEL_INGOT,CONTENT_LOCKABLE_CHEST); - crafting::setFilledRoundRecipe(CONTENT_JUNGLEWOOD,CONTENT_CRAFTITEM_STEEL_INGOT,CONTENT_LOCKABLE_CHEST); - crafting::set1Any2Recipe(CONTENT_CHEST,CONTENT_CRAFTITEM_STEEL_INGOT,CONTENT_LOCKABLE_CHEST); - crafting::setFilledRoundRecipe(CONTENT_WOOD,CONTENT_CRAFTITEM_COPPER_INGOT,CONTENT_LOCKABLE_CHEST); - crafting::setFilledRoundRecipe(CONTENT_JUNGLEWOOD,CONTENT_CRAFTITEM_COPPER_INGOT,CONTENT_LOCKABLE_CHEST); - crafting::set1Any2Recipe(CONTENT_CHEST,CONTENT_CRAFTITEM_COPPER_INGOT,CONTENT_LOCKABLE_CHEST); - crafting::setFilledRoundRecipe(CONTENT_WOOD,CONTENT_CRAFTITEM_SILVER_INGOT,CONTENT_LOCKABLE_CHEST); - crafting::setFilledRoundRecipe(CONTENT_JUNGLEWOOD,CONTENT_CRAFTITEM_SILVER_INGOT,CONTENT_LOCKABLE_CHEST); - crafting::set1Any2Recipe(CONTENT_CHEST,CONTENT_CRAFTITEM_SILVER_INGOT,CONTENT_LOCKABLE_CHEST); - content_list_add("craftguide",i,1,0); - content_list_add("creative",i,1,0); i = CONTENT_SAFE; f = &content_features(i); diff --git a/src/content_nodemeta.h b/src/content_nodemeta.h index 2d9d11a..b46efa8 100644 --- a/src/content_nodemeta.h +++ b/src/content_nodemeta.h @@ -159,6 +159,37 @@ public: ChestNodeMetadata(); ~ChestNodeMetadata(); + virtual u16 typeId() const; + static NodeMetadata* create(std::istream &is); + virtual NodeMetadata* clone(); + virtual void serializeBody(std::ostream &os); + virtual std::wstring infoText(); + virtual Inventory* getInventory(); + virtual void inventoryModified(); + virtual bool nodeRemovalDisabled(); + virtual std::string getDrawSpecString(Player *player); + virtual std::vector getNodeBoxes(MapNode &n); + + virtual std::string getOwner(); + virtual void setOwner(std::string t){ m_owner = t; } + virtual std::string getInventoryOwner(); + virtual void setInventoryOwner(std::string t){ m_owner = t; } + +private: + Inventory *m_inventory; + std::string m_owner; + bool m_is_exo; + bool m_is_expanded; + bool m_is_locked; + uint16_t m_expanded_slot_id; +}; + +class DeprecatedChestNodeMetadata : public NodeMetadata +{ +public: + DeprecatedChestNodeMetadata(); + ~DeprecatedChestNodeMetadata(); + virtual u16 typeId() const; static NodeMetadata* create(std::istream &is); virtual NodeMetadata* clone(); @@ -174,11 +205,11 @@ private: Inventory *m_inventory; }; -class LockingChestNodeMetadata : public NodeMetadata +class LockingDeprecatedChestNodeMetadata : public NodeMetadata { public: - LockingChestNodeMetadata(); - ~LockingChestNodeMetadata(); + LockingDeprecatedChestNodeMetadata(); + ~LockingDeprecatedChestNodeMetadata(); virtual u16 typeId() const; static NodeMetadata* create(std::istream &is); diff --git a/src/content_toolitem.cpp b/src/content_toolitem.cpp index b3eca20..ff575b9 100644 --- a/src/content_toolitem.cpp +++ b/src/content_toolitem.cpp @@ -966,6 +966,7 @@ void content_toolitem_init() f->has_unlock_effect = true; crafting::set1To1Recipe(CONTENT_CRAFTITEM_GOLD_INGOT,CONTENT_TOOLITEM_KEY); content_list_add("craftguide",i,1,0); + content_list_add("creative",i,1,0); i = CONTENT_TOOLITEM_MITHRIL_KEY; f = &g_content_toolitem_features[i]; diff --git a/src/inventory.cpp b/src/inventory.cpp index 6b5938e..331cb85 100644 --- a/src/inventory.cpp +++ b/src/inventory.cpp @@ -23,7 +23,7 @@ * for Voxelands. ************************************************************************/ - +#include "common.h" #include "inventory.h" #include "serialization.h" #include "utility.h" @@ -840,7 +840,7 @@ void InventoryList::deSerialize(std::istream &is) m_items[item_i] = InventoryItem::create(c,wc,wc); } if (readU8(is) != 3) - throw SerializationError("Unknown inventory identifier"); + throw SerializationError("Unknown inventory identifier (2)"); return; } @@ -903,7 +903,7 @@ void InventoryList::deSerialize(std::istream &is) delete m_items[item_i]; m_items[item_i++] = NULL; }else{ - throw SerializationError("Unknown inventory identifier"); + throw SerializationError("Unknown inventory identifier (3)"); } } } @@ -1314,7 +1314,7 @@ void Inventory::deSerialize(std::istream &is) list->deSerialize(is); }else{ - throw SerializationError("Unknown inventory identifier"); + throw SerializationError("Unknown Inventory identifier"); } } } diff --git a/src/map.cpp b/src/map.cpp index 2693521..045bcb0 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -1850,8 +1850,8 @@ MapBlock* ServerMap::finishBlockMake(mapgen::BlockMakeData *data, for (p0.Y=0; p0.YgetNodeNoEx(p0); - if (n.getContent() == CONTENT_CHEST) { - printf("CHEST!!\n"); + /* TODO: chests */ + if (n.getContent() == CONTENT_CHEST_DEPRECATED) { // chest? give it metadata and put shit in it NodeMetadata *f = block->m_node_metadata.get(p0); Inventory *inv = f->getInventory(); diff --git a/src/mapgen.cpp b/src/mapgen.cpp index 49d2348..e437749 100644 --- a/src/mapgen.cpp +++ b/src/mapgen.cpp @@ -548,7 +548,8 @@ static void make_room1(VoxelManipulator &vmanip, v3s16 roomsize, v3s16 roomplace u32 vi = vmanip.m_area.index(p); if (vmanip.m_data[vi].getContent() == CONTENT_AIR) { vmanip.m_flags[vi] |= VMANIP_FLAG_DUNGEON_UNTOUCHABLE; - vmanip.m_data[vi] = MapNode(CONTENT_CHEST); + /* TODO: chests + vmanip.m_data[vi] = MapNode(CONTENT_CHEST); */ } } } diff --git a/src/nodemeta/content_nodemeta_storage.cpp b/src/nodemeta/content_nodemeta_storage.cpp new file mode 100644 index 0000000..5327fd4 --- /dev/null +++ b/src/nodemeta/content_nodemeta_storage.cpp @@ -0,0 +1,305 @@ +/************************************************************************ +* Minetest-c55 +* Copyright (C) 2010-2011 celeron55, Perttu Ahola +* +* content_nodemeta.cpp +* voxelands - 3d voxel world sandbox game +* Copyright (C) Lisa 'darkrose' Milne 2013-2014 +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, but +* WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see +* +* License updated from GPLv2 or later to GPLv3 or later by Lisa Milne +* for Voxelands. +************************************************************************/ + +#include "common.h" +#include "content_nodemeta.h" +#include "inventory.h" +#include "content_mapnode.h" +#include "content_craftitem.h" +#include "content_toolitem.h" +#include "player.h" + + +/* + ChestNodeMetadata +*/ + +// Prototype +ChestNodeMetadata proto_ChestNodeMetadata; + +ChestNodeMetadata::ChestNodeMetadata() +{ + NodeMetadata::registerType(typeId(), create); + + m_is_locked = false; + m_is_expanded = false; + m_is_exo = false; + m_expanded_slot_id = 0; + + m_inventory = new Inventory(); + m_inventory->addList("upgrades", 2); + m_inventory->addList("main", 18); + inventoryModified(); +} +ChestNodeMetadata::~ChestNodeMetadata() +{ + delete m_inventory; +} +u16 ChestNodeMetadata::typeId() const +{ + return CONTENT_CHEST; +} +NodeMetadata* ChestNodeMetadata::create(std::istream &is) +{ + std::string s; + ChestNodeMetadata *d = new ChestNodeMetadata(); + + d->setOwner(deSerializeString(is)); + + s = deSerializeString(is); + d->m_is_exo = !!mystoi(s); + + s = deSerializeString(is); + d->m_is_expanded = !!mystoi(s); + + s = deSerializeString(is); + d->m_is_locked = !!mystoi(s); + + s = deSerializeString(is); + d->m_expanded_slot_id = mystoi(s); + + if (d->m_is_expanded) { + delete d->m_inventory; + d->m_inventory = new Inventory(); + d->m_inventory->addList("upgrades", 2); + d->m_inventory->addList("main", 36); + } + d->m_inventory->deSerialize(is); + d->inventoryModified(); + + return d; +} +NodeMetadata* ChestNodeMetadata::clone() +{ + ChestNodeMetadata *d = new ChestNodeMetadata(); + d->m_is_exo = m_is_exo; + d->m_is_expanded = m_is_expanded; + d->m_is_locked = m_is_locked; + d->m_expanded_slot_id = m_expanded_slot_id; + *d->m_inventory = *m_inventory; + return d; +} +void ChestNodeMetadata::serializeBody(std::ostream &os) +{ + os<serialize(os); +} +std::wstring ChestNodeMetadata::infoText() +{ + char buff[256]; + if (m_is_locked) { + snprintf(buff, 256, gettext("Locked Chest owned by '%s'"), m_owner.c_str()); + }else if (m_is_exo) { + snprintf(buff, 256, gettext("Exo Chest")); + }else{ + snprintf(buff, 256, gettext("Chest")); + } + return narrow_to_wide(buff); +} +Inventory* ChestNodeMetadata::getInventory() +{ + return m_inventory; +} +void ChestNodeMetadata::inventoryModified() +{ + int i; + int k; + int a[3] = {1,1,1}; + int ex = 0; + Inventory *inv; + InventoryList *il; + InventoryList *im; + InventoryItem *itm; + InventoryList *l = m_inventory->getList("upgrades"); + InventoryList *m = m_inventory->getList("main"); + if (!l || !m) + return; + + for (i=0; i<2; i++) { + itm = l->getItem(i); + if (!itm) + continue; + if (itm->getContent() == CONTENT_CHEST) { + if (m_is_expanded) { + ex = 1; + continue; + } + if (m_is_exo) + continue; + inv = new Inventory(); + inv->addList("upgrades", 2); + inv->addList("main", 36); + il = inv->getList("upgrades"); + im = inv->getList("main"); + if (!il || !im) { + delete inv; + continue; + } + for (k=0; k<2; k++) { + itm = l->changeItem(k,NULL); + if (itm) + il->addItem(k,itm); + } + for (k=0; k<18; k++) { + itm = m->changeItem(k,NULL); + if (itm) + im->addItem(k,itm); + } + delete m_inventory; + m_inventory = inv; + l = il; + m = im; + a[2] = 0; + ex = 1; + m_is_expanded = true; + m_expanded_slot_id = i; + }else if (itm->getContent() == CONTENT_TOOLITEM_KEY) { + if (m_is_exo) + continue; + a[2] = 0; + m_is_locked = true; + }else if (itm->getContent() == CONTENT_CRAFTITEM_OERKKI_DUST) { + if (m_is_exo) + continue; + if (m->getUsedSlots() != 0) + continue; + if (l->getUsedSlots() != 1) + continue; + if (m_is_locked) + continue; + if (m_is_expanded) + continue; + m_is_exo = true; + a[0] = 0; + a[1] = 0; + } + } + + if (m_is_expanded && !ex) { + inv = new Inventory(); + inv->addList("upgrades", 2); + inv->addList("main", 18); + il = inv->getList("upgrades"); + im = inv->getList("main"); + if (!il || !im) { + delete inv; + }else{ + for (k=0; k<2; k++) { + itm = l->changeItem(k,NULL); + if (itm) + il->addItem(k,itm); + } + for (k=0; k<36; k++) { + itm = m->changeItem(k,NULL); + if (itm) { + if (k > 17) { + im->addItem(itm); + }else{ + im->addItem(k,itm); + } + } + } + delete m_inventory; + m_inventory = inv; + l = il; + m = im; + m_is_expanded = false; + } + } + + if (m_is_expanded || m_is_locked || m->getUsedSlots() != 0) + a[2] = 0; + + l->clearAllowed(); + if (a[0]) + l->addAllowed(CONTENT_CHEST); + if (a[1]) + l->addAllowed(CONTENT_TOOLITEM_KEY); + if (a[2]) + l->addAllowed(CONTENT_CRAFTITEM_OERKKI_DUST); +} +bool ChestNodeMetadata::nodeRemovalDisabled() +{ + /* + Disable removal if chest contains something + */ + InventoryList *list = m_inventory->getList("main"); + if(list == NULL) + return false; + if(list->getUsedSlots() == 0) + return false; + return true; +} +std::string ChestNodeMetadata::getDrawSpecString(Player *player) +{ + std::string spec("size[9,10]"); + + if (!m_is_exo) { + InventoryList *l = m_inventory->getList("main"); + if (m_is_expanded && l && l->getUsedSlots() > 18) { + if (m_expanded_slot_id == 0) { + spec += "list[current_name;upgrades;1,0;1,1;1,1;]"; + }else{ + spec += "list[current_name;upgrades;0,0;1,1;0,1;]"; + } + }else{ + spec += "list[current_name;upgrades;0,0;2,1;]"; + } + } + + if (m_is_expanded) { + spec += "list[current_name;main;0,1;9,4;]"; + }else if (m_is_exo) { + spec += "list[current_player;exo;1.5,1.5;6,3;]"; + }else{ + spec += "list[current_name;main;1.5,1.5;6,3;]"; + } + + spec += "list[current_player;main;0.5,5.8;8,1;0,8;]"; + spec += "list[current_player;main;0.5,7;8,3;8,-1;]"; + + return spec; +} +std::vector ChestNodeMetadata::getNodeBoxes(MapNode &n) +{ + std::vector boxes; + return boxes; +} +std::string ChestNodeMetadata::getOwner() +{ + if (m_is_locked) + return m_owner; + return ""; +} +std::string ChestNodeMetadata::getInventoryOwner() +{ + if (m_is_locked) + return m_owner; + return ""; +} diff --git a/src/nodemeta/content_nodemeta_storage_old.cpp b/src/nodemeta/content_nodemeta_storage_old.cpp index cfc3b78..f9a7ac0 100644 --- a/src/nodemeta/content_nodemeta_storage_old.cpp +++ b/src/nodemeta/content_nodemeta_storage_old.cpp @@ -31,48 +31,48 @@ /* - ChestNodeMetadata + DeprecatedChestNodeMetadata */ // Prototype -ChestNodeMetadata proto_ChestNodeMetadata; +DeprecatedChestNodeMetadata proto_DeprecatedChestNodeMetadata; -ChestNodeMetadata::ChestNodeMetadata() +DeprecatedChestNodeMetadata::DeprecatedChestNodeMetadata() { NodeMetadata::registerType(typeId(), create); m_inventory = new Inventory(); m_inventory->addList("0", 8*4); } -ChestNodeMetadata::~ChestNodeMetadata() +DeprecatedChestNodeMetadata::~DeprecatedChestNodeMetadata() { delete m_inventory; } -u16 ChestNodeMetadata::typeId() const +u16 DeprecatedChestNodeMetadata::typeId() const { - return CONTENT_CHEST; + return CONTENT_CHEST_DEPRECATED; } -NodeMetadata* ChestNodeMetadata::create(std::istream &is) +NodeMetadata* DeprecatedChestNodeMetadata::create(std::istream &is) { - ChestNodeMetadata *d = new ChestNodeMetadata(); + DeprecatedChestNodeMetadata *d = new DeprecatedChestNodeMetadata(); d->m_inventory->deSerialize(is); return d; } -NodeMetadata* ChestNodeMetadata::clone() +NodeMetadata* DeprecatedChestNodeMetadata::clone() { - ChestNodeMetadata *d = new ChestNodeMetadata(); + DeprecatedChestNodeMetadata *d = new DeprecatedChestNodeMetadata(); *d->m_inventory = *m_inventory; return d; } -void ChestNodeMetadata::serializeBody(std::ostream &os) +void DeprecatedChestNodeMetadata::serializeBody(std::ostream &os) { m_inventory->serialize(os); } -std::wstring ChestNodeMetadata::infoText() +std::wstring DeprecatedChestNodeMetadata::infoText() { return narrow_to_wide(gettext("Chest")); } -bool ChestNodeMetadata::nodeRemovalDisabled() +bool DeprecatedChestNodeMetadata::nodeRemovalDisabled() { /* Disable removal if chest contains something @@ -84,69 +84,69 @@ bool ChestNodeMetadata::nodeRemovalDisabled() return false; return true; } -std::string ChestNodeMetadata::getDrawSpecString(Player *player) +std::string DeprecatedChestNodeMetadata::getDrawSpecString(Player *player) { return "size[8,9]" "list[current_name;0;0,0;8,4;]" "list[current_player;main;0,5;8,4;]"; } -bool ChestNodeMetadata::import(NodeMetadata *meta) +bool DeprecatedChestNodeMetadata::import(NodeMetadata *meta) { - if (meta->typeId() != CONTENT_LOCKABLE_CHEST) + if (meta->typeId() != CONTENT_LOCKABLE_CHEST_DEPRECATED) return false; - LockingChestNodeMetadata *l = (LockingChestNodeMetadata*)meta; + LockingDeprecatedChestNodeMetadata *l = (LockingDeprecatedChestNodeMetadata*)meta; *m_inventory = *l->getInventory(); return true; } /* - LockingChestNodeMetadata + LockingDeprecatedChestNodeMetadata */ // Prototype -LockingChestNodeMetadata proto_LockingChestNodeMetadata; +LockingDeprecatedChestNodeMetadata proto_LockingDeprecatedChestNodeMetadata; -LockingChestNodeMetadata::LockingChestNodeMetadata() +LockingDeprecatedChestNodeMetadata::LockingDeprecatedChestNodeMetadata() { NodeMetadata::registerType(typeId(), create); m_inventory = new Inventory(); m_inventory->addList("0", 8*4); } -LockingChestNodeMetadata::~LockingChestNodeMetadata() +LockingDeprecatedChestNodeMetadata::~LockingDeprecatedChestNodeMetadata() { delete m_inventory; } -u16 LockingChestNodeMetadata::typeId() const +u16 LockingDeprecatedChestNodeMetadata::typeId() const { - return CONTENT_LOCKABLE_CHEST; + return CONTENT_LOCKABLE_CHEST_DEPRECATED; } -NodeMetadata* LockingChestNodeMetadata::create(std::istream &is) +NodeMetadata* LockingDeprecatedChestNodeMetadata::create(std::istream &is) { - LockingChestNodeMetadata *d = new LockingChestNodeMetadata(); + LockingDeprecatedChestNodeMetadata *d = new LockingDeprecatedChestNodeMetadata(); d->setOwner(deSerializeString(is)); d->m_inventory->deSerialize(is); return d; } -NodeMetadata* LockingChestNodeMetadata::clone() +NodeMetadata* LockingDeprecatedChestNodeMetadata::clone() { - LockingChestNodeMetadata *d = new LockingChestNodeMetadata(); + LockingDeprecatedChestNodeMetadata *d = new LockingDeprecatedChestNodeMetadata(); *d->m_inventory = *m_inventory; return d; } -void LockingChestNodeMetadata::serializeBody(std::ostream &os) +void LockingDeprecatedChestNodeMetadata::serializeBody(std::ostream &os) { os<serialize(os); } -std::wstring LockingChestNodeMetadata::infoText() +std::wstring LockingDeprecatedChestNodeMetadata::infoText() { char buff[256]; snprintf(buff, 256, gettext("Locking Chest owned by '%s'"), m_owner.c_str()); return narrow_to_wide(buff); } -bool LockingChestNodeMetadata::nodeRemovalDisabled() +bool LockingDeprecatedChestNodeMetadata::nodeRemovalDisabled() { /* Disable removal if chest contains something @@ -158,18 +158,18 @@ bool LockingChestNodeMetadata::nodeRemovalDisabled() return false; return true; } -std::string LockingChestNodeMetadata::getDrawSpecString(Player *player) +std::string LockingDeprecatedChestNodeMetadata::getDrawSpecString(Player *player) { return "size[8,9]" "list[current_name;0;0,0;8,4;]" "list[current_player;main;0,5;8,4;]"; } -bool LockingChestNodeMetadata::import(NodeMetadata *meta) +bool LockingDeprecatedChestNodeMetadata::import(NodeMetadata *meta) { - if (meta->typeId() != CONTENT_CHEST) + if (meta->typeId() != CONTENT_CHEST_DEPRECATED) return false; - ChestNodeMetadata *l = (ChestNodeMetadata*)meta; + DeprecatedChestNodeMetadata *l = (DeprecatedChestNodeMetadata*)meta; *m_inventory = *l->getInventory(); return true; } @@ -241,9 +241,9 @@ std::string SafeNodeMetadata::getDrawSpecString(Player *player) } bool SafeNodeMetadata::import(NodeMetadata *meta) { - if (meta->typeId() != CONTENT_CHEST) + if (meta->typeId() != CONTENT_CHEST_DEPRECATED) return false; - ChestNodeMetadata *l = (ChestNodeMetadata*)meta; + DeprecatedChestNodeMetadata *l = (DeprecatedChestNodeMetadata*)meta; *m_inventory = *l->getInventory(); return true; } diff --git a/src/nodemetadata.cpp b/src/nodemetadata.cpp index 9e39fcb..6fa57b8 100644 --- a/src/nodemetadata.cpp +++ b/src/nodemetadata.cpp @@ -23,6 +23,7 @@ * for Voxelands. ************************************************************************/ +#include "common.h" #include "nodemetadata.h" #include "utility.h" #include "mapnode.h" @@ -30,7 +31,6 @@ #include "inventory.h" #include #include "content_mapnode.h" -#include "log.h" /* NodeMetadata @@ -62,8 +62,7 @@ NodeMetadata* NodeMetadata::deSerialize(std::istream &is) if(n == NULL) { // If factory is not found, just return. - infostream<<"WARNING: NodeMetadata: No factory for typeId=" - < 1) { - infostream<<__FUNCTION_NAME<<": version "<clearItems(); + l = inventory.getList("exo"); if (l) l->clearItems(); l = inventory.getList("discard"); @@ -114,6 +117,8 @@ void Player::checkInventory() { if (!inventory.getList("main")) inventory.addList("main", PLAYER_INVENTORY_SIZE); + if (!inventory.getList("exo")) + inventory.addList("exo", 18); if (!inventory.getList("hat")) inventory.addList("hat",1); if (!inventory.getList("jacket")) diff --git a/src/server.cpp b/src/server.cpp index 68a2569..5510d33 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -3079,7 +3079,7 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id) if ( meta && ( - meta->typeId() == CONTENT_LOCKABLE_CHEST + meta->typeId() == CONTENT_LOCKABLE_CHEST_DEPRECATED || meta->typeId() == CONTENT_LOCKABLE_SIGN || meta->typeId() == CONTENT_LOCKABLE_SIGN_WALL || meta->typeId() == CONTENT_LOCKABLE_SIGN_UD @@ -4394,8 +4394,8 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id) p.Z = mystoi(fn.next(",")); NodeMetadata *meta = m_env.getMap().getNodeMetadata(p); if (meta) { - if (meta->typeId() == CONTENT_LOCKABLE_CHEST) { - LockingChestNodeMetadata *lcm = (LockingChestNodeMetadata*)meta; + if (meta->typeId() == CONTENT_LOCKABLE_CHEST_DEPRECATED) { + LockingDeprecatedChestNodeMetadata *lcm = (LockingDeprecatedChestNodeMetadata*)meta; if (lcm->getInventoryOwner() != player->getName()) return; }else if (meta->typeId() == CONTENT_LOCKABLE_FURNACE) { @@ -4423,8 +4423,8 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id) p.Z = mystoi(fn.next(",")); NodeMetadata *meta = m_env.getMap().getNodeMetadata(p); if (meta) { - if (meta->typeId() == CONTENT_LOCKABLE_CHEST) { - LockingChestNodeMetadata *lcm = (LockingChestNodeMetadata*)meta; + if (meta->typeId() == CONTENT_LOCKABLE_CHEST_DEPRECATED) { + LockingDeprecatedChestNodeMetadata *lcm = (LockingDeprecatedChestNodeMetadata*)meta; if (lcm->getInventoryOwner() != player->getName()) return; }else if (meta->typeId() == CONTENT_LOCKABLE_FURNACE) { @@ -4755,8 +4755,7 @@ void Server::onMapEditEvent(MapEditEvent *event) Inventory* Server::getInventory(InventoryContext *c, std::string id) { - if(id == "current_player") - { + if (id == "current_player") { assert(c->current_player); return &(c->current_player->inventory); } @@ -4764,14 +4763,13 @@ Inventory* Server::getInventory(InventoryContext *c, std::string id) Strfnd fn(id); std::string id0 = fn.next(":"); - if(id0 == "nodemeta") - { + if (id0 == "nodemeta") { v3s16 p; p.X = mystoi(fn.next(",")); p.Y = mystoi(fn.next(",")); p.Z = mystoi(fn.next(",")); NodeMetadata *meta = m_env.getMap().getNodeMetadata(p); - if(meta) + if (meta) return meta->getInventory(); infostream<<"nodemeta at ("<current_player); // Send inventory UpdateCrafting(c->current_player->peer_id);