forked from Mirrorlandia_minetest/minetest
Remove burn time definitions from FurnaceNodeMetadata
This commit is contained in:
parent
7fae32095a
commit
6a417c538f
@ -254,6 +254,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
|
|||||||
f->is_ground_content = true;
|
f->is_ground_content = true;
|
||||||
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
||||||
f->cookresult_item = "CraftItem lump_of_coal 1";
|
f->cookresult_item = "CraftItem lump_of_coal 1";
|
||||||
|
f->furnace_burntime = 30;
|
||||||
setWoodLikeMaterialProperties(f->material, 1.0);
|
setWoodLikeMaterialProperties(f->material, 1.0);
|
||||||
|
|
||||||
i = CONTENT_JUNGLETREE;
|
i = CONTENT_JUNGLETREE;
|
||||||
@ -263,6 +264,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
|
|||||||
f->setTexture(1, "jungletree_top.png");
|
f->setTexture(1, "jungletree_top.png");
|
||||||
f->param_type = CPT_MINERAL;
|
f->param_type = CPT_MINERAL;
|
||||||
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
||||||
|
f->furnace_burntime = 30;
|
||||||
setWoodLikeMaterialProperties(f->material, 1.0);
|
setWoodLikeMaterialProperties(f->material, 1.0);
|
||||||
|
|
||||||
i = CONTENT_JUNGLEGRASS;
|
i = CONTENT_JUNGLEGRASS;
|
||||||
@ -277,6 +279,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
|
|||||||
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
||||||
f->walkable = false;
|
f->walkable = false;
|
||||||
setLeavesLikeMaterialProperties(f->material, 1.0);
|
setLeavesLikeMaterialProperties(f->material, 1.0);
|
||||||
|
f->furnace_burntime = 2;
|
||||||
|
|
||||||
i = CONTENT_LEAVES;
|
i = CONTENT_LEAVES;
|
||||||
f = nodemgr->getModifiable(i);
|
f = nodemgr->getModifiable(i);
|
||||||
@ -289,6 +292,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
|
|||||||
f->extra_dug_item_rarity = 20;
|
f->extra_dug_item_rarity = 20;
|
||||||
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
||||||
setLeavesLikeMaterialProperties(f->material, 1.0);
|
setLeavesLikeMaterialProperties(f->material, 1.0);
|
||||||
|
f->furnace_burntime = 1.0;
|
||||||
|
|
||||||
i = CONTENT_CACTUS;
|
i = CONTENT_CACTUS;
|
||||||
f = nodemgr->getModifiable(i);
|
f = nodemgr->getModifiable(i);
|
||||||
@ -300,6 +304,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
|
|||||||
f->is_ground_content = true;
|
f->is_ground_content = true;
|
||||||
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
||||||
setWoodLikeMaterialProperties(f->material, 0.75);
|
setWoodLikeMaterialProperties(f->material, 0.75);
|
||||||
|
f->furnace_burntime = 15;
|
||||||
|
|
||||||
i = CONTENT_PAPYRUS;
|
i = CONTENT_PAPYRUS;
|
||||||
f = nodemgr->getModifiable(i);
|
f = nodemgr->getModifiable(i);
|
||||||
@ -312,6 +317,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
|
|||||||
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
||||||
f->walkable = false;
|
f->walkable = false;
|
||||||
setLeavesLikeMaterialProperties(f->material, 0.5);
|
setLeavesLikeMaterialProperties(f->material, 0.5);
|
||||||
|
f->furnace_burntime = 1;
|
||||||
|
|
||||||
i = CONTENT_BOOKSHELF;
|
i = CONTENT_BOOKSHELF;
|
||||||
f = nodemgr->getModifiable(i);
|
f = nodemgr->getModifiable(i);
|
||||||
@ -324,6 +330,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
|
|||||||
f->param_type = CPT_MINERAL;
|
f->param_type = CPT_MINERAL;
|
||||||
f->is_ground_content = true;
|
f->is_ground_content = true;
|
||||||
setWoodLikeMaterialProperties(f->material, 0.75);
|
setWoodLikeMaterialProperties(f->material, 0.75);
|
||||||
|
f->furnace_burntime = 30;
|
||||||
|
|
||||||
i = CONTENT_GLASS;
|
i = CONTENT_GLASS;
|
||||||
f = nodemgr->getModifiable(i);
|
f = nodemgr->getModifiable(i);
|
||||||
@ -350,6 +357,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
|
|||||||
f->selection_box.type = NODEBOX_FIXED;
|
f->selection_box.type = NODEBOX_FIXED;
|
||||||
f->selection_box.fixed = core::aabbox3d<f32>(
|
f->selection_box.fixed = core::aabbox3d<f32>(
|
||||||
-BS/7, -BS/2, -BS/7, BS/7, BS/2, BS/7);
|
-BS/7, -BS/2, -BS/7, BS/7, BS/2, BS/7);
|
||||||
|
f->furnace_burntime = 30/2;
|
||||||
setWoodLikeMaterialProperties(f->material, 0.75);
|
setWoodLikeMaterialProperties(f->material, 0.75);
|
||||||
|
|
||||||
i = CONTENT_RAIL;
|
i = CONTENT_RAIL;
|
||||||
@ -367,6 +375,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
|
|||||||
f->air_equivalent = true; // grass grows underneath
|
f->air_equivalent = true; // grass grows underneath
|
||||||
f->walkable = false;
|
f->walkable = false;
|
||||||
f->selection_box.type = NODEBOX_FIXED;
|
f->selection_box.type = NODEBOX_FIXED;
|
||||||
|
f->furnace_burntime = 5;
|
||||||
setDirtLikeMaterialProperties(f->material, 0.75);
|
setDirtLikeMaterialProperties(f->material, 0.75);
|
||||||
|
|
||||||
i = CONTENT_LADDER;
|
i = CONTENT_LADDER;
|
||||||
@ -383,6 +392,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
|
|||||||
f->walkable = false;
|
f->walkable = false;
|
||||||
f->climbable = true;
|
f->climbable = true;
|
||||||
f->selection_box.type = NODEBOX_WALLMOUNTED;
|
f->selection_box.type = NODEBOX_WALLMOUNTED;
|
||||||
|
f->furnace_burntime = 5;
|
||||||
setWoodLikeMaterialProperties(f->material, 0.5);
|
setWoodLikeMaterialProperties(f->material, 0.5);
|
||||||
|
|
||||||
// Deprecated
|
// Deprecated
|
||||||
@ -398,6 +408,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
|
|||||||
f->setInventoryTextureCube("wood.png", "wood.png", "wood.png");
|
f->setInventoryTextureCube("wood.png", "wood.png", "wood.png");
|
||||||
f->is_ground_content = true;
|
f->is_ground_content = true;
|
||||||
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
||||||
|
f->furnace_burntime = 30/4;
|
||||||
setWoodLikeMaterialProperties(f->material, 0.75);
|
setWoodLikeMaterialProperties(f->material, 0.75);
|
||||||
|
|
||||||
i = CONTENT_MESE;
|
i = CONTENT_MESE;
|
||||||
@ -406,6 +417,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
|
|||||||
f->setInventoryTextureCube("mese.png", "mese.png", "mese.png");
|
f->setInventoryTextureCube("mese.png", "mese.png", "mese.png");
|
||||||
f->is_ground_content = true;
|
f->is_ground_content = true;
|
||||||
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
||||||
|
f->furnace_burntime = 30;
|
||||||
setStoneLikeMaterialProperties(f->material, 0.5);
|
setStoneLikeMaterialProperties(f->material, 0.5);
|
||||||
|
|
||||||
i = CONTENT_CLOUD;
|
i = CONTENT_CLOUD;
|
||||||
@ -509,6 +521,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
|
|||||||
f->post_effect_color = video::SColor(192, 255, 64, 0);
|
f->post_effect_color = video::SColor(192, 255, 64, 0);
|
||||||
// New-style lava source material (mostly unused)
|
// New-style lava source material (mostly unused)
|
||||||
f->setSpecialMaterial(0, MaterialSpec("lava.png", false));
|
f->setSpecialMaterial(0, MaterialSpec("lava.png", false));
|
||||||
|
f->furnace_burntime = 60;
|
||||||
|
|
||||||
i = CONTENT_TORCH;
|
i = CONTENT_TORCH;
|
||||||
f = nodemgr->getModifiable(i);
|
f = nodemgr->getModifiable(i);
|
||||||
@ -533,6 +546,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
|
|||||||
f->selection_box.wall_side = core::aabbox3d<f32>(
|
f->selection_box.wall_side = core::aabbox3d<f32>(
|
||||||
-BS/2, -BS/3.333, -BS/10, -BS/2+BS/3.333, BS/3.333, BS/10);
|
-BS/2, -BS/3.333, -BS/10, -BS/2+BS/3.333, BS/3.333, BS/10);
|
||||||
setConstantMaterialProperties(f->material, 0.0);
|
setConstantMaterialProperties(f->material, 0.0);
|
||||||
|
f->furnace_burntime = 4;
|
||||||
|
|
||||||
i = CONTENT_SIGN_WALL;
|
i = CONTENT_SIGN_WALL;
|
||||||
f = nodemgr->getModifiable(i);
|
f = nodemgr->getModifiable(i);
|
||||||
@ -550,6 +564,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
|
|||||||
f->initial_metadata = new SignNodeMetadata(NULL, "Some sign");
|
f->initial_metadata = new SignNodeMetadata(NULL, "Some sign");
|
||||||
setConstantMaterialProperties(f->material, 0.5);
|
setConstantMaterialProperties(f->material, 0.5);
|
||||||
f->selection_box.type = NODEBOX_WALLMOUNTED;
|
f->selection_box.type = NODEBOX_WALLMOUNTED;
|
||||||
|
f->furnace_burntime = 10;
|
||||||
|
|
||||||
i = CONTENT_CHEST;
|
i = CONTENT_CHEST;
|
||||||
f = nodemgr->getModifiable(i);
|
f = nodemgr->getModifiable(i);
|
||||||
@ -564,6 +579,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
|
|||||||
if(f->initial_metadata == NULL)
|
if(f->initial_metadata == NULL)
|
||||||
f->initial_metadata = new ChestNodeMetadata(NULL);
|
f->initial_metadata = new ChestNodeMetadata(NULL);
|
||||||
setWoodLikeMaterialProperties(f->material, 1.0);
|
setWoodLikeMaterialProperties(f->material, 1.0);
|
||||||
|
f->furnace_burntime = 30;
|
||||||
|
|
||||||
i = CONTENT_LOCKABLE_CHEST;
|
i = CONTENT_LOCKABLE_CHEST;
|
||||||
f = nodemgr->getModifiable(i);
|
f = nodemgr->getModifiable(i);
|
||||||
@ -578,6 +594,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
|
|||||||
if(f->initial_metadata == NULL)
|
if(f->initial_metadata == NULL)
|
||||||
f->initial_metadata = new LockingChestNodeMetadata(NULL);
|
f->initial_metadata = new LockingChestNodeMetadata(NULL);
|
||||||
setWoodLikeMaterialProperties(f->material, 1.0);
|
setWoodLikeMaterialProperties(f->material, 1.0);
|
||||||
|
f->furnace_burntime = 30;
|
||||||
|
|
||||||
i = CONTENT_FURNACE;
|
i = CONTENT_FURNACE;
|
||||||
f = nodemgr->getModifiable(i);
|
f = nodemgr->getModifiable(i);
|
||||||
@ -629,6 +646,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
|
|||||||
f->setInventoryTexture("nc_front.png");
|
f->setInventoryTexture("nc_front.png");
|
||||||
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
||||||
setStoneLikeMaterialProperties(f->material, 3.0);
|
setStoneLikeMaterialProperties(f->material, 3.0);
|
||||||
|
f->furnace_burntime = 1;
|
||||||
|
|
||||||
i = CONTENT_NC_RB;
|
i = CONTENT_NC_RB;
|
||||||
f = nodemgr->getModifiable(i);
|
f = nodemgr->getModifiable(i);
|
||||||
@ -636,6 +654,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
|
|||||||
f->setInventoryTexture("nc_rb.png");
|
f->setInventoryTexture("nc_rb.png");
|
||||||
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
||||||
setStoneLikeMaterialProperties(f->material, 3.0);
|
setStoneLikeMaterialProperties(f->material, 3.0);
|
||||||
|
f->furnace_burntime = 1;
|
||||||
|
|
||||||
i = CONTENT_SAPLING;
|
i = CONTENT_SAPLING;
|
||||||
f = nodemgr->getModifiable(i);
|
f = nodemgr->getModifiable(i);
|
||||||
@ -649,6 +668,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
|
|||||||
f->air_equivalent = false;
|
f->air_equivalent = false;
|
||||||
f->walkable = false;
|
f->walkable = false;
|
||||||
setConstantMaterialProperties(f->material, 0.0);
|
setConstantMaterialProperties(f->material, 0.0);
|
||||||
|
f->furnace_burntime = 10;
|
||||||
|
|
||||||
i = CONTENT_APPLE;
|
i = CONTENT_APPLE;
|
||||||
f = nodemgr->getModifiable(i);
|
f = nodemgr->getModifiable(i);
|
||||||
@ -663,6 +683,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
|
|||||||
f->air_equivalent = true;
|
f->air_equivalent = true;
|
||||||
f->dug_item = std::string("CraftItem apple 1");
|
f->dug_item = std::string("CraftItem apple 1");
|
||||||
setConstantMaterialProperties(f->material, 0.0);
|
setConstantMaterialProperties(f->material, 0.0);
|
||||||
|
f->furnace_burntime = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -326,7 +326,7 @@ bool FurnaceNodeMetadata::step(float dtime)
|
|||||||
// accomodate any result item
|
// accomodate any result item
|
||||||
if(room_available)
|
if(room_available)
|
||||||
{
|
{
|
||||||
m_src_totaltime = 3;
|
m_src_totaltime = src_item->getCookTime();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -381,85 +381,12 @@ bool FurnaceNodeMetadata::step(float dtime)
|
|||||||
assert(fuel_list);
|
assert(fuel_list);
|
||||||
const InventoryItem *fuel_item = fuel_list->getItem(0);
|
const InventoryItem *fuel_item = fuel_list->getItem(0);
|
||||||
|
|
||||||
if(ItemSpec(ITEM_MATERIAL, CONTENT_TREE).checkItem(fuel_item))
|
if(fuel_item && fuel_item->getBurnTime() >= 0){
|
||||||
{
|
m_fuel_totaltime = fuel_item->getBurnTime();
|
||||||
m_fuel_totaltime = 30;
|
|
||||||
m_fuel_time = 0;
|
m_fuel_time = 0;
|
||||||
fuel_list->decrementMaterials(1);
|
fuel_list->decrementMaterials(1);
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
} else {
|
||||||
else if(ItemSpec(ITEM_MATERIAL, CONTENT_JUNGLETREE).checkItem(fuel_item))
|
|
||||||
{
|
|
||||||
m_fuel_totaltime = 30;
|
|
||||||
m_fuel_time = 0;
|
|
||||||
fuel_list->decrementMaterials(1);
|
|
||||||
changed = true;
|
|
||||||
}
|
|
||||||
else if(ItemSpec(ITEM_MATERIAL, CONTENT_FENCE).checkItem(fuel_item))
|
|
||||||
{
|
|
||||||
m_fuel_totaltime = 30/2;
|
|
||||||
m_fuel_time = 0;
|
|
||||||
fuel_list->decrementMaterials(1);
|
|
||||||
changed = true;
|
|
||||||
}
|
|
||||||
else if(ItemSpec(ITEM_MATERIAL, CONTENT_WOOD).checkItem(fuel_item))
|
|
||||||
{
|
|
||||||
m_fuel_totaltime = 30/4;
|
|
||||||
m_fuel_time = 0;
|
|
||||||
fuel_list->decrementMaterials(1);
|
|
||||||
changed = true;
|
|
||||||
}
|
|
||||||
else if(ItemSpec(ITEM_MATERIAL, CONTENT_BOOKSHELF).checkItem(fuel_item))
|
|
||||||
{
|
|
||||||
m_fuel_totaltime = 30/4;
|
|
||||||
m_fuel_time = 0;
|
|
||||||
fuel_list->decrementMaterials(1);
|
|
||||||
changed = true;
|
|
||||||
}
|
|
||||||
else if(ItemSpec(ITEM_MATERIAL, CONTENT_LEAVES).checkItem(fuel_item))
|
|
||||||
{
|
|
||||||
m_fuel_totaltime = 30/16;
|
|
||||||
m_fuel_time = 0;
|
|
||||||
fuel_list->decrementMaterials(1);
|
|
||||||
changed = true;
|
|
||||||
}
|
|
||||||
else if(ItemSpec(ITEM_MATERIAL, CONTENT_PAPYRUS).checkItem(fuel_item))
|
|
||||||
{
|
|
||||||
m_fuel_totaltime = 30/32;
|
|
||||||
m_fuel_time = 0;
|
|
||||||
fuel_list->decrementMaterials(1);
|
|
||||||
changed = true;
|
|
||||||
}
|
|
||||||
else if(ItemSpec(ITEM_MATERIAL, CONTENT_JUNGLEGRASS).checkItem(fuel_item))
|
|
||||||
{
|
|
||||||
m_fuel_totaltime = 30/32;
|
|
||||||
m_fuel_time = 0;
|
|
||||||
fuel_list->decrementMaterials(1);
|
|
||||||
changed = true;
|
|
||||||
}
|
|
||||||
else if(ItemSpec(ITEM_MATERIAL, CONTENT_CACTUS).checkItem(fuel_item))
|
|
||||||
{
|
|
||||||
m_fuel_totaltime = 30/4;
|
|
||||||
m_fuel_time = 0;
|
|
||||||
fuel_list->decrementMaterials(1);
|
|
||||||
changed = true;
|
|
||||||
}
|
|
||||||
else if(ItemSpec(ITEM_CRAFT, "Stick").checkItem(fuel_item))
|
|
||||||
{
|
|
||||||
m_fuel_totaltime = 30/4/4;
|
|
||||||
m_fuel_time = 0;
|
|
||||||
fuel_list->decrementMaterials(1);
|
|
||||||
changed = true;
|
|
||||||
}
|
|
||||||
else if(ItemSpec(ITEM_CRAFT, "lump_of_coal").checkItem(fuel_item))
|
|
||||||
{
|
|
||||||
m_fuel_totaltime = 40;
|
|
||||||
m_fuel_time = 0;
|
|
||||||
fuel_list->decrementMaterials(1);
|
|
||||||
changed = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//infostream<<"No fuel found"<<std::endl;
|
//infostream<<"No fuel found"<<std::endl;
|
||||||
// No fuel, stop loop.
|
// No fuel, stop loop.
|
||||||
m_step_accumulator = 0;
|
m_step_accumulator = 0;
|
||||||
|
@ -171,6 +171,20 @@ InventoryItem *MaterialItem::createCookResult() const
|
|||||||
return InventoryItem::deSerialize(is, m_gamedef);
|
return InventoryItem::deSerialize(is, m_gamedef);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float MaterialItem::getCookTime() const
|
||||||
|
{
|
||||||
|
INodeDefManager *ndef = m_gamedef->ndef();
|
||||||
|
const ContentFeatures &f = ndef->get(m_content);
|
||||||
|
return f.furnace_cooktime;
|
||||||
|
}
|
||||||
|
|
||||||
|
float MaterialItem::getBurnTime() const
|
||||||
|
{
|
||||||
|
INodeDefManager *ndef = m_gamedef->ndef();
|
||||||
|
const ContentFeatures &f = ndef->get(m_content);
|
||||||
|
return f.furnace_burntime;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
ToolItem
|
ToolItem
|
||||||
*/
|
*/
|
||||||
@ -258,6 +272,18 @@ InventoryItem *CraftItem::createCookResult() const
|
|||||||
return item_craft_create_cook_result(m_subname, m_gamedef);
|
return item_craft_create_cook_result(m_subname, m_gamedef);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float CraftItem::getCookTime() const
|
||||||
|
{
|
||||||
|
return 3.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
float CraftItem::getBurnTime() const
|
||||||
|
{
|
||||||
|
if(m_subname == "lump_of_coal")
|
||||||
|
return 40;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
bool CraftItem::use(ServerEnvironment *env, ServerActiveObject *user)
|
bool CraftItem::use(ServerEnvironment *env, ServerActiveObject *user)
|
||||||
{
|
{
|
||||||
if(!item_craft_is_eatable(m_subname, m_gamedef))
|
if(!item_craft_is_eatable(m_subname, m_gamedef))
|
||||||
|
@ -106,10 +106,12 @@ public:
|
|||||||
|
|
||||||
// Whether it can be cooked
|
// Whether it can be cooked
|
||||||
virtual bool isCookable() const {return false;}
|
virtual bool isCookable() const {return false;}
|
||||||
// Time of cooking
|
|
||||||
virtual float getCookTime(){return 3.0;}
|
|
||||||
// Result of cooking (can randomize)
|
// Result of cooking (can randomize)
|
||||||
virtual InventoryItem *createCookResult() const {return NULL;}
|
virtual InventoryItem *createCookResult() const {return NULL;}
|
||||||
|
// Time of cooking
|
||||||
|
virtual float getCookTime() const {return 3.0;}
|
||||||
|
// Whether it can be burned (<0 = cannot be burned)
|
||||||
|
virtual float getBurnTime() const {return -1;}
|
||||||
|
|
||||||
// Eat, press, activate, whatever.
|
// Eat, press, activate, whatever.
|
||||||
// Called when item is right-clicked when lying on ground.
|
// Called when item is right-clicked when lying on ground.
|
||||||
@ -180,6 +182,8 @@ public:
|
|||||||
*/
|
*/
|
||||||
bool isCookable() const;
|
bool isCookable() const;
|
||||||
InventoryItem *createCookResult() const;
|
InventoryItem *createCookResult() const;
|
||||||
|
float getCookTime() const;
|
||||||
|
float getBurnTime() const;
|
||||||
/*
|
/*
|
||||||
Special methods
|
Special methods
|
||||||
*/
|
*/
|
||||||
@ -258,6 +262,8 @@ public:
|
|||||||
|
|
||||||
bool isCookable() const;
|
bool isCookable() const;
|
||||||
InventoryItem *createCookResult() const;
|
InventoryItem *createCookResult() const;
|
||||||
|
float getCookTime() const;
|
||||||
|
float getBurnTime() const;
|
||||||
|
|
||||||
bool use(ServerEnvironment *env, ServerActiveObject *user);
|
bool use(ServerEnvironment *env, ServerActiveObject *user);
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@ void MaterialProperties::serialize(std::ostream &os)
|
|||||||
writeF1000(os, crackiness);
|
writeF1000(os, crackiness);
|
||||||
writeF1000(os, crumbliness);
|
writeF1000(os, crumbliness);
|
||||||
writeF1000(os, cuttability);
|
writeF1000(os, cuttability);
|
||||||
|
writeF1000(os, flammability);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaterialProperties::deSerialize(std::istream &is)
|
void MaterialProperties::deSerialize(std::istream &is)
|
||||||
@ -45,6 +46,7 @@ void MaterialProperties::deSerialize(std::istream &is)
|
|||||||
crackiness = readF1000(is);
|
crackiness = readF1000(is);
|
||||||
crumbliness = readF1000(is);
|
crumbliness = readF1000(is);
|
||||||
cuttability = readF1000(is);
|
cuttability = readF1000(is);
|
||||||
|
flammability = readF1000(is);
|
||||||
}
|
}
|
||||||
|
|
||||||
DiggingProperties getDiggingProperties(u16 content, ToolDiggingProperties *tp,
|
DiggingProperties getDiggingProperties(u16 content, ToolDiggingProperties *tp,
|
||||||
|
@ -56,15 +56,16 @@ struct MaterialProperties
|
|||||||
// Sword is best for cuttable light stuff.
|
// Sword is best for cuttable light stuff.
|
||||||
float cuttability;
|
float cuttability;
|
||||||
// If high, ignites easily
|
// If high, ignites easily
|
||||||
//float flammability;
|
float flammability;
|
||||||
|
|
||||||
MaterialProperties():
|
MaterialProperties():
|
||||||
diggability(DIGGABLE_NOT),
|
diggability(DIGGABLE_NOT),
|
||||||
constant_time(0.5),
|
constant_time(0.5),
|
||||||
weight(1),
|
weight(0),
|
||||||
crackiness(1),
|
crackiness(0),
|
||||||
crumbliness(1),
|
crumbliness(0),
|
||||||
cuttability(1)
|
cuttability(0),
|
||||||
|
flammability(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void serialize(std::ostream &os);
|
void serialize(std::ostream &os);
|
||||||
|
@ -151,7 +151,9 @@ void ContentFeatures::reset()
|
|||||||
damage_per_second = 0;
|
damage_per_second = 0;
|
||||||
selection_box = NodeBox();
|
selection_box = NodeBox();
|
||||||
material = MaterialProperties();
|
material = MaterialProperties();
|
||||||
cookresult_item = "";
|
cookresult_item = ""; // Cannot be cooked
|
||||||
|
furnace_cooktime = 3.0;
|
||||||
|
furnace_burntime = -1.0; // Cannot be burned
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContentFeatures::serialize(std::ostream &os)
|
void ContentFeatures::serialize(std::ostream &os)
|
||||||
@ -202,6 +204,8 @@ void ContentFeatures::serialize(std::ostream &os)
|
|||||||
selection_box.serialize(os);
|
selection_box.serialize(os);
|
||||||
material.serialize(os);
|
material.serialize(os);
|
||||||
os<<serializeString(cookresult_item);
|
os<<serializeString(cookresult_item);
|
||||||
|
writeF1000(os, furnace_cooktime);
|
||||||
|
writeF1000(os, furnace_burntime);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContentFeatures::deSerialize(std::istream &is, IGameDef *gamedef)
|
void ContentFeatures::deSerialize(std::istream &is, IGameDef *gamedef)
|
||||||
@ -255,6 +259,8 @@ void ContentFeatures::deSerialize(std::istream &is, IGameDef *gamedef)
|
|||||||
selection_box.deSerialize(is);
|
selection_box.deSerialize(is);
|
||||||
material.deSerialize(is);
|
material.deSerialize(is);
|
||||||
cookresult_item = deSerializeString(is);
|
cookresult_item = deSerializeString(is);
|
||||||
|
furnace_cooktime = readF1000(is);
|
||||||
|
furnace_burntime = readF1000(is);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContentFeatures::setTexture(u16 i, std::string name)
|
void ContentFeatures::setTexture(u16 i, std::string name)
|
||||||
|
@ -207,6 +207,8 @@ struct ContentFeatures
|
|||||||
NodeBox selection_box;
|
NodeBox selection_box;
|
||||||
MaterialProperties material;
|
MaterialProperties material;
|
||||||
std::string cookresult_item;
|
std::string cookresult_item;
|
||||||
|
float furnace_cooktime;
|
||||||
|
float furnace_burntime;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Methods
|
Methods
|
||||||
|
@ -40,7 +40,8 @@ extern "C" {
|
|||||||
/*
|
/*
|
||||||
TODO:
|
TODO:
|
||||||
- Node definition
|
- Node definition
|
||||||
- Random node triggers
|
- Random node triggers (like grass growth)
|
||||||
|
- Deterministic node triggers (like falling sand)
|
||||||
- Object visual client-side stuff
|
- Object visual client-side stuff
|
||||||
- Blink effect
|
- Blink effect
|
||||||
- Spritesheets and animation
|
- Spritesheets and animation
|
||||||
@ -52,7 +53,7 @@ TODO:
|
|||||||
blockdef.on_inventory_modified
|
blockdef.on_inventory_modified
|
||||||
meta.set("owner", playername)
|
meta.set("owner", playername)
|
||||||
meta.get("owner")
|
meta.get("owner")
|
||||||
- Item definition
|
- Item definition (actually, only CraftItem)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void stackDump(lua_State *L, std::ostream &o)
|
static void stackDump(lua_State *L, std::ostream &o)
|
||||||
|
Loading…
Reference in New Issue
Block a user