Merge remote-tracking branch 'origin/next'

This commit is contained in:
Mikita Wiśniewski 2022-10-09 15:39:23 +07:00
commit a357321e8e
13 changed files with 585 additions and 366 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 136 B

After

Width:  |  Height:  |  Size: 124 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 148 B

After

Width:  |  Height:  |  Size: 265 B

View File

@ -321,11 +321,11 @@ set(voxelandsserver_SRCS
) )
include_directories( include_directories(
${voxelands_SOURCE_DIR}
${CMAKE_BINARY_DIR}/src/jthread ${CMAKE_BINARY_DIR}/src/jthread
${PROJECT_BINARY_DIR} ${PROJECT_BINARY_DIR}
${IRRLICHT_INCLUDE_DIR} ${IRRLICHT_INCLUDE_DIR}
${ZLIB_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR}
${CMAKE_BUILD_TYPE}
${PNG_INCLUDE_DIR} ${PNG_INCLUDE_DIR}
${AUDIO_INCLUDE_DIRS} ${AUDIO_INCLUDE_DIRS}
${JTHREAD_INCLUDE_DIR} ${JTHREAD_INCLUDE_DIR}

View File

@ -43,6 +43,13 @@ typedef struct config_s {
int (*setter)(char* v); int (*setter)(char* v);
} config_t; } 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 */ /* get the value of a config setting */
char* config_get(char* name) char* config_get(char* name)
{ {
@ -393,12 +400,111 @@ void config_save(char* section, char* type, char* file)
n = n->next; n = n->next;
} }
}else{ }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; 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) 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; 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); events_save(f);
*/ */

View File

