From abc4327af6e6309e5b58607c51b36666f026b695 Mon Sep 17 00:00:00 2001 From: JonnyW Date: Thu, 1 Mar 2018 08:02:30 +0000 Subject: [PATCH 1/7] sort config file alphabetically --- src/config.c | 110 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 108 insertions(+), 2 deletions(-) diff --git a/src/config.c b/src/config.c index f63f745..ed13efb 100644 --- a/src/config.c +++ b/src/config.c @@ -43,6 +43,13 @@ typedef struct config_s { int (*setter)(char* v); } config_t; +typedef struct sort_s { + struct sort_s *prev; + struct sort_s *next; + char *name; + char *value; +} sort_t; + /* get the value of a config setting */ char* config_get(char* name) { @@ -393,12 +400,111 @@ void config_save(char* section, char* type, char* file) n = n->next; } }else{ + sort_t *copyhead = 0; + sort_t *copytail = 0; + sort_t *copying = 0; + sort_t *copied = 0; + int copy_failed=0; + + // get config name/value pairs in new list n = config.items; - while (n) { + while(n) { + if (!n->name) continue; + copying=malloc(sizeof(sort_t)); + if (!copying) { + copy_failed=1; + break; + } + if (!copyhead) + // remember the first entry in the list for sorting + copyhead=copying; + if (copied) { + copied->next = copying; + copying->prev = copied; + } + else { + copying->prev = 0; + } + + copying->name = strdup(n->name); if (n->value) - file_writef(f,"set %s %s\n",n->name,n->value); + copying->value = strdup(n->value); + else + copying->value = 0; + + copying->next = 0; + copied = copying; n = n->next; } + // remember the last entry in the list for cleaning up + copytail=copied; + + // alpha sort name/value pairs by name + sort_t *sprev; + sort_t *scurr; + char *store; + + if (!copy_failed && copyhead) { + scurr=copyhead; + while(scurr->next){ + if (strcmp(scurr->name,scurr->next->name)>0){ + store=scurr->name; + scurr->name = scurr->next->name; + scurr->next->name = store; + store=scurr->value; + scurr->value=scurr->next->value; + scurr->next->value=store; + sprev=scurr; + while(sprev->prev){ + if (strcmp(sprev->prev->name,sprev->name) > 0) { + store=sprev->name; + sprev->name = sprev->prev->name; + sprev->prev->name = store; + store=sprev->value; + sprev->value = sprev->prev->value; + sprev->prev->value=store; + sprev=sprev->prev; + } + else break; + } + } + scurr=scurr->next; + } + } + + // save one of the lists to file + if (copy_failed) { + while (n) { + if (n->value) + file_writef(f,"set %s %s\n",n->name,n->value); + n = n->next; + } + } else { + scurr=copyhead; + while (scurr) { + if (scurr->value) + file_writef(f,"set %s %s\n",scurr->name,scurr->value); + scurr=scurr->next; + } + } + + // free list memory and clean up + while(copytail) { + if (!(copytail->prev)) break; + copytail=copytail->prev; + free(copytail->next); + copytail->next=0; + } + free(copytail); + + copyhead=0; + copytail=0; + copying=0; + copied=0; + sprev=0; + scurr=0; + store=0; + /* events_save(f); */ From 318a9968b9067140bc26a768ef7c394fb1847cf3 Mon Sep 17 00:00:00 2001 From: JonnyW Date: Thu, 1 Mar 2018 08:13:16 +0000 Subject: [PATCH 2/7] removed mithril recipes for craft book that can be made with sticks --- src/content_mapnode_special.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/content_mapnode_special.cpp b/src/content_mapnode_special.cpp index 2aac937..8f8b8a0 100644 --- a/src/content_mapnode_special.cpp +++ b/src/content_mapnode_special.cpp @@ -761,8 +761,9 @@ void content_mapnode_special(bool repeat) f->dig_time = 1.0; f->pressure_type = CST_CRUSHABLE; f->suffocation_per_second = 0; - crafting::set1Any2Recipe(CONTENT_BOOK,CONTENT_CRAFTITEM_MITHRIL_RAW,i); - crafting::set1Any2Recipe(CONTENT_BOOK,CONTENT_CRAFTITEM_MITHRIL_UNBOUND,i); + //not going to use mithril when you can use sticks + //crafting::set1Any2Recipe(CONTENT_BOOK,CONTENT_CRAFTITEM_MITHRIL_RAW,i); + //crafting::set1Any2Recipe(CONTENT_BOOK,CONTENT_CRAFTITEM_MITHRIL_UNBOUND,i); { content_t r[9] = { CONTENT_CRAFTITEM_STICK, CONTENT_CRAFTITEM_STICK, CONTENT_IGNORE, From 375a1ec93f030b7d457b099ea4a02ffc5cb245ea Mon Sep 17 00:00:00 2001 From: JonnyW Date: Thu, 1 Mar 2018 09:50:53 +0000 Subject: [PATCH 3/7] fix reverse craft book. clear recipe/result boxes if no item. --- src/content_craft.cpp | 16 +++-- src/nodemeta/content_nodemeta_book_guide.cpp | 71 ++++++++++++++++---- 2 files changed, 66 insertions(+), 21 deletions(-) diff --git a/src/content_craft.cpp b/src/content_craft.cpp index 6b65650..95fcada 100644 --- a/src/content_craft.cpp +++ b/src/content_craft.cpp @@ -987,19 +987,20 @@ FoundReverseRecipe getReverseRecipe(InventoryItem *iitem, int index) } //how to update an ingredient list given a range of new craft items -void addToIngredientList(std::vector results, uint32_t begin, std::vector& ingredient_list) +void addToIngredientList(contentlist_t *list, uint32_t begin, std::vector& ingredient_list) { using namespace std; //make a set to hold the items as the list is compiled set ingredients (ingredient_list.begin(), ingredient_list.end()); - //go through the result list - for (std::vector::iterator it = results.begin()+begin; it != results.end(); ++it) { + listdata_t *d = list->data; + + //go through the result list + while (d) { - listdata_t d = *it; //make a temporary inventory item for the result - InventoryItem *result = InventoryItem::create(d.content, 1, 0, d.data); + InventoryItem *result = InventoryItem::create(d->content, 1, 0, d->data); //go through every recipe for this item for (int rec_ind = getRecipeCount(result); rec_ind--;) { @@ -1020,6 +1021,8 @@ void addToIngredientList(std::vector results, uint32_t begin, std::v //clean up delete result; + + d = d->next; } //ignore CONTENT_IGNORE @@ -1050,8 +1053,7 @@ std::vector& getCraftGuideIngredientList() if (list_size > last_craftguide_count) { //if so, add the new stuff - /* TODO: basically everything for reverse lookup */ - //addToIngredientList(craft_list, last_craftguide_count, ingredient_list); + addToIngredientList(cl, last_craftguide_count, ingredient_list); //and update the craftguide count last_craftguide_count = list_size; diff --git a/src/nodemeta/content_nodemeta_book_guide.cpp b/src/nodemeta/content_nodemeta_book_guide.cpp index b7e6422..a5d4f34 100644 --- a/src/nodemeta/content_nodemeta_book_guide.cpp +++ b/src/nodemeta/content_nodemeta_book_guide.cpp @@ -136,8 +136,17 @@ bool CraftGuideNodeMetadata::step(float dtime, v3s16 pos, ServerEnvironment *env { InventoryList *l = m_inventory->getList("result"); InventoryItem *t = l->getItem(0); - if (!t || t->getContent() == CONTENT_IGNORE) + + if (!t || t->getContent() == CONTENT_IGNORE){ + // nothing in result box so clear recipe list + InventoryList *rec_list = m_inventory->getList("recipe"); + if (rec_list) { + //clear out the recipe grid if the item slot is empty + rec_list->clearItems(); + return true; + } return false; + } content_t *r = crafting::getRecipe(t,m_recipe); if (!r) { if (m_recipe == 0) @@ -468,12 +477,24 @@ void ReverseCraftGuideNodeMetadata::inventoryModified() } bool ReverseCraftGuideNodeMetadata::step(float dtime, v3s16 pos, ServerEnvironment *env) { + //make sure there's a valid item list + InventoryList *item_list = m_inventory->getList("item"); + if (!item_list) return false; + //get the item in the item box - InventoryItem *item = m_inventory->getList("item")->getItem(0); + InventoryItem *item = item_list->getItem(0); //if there's no item in the item box, do nothing - if (!item || item->getContent() == CONTENT_IGNORE) - return false; + if (!item || item->getContent() == CONTENT_IGNORE) { + // nothing in item box so clear recipe and result lists + InventoryList *rec_list = m_inventory->getList("recipe"); + if (rec_list) + rec_list->clearItems(); + InventoryList *res_list = m_inventory->getList("result"); + if (res_list) + res_list->clearItems(); + return true; + } //attempt to look up the recipe crafting::FoundReverseRecipe recipe = crafting::getReverseRecipe(item, m_recipe); @@ -731,8 +752,17 @@ bool CookBookNodeMetadata::step(float dtime, v3s16 pos, ServerEnvironment *env) { InventoryList *l = m_inventory->getList("result"); InventoryItem *t = l->getItem(0); - if (!t || t->getContent() == CONTENT_IGNORE) + + if (!t || t->getContent() == CONTENT_IGNORE){ + // nothing in result box so clear recipe list + InventoryList *rec_list = m_inventory->getList("recipe"); + if (rec_list) { + //clear out the recipe grid if the item slot is empty + rec_list->clearItems(); + return true; + } return false; + } InventoryItem *cookresult = t->createCookResult(); if (!cookresult || cookresult->getContent() == CONTENT_IGNORE) return false; @@ -992,16 +1022,29 @@ bool DeCraftNodeMetadata::step(float dtime, v3s16 pos, ServerEnvironment *env) { InventoryList *l = m_inventory->getList("result"); InventoryItem *t = l->getItem(0); + + int leave = 0; + if (!t || t->getContent() == CONTENT_IGNORE) - return false; - if ((t->getContent()&CONTENT_CRAFTITEM_MASK) == CONTENT_CRAFTITEM_MASK) - return false; - if ((t->getContent()&CONTENT_TOOLITEM_MASK) == CONTENT_TOOLITEM_MASK) - return false; - if ((t->getContent()&CONTENT_CLOTHESITEM_MASK) == CONTENT_CLOTHESITEM_MASK) - return false; - if (content_features(t->getContent()).dug_item == "" && content_features(t->getContent()).extra_dug_item == "") - return false; + leave=1; + else if ((t->getContent()&CONTENT_CRAFTITEM_MASK) == CONTENT_CRAFTITEM_MASK) + leave=1; + else if ((t->getContent()&CONTENT_TOOLITEM_MASK) == CONTENT_TOOLITEM_MASK) + leave=1; + else if ((t->getContent()&CONTENT_CLOTHESITEM_MASK) == CONTENT_CLOTHESITEM_MASK) + leave=1; + else if (content_features(t->getContent()).dug_item == "" && content_features(t->getContent()).extra_dug_item == "") + leave=1; + if (leave) { + // nothing in item box so clear recipe and result lists + InventoryList *rec_list = m_inventory->getList("recipe"); + if (rec_list) + rec_list->clearItems(); + InventoryList *ran_list = m_inventory->getList("random"); + if (ran_list) + ran_list->clearItems(); + return true; + } l = m_inventory->getList("recipe"); l->clearItems(); if (content_features(t->getContent()).dug_item != "") { From 617f5c91d4488052d96497c35d8022e0a2a3f870 Mon Sep 17 00:00:00 2001 From: JonnyW Date: Fri, 2 Mar 2018 21:38:33 +0000 Subject: [PATCH 4/7] Put flint before copper and bronze before iron as this is how things progressed historically. Consistent values for uses/time/level for each material, defined in content_toolitem.h All weapons and none core tools have a dig level of 1. --- src/content_toolitem.cpp | 398 +++++++++++++++++++-------------------- src/content_toolitem.h | 52 +++++ src/mineral.cpp | 262 +++++++++++++------------- 3 files changed, 384 insertions(+), 328 deletions(-) diff --git a/src/content_toolitem.cpp b/src/content_toolitem.cpp index a205890..41d59d0 100644 --- a/src/content_toolitem.cpp +++ b/src/content_toolitem.cpp @@ -287,9 +287,9 @@ void content_toolitem_init() f->texture = "tool_handle.png^tool_head_pick_stone.png^tool_binding_pick.png"; f->description = gettext("Stone Pick"); f->type = TT_PICK; - f->diginfo.uses = 32; - f->diginfo.time = 3.0; - f->diginfo.level = 1; + f->diginfo.uses = STONE_USES; + f->diginfo.time = STONE_TIME; + f->diginfo.level = STONE_LEVEL; { content_t r[9] = { CONTENT_ROCK, CONTENT_ROCK, CONTENT_ROCK, @@ -303,41 +303,41 @@ void content_toolitem_init() content_list_add("craftguide",i,1,0); content_list_add("creative",i,1,0); - i = CONTENT_TOOLITEM_COPPER_PICK; - f = &g_content_toolitem_features[i]; - f->content = i; - f->texture = "tool_handle.png^tool_head_pick_copper.png^tool_binding_pick.png"; - f->description = gettext("Copper Pick"); - f->type = TT_PICK; - f->diginfo.uses = 64; - f->diginfo.time = 1.5; - f->diginfo.level = 2; - crafting::setPickRecipe(CONTENT_CRAFTITEM_COPPER_INGOT,CONTENT_TOOLITEM_COPPER_PICK); - content_list_add("craftguide",i,1,0); - content_list_add("creative",i,1,0); - i = CONTENT_TOOLITEM_FLINTPICK; f = &g_content_toolitem_features[i]; f->content = i; f->texture = "tool_handle.png^tool_head_pick_flint.png^tool_binding_pick.png"; f->description = gettext("Flint Pick"); f->type = TT_PICK; - f->diginfo.uses = 64; - f->diginfo.time = 1.5; - f->diginfo.level = 2; + f->diginfo.uses = FLINT_USES; + f->diginfo.time = FLINT_TIME; + f->diginfo.level = FLINT_LEVEL; crafting::setPickRecipe(CONTENT_CRAFTITEM_FLINT,CONTENT_TOOLITEM_FLINTPICK); content_list_add("craftguide",i,1,0); content_list_add("creative",i,1,0); + i = CONTENT_TOOLITEM_COPPER_PICK; + f = &g_content_toolitem_features[i]; + f->content = i; + f->texture = "tool_handle.png^tool_head_pick_copper.png^tool_binding_pick.png"; + f->description = gettext("Copper Pick"); + f->type = TT_PICK; + f->diginfo.uses = COPPER_USES; + f->diginfo.time = COPPER_TIME; + f->diginfo.level = COPPER_LEVEL; + crafting::setPickRecipe(CONTENT_CRAFTITEM_COPPER_INGOT,CONTENT_TOOLITEM_COPPER_PICK); + content_list_add("craftguide",i,1,0); + content_list_add("creative",i,1,0); + i = CONTENT_TOOLITEM_BRONZE_PICK; f = &g_content_toolitem_features[i]; f->content = i; f->texture = "tool_handle.png^tool_head_pick_bronze.png^tool_binding_pick.png"; f->description = gettext("Bronze Pick"); f->type = TT_PICK; - f->diginfo.uses = 128; - f->diginfo.time = 1.25; - f->diginfo.level = 3; + f->diginfo.uses = BRONZE_USES; + f->diginfo.time = BRONZE_TIME; + f->diginfo.level = BRONZE_LEVEL; crafting::setPickRecipe(CONTENT_CRAFTITEM_BRONZE_INGOT,CONTENT_TOOLITEM_BRONZE_PICK); content_list_add("craftguide",i,1,0); content_list_add("creative",i,1,0); @@ -348,9 +348,9 @@ void content_toolitem_init() f->texture = "tool_handle.png^tool_head_pick_iron.png^tool_binding_pick.png"; f->description = gettext("Iron Pick"); f->type = TT_PICK; - f->diginfo.uses = 256; - f->diginfo.time = 1.0; - f->diginfo.level = 4; + f->diginfo.uses = IRON_USES; + f->diginfo.time = IRON_TIME; + f->diginfo.level = IRON_LEVEL; crafting::setPickRecipe(CONTENT_CRAFTITEM_IRON_INGOT,CONTENT_TOOLITEM_IRON_PICK); content_list_add("craftguide",i,1,0); content_list_add("creative",i,1,0); @@ -361,9 +361,9 @@ void content_toolitem_init() f->texture = "tool_handle.png^tool_head_pick_mithril.png^tool_binding_pick.png"; f->description = gettext("Unbound Mithril Pick"); f->type = TT_PICK; - f->diginfo.uses = 1024; - f->diginfo.time = 0.6; - f->diginfo.level = 5; + f->diginfo.uses = U_MITHRIL_USES; + f->diginfo.time = U_MITHRIL_TIME; + f->diginfo.level = U_MITHRIL_LEVEL; crafting::setPickRecipe(CONTENT_CRAFTITEM_MITHRIL_UNBOUND,CONTENT_TOOLITEM_MITHRIL_UNBOUND_PICK); content_list_add("craftguide",i,1,0); content_list_add("creative",i,1,0); @@ -375,9 +375,9 @@ void content_toolitem_init() f->description = gettext("Mithril Pick"); f->type = TT_PICK; f->param_type = CPT_ENCHANTMENT; - f->diginfo.uses = 2048; - f->diginfo.time = 0.4; - f->diginfo.level = 6; + f->diginfo.uses = E_MITHRIL_USES; + f->diginfo.time = E_MITHRIL_TIME; + f->diginfo.level = E_MITHRIL_LEVEL; f->has_punch_effect = false; crafting::setPickRecipe(CONTENT_CRAFTITEM_MITHRIL,CONTENT_TOOLITEM_MITHRIL_PICK); content_list_add("craftguide",i,1,0); @@ -403,49 +403,36 @@ void content_toolitem_init() f->texture = "tool_handle.png^tool_head_shovel_stone.png^tool_binding_shovel.png"; f->description = gettext("Stone Shovel"); f->type = TT_SHOVEL; - f->diginfo.uses = 32; - f->diginfo.time = 3.0; - f->diginfo.level = 1; + f->diginfo.uses = STONE_USES; + f->diginfo.time = STONE_TIME; + f->diginfo.level = STONE_LEVEL; crafting::set1over1Recipe(CONTENT_ROCK,CONTENT_CRAFTITEM_STICK,i); content_list_add("craftguide",i,1,0); content_list_add("creative",i,1,0); - i = CONTENT_TOOLITEM_COPPER_SHOVEL; - f = &g_content_toolitem_features[i]; - f->content = i; - f->texture = "tool_handle.png^tool_head_shovel_copper.png^tool_binding_shovel.png"; - f->description = gettext("Copper Shovel"); - f->type = TT_SHOVEL; - f->diginfo.uses = 64; - f->diginfo.time = 1.5; - f->diginfo.level = 1; - crafting::setShovelRecipe(CONTENT_CRAFTITEM_COPPER_INGOT,CONTENT_TOOLITEM_COPPER_SHOVEL); - content_list_add("craftguide",i,1,0); - content_list_add("creative",i,1,0); - i = CONTENT_TOOLITEM_FLINTSHOVEL; f = &g_content_toolitem_features[i]; f->content = i; f->texture = "tool_handle.png^tool_head_shovel_flint.png^tool_binding_shovel.png"; f->description = gettext("Flint Shovel"); f->type = TT_SHOVEL; - f->diginfo.uses = 128; - f->diginfo.time = 1.75; - f->diginfo.level = 2; + f->diginfo.uses = FLINT_USES; + f->diginfo.time = FLINT_TIME; + f->diginfo.level = FLINT_LEVEL; crafting::setShovelRecipe(CONTENT_CRAFTITEM_FLINT,CONTENT_TOOLITEM_FLINTSHOVEL); content_list_add("craftguide",i,1,0); content_list_add("creative",i,1,0); - i = CONTENT_TOOLITEM_IRON_SHOVEL; + i = CONTENT_TOOLITEM_COPPER_SHOVEL; f = &g_content_toolitem_features[i]; f->content = i; - f->texture = "tool_handle.png^tool_head_shovel_iron.png^tool_binding_shovel.png"; - f->description = gettext("Iron Shovel"); + f->texture = "tool_handle.png^tool_head_shovel_copper.png^tool_binding_shovel.png"; + f->description = gettext("Copper Shovel"); f->type = TT_SHOVEL; - f->diginfo.uses = 256; - f->diginfo.time = 1.0; - f->diginfo.level = 3; - crafting::setShovelRecipe(CONTENT_CRAFTITEM_IRON_INGOT,CONTENT_TOOLITEM_IRON_SHOVEL); + f->diginfo.uses = COPPER_USES; + f->diginfo.time = COPPER_TIME; + f->diginfo.level = COPPER_LEVEL; + crafting::setShovelRecipe(CONTENT_CRAFTITEM_COPPER_INGOT,CONTENT_TOOLITEM_COPPER_SHOVEL); content_list_add("craftguide",i,1,0); content_list_add("creative",i,1,0); @@ -455,22 +442,35 @@ void content_toolitem_init() f->texture = "tool_handle.png^tool_head_shovel_bronze.png^tool_binding_shovel.png"; f->description = gettext("Bronze Shovel"); f->type = TT_SHOVEL; - f->diginfo.uses = 512; - f->diginfo.time = 0.75; - f->diginfo.level = 4; + f->diginfo.uses = BRONZE_USES; + f->diginfo.time = BRONZE_TIME; + f->diginfo.level = BRONZE_LEVEL; crafting::setShovelRecipe(CONTENT_CRAFTITEM_BRONZE_INGOT,CONTENT_TOOLITEM_BRONZE_SHOVEL); content_list_add("craftguide",i,1,0); content_list_add("creative",i,1,0); + i = CONTENT_TOOLITEM_IRON_SHOVEL; + f = &g_content_toolitem_features[i]; + f->content = i; + f->texture = "tool_handle.png^tool_head_shovel_iron.png^tool_binding_shovel.png"; + f->description = gettext("Iron Shovel"); + f->type = TT_SHOVEL; + f->diginfo.uses = IRON_USES; + f->diginfo.time = IRON_TIME; + f->diginfo.level = IRON_LEVEL; + crafting::setShovelRecipe(CONTENT_CRAFTITEM_IRON_INGOT,CONTENT_TOOLITEM_IRON_SHOVEL); + content_list_add("craftguide",i,1,0); + content_list_add("creative",i,1,0); + i = CONTENT_TOOLITEM_MITHRIL_UNBOUND_SHOVEL; f = &g_content_toolitem_features[i]; f->content = i; f->texture = "tool_handle.png^tool_head_shovel_mithril.png^tool_binding_shovel.png"; f->description = gettext("Unbound Mithril Shovel"); f->type = TT_SHOVEL; - f->diginfo.uses = 1024; - f->diginfo.time = 0.6; - f->diginfo.level = 5; + f->diginfo.uses = U_MITHRIL_USES; + f->diginfo.time = U_MITHRIL_TIME; + f->diginfo.level = U_MITHRIL_LEVEL; crafting::setShovelRecipe(CONTENT_CRAFTITEM_MITHRIL_UNBOUND,CONTENT_TOOLITEM_MITHRIL_UNBOUND_SHOVEL); content_list_add("craftguide",i,1,0); content_list_add("creative",i,1,0); @@ -482,9 +482,9 @@ void content_toolitem_init() f->description = gettext("Mithril Shovel"); f->type = TT_SHOVEL; f->param_type = CPT_ENCHANTMENT; - f->diginfo.uses = 2048; - f->diginfo.time = 0.4; - f->diginfo.level = 5; + f->diginfo.uses = E_MITHRIL_USES; + f->diginfo.time = E_MITHRIL_TIME; + f->diginfo.level = E_MITHRIL_LEVEL; crafting::setShovelRecipe(CONTENT_CRAFTITEM_MITHRIL,CONTENT_TOOLITEM_MITHRIL_SHOVEL); content_list_add("craftguide",i,1,0); @@ -496,9 +496,9 @@ void content_toolitem_init() f->texture = "tool_handle.png^tool_head_axe_stone.png^tool_binding_axe.png"; f->description = gettext("Stone Axe"); f->type = TT_AXE; - f->diginfo.uses = 32; - f->diginfo.time = 3.0; - f->diginfo.level = 1; + f->diginfo.uses = STONE_USES; + f->diginfo.time = STONE_TIME; + f->diginfo.level = STONE_LEVEL; { content_t r[9] = { CONTENT_ROCK, CONTENT_ROCK, CONTENT_IGNORE, @@ -513,42 +513,29 @@ void content_toolitem_init() content_list_add("craftguide",i,1,0); content_list_add("creative",i,1,0); - i = CONTENT_TOOLITEM_COPPER_AXE; - f = &g_content_toolitem_features[i]; - f->content = i; - f->texture = "tool_handle.png^tool_head_axe_copper.png^tool_binding_axe.png"; - f->description = gettext("Copper Axe"); - f->type = TT_AXE; - f->diginfo.uses = 64; - f->diginfo.time = 1.5; - f->diginfo.level = 1; - crafting::setAxeRecipe(CONTENT_CRAFTITEM_COPPER_INGOT,CONTENT_TOOLITEM_COPPER_AXE); - content_list_add("craftguide",i,1,0); - content_list_add("creative",i,1,0); - i = CONTENT_TOOLITEM_FLINTAXE; f = &g_content_toolitem_features[i]; f->content = i; f->texture = "tool_handle.png^tool_head_axe_flint.png^tool_binding_axe.png"; f->description = gettext("Flint Axe"); f->type = TT_AXE; - f->diginfo.uses = 128; - f->diginfo.time = 1.75; - f->diginfo.level = 2; + f->diginfo.uses = FLINT_USES; + f->diginfo.time = FLINT_TIME; + f->diginfo.level = FLINT_LEVEL; crafting::setAxeRecipe(CONTENT_CRAFTITEM_FLINT,CONTENT_TOOLITEM_FLINTAXE); content_list_add("craftguide",i,1,0); content_list_add("creative",i,1,0); - i = CONTENT_TOOLITEM_IRON_AXE; + i = CONTENT_TOOLITEM_COPPER_AXE; f = &g_content_toolitem_features[i]; f->content = i; - f->texture = "tool_handle.png^tool_head_axe_iron.png^tool_binding_axe.png"; - f->description = gettext("Iron Axe"); + f->texture = "tool_handle.png^tool_head_axe_copper.png^tool_binding_axe.png"; + f->description = gettext("Copper Axe"); f->type = TT_AXE; - f->diginfo.uses = 256; - f->diginfo.time = 1.0; - f->diginfo.level = 3; - crafting::setAxeRecipe(CONTENT_CRAFTITEM_IRON_INGOT,CONTENT_TOOLITEM_IRON_AXE); + f->diginfo.uses = COPPER_USES; + f->diginfo.time = COPPER_TIME; + f->diginfo.level = COPPER_LEVEL; + crafting::setAxeRecipe(CONTENT_CRAFTITEM_COPPER_INGOT,CONTENT_TOOLITEM_COPPER_AXE); content_list_add("craftguide",i,1,0); content_list_add("creative",i,1,0); @@ -558,22 +545,35 @@ void content_toolitem_init() f->texture = "tool_handle.png^tool_head_axe_bronze.png^tool_binding_axe.png"; f->description = gettext("Bronze Axe"); f->type = TT_AXE; - f->diginfo.uses = 512; - f->diginfo.time = 0.75; - f->diginfo.level = 4; + f->diginfo.uses = BRONZE_USES; + f->diginfo.time = BRONZE_TIME; + f->diginfo.level = BRONZE_LEVEL; crafting::setAxeRecipe(CONTENT_CRAFTITEM_BRONZE_INGOT,CONTENT_TOOLITEM_BRONZE_AXE); content_list_add("craftguide",i,1,0); content_list_add("creative",i,1,0); + i = CONTENT_TOOLITEM_IRON_AXE; + f = &g_content_toolitem_features[i]; + f->content = i; + f->texture = "tool_handle.png^tool_head_axe_iron.png^tool_binding_axe.png"; + f->description = gettext("Iron Axe"); + f->type = TT_AXE; + f->diginfo.uses = IRON_USES; + f->diginfo.time = IRON_TIME; + f->diginfo.level = IRON_LEVEL; + crafting::setAxeRecipe(CONTENT_CRAFTITEM_IRON_INGOT,CONTENT_TOOLITEM_IRON_AXE); + content_list_add("craftguide",i,1,0); + content_list_add("creative",i,1,0); + i = CONTENT_TOOLITEM_MITHRIL_UNBOUND_AXE; f = &g_content_toolitem_features[i]; f->content = i; f->texture = "tool_handle.png^tool_head_axe_mithril.png^tool_binding_axe.png"; f->description = gettext("Unbound Mithril Axe"); f->type = TT_AXE; - f->diginfo.uses = 1024; - f->diginfo.time = 0.6; - f->diginfo.level = 5; + f->diginfo.uses = U_MITHRIL_USES; + f->diginfo.time = U_MITHRIL_TIME; + f->diginfo.level = U_MITHRIL_LEVEL; crafting::setAxeRecipe(CONTENT_CRAFTITEM_MITHRIL_UNBOUND,CONTENT_TOOLITEM_MITHRIL_UNBOUND_AXE); content_list_add("craftguide",i,1,0); content_list_add("creative",i,1,0); @@ -585,9 +585,9 @@ void content_toolitem_init() f->description = gettext("Mithril Axe"); f->type = TT_AXE; f->param_type = CPT_ENCHANTMENT; - f->diginfo.uses = 2048; - f->diginfo.time = 0.4; - f->diginfo.level = 5; + f->diginfo.uses = E_MITHRIL_USES; + f->diginfo.time = E_MITHRIL_TIME; + f->diginfo.level = E_MITHRIL_LEVEL; crafting::setAxeRecipe(CONTENT_CRAFTITEM_MITHRIL,CONTENT_TOOLITEM_MITHRIL_AXE); content_list_add("craftguide",i,1,0); @@ -613,9 +613,9 @@ void content_toolitem_init() f->texture = "tool_bow.png"; f->description = gettext("Bow"); f->type = TT_SPECIAL; - f->diginfo.uses = 256; - f->diginfo.time = 1.0; - f->diginfo.level = 2; + f->diginfo.uses = BOW_USES; + f->diginfo.time = BOW_TIME; + f->diginfo.level = BOW_LEVEL; f->thrown_item = CONTENT_CRAFTITEM_ARROW; { content_t r[9] = { @@ -636,49 +636,36 @@ void content_toolitem_init() f->texture = "tool_handle_long.png^tool_head_spear_stone.png^tool_binding_spear.png"; f->description = gettext("Stone Spear"); f->type = TT_SPEAR; - f->diginfo.uses = 64; - f->diginfo.time = 1.5; + f->diginfo.uses = STONE_USES; + f->diginfo.time = STONE_TIME; f->diginfo.level = 1; crafting::setSpearRecipe(CONTENT_ROCK,CONTENT_TOOLITEM_STONE_SPEAR); content_list_add("craftguide",i,1,0); content_list_add("creative",i,1,0); - i = CONTENT_TOOLITEM_COPPER_SPEAR; - f = &g_content_toolitem_features[i]; - f->content = i; - f->texture = "tool_handle_long.png^tool_head_spear_copper.png^tool_binding_spear.png"; - f->description = gettext("Copper Spear"); - f->type = TT_SPEAR; - f->diginfo.uses = 64; - f->diginfo.time = 1.5; - f->diginfo.level = 1; - crafting::setSpearRecipe(CONTENT_CRAFTITEM_COPPER_INGOT,CONTENT_TOOLITEM_COPPER_SPEAR); - content_list_add("craftguide",i,1,0); - content_list_add("creative",i,1,0); - i = CONTENT_TOOLITEM_FLINTSPEAR; f = &g_content_toolitem_features[i]; f->content = i; f->texture = "tool_handle_long.png^tool_head_spear_flint.png^tool_binding_spear.png"; f->description = gettext("Flint Spear"); f->type = TT_SPEAR; - f->diginfo.uses = 128; - f->diginfo.time = 1.75; - f->diginfo.level = 2; + f->diginfo.uses = FLINT_USES; + f->diginfo.time = FLINT_TIME; + f->diginfo.level = 1; crafting::setSpearRecipe(CONTENT_CRAFTITEM_FLINT,CONTENT_TOOLITEM_FLINTSPEAR); content_list_add("craftguide",i,1,0); content_list_add("creative",i,1,0); - i = CONTENT_TOOLITEM_IRON_SPEAR; + i = CONTENT_TOOLITEM_COPPER_SPEAR; f = &g_content_toolitem_features[i]; f->content = i; - f->texture = "tool_handle_long.png^tool_head_spear_iron.png^tool_binding_spear.png"; - f->description = gettext("Iron Spear"); + f->texture = "tool_handle_long.png^tool_head_spear_copper.png^tool_binding_spear.png"; + f->description = gettext("Copper Spear"); f->type = TT_SPEAR; - f->diginfo.uses = 256; - f->diginfo.time = 1.0; - f->diginfo.level = 3; - crafting::setSpearRecipe(CONTENT_CRAFTITEM_IRON_INGOT,CONTENT_TOOLITEM_IRON_SPEAR); + f->diginfo.uses = COPPER_USES; + f->diginfo.time = COPPER_TIME; + f->diginfo.level = 1; + crafting::setSpearRecipe(CONTENT_CRAFTITEM_COPPER_INGOT,CONTENT_TOOLITEM_COPPER_SPEAR); content_list_add("craftguide",i,1,0); content_list_add("creative",i,1,0); @@ -688,22 +675,35 @@ void content_toolitem_init() f->texture = "tool_handle_long.png^tool_head_spear_bronze.png^tool_binding_spear.png"; f->description = gettext("Bronze Spear"); f->type = TT_SPEAR; - f->diginfo.uses = 512; - f->diginfo.time = 0.75; - f->diginfo.level = 4; + f->diginfo.uses = BRONZE_USES; + f->diginfo.time = BRONZE_TIME; + f->diginfo.level = 1; crafting::setSpearRecipe(CONTENT_CRAFTITEM_BRONZE_INGOT,CONTENT_TOOLITEM_BRONZE_SPEAR); content_list_add("craftguide",i,1,0); content_list_add("creative",i,1,0); + i = CONTENT_TOOLITEM_IRON_SPEAR; + f = &g_content_toolitem_features[i]; + f->content = i; + f->texture = "tool_handle_long.png^tool_head_spear_iron.png^tool_binding_spear.png"; + f->description = gettext("Iron Spear"); + f->type = TT_SPEAR; + f->diginfo.uses = IRON_USES; + f->diginfo.time = IRON_TIME; + f->diginfo.level = 1; + crafting::setSpearRecipe(CONTENT_CRAFTITEM_IRON_INGOT,CONTENT_TOOLITEM_IRON_SPEAR); + content_list_add("craftguide",i,1,0); + content_list_add("creative",i,1,0); + i = CONTENT_TOOLITEM_MITHRIL_UNBOUND_SPEAR; f = &g_content_toolitem_features[i]; f->content = i; f->texture = "tool_handle_long.png^tool_head_spear_mithril.png^tool_binding_spear.png"; f->description = gettext("Unbound Mithril Spear"); f->type = TT_SPEAR; - f->diginfo.uses = 1024; - f->diginfo.time = 0.6; - f->diginfo.level = 5; + f->diginfo.uses = U_MITHRIL_USES; + f->diginfo.time = U_MITHRIL_TIME; + f->diginfo.level = 1; crafting::setSpearRecipe(CONTENT_CRAFTITEM_MITHRIL_UNBOUND,CONTENT_TOOLITEM_MITHRIL_UNBOUND_SPEAR); content_list_add("craftguide",i,1,0); content_list_add("creative",i,1,0); @@ -715,9 +715,9 @@ void content_toolitem_init() f->description = gettext("Mithril Spear"); f->type = TT_SPEAR; f->param_type = CPT_ENCHANTMENT; - f->diginfo.uses = 2048; - f->diginfo.time = 0.4; - f->diginfo.level = 5; + f->diginfo.uses = E_MITHRIL_USES; + f->diginfo.time = E_MITHRIL_TIME; + f->diginfo.level = 1; crafting::setSpearRecipe(CONTENT_CRAFTITEM_MITHRIL,CONTENT_TOOLITEM_MITHRIL_SPEAR); content_list_add("craftguide",i,1,0); @@ -729,8 +729,8 @@ void content_toolitem_init() f->texture = "tool_handle.png^tool_head_sword_copper.png^tool_binding_sword.png"; f->description = gettext("Copper Sword"); f->type = TT_SWORD; - f->diginfo.uses = 64; - f->diginfo.time = 1.5; + f->diginfo.uses = COPPER_USES; + f->diginfo.time = COPPER_TIME; f->diginfo.level = 1; crafting::setSwordRecipe(CONTENT_CRAFTITEM_COPPER_INGOT,CONTENT_TOOLITEM_COPPER_SWORD); content_list_add("craftguide",i,1,0); @@ -742,9 +742,9 @@ void content_toolitem_init() f->texture = "tool_handle.png^tool_head_sword_bronze.png^tool_binding_sword.png"; f->description = gettext("Bronze Sword"); f->type = TT_SWORD; - f->diginfo.uses = 128; - f->diginfo.time = 1.5; - f->diginfo.level = 4; + f->diginfo.uses = BRONZE_USES; + f->diginfo.time = BRONZE_TIME; + f->diginfo.level = 1; crafting::setSwordRecipe(CONTENT_CRAFTITEM_BRONZE_INGOT,CONTENT_TOOLITEM_BRONZE_SWORD); content_list_add("craftguide",i,1,0); content_list_add("creative",i,1,0); @@ -755,9 +755,9 @@ void content_toolitem_init() f->texture = "tool_handle.png^tool_head_sword_iron.png^tool_binding_sword.png"; f->description = gettext("Iron Sword"); f->type = TT_SWORD; - f->diginfo.uses = 256; - f->diginfo.time = 1.0; - f->diginfo.level = 3; + f->diginfo.uses = IRON_USES; + f->diginfo.time = IRON_TIME; + f->diginfo.level = 1; crafting::setSwordRecipe(CONTENT_CRAFTITEM_IRON_INGOT,CONTENT_TOOLITEM_IRON_SWORD); content_list_add("craftguide",i,1,0); content_list_add("creative",i,1,0); @@ -768,9 +768,9 @@ void content_toolitem_init() f->texture = "tool_handle.png^tool_head_sword_mithril.png^tool_binding_sword.png"; f->description = gettext("Unbound Mithril Sword"); f->type = TT_SWORD; - f->diginfo.uses = 1024; - f->diginfo.time = 0.6; - f->diginfo.level = 5; + f->diginfo.uses = U_MITHRIL_USES; + f->diginfo.time = U_MITHRIL_TIME; + f->diginfo.level = 1; crafting::setSwordRecipe(CONTENT_CRAFTITEM_MITHRIL_UNBOUND,CONTENT_TOOLITEM_MITHRIL_UNBOUND_SWORD); content_list_add("craftguide",i,1,0); content_list_add("creative",i,1,0); @@ -782,9 +782,9 @@ void content_toolitem_init() f->description = gettext("Mithril Sword"); f->type = TT_SWORD; f->param_type = CPT_ENCHANTMENT; - f->diginfo.uses = 2048; - f->diginfo.time = 0.4; - f->diginfo.level = 5; + f->diginfo.uses = E_MITHRIL_USES; + f->diginfo.time = E_MITHRIL_TIME; + f->diginfo.level = 1; crafting::setSwordRecipe(CONTENT_CRAFTITEM_MITHRIL,CONTENT_TOOLITEM_MITHRIL_SWORD); content_list_add("craftguide",i,1,0); @@ -796,9 +796,9 @@ void content_toolitem_init() f->texture = "tool_flintshears.png"; f->description = gettext("Flint Shears"); f->type = TT_SHEAR; - f->diginfo.uses = 128; - f->diginfo.time = 1.5; - f->diginfo.level = 2; + f->diginfo.uses = FLINT_USES; + f->diginfo.time = FLINT_TIME; + f->diginfo.level = 1; crafting::setShearsRecipe(CONTENT_CRAFTITEM_FLINT,CONTENT_TOOLITEM_FLINTSHEARS); content_list_add("craftguide",i,1,0); content_list_add("creative",i,1,0); @@ -809,9 +809,9 @@ void content_toolitem_init() f->texture = "tool_copper_shears.png"; f->description = gettext("Copper Shears"); f->type = TT_SHEAR; - f->diginfo.uses = 128; - f->diginfo.time = 1.5; - f->diginfo.level = 2; + f->diginfo.uses = COPPER_USES; + f->diginfo.time = COPPER_TIME; + f->diginfo.level = 1; crafting::setShearsRecipe(CONTENT_CRAFTITEM_COPPER_INGOT,CONTENT_TOOLITEM_COPPER_SHEARS); content_list_add("craftguide",i,1,0); content_list_add("creative",i,1,0); @@ -822,9 +822,9 @@ void content_toolitem_init() f->texture = "tool_ironshears.png"; f->description = gettext("Iron Shears"); f->type = TT_SHEAR; - f->diginfo.uses = 256; - f->diginfo.time = 1.0; - f->diginfo.level = 2; + f->diginfo.uses = IRON_USES; + f->diginfo.time = IRON_TIME; + f->diginfo.level = 1; crafting::setShearsRecipe(CONTENT_CRAFTITEM_IRON_INGOT,CONTENT_TOOLITEM_IRON_SHEARS); content_list_add("craftguide",i,1,0); content_list_add("creative",i,1,0); @@ -839,8 +839,8 @@ void content_toolitem_init() f->liquids_pointable = true; f->type = TT_BUCKET; f->param_type = CPT_CONTENT; - f->diginfo.uses = 64; - f->diginfo.time = 1.5; + f->diginfo.uses = WOOD_BUCKET_USES; + f->diginfo.time = WOOD_BUCKET_TIME; f->diginfo.level = 1; f->damaging_nodes_diggable = false; crafting::setURecipe(CONTENT_CRAFTITEM_JUNGLE_PLANK,CONTENT_TOOLITEM_WBUCKET); @@ -857,9 +857,9 @@ void content_toolitem_init() f->liquids_pointable = true; f->type = TT_BUCKET; f->param_type = CPT_CONTENT; - f->diginfo.uses = 128; - f->diginfo.time = 1.75; - f->diginfo.level = 2; + f->diginfo.uses = TIN_BUCKET_USES; + f->diginfo.time = TIN_BUCKET_TIME; + f->diginfo.level = 1; f->damaging_nodes_diggable = false; crafting::setURecipe(CONTENT_CRAFTITEM_TIN_INGOT,CONTENT_TOOLITEM_TINBUCKET); content_list_add("craftguide",i,1,0); @@ -874,9 +874,9 @@ void content_toolitem_init() f->liquids_pointable = true; f->type = TT_BUCKET; f->param_type = CPT_CONTENT; - f->diginfo.uses = 256; - f->diginfo.time = 1.0; - f->diginfo.level = 3; + f->diginfo.uses = IRON_BUCKET_USES; + f->diginfo.time = IRON_BUCKET_TIME; + f->diginfo.level = 1; crafting::setURecipe(CONTENT_CRAFTITEM_IRON_INGOT,CONTENT_TOOLITEM_IRON_BUCKET); content_list_add("craftguide",i,1,0); content_list_add("creative",i,1,0); @@ -891,47 +891,47 @@ void content_toolitem_init() f->texture = "tool_handle_short.png^tool_head_knife_stone.png"; f->description = gettext("Stone Knife"); f->type = TT_KNIFE; - f->diginfo.uses = 32; - f->diginfo.time = 3.0; + f->diginfo.uses = STONE_USES; + f->diginfo.time = STONE_TIME; f->diginfo.level = 1; crafting::setKnifeRecipe(CONTENT_ROCK,CONTENT_TOOLITEM_STONE_KNIFE); content_list_add("craftguide",i,1,0); content_list_add("creative",i,1,0); - i = CONTENT_TOOLITEM_COPPER_KNIFE; - f = &g_content_toolitem_features[i]; - f->content = i; - f->texture = "tool_handle_short.png^tool_head_knife_copper.png"; - f->description = gettext("Copper Knife"); - f->type = TT_KNIFE; - f->diginfo.uses = 64; - f->diginfo.time = 2.0; - f->diginfo.level = 1; - crafting::setKnifeRecipe(CONTENT_CRAFTITEM_COPPER_INGOT,CONTENT_TOOLITEM_COPPER_KNIFE); - content_list_add("craftguide",i,1,0); - content_list_add("creative",i,1,0); - i = CONTENT_TOOLITEM_FLINT_KNIFE; f = &g_content_toolitem_features[i]; f->content = i; f->texture = "tool_handle_short.png^tool_head_knife_flint.png"; f->description = gettext("Flint Knife"); f->type = TT_KNIFE; - f->diginfo.uses = 64; - f->diginfo.time = 2.0; + f->diginfo.uses = FLINT_USES; + f->diginfo.time = FLINT_TIME; f->diginfo.level = 1; crafting::setKnifeRecipe(CONTENT_CRAFTITEM_FLINT,CONTENT_TOOLITEM_FLINT_KNIFE); content_list_add("craftguide",i,1,0); content_list_add("creative",i,1,0); + i = CONTENT_TOOLITEM_COPPER_KNIFE; + f = &g_content_toolitem_features[i]; + f->content = i; + f->texture = "tool_handle_short.png^tool_head_knife_copper.png"; + f->description = gettext("Copper Knife"); + f->type = TT_KNIFE; + f->diginfo.uses = COPPER_USES; + f->diginfo.time = COPPER_TIME; + f->diginfo.level = 1; + crafting::setKnifeRecipe(CONTENT_CRAFTITEM_COPPER_INGOT,CONTENT_TOOLITEM_COPPER_KNIFE); + content_list_add("craftguide",i,1,0); + content_list_add("creative",i,1,0); + i = CONTENT_TOOLITEM_BRONZE_KNIFE; f = &g_content_toolitem_features[i]; f->content = i; f->texture = "tool_handle_short.png^tool_head_knife_bronze.png"; f->description = gettext("Bronze Knife"); f->type = TT_KNIFE; - f->diginfo.uses = 128; - f->diginfo.time = 1.5; + f->diginfo.uses = BRONZE_USES; + f->diginfo.time = BRONZE_TIME; f->diginfo.level = 1; crafting::setKnifeRecipe(CONTENT_CRAFTITEM_BRONZE_INGOT,CONTENT_TOOLITEM_BRONZE_KNIFE); content_list_add("craftguide",i,1,0); @@ -943,8 +943,8 @@ void content_toolitem_init() f->texture = "tool_handle_short.png^tool_head_knife_iron.png"; f->description = gettext("Iron Knife"); f->type = TT_KNIFE; - f->diginfo.uses = 256; - f->diginfo.time = 1.0; + f->diginfo.uses = IRON_USES; + f->diginfo.time = IRON_TIME; f->diginfo.level = 1; crafting::setKnifeRecipe(CONTENT_CRAFTITEM_IRON_INGOT,CONTENT_TOOLITEM_IRON_KNIFE); content_list_add("craftguide",i,1,0); @@ -956,8 +956,8 @@ void content_toolitem_init() f->texture = "tool_handle_short.png^tool_head_knife_mithril.png"; f->description = gettext("Unbound Mithril Knife"); f->type = TT_KNIFE; - f->diginfo.uses = 1024; - f->diginfo.time = 0.5; + f->diginfo.uses = U_MITHRIL_USES; + f->diginfo.time = U_MITHRIL_TIME; f->diginfo.level = 1; crafting::setKnifeRecipe(CONTENT_CRAFTITEM_MITHRIL_UNBOUND,CONTENT_TOOLITEM_MITHRIL_UNBOUND_KNIFE); content_list_add("craftguide",i,1,0); @@ -970,8 +970,8 @@ void content_toolitem_init() f->description = gettext("Mithril Knife"); f->type = TT_KNIFE; f->param_type = CPT_ENCHANTMENT; - f->diginfo.uses = 2048; - f->diginfo.time = 0.5; + f->diginfo.uses = E_MITHRIL_USES; + f->diginfo.time = E_MITHRIL_TIME; f->diginfo.level = 1; crafting::setKnifeRecipe(CONTENT_CRAFTITEM_MITHRIL,CONTENT_TOOLITEM_MITHRIL_KNIFE); content_list_add("craftguide",i,1,0); @@ -986,7 +986,7 @@ void content_toolitem_init() f->description = gettext("Fire Starter"); f->liquids_pointable = true; f->type = TT_SPECIAL; - f->diginfo.level = 3; + f->diginfo.level = 1; f->has_fire_effect = true; crafting::set1Any2Recipe(CONTENT_CRAFTITEM_FLINT,CONTENT_CRAFTITEM_IRON_INGOT,CONTENT_TOOLITEM_FIRESTARTER); content_list_add("craftguide",i,1,0); @@ -998,7 +998,7 @@ void content_toolitem_init() f->texture = "tool_crowbar.png"; f->description = gettext("Crowbar"); f->type = TT_SPECIAL; - f->diginfo.level = 3; + f->diginfo.level = 1; f->has_rotate_effect = true; crafting::set1over1Recipe(CONTENT_CRAFTITEM_IRON_INGOT,CONTENT_CRAFTITEM_IRON_INGOT,CONTENT_TOOLITEM_CROWBAR); content_list_add("craftguide",i,1,0); @@ -1010,7 +1010,7 @@ void content_toolitem_init() f->texture = "tool_key.png"; f->description = gettext("Key"); f->type = TT_SPECIAL; - f->diginfo.level = 4; + f->diginfo.level = 1; f->has_unlock_effect = true; crafting::set1To1Recipe(CONTENT_CRAFTITEM_GOLD_INGOT,CONTENT_TOOLITEM_KEY); content_list_add("craftguide",i,1,0); @@ -1022,7 +1022,7 @@ void content_toolitem_init() f->texture = "tool_mithril_key.png"; f->description = gettext("Mithril Key"); f->type = TT_SPECIAL; - f->diginfo.level = 5; + f->diginfo.level = 1; f->has_unlock_effect = true; f->has_super_unlock_effect = true; /* this can only be crafted by server admin */ @@ -1041,7 +1041,7 @@ void content_toolitem_init() f->texture = "tool_mob_spawner.png"; f->description = gettext("Mob Spawner"); f->type = TT_SPECIAL; - f->diginfo.level = 4; + f->diginfo.level = 1; f->param_type = CPT_DROP; { content_t r[9] = { diff --git a/src/content_toolitem.h b/src/content_toolitem.h index 71a96d6..27a6b6c 100644 --- a/src/content_toolitem.h +++ b/src/content_toolitem.h @@ -177,4 +177,56 @@ ToolItemFeatures & content_toolitem_features(std::string subname); #define CONTENT_TOOLITEM_COPPER_SPEAR (CONTENT_TOOLITEM_MASK | 0x39) #define CONTENT_TOOLITEM_COPPER_SHEARS (CONTENT_TOOLITEM_MASK | 0x3A) +// times are calculated as : +// Stone : 3.0 +// Flint : 3.0 - 1.0 = 2.0 +// Copper : 2.0 - 0.5 = 1.5 +// Bronze : 1.5 - 0.4 = 1.1 +// Iron : 1.1 - 0.3 = 0.8 +// Mithril : 0.8 - 0.2 = 0.6 Unbound +// Mithril : 0.6 - 0.2 = 0.4 Enchanted +#define STONE_USES 32 +#define STONE_TIME 3.0 +#define STONE_LEVEL 1 + +#define FLINT_USES 64 +#define FLINT_TIME 2.0 +#define FLINT_LEVEL 2 + +#define COPPER_USES 128 +#define COPPER_TIME 1.5 +#define COPPER_LEVEL 2 + +#define BRONZE_USES 256 +#define BRONZE_TIME 1.1 +#define BRONZE_LEVEL 3 + +#define IRON_USES 512 +#define IRON_TIME 0.8 +#define IRON_LEVEL 4 + +// Unbound Mithril +#define U_MITHRIL_USES 1024 +#define U_MITHRIL_TIME 0.6 +#define U_MITHRIL_LEVEL 5 + +// Enchanted Mithril +#define E_MITHRIL_USES 2048 +#define E_MITHRIL_TIME 0.4 +#define E_MITHRIL_LEVEL 5 + +#define BOW_USES 256 +#define BOW_TIME 1.0 +#define BOW_LEVEL 1 + +#define WOOD_BUCKET_USES 64 +#define WOOD_BUCKET_TIME 1.5 + +#define TIN_BUCKET_USES 128 +#define TIN_BUCKET_TIME 1.75 + +#define IRON_BUCKET_USES 256 +#define IRON_BUCKET_TIME 1.0 + + #endif diff --git a/src/mineral.cpp b/src/mineral.cpp index 2c3a41a..91f0317 100644 --- a/src/mineral.cpp +++ b/src/mineral.cpp @@ -31,164 +31,168 @@ struct MineralFeatures g_mineral_features[MINERAL_MAX+1]; MineralFeatures & mineral_features(u8 i) { - return g_mineral_features[i]; + return g_mineral_features[i]; } CraftItem *getDiggedMineralItem(u8 mineral, Player *player, InventoryItem *tool) { - MineralFeatures m = mineral_features(mineral); - if (m.dug_item == CONTENT_IGNORE) - return NULL; + MineralFeatures m = mineral_features(mineral); + if (m.dug_item == CONTENT_IGNORE) + return NULL; - if (content_craftitem_features(m.dug_item)->content == CONTENT_IGNORE) - return NULL; + if (content_craftitem_features(m.dug_item)->content == CONTENT_IGNORE) + return NULL; - if (!tool && m.min_level > 0) - return NULL; + if (!tool && m.min_level > 0) + return NULL; - ToolItemFeatures *t = &content_toolitem_features(tool->getContent()); - if (t->content == CONTENT_IGNORE && m.min_level > 0) - return NULL; + ToolItemFeatures *t = &content_toolitem_features(tool->getContent()); + if (t->content == CONTENT_IGNORE && m.min_level > 0) + return NULL; - if (t->diginfo.level < m.min_level) - return NULL; + if (t->diginfo.level < m.min_level) + return NULL; - u16 count = m.dug_count_min; - u16 count_max = t->diginfo.level; - u16 data = tool->getData(); + u16 count = m.dug_count_min; + u16 count_max = t->diginfo.level; + u16 data = tool->getData(); - if (data != 0) { - EnchantmentInfo info; - while (enchantment_get(&data,&info)) { - switch (info.type) { - case ENCHANTMENT_MORE: // amplius increases the amount given - count += (info.level+1)/2; - count_max += info.level; - break; - case ENCHANTMENT_DONTBREAK: // gives no mineral - return NULL; - break; - default:; - } - } - } + if (data != 0) { + EnchantmentInfo info; + while (enchantment_get(&data,&info)) { + switch (info.type) { + case ENCHANTMENT_MORE: // amplius increases the amount given + count += (info.level+1)/2; + count_max += info.level; + break; + case ENCHANTMENT_DONTBREAK: // gives no mineral + return NULL; + break; + default:; + } + } + } - if (count_max > count) { - count = myrand_range(m.dug_count_min,count_max); - } + if (count_max > count) { + count = myrand_range(m.dug_count_min,count_max); + } - if (count > m.dug_count_max) - count = m.dug_count_max; + if (count > m.dug_count_max) + count = m.dug_count_max; - return new CraftItem(m.dug_item, count, 0); + return new CraftItem(m.dug_item, count, 0); } void init_mineral() { - u8 i; - MineralFeatures *f = NULL; + u8 i; + MineralFeatures *f = NULL; - i = MINERAL_COAL; - f = &mineral_features(i); - f->description = gettext("Coal"); - f->texture = "mineral_coal.png"; - f->dug_item = CONTENT_CRAFTITEM_COAL; + i = MINERAL_COAL; + f = &mineral_features(i); + f->description = gettext("Coal"); + f->texture = "mineral_coal.png"; + f->dug_item = CONTENT_CRAFTITEM_COAL; - i = MINERAL_IRON; - f = &mineral_features(i); - f->description = gettext("Iron"); - f->texture = "mineral_iron.png"; - f->dug_item = CONTENT_CRAFTITEM_IRON; - f->min_level = 2; + // Flint from gravel for level 2 tools - i = MINERAL_TIN; - f = &mineral_features(i); - f->description = gettext("Tin"); - f->texture = "mineral_tin.png"; - f->dug_item = CONTENT_CRAFTITEM_TIN; - f->min_level = 2; + i = MINERAL_COPPER; + f = &mineral_features(i); + f->description = gettext("Copper"); + f->texture = "mineral_copper.png"; + f->dug_item = CONTENT_CRAFTITEM_COPPER; + f->dug_count_max = 4; + f->min_level = 2; - i = MINERAL_COPPER; - f = &mineral_features(i); - f->description = gettext("Copper"); - f->texture = "mineral_copper.png"; - f->dug_item = CONTENT_CRAFTITEM_COPPER; - f->dug_count_max = 4; - f->min_level = 2; + i = MINERAL_TIN; + f = &mineral_features(i); + f->description = gettext("Tin"); + f->texture = "mineral_tin.png"; + f->dug_item = CONTENT_CRAFTITEM_TIN; + f->min_level = 2; - i = MINERAL_SILVER; - f = &mineral_features(i); - f->description = gettext("Silver"); - f->texture = "mineral_silver.png"; - f->dug_item = CONTENT_CRAFTITEM_SILVER; - f->min_level = 3; + // bronze for level 3 tools - i = MINERAL_GOLD; - f = &mineral_features(i); - f->description = gettext("Gold"); - f->texture = "mineral_gold.png"; - f->dug_item = CONTENT_CRAFTITEM_GOLD; - f->min_level = 3; + i = MINERAL_IRON; + f = &mineral_features(i); + f->description = gettext("Iron"); + f->texture = "mineral_iron.png"; + f->dug_item = CONTENT_CRAFTITEM_IRON; + f->min_level = 3; - i = MINERAL_QUARTZ; - f = &mineral_features(i); - f->description = gettext("Quartz"); - f->texture = "mineral_quartz.png"; - f->dug_item = CONTENT_CRAFTITEM_QUARTZ; - f->min_level = 3; + i = MINERAL_MITHRIL; + f = &mineral_features(i); + f->description = gettext("Mithril"); + f->texture = "mineral_mithril.png"; + f->dug_item = CONTENT_CRAFTITEM_MITHRIL_RAW; + f->min_level = 4; - i = MINERAL_MITHRIL; - f = &mineral_features(i); - f->description = gettext("Mithril"); - f->texture = "mineral_mithril.png"; - f->dug_item = CONTENT_CRAFTITEM_MITHRIL_RAW; - f->min_level = 3; + i = MINERAL_SALT; + f = &mineral_features(i); + f->description = gettext("Salt"); + f->texture = "mineral_salt.png"; + f->dug_item = CONTENT_CRAFTITEM_SALT; + f->min_level = 1; + f->dug_count_max = 2; - i = MINERAL_RUBY; - f = &mineral_features(i); - f->description = gettext("Ruby"); - f->texture = "mineral_ruby.png"; - f->dug_item = CONTENT_CRAFTITEM_RUBY; - f->min_level = 3; - f->dug_count_max = 2; + i = MINERAL_SILVER; + f = &mineral_features(i); + f->description = gettext("Silver"); + f->texture = "mineral_silver.png"; + f->dug_item = CONTENT_CRAFTITEM_SILVER; + f->min_level = 3; - i = MINERAL_TURQUOISE; - f = &mineral_features(i); - f->description = gettext("Turquoise"); - f->texture = "mineral_turquoise.png"; - f->dug_item = CONTENT_CRAFTITEM_TURQUOISE; - f->min_level = 3; - f->dug_count_max = 2; + i = MINERAL_GOLD; + f = &mineral_features(i); + f->description = gettext("Gold"); + f->texture = "mineral_gold.png"; + f->dug_item = CONTENT_CRAFTITEM_GOLD; + f->min_level = 3; - i = MINERAL_AMETHYST; - f = &mineral_features(i); - f->description = gettext("Amethyst"); - f->texture = "mineral_amethyst.png"; - f->dug_item = CONTENT_CRAFTITEM_AMETHYST; - f->min_level = 3; - f->dug_count_max = 2; + i = MINERAL_QUARTZ; + f = &mineral_features(i); + f->description = gettext("Quartz"); + f->texture = "mineral_quartz.png"; + f->dug_item = CONTENT_CRAFTITEM_QUARTZ; + f->min_level = 3; - i = MINERAL_SAPPHIRE; - f = &mineral_features(i); - f->description = gettext("Sapphire"); - f->texture = "mineral_sapphire.png"; - f->dug_item = CONTENT_CRAFTITEM_SAPPHIRE; - f->min_level = 3; - f->dug_count_max = 2; + i = MINERAL_RUBY; + f = &mineral_features(i); + f->description = gettext("Ruby"); + f->texture = "mineral_ruby.png"; + f->dug_item = CONTENT_CRAFTITEM_RUBY; + f->min_level = 3; + f->dug_count_max = 2; - i = MINERAL_SUNSTONE; - f = &mineral_features(i); - f->description = gettext("Sunstone"); - f->texture = "mineral_sunstone.png"; - f->dug_item = CONTENT_CRAFTITEM_SUNSTONE; - f->min_level = 3; - f->dug_count_max = 2; + i = MINERAL_TURQUOISE; + f = &mineral_features(i); + f->description = gettext("Turquoise"); + f->texture = "mineral_turquoise.png"; + f->dug_item = CONTENT_CRAFTITEM_TURQUOISE; + f->min_level = 3; + f->dug_count_max = 2; - i = MINERAL_SALT; - f = &mineral_features(i); - f->description = gettext("Salt"); - f->texture = "mineral_salt.png"; - f->dug_item = CONTENT_CRAFTITEM_SALT; - f->min_level = 1; - f->dug_count_max = 2; + i = MINERAL_AMETHYST; + f = &mineral_features(i); + f->description = gettext("Amethyst"); + f->texture = "mineral_amethyst.png"; + f->dug_item = CONTENT_CRAFTITEM_AMETHYST; + f->min_level = 3; + f->dug_count_max = 2; + + i = MINERAL_SAPPHIRE; + f = &mineral_features(i); + f->description = gettext("Sapphire"); + f->texture = "mineral_sapphire.png"; + f->dug_item = CONTENT_CRAFTITEM_SAPPHIRE; + f->min_level = 3; + f->dug_count_max = 2; + + i = MINERAL_SUNSTONE; + f = &mineral_features(i); + f->description = gettext("Sunstone"); + f->texture = "mineral_sunstone.png"; + f->dug_item = CONTENT_CRAFTITEM_SUNSTONE; + f->min_level = 3; + f->dug_count_max = 2; } From f7d3480951f50a79953ac0e636acd6253bdf98f1 Mon Sep 17 00:00:00 2001 From: JonnyW Date: Sat, 3 Mar 2018 18:50:32 +0000 Subject: [PATCH 5/7] fixed the clock --- data/textures/clock.png | Bin 136 -> 124 bytes data/textures/clock_front.png | Bin 148 -> 265 bytes src/content_nodebox.cpp | 4 ++-- src/nodemeta/content_nodemeta_blocks.cpp | 29 ++++++++++++++++------- 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/data/textures/clock.png b/data/textures/clock.png index e4f69011da928ec205986bb6c3f0125c073f5b13..648a6440997d2f5883034392a725358ea46180a6 100644 GIT binary patch literal 124 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdzmSQK*5Dp-y;YjHK@{K)R977^n z-=1@1WH8`3vLShydY07%)07XMye3!Q|I;Zmdk$2E3_Oj_m@uo&Q@ol567_WTb6Mw< G&;$UYXC4#) literal 136 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61SBU+%rFB|jKx9jP7LeL$-D$|I14-?iy0WW zg+Z8+Vb&Z8pdfpRr>`sfJq|%$2FvUh+vfv?q&!_5Lp07O+w9skr%~j<5eFrSs|KqQ cUt};autYJj*Y5RO3{=J7>FVdQ&MBb@0A(^EO8@`> diff --git a/data/textures/clock_front.png b/data/textures/clock_front.png index 338a5b18f26ff9f169bcb6f9bd44eb4abfa92165..ef70211358a4271f1733e4a43315ae90eb1cb4a0 100644 GIT binary patch delta 245 zcmbQj*vaJF8Q|y6%O%Cdz`(%k>ERLtq!mDzg9%9fk$AfpNU@|l`Z_W&Z0zU$lgJ9> zvn6@EyD`sfJq|%$Ca!0ETeyKjYMw5RAsXkCZFcRN(ERfmae pt1tLnGLbnfxR5#Hus|0(!}cc}?1v(S4ghs9c)I$ztaD0e0s#MKCA0tl diff --git a/src/content_nodebox.cpp b/src/content_nodebox.cpp index 0e77891..db90b5f 100644 --- a/src/content_nodebox.cpp +++ b/src/content_nodebox.cpp @@ -1419,10 +1419,10 @@ void content_nodebox_clock(ContentFeatures *f) -0.4375*BS,0.1875*BS,-0.125*BS,0.4375*BS,0.25*BS,-0.0625*BS )); f->addNodeBox(NodeBox( - 0.*BS,-0.0625*BS,-0.125*BS,0.0625*BS,0.*BS,-0.0625*BS + -0.02*BS,-0.0625*BS,-0.125*BS,0.0225*BS,0.*BS,-0.0625*BS )); f->addNodeBox(NodeBox( - 0.*BS,-0.1875*BS,-0.125*BS,0.0625*BS,-0.125*BS,-0.0625*BS + -0.02*BS,-0.1875*BS,-0.125*BS,0.0225*BS,-0.125*BS,-0.0625*BS )); } diff --git a/src/nodemeta/content_nodemeta_blocks.cpp b/src/nodemeta/content_nodemeta_blocks.cpp index 64115ef..534a5cd 100644 --- a/src/nodemeta/content_nodemeta_blocks.cpp +++ b/src/nodemeta/content_nodemeta_blocks.cpp @@ -76,28 +76,39 @@ std::vector ClockNodeMetadata::getNodeBoxes(MapNode &n) { v[2] = m/10; v[3] = m%10; - f32 x[4] = {-0.125,0.0625,0.3125,0.5}; + f32 x[4] = {-0.180,0.0225,0.2925,0.5}; u8 b[10] = {0xFC,0x0C,0xB6,0x9E,0x4E,0xDA,0xFA,0x8C,0xFE,0xDE}; + float z1 = -0.125; + float z2 = -0.0625; + for (int i=0; i<4; i++) { + // clock numbers are built from 7 segments + // top if ((b[v[i]]&0x80)) - boxes.push_back(NodeBox((-0.25+x[i])*BS,0.0625*BS,-0.125*BS,(-0.0625+x[i])*BS,0.125*BS,-0.0625*BS)); + boxes.push_back(NodeBox((-0.25+x[i])*BS,0.0625*BS,z1*BS,(-0.0625+x[i])*BS,0.125*BS,z2*BS)); + // top right if ((b[v[i]]&0x04)) - boxes.push_back(NodeBox((-0.125+x[i])*BS,-0.0625*BS,-0.125*BS,(-0.0625+x[i])*BS,0.0625*BS,-0.0625*BS)); + boxes.push_back(NodeBox((-0.125+x[i])*BS,-0.125*BS,z1*BS,(-0.0625+x[i])*BS,0.125*BS,z2*BS)); + // bottom right if ((b[v[i]]&0x08)) - boxes.push_back(NodeBox((-0.125+x[i])*BS,-0.25*BS,-0.125*BS,(-0.0625+x[i])*BS,-0.125*BS,-0.0625*BS)); + boxes.push_back(NodeBox((-0.125+x[i])*BS,-0.3125*BS,z1*BS,(-0.0625+x[i])*BS,-0.0625*BS,z2*BS)); + // bottom if ((b[v[i]]&0x10)) - boxes.push_back(NodeBox((-0.25+x[i])*BS,-0.3125*BS,-0.125*BS,(-0.0625+x[i])*BS,-0.25*BS,-0.0625*BS)); + boxes.push_back(NodeBox((-0.25+x[i])*BS,-0.3125*BS,z1*BS,(-0.0625+x[i])*BS,-0.25*BS,z2*BS)); + // bottom left if ((b[v[i]]&0x20)) - boxes.push_back(NodeBox((-0.25+x[i])*BS,-0.25*BS,-0.125*BS,(-0.1875+x[i])*BS,-0.125*BS,-0.0625*BS)); + boxes.push_back(NodeBox((-0.25+x[i])*BS,-0.3125*BS,z1*BS,(-0.1875+x[i])*BS,-0.0625*BS,z2*BS)); + // top left if ((b[v[i]]&0x40)) - boxes.push_back(NodeBox((-0.25+x[i])*BS,-0.0625*BS,-0.125*BS,(-0.1875+x[i])*BS,0.0625*BS,-0.0625*BS)); + boxes.push_back(NodeBox((-0.25+x[i])*BS,-0.125*BS,z1*BS,(-0.1875+x[i])*BS,0.125*BS,z2*BS)); + // middle if ((b[v[i]]&0x02)) - boxes.push_back(NodeBox((-0.1875+x[i])*BS,-0.125*BS,-0.125*BS,(-0.125+x[i])*BS,-0.0625*BS,-0.0625*BS)); + boxes.push_back(NodeBox((-0.25+x[i])*BS,-0.125*BS,z1*BS,(-0.0625+x[i])*BS,-0.0625*BS,z2*BS)); } - return transformNodeBox(n,boxes); + return boxes; } bool ClockNodeMetadata::step(float dtime, v3s16 pos, ServerEnvironment *env) { From e2910b4e73ee41ddcd89f4c8af653b8d7b191ec7 Mon Sep 17 00:00:00 2001 From: JonnyW Date: Sat, 3 Mar 2018 23:29:12 +0000 Subject: [PATCH 6/7] Fixed book orientation when in book case. --- src/nodemeta/content_nodemeta_storage.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nodemeta/content_nodemeta_storage.cpp b/src/nodemeta/content_nodemeta_storage.cpp index 25cb5b5..6d86b35 100644 --- a/src/nodemeta/content_nodemeta_storage.cpp +++ b/src/nodemeta/content_nodemeta_storage.cpp @@ -127,7 +127,7 @@ std::vector BookShelfNodeMetadata::getNodeBoxes(MapNode &n) )); } - return transformNodeBox(n,boxes); + return boxes; } /* From 1a46bdfabd0e2db7ea21b3eed8270381fe342b71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Fri, 9 Mar 2018 09:14:42 +0100 Subject: [PATCH 7/7] CMake: Fix include path for out-of-source build Fixes https://forum.voxelands.com/viewtopic.php?id=893 --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f11f059..4c8d3f0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -321,11 +321,11 @@ set(voxelandsserver_SRCS ) include_directories( + ${voxelands_SOURCE_DIR} ${CMAKE_BINARY_DIR}/src/jthread ${PROJECT_BINARY_DIR} ${IRRLICHT_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} - ${CMAKE_BUILD_TYPE} ${PNG_INCLUDE_DIR} ${AUDIO_INCLUDE_DIRS} ${JTHREAD_INCLUDE_DIR}