@ -987,19 +987,20 @@ FoundReverseRecipe getReverseRecipe(InventoryItem *iitem, int index)
} }
//how to update an ingredient list given a range of new craft items //how to update an ingredient list given a range of new craft items
void addToIngredientList(std::vector<listdata_t> results, uint32_t begin, std::vector<content_t>& ingredient_list) void addToIngredientList(contentlist_t *list, uint32_t begin, std::vector<content_t>& ingredient_list)
{ {
using namespace std; using namespace std;
//make a set to hold the items as the list is compiled //make a set to hold the items as the list is compiled
set<content_t> ingredients (ingredient_list.begin(), ingredient_list.end()); set<content_t> ingredients (ingredient_list.begin(), ingredient_list.end());
//go through the result list listdata_t *d = list->data;
for (std::vector<listdata_t>::iterator it = results.begin()+begin; it != results.end(); ++it) {
//go through the result list
while (d) {
listdata_t d = *it;
//make a temporary inventory item for the result //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 //go through every recipe for this item
for (int rec_ind = getRecipeCount(result); rec_ind--;) { for (int rec_ind = getRecipeCount(result); rec_ind--;) {
@ -1020,6 +1021,8 @@ void addToIngredientList(std::vector<listdata_t> results, uint32_t begin, std::v
//clean up //clean up
delete result; delete result;
d = d->next;
} }
//ignore CONTENT_IGNORE //ignore CONTENT_IGNORE
@ -1050,8 +1053,7 @@ std::vector<content_t>& getCraftGuideIngredientList()
if (list_size > last_craftguide_count) { if (list_size > last_craftguide_count) {
//if so, add the new stuff //if so, add the new stuff
/* TODO: basically everything for reverse lookup */ addToIngredientList(cl, last_craftguide_count, ingredient_list);
//addToIngredientList(craft_list, last_craftguide_count, ingredient_list);
//and update the craftguide count //and update the craftguide count
last_craftguide_count = list_size; last_craftguide_count = list_size;

View File

@ -761,8 +761,9 @@ void content_mapnode_special(bool repeat)
f->dig_time = 1.0; f->dig_time = 1.0;
f->pressure_type = CST_CRUSHABLE; f->pressure_type = CST_CRUSHABLE;
f->suffocation_per_second = 0; f->suffocation_per_second = 0;
crafting::set1Any2Recipe(CONTENT_BOOK,CONTENT_CRAFTITEM_MITHRIL_RAW,i); //not going to use mithril when you can use sticks
crafting::set1Any2Recipe(CONTENT_BOOK,CONTENT_CRAFTITEM_MITHRIL_UNBOUND,i); //crafting::set1Any2Recipe(CONTENT_BOOK,CONTENT_CRAFTITEM_MITHRIL_RAW,i);
//crafting::set1Any2Recipe(CONTENT_BOOK,CONTENT_CRAFTITEM_MITHRIL_UNBOUND,i);
{ {
content_t r[9] = { content_t r[9] = {
CONTENT_CRAFTITEM_STICK, CONTENT_CRAFTITEM_STICK, CONTENT_IGNORE, CONTENT_CRAFTITEM_STICK, CONTENT_CRAFTITEM_STICK, CONTENT_IGNORE,

View File

@ -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 -0.4375*BS,0.1875*BS,-0.125*BS,0.4375*BS,0.25*BS,-0.0625*BS
)); ));
f->addNodeBox(NodeBox( 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( 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
)); ));
} }

View File

@ -287,9 +287,9 @@ void content_toolitem_init()
f->texture = "tool_handle.png^tool_head_pick_stone.png^tool_binding_pick.png"; f->texture = "tool_handle.png^tool_head_pick_stone.png^tool_binding_pick.png";
f->description = gettext("Stone Pick"); f->description = gettext("Stone Pick");
f->type = TT_PICK; f->type = TT_PICK;
f->diginfo.uses = 32; f->diginfo.uses = STONE_USES;
f->diginfo.time = 3.0; f->diginfo.time = STONE_TIME;
f->diginfo.level = 1; f->diginfo.level = STONE_LEVEL;
{ {
content_t r[9] = { content_t r[9] = {
CONTENT_ROCK, CONTENT_ROCK, CONTENT_ROCK, CONTENT_ROCK, CONTENT_ROCK, CONTENT_ROCK,
@ -303,41 +303,41 @@ void content_toolitem_init()
content_list_add("craftguide",i,1,0); content_list_add("craftguide",i,1,0);
content_list_add("creative",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; i = CONTENT_TOOLITEM_FLINTPICK;
f = &g_content_toolitem_features[i]; f = &g_content_toolitem_features[i];
f->content = i; f->content = i;
f->texture = "tool_handle.png^tool_head_pick_flint.png^tool_binding_pick.png"; f->texture = "tool_handle.png^tool_head_pick_flint.png^tool_binding_pick.png";
f->description = gettext("Flint Pick"); f->description = gettext("Flint Pick");
f->type = TT_PICK; f->type = TT_PICK;
f->diginfo.uses = 64; f->diginfo.uses = FLINT_USES;
f->diginfo.time = 1.5; f->diginfo.time = FLINT_TIME;
f->diginfo.level = 2; f->diginfo.level = FLINT_LEVEL;
crafting::setPickRecipe(CONTENT_CRAFTITEM_FLINT,CONTENT_TOOLITEM_FLINTPICK); crafting::setPickRecipe(CONTENT_CRAFTITEM_FLINT,CONTENT_TOOLITEM_FLINTPICK);
content_list_add("craftguide",i,1,0); content_list_add("craftguide",i,1,0);
content_list_add("creative",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; i = CONTENT_TOOLITEM_BRONZE_PICK;
f = &g_content_toolitem_features[i]; f = &g_content_toolitem_features[i];
f->content = i; f->content = i;
f->texture = "tool_handle.png^tool_head_pick_bronze.png^tool_binding_pick.png"; f->texture = "tool_handle.png^tool_head_pick_bronze.png^tool_binding_pick.png";
f->description = gettext("Bronze Pick"); f->description = gettext("Bronze Pick");
f->type = TT_PICK; f->type = TT_PICK;
f->diginfo.uses = 128; f->diginfo.uses = BRONZE_USES;
f->diginfo.time = 1.25; f->diginfo.time = BRONZE_TIME;
f->diginfo.level = 3; f->diginfo.level = BRONZE_LEVEL;
crafting::setPickRecipe(CONTENT_CRAFTITEM_BRONZE_INGOT,CONTENT_TOOLITEM_BRONZE_PICK); crafting::setPickRecipe(CONTENT_CRAFTITEM_BRONZE_INGOT,CONTENT_TOOLITEM_BRONZE_PICK);
content_list_add("craftguide",i,1,0); content_list_add("craftguide",i,1,0);
content_list_add("creative",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->texture = "tool_handle.png^tool_head_pick_iron.png^tool_binding_pick.png";
f->description = gettext("Iron Pick"); f->description = gettext("Iron Pick");
f->type = TT_PICK; f->type = TT_PICK;
f->diginfo.uses = 256; f->diginfo.uses = IRON_USES;
f->diginfo.time = 1.0; f->diginfo.time = IRON_TIME;
f->diginfo.level = 4; f->diginfo.level = IRON_LEVEL;
crafting::setPickRecipe(CONTENT_CRAFTITEM_IRON_INGOT,CONTENT_TOOLITEM_IRON_PICK); crafting::setPickRecipe(CONTENT_CRAFTITEM_IRON_INGOT,CONTENT_TOOLITEM_IRON_PICK);
content_list_add("craftguide",i,1,0); content_list_add("craftguide",i,1,0);
content_list_add("creative",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->texture = "tool_handle.png^tool_head_pick_mithril.png^tool_binding_pick.png";
f->description = gettext("Unbound Mithril Pick"); f->description = gettext("Unbound Mithril Pick");
f->type = TT_PICK; f->type = TT_PICK;
f->diginfo.uses = 1024; f->diginfo.uses = U_MITHRIL_USES;
f->diginfo.time = 0.6; f->diginfo.time = U_MITHRIL_TIME;
f->diginfo.level = 5; f->diginfo.level = U_MITHRIL_LEVEL;
crafting::setPickRecipe(CONTENT_CRAFTITEM_MITHRIL_UNBOUND,CONTENT_TOOLITEM_MITHRIL_UNBOUND_PICK); crafting::setPickRecipe(CONTENT_CRAFTITEM_MITHRIL_UNBOUND,CONTENT_TOOLITEM_MITHRIL_UNBOUND_PICK);
content_list_add("craftguide",i,1,0); content_list_add("craftguide",i,1,0);
content_list_add("creative",i,1,0); content_list_add("creative",i,1,0);
@ -375,9 +375,9 @@ void content_toolitem_init()
f->description = gettext("Mithril Pick"); f->description = gettext("Mithril Pick");
f->type = TT_PICK; f->type = TT_PICK;
f->param_type = CPT_ENCHANTMENT; f->param_type = CPT_ENCHANTMENT;
f->diginfo.uses = 2048; f->diginfo.uses = E_MITHRIL_USES;
f->diginfo.time = 0.4; f->diginfo.time = E_MITHRIL_TIME;
f->diginfo.level = 6; f->diginfo.level = E_MITHRIL_LEVEL;
f->has_punch_effect = false; f->has_punch_effect = false;
crafting::setPickRecipe(CONTENT_CRAFTITEM_MITHRIL,CONTENT_TOOLITEM_MITHRIL_PICK); crafting::setPickRecipe(CONTENT_CRAFTITEM_MITHRIL,CONTENT_TOOLITEM_MITHRIL_PICK);
content_list_add("craftguide",i,1,0); 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->texture = "tool_handle.png^tool_head_shovel_stone.png^tool_binding_shovel.png";
f->description = gettext("Stone Shovel"); f->description = gettext("Stone Shovel");
f->type = TT_SHOVEL; f->type = TT_SHOVEL;
f->diginfo.uses = 32; f->diginfo.uses = STONE_USES;
f->diginfo.time = 3.0; f->diginfo.time = STONE_TIME;
f->diginfo.level = 1; f->diginfo.level = STONE_LEVEL;
crafting::set1over1Recipe(CONTENT_ROCK,CONTENT_CRAFTITEM_STICK,i); crafting::set1over1Recipe(CONTENT_ROCK,CONTENT_CRAFTITEM_STICK,i);
content_list_add("craftguide",i,1,0); content_list_add("craftguide",i,1,0);
content_list_add("creative",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; i = CONTENT_TOOLITEM_FLINTSHOVEL;
f = &g_content_toolitem_features[i]; f = &g_content_toolitem_features[i];
f->content = i; f->content = i;
f->texture = "tool_handle.png^tool_head_shovel_flint.png^tool_binding_shovel.png"; f->texture = "tool_handle.png^tool_head_shovel_flint.png^tool_binding_shovel.png";
f->description = gettext("Flint Shovel"); f->description = gettext("Flint Shovel");
f->type = TT_SHOVEL; f->type = TT_SHOVEL;
f->diginfo.uses = 128; f->diginfo.uses = FLINT_USES;
f->diginfo.time = 1.75; f->diginfo.time = FLINT_TIME;
f->diginfo.level = 2; f->diginfo.level = FLINT_LEVEL;
crafting::setShovelRecipe(CONTENT_CRAFTITEM_FLINT,CONTENT_TOOLITEM_FLINTSHOVEL); crafting::setShovelRecipe(CONTENT_CRAFTITEM_FLINT,CONTENT_TOOLITEM_FLINTSHOVEL);
content_list_add("craftguide",i,1,0); content_list_add("craftguide",i,1,0);
content_list_add("creative",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 = &g_content_toolitem_features[i];
f->content = i; f->content = i;
f->texture = "tool_handle.png^tool_head_shovel_iron.png^tool_binding_shovel.png"; f->texture = "tool_handle.png^tool_head_shovel_copper.png^tool_binding_shovel.png";
f->description = gettext("Iron Shovel"); f->description = gettext("Copper Shovel");
f->type = TT_SHOVEL; f->type = TT_SHOVEL;
f->diginfo.uses = 256; f->diginfo.uses = COPPER_USES;
f->diginfo.time = 1.0; f->diginfo.time = COPPER_TIME;
f->diginfo.level = 3; f->diginfo.level = COPPER_LEVEL;
crafting::setShovelRecipe(CONTENT_CRAFTITEM_IRON_INGOT,CONTENT_TOOLITEM_IRON_SHOVEL); crafting::setShovelRecipe(CONTENT_CRAFTITEM_COPPER_INGOT,CONTENT_TOOLITEM_COPPER_SHOVEL);
content_list_add("craftguide",i,1,0); content_list_add("craftguide",i,1,0);
content_list_add("creative",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->texture = "tool_handle.png^tool_head_shovel_bronze.png^tool_binding_shovel.png";
f->description = gettext("Bronze Shovel"); f->description = gettext("Bronze Shovel");
f->type = TT_SHOVEL; f->type = TT_SHOVEL;
f->diginfo.uses = 512; f->diginfo.uses = BRONZE_USES;
f->diginfo.time = 0.75; f->diginfo.time = BRONZE_TIME;
f->diginfo.level = 4; f->diginfo.level = BRONZE_LEVEL;
crafting::setShovelRecipe(CONTENT_CRAFTITEM_BRONZE_INGOT,CONTENT_TOOLITEM_BRONZE_SHOVEL); crafting::setShovelRecipe(CONTENT_CRAFTITEM_BRONZE_INGOT,CONTENT_TOOLITEM_BRONZE_SHOVEL);
content_list_add("craftguide",i,1,0); content_list_add("craftguide",i,1,0);
content_list_add("creative",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; i = CONTENT_TOOLITEM_MITHRIL_UNBOUND_SHOVEL;
f = &g_content_toolitem_features[i]; f = &g_content_toolitem_features[i];
f->content = i; f->content = i;
f->texture = "tool_handle.png^tool_head_shovel_mithril.png^tool_binding_shovel.png"; f->texture = "tool_handle.png^tool_head_shovel_mithril.png^tool_binding_shovel.png";
f->description = gettext("Unbound Mithril Shovel"); f->description = gettext("Unbound Mithril Shovel");
f->type = TT_SHOVEL; f->type = TT_SHOVEL;
f->diginfo.uses = 1024; f->diginfo.uses = U_MITHRIL_USES;
f->diginfo.time = 0.6; f->diginfo.time = U_MITHRIL_TIME;
f->diginfo.level = 5; f->diginfo.level = U_MITHRIL_LEVEL;
crafting::setShovelRecipe(CONTENT_CRAFTITEM_MITHRIL_UNBOUND,CONTENT_TOOLITEM_MITHRIL_UNBOUND_SHOVEL); crafting::setShovelRecipe(CONTENT_CRAFTITEM_MITHRIL_UNBOUND,CONTENT_TOOLITEM_MITHRIL_UNBOUND_SHOVEL);
content_list_add("craftguide",i,1,0); content_list_add("craftguide",i,1,0);
content_list_add("creative",i,1,0); content_list_add("creative",i,1,0);
@ -482,9 +482,9 @@ void content_toolitem_init()
f->description = gettext("Mithril Shovel"); f->description = gettext("Mithril Shovel");
f->type = TT_SHOVEL; f->type = TT_SHOVEL;
f->param_type = CPT_ENCHANTMENT; f->param_type = CPT_ENCHANTMENT;
f->diginfo.uses = 2048; f->diginfo.uses = E_MITHRIL_USES;
f->diginfo.time = 0.4; f->diginfo.time = E_MITHRIL_TIME;
f->diginfo.level = 5; f->diginfo.level = E_MITHRIL_LEVEL;
crafting::setShovelRecipe(CONTENT_CRAFTITEM_MITHRIL,CONTENT_TOOLITEM_MITHRIL_SHOVEL); crafting::setShovelRecipe(CONTENT_CRAFTITEM_MITHRIL,CONTENT_TOOLITEM_MITHRIL_SHOVEL);
content_list_add("craftguide",i,1,0); 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->texture = "tool_handle.png^tool_head_axe_stone.png^tool_binding_axe.png";
f->description = gettext("Stone Axe"); f->description = gettext("Stone Axe");
f->type = TT_AXE; f->type = TT_AXE;
f->diginfo.uses = 32; f->diginfo.uses = STONE_USES;
f->diginfo.time = 3.0; f->diginfo.time = STONE_TIME;
f->diginfo.level = 1; f->diginfo.level = STONE_LEVEL;
{ {
content_t r[9] = { content_t r[9] = {
CONTENT_ROCK, CONTENT_ROCK, CONTENT_IGNORE, CONTENT_ROCK, CONTENT_ROCK, CONTENT_IGNORE,
@ -513,42 +513,29 @@ void content_toolitem_init()
content_list_add("craftguide",i,1,0); content_list_add("craftguide",i,1,0);
content_list_add("creative",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; i = CONTENT_TOOLITEM_FLINTAXE;
f = &g_content_toolitem_features[i]; f = &g_content_toolitem_features[i];
f->content = i; f->content = i;
f->texture = "tool_handle.png^tool_head_axe_flint.png^tool_binding_axe.png"; f->texture = "tool_handle.png^tool_head_axe_flint.png^tool_binding_axe.png";
f->description = gettext("Flint Axe"); f->description = gettext("Flint Axe");
f->type = TT_AXE; f->type = TT_AXE;
f->diginfo.uses = 128; f->diginfo.uses = FLINT_USES;
f->diginfo.time = 1.75; f->diginfo.time = FLINT_TIME;
f->diginfo.level = 2; f->diginfo.level = FLINT_LEVEL;
crafting::setAxeRecipe(CONTENT_CRAFTITEM_FLINT,CONTENT_TOOLITEM_FLINTAXE); crafting::setAxeRecipe(CONTENT_CRAFTITEM_FLINT,CONTENT_TOOLITEM_FLINTAXE);
content_list_add("craftguide",i,1,0); content_list_add("craftguide",i,1,0);
content_list_add("creative",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 = &g_content_toolitem_features[i];
f->content = i; f->content = i;
f->texture = "tool_handle.png^tool_head_axe_iron.png^tool_binding_axe.png"; f->texture = "tool_handle.png^tool_head_axe_copper.png^tool_binding_axe.png";
f->description = gettext("Iron Axe"); f->description = gettext("Copper Axe");
f->type = TT_AXE; f->type = TT_AXE;
f->diginfo.uses = 256; f->diginfo.uses = COPPER_USES;
f->diginfo.time = 1.0; f->diginfo.time = COPPER_TIME;
f->diginfo.level = 3; f->diginfo.level = COPPER_LEVEL;
crafting::setAxeRecipe(CONTENT_CRAFTITEM_IRON_INGOT,CONTENT_TOOLITEM_IRON_AXE); crafting::setAxeRecipe(CONTENT_CRAFTITEM_COPPER_INGOT,CONTENT_TOOLITEM_COPPER_AXE);
content_list_add("craftguide",i,1,0); content_list_add("craftguide",i,1,0);
content_list_add("creative",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->texture = "tool_handle.png^tool_head_axe_bronze.png^tool_binding_axe.png";
f->description = gettext("Bronze Axe"); f->description = gettext("Bronze Axe");
f->type = TT_AXE; f->type = TT_AXE;
f->diginfo.uses = 512; f->diginfo.uses = BRONZE_USES;
f->diginfo.time = 0.75; f->diginfo.time = BRONZE_TIME;
f->diginfo.level = 4; f->diginfo.level = BRONZE_LEVEL;
crafting::setAxeRecipe(CONTENT_CRAFTITEM_BRONZE_INGOT,CONTENT_TOOLITEM_BRONZE_AXE); crafting::setAxeRecipe(CONTENT_CRAFTITEM_BRONZE_INGOT,CONTENT_TOOLITEM_BRONZE_AXE);
content_list_add("craftguide",i,1,0); content_list_add("craftguide",i,1,0);
content_list_add("creative",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; i = CONTENT_TOOLITEM_MITHRIL_UNBOUND_AXE;
f = &g_content_toolitem_features[i]; f = &g_content_toolitem_features[i];
f->content = i; f->content = i;
f->texture = "tool_handle.png^tool_head_axe_mithril.png^tool_binding_axe.png"; f->texture = "tool_handle.png^tool_head_axe_mithril.png^tool_binding_axe.png";
f->description = gettext("Unbound Mithril Axe"); f->description = gettext("Unbound Mithril Axe");
f->type = TT_AXE; f->type = TT_AXE;
f->diginfo.uses = 1024; f->diginfo.uses = U_MITHRIL_USES;
f->diginfo.time = 0.6; f->diginfo.time = U_MITHRIL_TIME;
f->diginfo.level = 5; f->diginfo.level = U_MITHRIL_LEVEL;
crafting::setAxeRecipe(CONTENT_CRAFTITEM_MITHRIL_UNBOUND,CONTENT_TOOLITEM_MITHRIL_UNBOUND_AXE); crafting::setAxeRecipe(CONTENT_CRAFTITEM_MITHRIL_UNBOUND,CONTENT_TOOLITEM_MITHRIL_UNBOUND_AXE);
content_list_add("craftguide",i,1,0); content_list_add("craftguide",i,1,0);
content_list_add("creative",i,1,0); content_list_add("creative",i,1,0);
@ -585,9 +585,9 @@ void content_toolitem_init()
f->description = gettext("Mithril Axe"); f->description = gettext("Mithril Axe");
f->type = TT_AXE; f->type = TT_AXE;
f->param_type = CPT_ENCHANTMENT; f->param_type = CPT_ENCHANTMENT;
f->diginfo.uses = 2048; f->diginfo.uses = E_MITHRIL_USES;
f->diginfo.time = 0.4; f->diginfo.time = E_MITHRIL_TIME;
f->diginfo.level = 5; f->diginfo.level = E_MITHRIL_LEVEL;
crafting::setAxeRecipe(CONTENT_CRAFTITEM_MITHRIL,CONTENT_TOOLITEM_MITHRIL_AXE); crafting::setAxeRecipe(CONTENT_CRAFTITEM_MITHRIL,CONTENT_TOOLITEM_MITHRIL_AXE);
content_list_add("craftguide",i,1,0); content_list_add("craftguide",i,1,0);
@ -613,9 +613,9 @@ void content_toolitem_init()
f->texture = "tool_bow.png"; f->texture = "tool_bow.png";
f->description = gettext("Bow"); f->description = gettext("Bow");
f->type = TT_SPECIAL; f->type = TT_SPECIAL;
f->diginfo.uses = 256; f->diginfo.uses = BOW_USES;
f->diginfo.time = 1.0; f->diginfo.time = BOW_TIME;
f->diginfo.level = 2; f->diginfo.level = BOW_LEVEL;
f->thrown_item = CONTENT_CRAFTITEM_ARROW; f->thrown_item = CONTENT_CRAFTITEM_ARROW;
{ {
content_t r[9] = { 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->texture = "tool_handle_long.png^tool_head_spear_stone.png^tool_binding_spear.png";
f->description = gettext("Stone Spear"); f->description = gettext("Stone Spear");
f->type = TT_SPEAR; f->type = TT_SPEAR;
f->diginfo.uses = 64; f->diginfo.uses = STONE_USES;
f->diginfo.time = 1.5; f->diginfo.time = STONE_TIME;
f->diginfo.level = 1; f->diginfo.level = 1;
crafting::setSpearRecipe(CONTENT_ROCK,CONTENT_TOOLITEM_STONE_SPEAR); crafting::setSpearRecipe(CONTENT_ROCK,CONTENT_TOOLITEM_STONE_SPEAR);
content_list_add("craftguide",i,1,0); content_list_add("craftguide",i,1,0);
content_list_add("creative",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; i = CONTENT_TOOLITEM_FLINTSPEAR;
f = &g_content_toolitem_features[i]; f = &g_content_toolitem_features[i];
f->content = i; f->content = i;
f->texture = "tool_handle_long.png^tool_head_spear_flint.png^tool_binding_spear.png"; f->texture = "tool_handle_long.png^tool_head_spear_flint.png^tool_binding_spear.png";
f->description = gettext("Flint Spear"); f->description = gettext("Flint Spear");
f->type = TT_SPEAR; f->type = TT_SPEAR;
f->diginfo.uses = 128; f->diginfo.uses = FLINT_USES;
f->diginfo.time = 1.75; f->diginfo.time = FLINT_TIME;
f->diginfo.level = 2; f->diginfo.level = 1;
crafting::setSpearRecipe(CONTENT_CRAFTITEM_FLINT,CONTENT_TOOLITEM_FLINTSPEAR); crafting::setSpearRecipe(CONTENT_CRAFTITEM_FLINT,CONTENT_TOOLITEM_FLINTSPEAR);
content_list_add("craftguide",i,1,0); content_list_add("craftguide",i,1,0);
content_list_add("creative",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 = &g_content_toolitem_features[i];
f->content = i; f->content = i;
f->texture = "tool_handle_long.png^tool_head_spear_iron.png^tool_binding_spear.png"; f->texture = "tool_handle_long.png^tool_head_spear_copper.png^tool_binding_spear.png";
f->description = gettext("Iron Spear"); f->description = gettext("Copper Spear");
f->type = TT_SPEAR; f->type = TT_SPEAR;
f->diginfo.uses = 256; f->diginfo.uses = COPPER_USES;
f->diginfo.time = 1.0; f->diginfo.time = COPPER_TIME;
f->diginfo.level = 3; f->diginfo.level = 1;
crafting::setSpearRecipe(CONTENT_CRAFTITEM_IRON_INGOT,CONTENT_TOOLITEM_IRON_SPEAR); crafting::setSpearRecipe(CONTENT_CRAFTITEM_COPPER_INGOT,CONTENT_TOOLITEM_COPPER_SPEAR);
content_list_add("craftguide",i,1,0); content_list_add("craftguide",i,1,0);
content_list_add("creative",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->texture = "tool_handle_long.png^tool_head_spear_bronze.png^tool_binding_spear.png";
f->description = gettext("Bronze Spear"); f->description = gettext("Bronze Spear");
f->type = TT_SPEAR; f->type = TT_SPEAR;
f->diginfo.uses = 512; f->diginfo.uses = BRONZE_USES;
f->diginfo.time = 0.75; f->diginfo.time = BRONZE_TIME;
f->diginfo.level = 4; f->diginfo.level = 1;
crafting::setSpearRecipe(CONTENT_CRAFTITEM_BRONZE_INGOT,CONTENT_TOOLITEM_BRONZE_SPEAR); crafting::setSpearRecipe(CONTENT_CRAFTITEM_BRONZE_INGOT,CONTENT_TOOLITEM_BRONZE_SPEAR);
content_list_add("craftguide",i,1,0); content_list_add("craftguide",i,1,0);
content_list_add("creative",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; i = CONTENT_TOOLITEM_MITHRIL_UNBOUND_SPEAR;
f = &g_content_toolitem_features[i]; f = &g_content_toolitem_features[i];
f->content = i; f->content = i;
f->texture = "tool_handle_long.png^tool_head_spear_mithril.png^tool_binding_spear.png"; f->texture = "tool_handle_long.png^tool_head_spear_mithril.png^tool_binding_spear.png";
f->description = gettext("Unbound Mithril Spear"); f->description = gettext("Unbound Mithril Spear");
f->type = TT_SPEAR; f->type = TT_SPEAR;
f->diginfo.uses = 1024; f->diginfo.uses = U_MITHRIL_USES;
f->diginfo.time = 0.6; f->diginfo.time = U_MITHRIL_TIME;
f->diginfo.level = 5; f->diginfo.level = 1;
crafting::setSpearRecipe(CONTENT_CRAFTITEM_MITHRIL_UNBOUND,CONTENT_TOOLITEM_MITHRIL_UNBOUND_SPEAR); crafting::setSpearRecipe(CONTENT_CRAFTITEM_MITHRIL_UNBOUND,CONTENT_TOOLITEM_MITHRIL_UNBOUND_SPEAR);
content_list_add("craftguide",i,1,0); content_list_add("craftguide",i,1,0);
content_list_add("creative",i,1,0); content_list_add("creative",i,1,0);
@ -715,9 +715,9 @@ void content_toolitem_init()
f->description = gettext("Mithril Spear"); f->description = gettext("Mithril Spear");
f->type = TT_SPEAR; f->type = TT_SPEAR;
f->param_type = CPT_ENCHANTMENT; f->param_type = CPT_ENCHANTMENT;
f->diginfo.uses = 2048; f->diginfo.uses = E_MITHRIL_USES;
f->diginfo.time = 0.4; f->diginfo.time = E_MITHRIL_TIME;
f->diginfo.level = 5; f->diginfo.level = 1;
crafting::setSpearRecipe(CONTENT_CRAFTITEM_MITHRIL,CONTENT_TOOLITEM_MITHRIL_SPEAR); crafting::setSpearRecipe(CONTENT_CRAFTITEM_MITHRIL,CONTENT_TOOLITEM_MITHRIL_SPEAR);
content_list_add("craftguide",i,1,0); 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->texture = "tool_handle.png^tool_head_sword_copper.png^tool_binding_sword.png";
f->description = gettext("Copper Sword"); f->description = gettext("Copper Sword");
f->type = TT_SWORD; f->type = TT_SWORD;
f->diginfo.uses = 64; f->diginfo.uses = COPPER_USES;
f->diginfo.time = 1.5; f->diginfo.time = COPPER_TIME;
f->diginfo.level = 1; f->diginfo.level = 1;
crafting::setSwordRecipe(CONTENT_CRAFTITEM_COPPER_INGOT,CONTENT_TOOLITEM_COPPER_SWORD); crafting::setSwordRecipe(CONTENT_CRAFTITEM_COPPER_INGOT,CONTENT_TOOLITEM_COPPER_SWORD);
content_list_add("craftguide",i,1,0); 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->texture = "tool_handle.png^tool_head_sword_bronze.png^tool_binding_sword.png";
f->description = gettext("Bronze Sword"); f->description = gettext("Bronze Sword");
f->type = TT_SWORD; f->type = TT_SWORD;
f->diginfo.uses = 128; f->diginfo.uses = BRONZE_USES;
f->diginfo.time = 1.5; f->diginfo.time = BRONZE_TIME;
f->diginfo.level = 4; f->diginfo.level = 1;
crafting::setSwordRecipe(CONTENT_CRAFTITEM_BRONZE_INGOT,CONTENT_TOOLITEM_BRONZE_SWORD); crafting::setSwordRecipe(CONTENT_CRAFTITEM_BRONZE_INGOT,CONTENT_TOOLITEM_BRONZE_SWORD);
content_list_add("craftguide",i,1,0); content_list_add("craftguide",i,1,0);
content_list_add("creative",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->texture = "tool_handle.png^tool_head_sword_iron.png^tool_binding_sword.png";
f->description = gettext("Iron Sword"); f->description = gettext("Iron Sword");
f->type = TT_SWORD; f->type = TT_SWORD;
f->diginfo.uses = 256; f->diginfo.uses = IRON_USES;
f->diginfo.time = 1.0; f->diginfo.time = IRON_TIME;
f->diginfo.level = 3; f->diginfo.level = 1;
crafting::setSwordRecipe(CONTENT_CRAFTITEM_IRON_INGOT,CONTENT_TOOLITEM_IRON_SWORD); crafting::setSwordRecipe(CONTENT_CRAFTITEM_IRON_INGOT,CONTENT_TOOLITEM_IRON_SWORD);
content_list_add("craftguide",i,1,0); content_list_add("craftguide",i,1,0);
content_list_add("creative",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->texture = "tool_handle.png^tool_head_sword_mithril.png^tool_binding_sword.png";
f->description = gettext("Unbound Mithril Sword"); f->description = gettext("Unbound Mithril Sword");
f->type = TT_SWORD; f->type = TT_SWORD;
f->diginfo.uses = 1024; f->diginfo.uses = U_MITHRIL_USES;
f->diginfo.time = 0.6; f->diginfo.time = U_MITHRIL_TIME;
f->diginfo.level = 5; f->diginfo.level = 1;
crafting::setSwordRecipe(CONTENT_CRAFTITEM_MITHRIL_UNBOUND,CONTENT_TOOLITEM_MITHRIL_UNBOUND_SWORD); crafting::setSwordRecipe(CONTENT_CRAFTITEM_MITHRIL_UNBOUND,CONTENT_TOOLITEM_MITHRIL_UNBOUND_SWORD);
content_list_add("craftguide",i,1,0); content_list_add("craftguide",i,1,0);
content_list_add("creative",i,1,0); content_list_add("creative",i,1,0);
@ -782,9 +782,9 @@ void content_toolitem_init()
f->description = gettext("Mithril Sword"); f->description = gettext("Mithril Sword");
f->type = TT_SWORD; f->type = TT_SWORD;
f->param_type = CPT_ENCHANTMENT; f->param_type = CPT_ENCHANTMENT;
f->diginfo.uses = 2048; f->diginfo.uses = E_MITHRIL_USES;
f->diginfo.time = 0.4; f->diginfo.time = E_MITHRIL_TIME;
f->diginfo.level = 5; f->diginfo.level = 1;
crafting::setSwordRecipe(CONTENT_CRAFTITEM_MITHRIL,CONTENT_TOOLITEM_MITHRIL_SWORD); crafting::setSwordRecipe(CONTENT_CRAFTITEM_MITHRIL,CONTENT_TOOLITEM_MITHRIL_SWORD);
content_list_add("craftguide",i,1,0); content_list_add("craftguide",i,1,0);
@ -796,9 +796,9 @@ void content_toolitem_init()
f->texture = "tool_flintshears.png"; f->texture = "tool_flintshears.png";
f->description = gettext("Flint Shears"); f->description = gettext("Flint Shears");
f->type = TT_SHEAR; f->type = TT_SHEAR;
f->diginfo.uses = 128; f->diginfo.uses = FLINT_USES;
f->diginfo.time = 1.5; f->diginfo.time = FLINT_TIME;
f->diginfo.level = 2; f->diginfo.level = 1;
crafting::setShearsRecipe(CONTENT_CRAFTITEM_FLINT,CONTENT_TOOLITEM_FLINTSHEARS); crafting::setShearsRecipe(CONTENT_CRAFTITEM_FLINT,CONTENT_TOOLITEM_FLINTSHEARS);
content_list_add("craftguide",i,1,0); content_list_add("craftguide",i,1,0);
content_list_add("creative",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->texture = "tool_copper_shears.png";
f->description = gettext("Copper Shears"); f->description = gettext("Copper Shears");
f->type = TT_SHEAR; f->type = TT_SHEAR;
f->diginfo.uses = 128; f->diginfo.uses = COPPER_USES;
f->diginfo.time = 1.5; f->diginfo.time = COPPER_TIME;
f->diginfo.level = 2; f->diginfo.level = 1;
crafting::setShearsRecipe(CONTENT_CRAFTITEM_COPPER_INGOT,CONTENT_TOOLITEM_COPPER_SHEARS); crafting::setShearsRecipe(CONTENT_CRAFTITEM_COPPER_INGOT,CONTENT_TOOLITEM_COPPER_SHEARS);
content_list_add("craftguide",i,1,0); content_list_add("craftguide",i,1,0);
content_list_add("creative",i,1,0); content_list_add("creative",i,1,0);
@ -822,9 +822,9 @@ void content_toolitem_init()
f->texture = "tool_ironshears.png"; f->texture = "tool_ironshears.png";
f->description = gettext("Iron Shears"); f->description = gettext("Iron Shears");
f->type = TT_SHEAR; f->type = TT_SHEAR;
f->diginfo.uses = 256; f->diginfo.uses = IRON_USES;
f->diginfo.time = 1.0; f->diginfo.time = IRON_TIME;
f->diginfo.level = 2; f->diginfo.level = 1;
crafting::setShearsRecipe(CONTENT_CRAFTITEM_IRON_INGOT,CONTENT_TOOLITEM_IRON_SHEARS); crafting::setShearsRecipe(CONTENT_CRAFTITEM_IRON_INGOT,CONTENT_TOOLITEM_IRON_SHEARS);
content_list_add("craftguide",i,1,0); content_list_add("craftguide",i,1,0);
content_list_add("creative",i,1,0); content_list_add("creative",i,1,0);
@ -839,8 +839,8 @@ void content_toolitem_init()
f->liquids_pointable = true; f->liquids_pointable = true;
f->type = TT_BUCKET; f->type = TT_BUCKET;
f->param_type = CPT_CONTENT; f->param_type = CPT_CONTENT;
f->diginfo.uses = 64; f->diginfo.uses = WOOD_BUCKET_USES;
f->diginfo.time = 1.5; f->diginfo.time = WOOD_BUCKET_TIME;
f->diginfo.level = 1; f->diginfo.level = 1;
f->damaging_nodes_diggable = false; f->damaging_nodes_diggable = false;
crafting::setURecipe(CONTENT_CRAFTITEM_JUNGLE_PLANK,CONTENT_TOOLITEM_WBUCKET); crafting::setURecipe(CONTENT_CRAFTITEM_JUNGLE_PLANK,CONTENT_TOOLITEM_WBUCKET);
@ -857,9 +857,9 @@ void content_toolitem_init()
f->liquids_pointable = true; f->liquids_pointable = true;
f->type = TT_BUCKET; f->type = TT_BUCKET;
f->param_type = CPT_CONTENT; f->param_type = CPT_CONTENT;
f->diginfo.uses = 128; f->diginfo.uses = TIN_BUCKET_USES;
f->diginfo.time = 1.75; f->diginfo.time = TIN_BUCKET_TIME;
f->diginfo.level = 2; f->diginfo.level = 1;
f->damaging_nodes_diggable = false; f->damaging_nodes_diggable = false;
crafting::setURecipe(CONTENT_CRAFTITEM_TIN_INGOT,CONTENT_TOOLITEM_TINBUCKET); crafting::setURecipe(CONTENT_CRAFTITEM_TIN_INGOT,CONTENT_TOOLITEM_TINBUCKET);
content_list_add("craftguide",i,1,0); content_list_add("craftguide",i,1,0);
@ -874,9 +874,9 @@ void content_toolitem_init()
f->liquids_pointable = true; f->liquids_pointable = true;
f->type = TT_BUCKET; f->type = TT_BUCKET;
f->param_type = CPT_CONTENT; f->param_type = CPT_CONTENT;
f->diginfo.uses = 256; f->diginfo.uses = IRON_BUCKET_USES;
f->diginfo.time = 1.0; f->diginfo.time = IRON_BUCKET_TIME;
f->diginfo.level = 3; f->diginfo.level = 1;
crafting::setURecipe(CONTENT_CRAFTITEM_IRON_INGOT,CONTENT_TOOLITEM_IRON_BUCKET); crafting::setURecipe(CONTENT_CRAFTITEM_IRON_INGOT,CONTENT_TOOLITEM_IRON_BUCKET);
content_list_add("craftguide",i,1,0); content_list_add("craftguide",i,1,0);
content_list_add("creative",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->texture = "tool_handle_short.png^tool_head_knife_stone.png";
f->description = gettext("Stone Knife"); f->description = gettext("Stone Knife");
f->type = TT_KNIFE; f->type = TT_KNIFE;
f->diginfo.uses = 32; f->diginfo.uses = STONE_USES;
f->diginfo.time = 3.0; f->diginfo.time = STONE_TIME;
f->diginfo.level = 1; f->diginfo.level = 1;
crafting::setKnifeRecipe(CONTENT_ROCK,CONTENT_TOOLITEM_STONE_KNIFE); crafting::setKnifeRecipe(CONTENT_ROCK,CONTENT_TOOLITEM_STONE_KNIFE);
content_list_add("craftguide",i,1,0); content_list_add("craftguide",i,1,0);
content_list_add("creative",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; i = CONTENT_TOOLITEM_FLINT_KNIFE;
f = &g_content_toolitem_features[i]; f = &g_content_toolitem_features[i];
f->content = i; f->content = i;
f->texture = "tool_handle_short.png^tool_head_knife_flint.png"; f->texture = "tool_handle_short.png^tool_head_knife_flint.png";
f->description = gettext("Flint Knife"); f->description = gettext("Flint Knife");
f->type = TT_KNIFE; f->type = TT_KNIFE;
f->diginfo.uses = 64; f->diginfo.uses = FLINT_USES;
f->diginfo.time = 2.0; f->diginfo.time = FLINT_TIME;
f->diginfo.level = 1; f->diginfo.level = 1;
crafting::setKnifeRecipe(CONTENT_CRAFTITEM_FLINT,CONTENT_TOOLITEM_FLINT_KNIFE); crafting::setKnifeRecipe(CONTENT_CRAFTITEM_FLINT,CONTENT_TOOLITEM_FLINT_KNIFE);
content_list_add("craftguide",i,1,0); content_list_add("craftguide",i,1,0);
content_list_add("creative",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; i = CONTENT_TOOLITEM_BRONZE_KNIFE;
f = &g_content_toolitem_features[i]; f = &g_content_toolitem_features[i];
f->content = i; f->content = i;
f->texture = "tool_handle_short.png^tool_head_knife_bronze.png"; f->texture = "tool_handle_short.png^tool_head_knife_bronze.png";
f->description = gettext("Bronze Knife"); f->description = gettext("Bronze Knife");
f->type = TT_KNIFE; f->type = TT_KNIFE;
f->diginfo.uses = 128; f->diginfo.uses = BRONZE_USES;
f->diginfo.time = 1.5; f->diginfo.time = BRONZE_TIME;
f->diginfo.level = 1; f->diginfo.level = 1;
crafting::setKnifeRecipe(CONTENT_CRAFTITEM_BRONZE_INGOT,CONTENT_TOOLITEM_BRONZE_KNIFE); crafting::setKnifeRecipe(CONTENT_CRAFTITEM_BRONZE_INGOT,CONTENT_TOOLITEM_BRONZE_KNIFE);
content_list_add("craftguide",i,1,0); 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->texture = "tool_handle_short.png^tool_head_knife_iron.png";
f->description = gettext("Iron Knife"); f->description = gettext("Iron Knife");
f->type = TT_KNIFE; f->type = TT_KNIFE;
f->diginfo.uses = 256; f->diginfo.uses = IRON_USES;
f->diginfo.time = 1.0; f->diginfo.time = IRON_TIME;
f->diginfo.level = 1; f->diginfo.level = 1;
crafting::setKnifeRecipe(CONTENT_CRAFTITEM_IRON_INGOT,CONTENT_TOOLITEM_IRON_KNIFE); crafting::setKnifeRecipe(CONTENT_CRAFTITEM_IRON_INGOT,CONTENT_TOOLITEM_IRON_KNIFE);
content_list_add("craftguide",i,1,0); 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->texture = "tool_handle_short.png^tool_head_knife_mithril.png";
f->description = gettext("Unbound Mithril Knife"); f->description = gettext("Unbound Mithril Knife");
f->type = TT_KNIFE; f->type = TT_KNIFE;
f->diginfo.uses = 1024; f->diginfo.uses = U_MITHRIL_USES;
f->diginfo.time = 0.5; f->diginfo.time = U_MITHRIL_TIME;
f->diginfo.level = 1; f->diginfo.level = 1;
crafting::setKnifeRecipe(CONTENT_CRAFTITEM_MITHRIL_UNBOUND,CONTENT_TOOLITEM_MITHRIL_UNBOUND_KNIFE); crafting::setKnifeRecipe(CONTENT_CRAFTITEM_MITHRIL_UNBOUND,CONTENT_TOOLITEM_MITHRIL_UNBOUND_KNIFE);
content_list_add("craftguide",i,1,0); content_list_add("craftguide",i,1,0);
@ -970,8 +970,8 @@ void content_toolitem_init()
f->description = gettext("Mithril Knife"); f->description = gettext("Mithril Knife");
f->type = TT_KNIFE; f->type = TT_KNIFE;
f->param_type = CPT_ENCHANTMENT; f->param_type = CPT_ENCHANTMENT;
f->diginfo.uses = 2048; f->diginfo.uses = E_MITHRIL_USES;
f->diginfo.time = 0.5; f->diginfo.time = E_MITHRIL_TIME;
f->diginfo.level = 1; f->diginfo.level = 1;
crafting::setKnifeRecipe(CONTENT_CRAFTITEM_MITHRIL,CONTENT_TOOLITEM_MITHRIL_KNIFE); crafting::setKnifeRecipe(CONTENT_CRAFTITEM_MITHRIL,CONTENT_TOOLITEM_MITHRIL_KNIFE);
content_list_add("craftguide",i,1,0); content_list_add("craftguide",i,1,0);
@ -986,7 +986,7 @@ void content_toolitem_init()
f->description = gettext("Fire Starter"); f->description = gettext("Fire Starter");
f->liquids_pointable = true; f->liquids_pointable = true;
f->type = TT_SPECIAL; f->type = TT_SPECIAL;
f->diginfo.level = 3; f->diginfo.level = 1;
f->has_fire_effect = true; f->has_fire_effect = true;
crafting::set1Any2Recipe(CONTENT_CRAFTITEM_FLINT,CONTENT_CRAFTITEM_IRON_INGOT,CONTENT_TOOLITEM_FIRESTARTER); crafting::set1Any2Recipe(CONTENT_CRAFTITEM_FLINT,CONTENT_CRAFTITEM_IRON_INGOT,CONTENT_TOOLITEM_FIRESTARTER);
content_list_add("craftguide",i,1,0); content_list_add("craftguide",i,1,0);
@ -998,7 +998,7 @@ void content_toolitem_init()
f->texture = "tool_crowbar.png"; f->texture = "tool_crowbar.png";
f->description = gettext("Crowbar"); f->description = gettext("Crowbar");
f->type = TT_SPECIAL; f->type = TT_SPECIAL;
f->diginfo.level = 3; f->diginfo.level = 1;
f->has_rotate_effect = true; f->has_rotate_effect = true;
crafting::set1over1Recipe(CONTENT_CRAFTITEM_IRON_INGOT,CONTENT_CRAFTITEM_IRON_INGOT,CONTENT_TOOLITEM_CROWBAR); crafting::set1over1Recipe(CONTENT_CRAFTITEM_IRON_INGOT,CONTENT_CRAFTITEM_IRON_INGOT,CONTENT_TOOLITEM_CROWBAR);
content_list_add("craftguide",i,1,0); content_list_add("craftguide",i,1,0);
@ -1010,7 +1010,7 @@ void content_toolitem_init()
f->texture = "tool_key.png"; f->texture = "tool_key.png";
f->description = gettext("Key"); f->description = gettext("Key");
f->type = TT_SPECIAL; f->type = TT_SPECIAL;
f->diginfo.level = 4; f->diginfo.level = 1;
f->has_unlock_effect = true; f->has_unlock_effect = true;
crafting::set1To1Recipe(CONTENT_CRAFTITEM_GOLD_INGOT,CONTENT_TOOLITEM_KEY); crafting::set1To1Recipe(CONTENT_CRAFTITEM_GOLD_INGOT,CONTENT_TOOLITEM_KEY);
content_list_add("craftguide",i,1,0); content_list_add("craftguide",i,1,0);
@ -1022,7 +1022,7 @@ void content_toolitem_init()
f->texture = "tool_mithril_key.png"; f->texture = "tool_mithril_key.png";
f->description = gettext("Mithril Key"); f->description = gettext("Mithril Key");
f->type = TT_SPECIAL; f->type = TT_SPECIAL;
f->diginfo.level = 5; f->diginfo.level = 1;
f->has_unlock_effect = true; f->has_unlock_effect = true;
f->has_super_unlock_effect = true; f->has_super_unlock_effect = true;
/* this can only be crafted by server admin */ /* this can only be crafted by server admin */
@ -1041,7 +1041,7 @@ void content_toolitem_init()
f->texture = "tool_mob_spawner.png"; f->texture = "tool_mob_spawner.png";
f->description = gettext("Mob Spawner"); f->description = gettext("Mob Spawner");
f->type = TT_SPECIAL; f->type = TT_SPECIAL;
f->diginfo.level = 4; f->diginfo.level = 1;
f->param_type = CPT_DROP; f->param_type = CPT_DROP;
{ {
content_t r[9] = { content_t r[9] = {

View File

@ -177,4 +177,56 @@ ToolItemFeatures & content_toolitem_features(std::string subname);
#define CONTENT_TOOLITEM_COPPER_SPEAR (CONTENT_TOOLITEM_MASK | 0x39) #define CONTENT_TOOLITEM_COPPER_SPEAR (CONTENT_TOOLITEM_MASK | 0x39)
#define CONTENT_TOOLITEM_COPPER_SHEARS (CONTENT_TOOLITEM_MASK | 0x3A) #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 #endif

View File

@ -31,164 +31,168 @@ struct MineralFeatures g_mineral_features[MINERAL_MAX+1];
MineralFeatures & mineral_features(u8 i) MineralFeatures & mineral_features(u8 i)
{ {
return g_mineral_features[i]; return g_mineral_features[i];
} }
CraftItem *getDiggedMineralItem(u8 mineral, Player *player, InventoryItem *tool) CraftItem *getDiggedMineralItem(u8 mineral, Player *player, InventoryItem *tool)
{ {
MineralFeatures m = mineral_features(mineral); MineralFeatures m = mineral_features(mineral);
if (m.dug_item == CONTENT_IGNORE) if (m.dug_item == CONTENT_IGNORE)
return NULL; return NULL;
if (content_craftitem_features(m.dug_item)->content == CONTENT_IGNORE) if (content_craftitem_features(m.dug_item)->content == CONTENT_IGNORE)
return NULL; return NULL;
if (!tool && m.min_level > 0) if (!tool && m.min_level > 0)
return NULL; return NULL;
ToolItemFeatures *t = &content_toolitem_features(tool->getContent()); ToolItemFeatures *t = &content_toolitem_features(tool->getContent());
if (t->content == CONTENT_IGNORE && m.min_level > 0) if (t->content == CONTENT_IGNORE && m.min_level > 0)
return NULL; return NULL;
if (t->diginfo.level < m.min_level) if (t->diginfo.level < m.min_level)
return NULL; return NULL;
u16 count = m.dug_count_min; u16 count = m.dug_count_min;
u16 count_max = t->diginfo.level; u16 count_max = t->diginfo.level;
u16 data = tool->getData(); u16 data = tool->getData();
if (data != 0) { if (data != 0) {
EnchantmentInfo info; EnchantmentInfo info;
while (enchantment_get(&data,&info)) { while (enchantment_get(&data,&info)) {
switch (info.type) { switch (info.type) {
case ENCHANTMENT_MORE: // amplius increases the amount given case ENCHANTMENT_MORE: // amplius increases the amount given
count += (info.level+1)/2; count += (info.level+1)/2;
count_max += info.level; count_max += info.level;
break; break;
case ENCHANTMENT_DONTBREAK: // gives no mineral case ENCHANTMENT_DONTBREAK: // gives no mineral
return NULL; return NULL;
break; break;
default:; default:;
} }
} }
} }
if (count_max > count) { if (count_max > count) {
count = myrand_range(m.dug_count_min,count_max); count = myrand_range(m.dug_count_min,count_max);
} }
if (count > m.dug_count_max) if (count > m.dug_count_max)
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() void init_mineral()
{ {
u8 i; u8 i;
MineralFeatures *f = NULL; MineralFeatures *f = NULL;
i = MINERAL_COAL; i = MINERAL_COAL;
f = &mineral_features(i); f = &mineral_features(i);
f->description = gettext("Coal"); f->description = gettext("Coal");
f->texture = "mineral_coal.png"; f->texture = "mineral_coal.png";
f->dug_item = CONTENT_CRAFTITEM_COAL; f->dug_item = CONTENT_CRAFTITEM_COAL;
i = MINERAL_IRON; // Flint from gravel for level 2 tools
f = &mineral_features(i);
f->description = gettext("Iron");
f->texture = "mineral_iron.png";
f->dug_item = CONTENT_CRAFTITEM_IRON;
f->min_level = 2;
i = MINERAL_TIN; i = MINERAL_COPPER;
f = &mineral_features(i); f = &mineral_features(i);
f->description = gettext("Tin"); f->description = gettext("Copper");
f->texture = "mineral_tin.png"; f->texture = "mineral_copper.png";
f->dug_item = CONTENT_CRAFTITEM_TIN; f->dug_item = CONTENT_CRAFTITEM_COPPER;
f->min_level = 2; f->dug_count_max = 4;
f->min_level = 2;
i = MINERAL_COPPER; i = MINERAL_TIN;
f = &mineral_features(i); f = &mineral_features(i);
f->description = gettext("Copper"); f->description = gettext("Tin");
f->texture = "mineral_copper.png"; f->texture = "mineral_tin.png";
f->dug_item = CONTENT_CRAFTITEM_COPPER; f->dug_item = CONTENT_CRAFTITEM_TIN;
f->dug_count_max = 4; f->min_level = 2;
f->min_level = 2;
i = MINERAL_SILVER; // bronze for level 3 tools
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_GOLD; i = MINERAL_IRON;
f = &mineral_features(i); f = &mineral_features(i);
f->description = gettext("Gold"); f->description = gettext("Iron");
f->texture = "mineral_gold.png"; f->texture = "mineral_iron.png";
f->dug_item = CONTENT_CRAFTITEM_GOLD; f->dug_item = CONTENT_CRAFTITEM_IRON;
f->min_level = 3; f->min_level = 3;
i = MINERAL_QUARTZ; i = MINERAL_MITHRIL;
f = &mineral_features(i); f = &mineral_features(i);
f->description = gettext("Quartz"); f->description = gettext("Mithril");
f->texture = "mineral_quartz.png"; f->texture = "mineral_mithril.png";
f->dug_item = CONTENT_CRAFTITEM_QUARTZ; f->dug_item = CONTENT_CRAFTITEM_MITHRIL_RAW;
f->min_level = 3; f->min_level = 4;
i = MINERAL_MITHRIL; i = MINERAL_SALT;
f = &mineral_features(i); f = &mineral_features(i);
f->description = gettext("Mithril"); f->description = gettext("Salt");
f->texture = "mineral_mithril.png"; f->texture = "mineral_salt.png";
f->dug_item = CONTENT_CRAFTITEM_MITHRIL_RAW; f->dug_item = CONTENT_CRAFTITEM_SALT;
f->min_level = 3; f->min_level = 1;
f->dug_count_max = 2;
i = MINERAL_RUBY; i = MINERAL_SILVER;
f = &mineral_features(i); f = &mineral_features(i);
f->description = gettext("Ruby"); f->description = gettext("Silver");
f->texture = "mineral_ruby.png"; f->texture = "mineral_silver.png";
f->dug_item = CONTENT_CRAFTITEM_RUBY; f->dug_item = CONTENT_CRAFTITEM_SILVER;
f->min_level = 3; f->min_level = 3;
f->dug_count_max = 2;
i = MINERAL_TURQUOISE; i = MINERAL_GOLD;
f = &mineral_features(i); f = &mineral_features(i);
f->description = gettext("Turquoise"); f->description = gettext("Gold");
f->texture = "mineral_turquoise.png"; f->texture = "mineral_gold.png";
f->dug_item = CONTENT_CRAFTITEM_TURQUOISE; f->dug_item = CONTENT_CRAFTITEM_GOLD;
f->min_level = 3; f->min_level = 3;
f->dug_count_max = 2;
i = MINERAL_AMETHYST; i = MINERAL_QUARTZ;
f = &mineral_features(i); f = &mineral_features(i);
f->description = gettext("Amethyst"); f->description = gettext("Quartz");
f->texture = "mineral_amethyst.png"; f->texture = "mineral_quartz.png";
f->dug_item = CONTENT_CRAFTITEM_AMETHYST; f->dug_item = CONTENT_CRAFTITEM_QUARTZ;
f->min_level = 3; f->min_level = 3;
f->dug_count_max = 2;
i = MINERAL_SAPPHIRE; i = MINERAL_RUBY;
f = &mineral_features(i); f = &mineral_features(i);
f->description = gettext("Sapphire"); f->description = gettext("Ruby");
f->texture = "mineral_sapphire.png"; f->texture = "mineral_ruby.png";
f->dug_item = CONTENT_CRAFTITEM_SAPPHIRE; f->dug_item = CONTENT_CRAFTITEM_RUBY;
f->min_level = 3; f->min_level = 3;
f->dug_count_max = 2; f->dug_count_max = 2;
i = MINERAL_SUNSTONE; i = MINERAL_TURQUOISE;
f = &mineral_features(i); f = &mineral_features(i);
f->description = gettext("Sunstone"); f->description = gettext("Turquoise");
f->texture = "mineral_sunstone.png"; f->texture = "mineral_turquoise.png";
f->dug_item = CONTENT_CRAFTITEM_SUNSTONE; f->dug_item = CONTENT_CRAFTITEM_TURQUOISE;
f->min_level = 3; f->min_level = 3;
f->dug_count_max = 2; f->dug_count_max = 2;
i = MINERAL_SALT; i = MINERAL_AMETHYST;
f = &mineral_features(i); f = &mineral_features(i);
f->description = gettext("Salt"); f->description = gettext("Amethyst");
f->texture = "mineral_salt.png"; f->texture = "mineral_amethyst.png";
f->dug_item = CONTENT_CRAFTITEM_SALT; f->dug_item = CONTENT_CRAFTITEM_AMETHYST;
f->min_level = 1; f->min_level = 3;
f->dug_count_max = 2; 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;
} }

View File

@ -76,28 +76,39 @@ std::vector<NodeBox> ClockNodeMetadata::getNodeBoxes(MapNode &n) {
v[2] = m/10; v[2] = m/10;
v[3] = 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}; 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++) { for (int i=0; i<4; i++) {
// clock numbers are built from 7 segments
// top
if ((b[v[i]]&0x80)) 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)) 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)) 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)) 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)) 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)) 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)) 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) bool ClockNodeMetadata::step(float dtime, v3s16 pos, ServerEnvironment *env)
{ {

View File

@ -136,8 +136,17 @@ bool CraftGuideNodeMetadata::step(float dtime, v3s16 pos, ServerEnvironment *env
{ {
InventoryList *l = m_inventory->getList("result"); InventoryList *l = m_inventory->getList("result");
InventoryItem *t = l->getItem(0); 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; return false;
}
content_t *r = crafting::getRecipe(t,m_recipe); content_t *r = crafting::getRecipe(t,m_recipe);
if (!r) { if (!r) {
if (m_recipe == 0) if (m_recipe == 0)
@ -468,12 +477,24 @@ void ReverseCraftGuideNodeMetadata::inventoryModified()
} }
bool ReverseCraftGuideNodeMetadata::step(float dtime, v3s16 pos, ServerEnvironment *env) 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 //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 there's no item in the item box, do nothing
if (!item || item->getContent() == CONTENT_IGNORE) if (!item || item->getContent() == CONTENT_IGNORE) {
return false; // 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 //attempt to look up the recipe
crafting::FoundReverseRecipe recipe = crafting::getReverseRecipe(item, m_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"); InventoryList *l = m_inventory->getList("result");
InventoryItem *t = l->getItem(0); 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; return false;
}
InventoryItem *cookresult = t->createCookResult(); InventoryItem *cookresult = t->createCookResult();
if (!cookresult || cookresult->getContent() == CONTENT_IGNORE) if (!cookresult || cookresult->getContent() == CONTENT_IGNORE)
return false; return false;
@ -992,16 +1022,29 @@ bool DeCraftNodeMetadata::step(float dtime, v3s16 pos, ServerEnvironment *env)
{ {
InventoryList *l = m_inventory->getList("result"); InventoryList *l = m_inventory->getList("result");
InventoryItem *t = l->getItem(0); InventoryItem *t = l->getItem(0);
int leave = 0;
if (!t || t->getContent() == CONTENT_IGNORE) if (!t || t->getContent() == CONTENT_IGNORE)
return false; leave=1;
if ((t->getContent()&CONTENT_CRAFTITEM_MASK) == CONTENT_CRAFTITEM_MASK) else if ((t->getContent()&CONTENT_CRAFTITEM_MASK) == CONTENT_CRAFTITEM_MASK)
return false; leave=1;
if ((t->getContent()&CONTENT_TOOLITEM_MASK) == CONTENT_TOOLITEM_MASK) else if ((t->getContent()&CONTENT_TOOLITEM_MASK) == CONTENT_TOOLITEM_MASK)
return false; leave=1;
if ((t->getContent()&CONTENT_CLOTHESITEM_MASK) == CONTENT_CLOTHESITEM_MASK) else if ((t->getContent()&CONTENT_CLOTHESITEM_MASK) == CONTENT_CLOTHESITEM_MASK)
return false; leave=1;
if (content_features(t->getContent()).dug_item == "" && content_features(t->getContent()).extra_dug_item == "") else if (content_features(t->getContent()).dug_item == "" && content_features(t->getContent()).extra_dug_item == "")
return false; 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 = m_inventory->getList("recipe");
l->clearItems(); l->clearItems();
if (content_features(t->getContent()).dug_item != "") { if (content_features(t->getContent()).dug_item != "") {

View File

@ -127,7 +127,7 @@ std::vector<NodeBox> BookShelfNodeMetadata::getNodeBoxes(MapNode &n)
)); ));
} }
return transformNodeBox(n,boxes); return boxes;
} }
/* /*