forked from oerkki/voxelands
some fertilizer changes
This commit is contained in:
parent
61c83c5bee
commit
a4dcf9e776
Binary file not shown.
After Width: | Height: | Size: 385 B |
|
@ -662,6 +662,7 @@ void content_craftitem_init()
|
|||
f->name = "mese_dust";
|
||||
f->description = wgettext("Mese Dust");
|
||||
f->drop_count = 1;
|
||||
f->drop_item = CONTENT_CIRCUIT_MESEWIRE;
|
||||
crafting::set1To2Recipe(CONTENT_MESE,CONTENT_CRAFTITEM_MESEDUST);
|
||||
lists::add("craftguide",i);
|
||||
lists::add("creative",i);
|
||||
|
@ -1107,4 +1108,17 @@ void content_craftitem_init()
|
|||
crafting::set1over4Recipe(CONTENT_CRAFTITEM_STEEL_INGOT,CONTENT_CRAFTITEM_STICK,CONTENT_CRAFTITEM_ARROW);
|
||||
lists::add("craftguide",i);
|
||||
lists::add("creative",i);
|
||||
|
||||
i = CONTENT_CRAFTITEM_FERTILIZER;
|
||||
f = &g_content_craftitem_features[i];
|
||||
f->content = CONTENT_CRAFTITEM_FERTILIZER;
|
||||
f->texture = "fertilizer_item.png";
|
||||
f->name = "fertilizer";
|
||||
f->description = wgettext("Fertilizer");
|
||||
f->drop_count = 1;
|
||||
f->drop_item = CONTENT_FERTILIZER;
|
||||
crafting::set2Any2Recipe(CONTENT_CRAFTITEM_MUSH,CONTENT_CRAFTITEM_ASH,CONTENT_CRAFTITEM_FERTILIZER);
|
||||
lists::add("craftguide",i);
|
||||
lists::add("creative",i);
|
||||
|
||||
}
|
||||
|
|
|
@ -170,5 +170,6 @@ CraftItemFeatures & content_craftitem_features(std::string subname);
|
|||
#define CONTENT_CRAFTITEM_LEATHER_YELLOW (CONTENT_CRAFTITEM_MASK | 0x69)
|
||||
#define CONTENT_CRAFTITEM_LEATHER_BLACK (CONTENT_CRAFTITEM_MASK | 0x6A)
|
||||
#define CONTENT_CRAFTITEM_ARROW (CONTENT_CRAFTITEM_MASK | 0x6B)
|
||||
#define CONTENT_CRAFTITEM_FERTILIZER (CONTENT_CRAFTITEM_MASK | 0x6C)
|
||||
|
||||
#endif
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "content_nodebox.h"
|
||||
#include "content_list.h"
|
||||
#include "content_craft.h"
|
||||
#include "content_craftitem.h"
|
||||
#include "content_nodemeta.h"
|
||||
#include "settings.h"
|
||||
#include "gettext.h"
|
||||
|
@ -54,16 +55,13 @@ void content_mapnode_farm(bool repeat)
|
|||
f->light_propagates = true;
|
||||
f->sunlight_propagates = true;
|
||||
f->solidness = 0; // drawn separately, makes no faces
|
||||
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
||||
f->dug_item = std::string("CraftItem2 ")+itos(CONTENT_CRAFTITEM_FERTILIZER)+" 1";
|
||||
content_nodebox_carpet(f);
|
||||
f->setInventoryTextureNodeBox(i,"fertilizer.png", "fertilizer.png", "fertilizer.png");
|
||||
f->type = CMT_DIRT;
|
||||
f->hardness = 0.4;
|
||||
f->pressure_type = CST_CRUSHABLE;
|
||||
f->suffocation_per_second = 0;
|
||||
crafting::set2Any2Recipe(CONTENT_CRAFTITEM_MUSH,CONTENT_CRAFTITEM_ASH,CONTENT_FERTILIZER);
|
||||
lists::add("craftguide",i);
|
||||
lists::add("creative",i);
|
||||
|
||||
i = CONTENT_TRELLIS;
|
||||
f = &content_features(i);
|
||||
|
|
|
@ -626,6 +626,8 @@ void content_mapnode_plants(bool repeat)
|
|||
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
|
||||
f->fuel_time = 30/4;
|
||||
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
||||
f->extra_dug_item = std::string("CraftItem2 ") + itos (CONTENT_CRAFTITEM_MUSH) + " 1";
|
||||
f->extra_dug_item_rarity = 10;
|
||||
f->setNodeBox(core::aabbox3d<f32>(
|
||||
-0.4375*BS,
|
||||
-0.5*BS,
|
||||
|
@ -709,9 +711,10 @@ void content_mapnode_plants(bool repeat)
|
|||
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
|
||||
f->fuel_time = 1;
|
||||
f->type = CMT_WOOD;
|
||||
f->hardness = 0.0;
|
||||
f->hardness = 0.1;
|
||||
f->pressure_type = CST_CRUSHABLE;
|
||||
f->suffocation_per_second = 0;
|
||||
f->fertilizer_affects = true;
|
||||
lists::add("creative",i);
|
||||
|
||||
i = CONTENT_APPLE_SAPLING;
|
||||
|
@ -730,9 +733,10 @@ void content_mapnode_plants(bool repeat)
|
|||
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
|
||||
f->fuel_time = 1;
|
||||
f->type = CMT_WOOD;
|
||||
f->hardness = 0.0;
|
||||
f->hardness = 0.1;
|
||||
f->pressure_type = CST_CRUSHABLE;
|
||||
f->suffocation_per_second = 0;
|
||||
f->fertilizer_affects = true;
|
||||
lists::add("creative",i);
|
||||
|
||||
i = CONTENT_JUNGLESAPLING;
|
||||
|
@ -751,9 +755,10 @@ void content_mapnode_plants(bool repeat)
|
|||
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
|
||||
f->fuel_time = 1;
|
||||
f->type = CMT_WOOD;
|
||||
f->hardness = 0.0;
|
||||
f->hardness = 0.1;
|
||||
f->pressure_type = CST_CRUSHABLE;
|
||||
f->suffocation_per_second = 0;
|
||||
f->fertilizer_affects = true;
|
||||
lists::add("creative",i);
|
||||
|
||||
i = CONTENT_CONIFER_SAPLING;
|
||||
|
@ -772,9 +777,10 @@ void content_mapnode_plants(bool repeat)
|
|||
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
|
||||
f->fuel_time = 1;
|
||||
f->type = CMT_WOOD;
|
||||
f->hardness = 0.0;
|
||||
f->hardness = 0.1;
|
||||
f->pressure_type = CST_CRUSHABLE;
|
||||
f->suffocation_per_second = 0;
|
||||
f->fertilizer_affects = true;
|
||||
lists::add("creative",i);
|
||||
|
||||
i = CONTENT_APPLE;
|
||||
|
|
|
@ -2012,7 +2012,64 @@ void ServerEnvironment::step(float dtime)
|
|||
// Make trees from saplings!
|
||||
case CONTENT_SAPLING:
|
||||
{
|
||||
if (n.envticks > 15) {
|
||||
if (n.envticks > 1000) {
|
||||
// full grown tree
|
||||
actionstream<<"A sapling grows into a tree at "<<PP(p)<<std::endl;
|
||||
std::vector<content_t> search;
|
||||
search.push_back(CONTENT_AIR);
|
||||
search.push_back(CONTENT_TREE);
|
||||
search.push_back(CONTENT_YOUNG_TREE);
|
||||
search.push_back(CONTENT_APPLE_TREE);
|
||||
search.push_back(CONTENT_YOUNG_APPLE_TREE);
|
||||
search.push_back(CONTENT_JUNGLETREE);
|
||||
search.push_back(CONTENT_YOUNG_JUNGLETREE);
|
||||
search.push_back(CONTENT_CONIFER_TREE);
|
||||
search.push_back(CONTENT_YOUNG_CONIFER_TREE);
|
||||
search.push_back(CONTENT_LEAVES);
|
||||
search.push_back(CONTENT_JUNGLELEAVES);
|
||||
search.push_back(CONTENT_CONIFER_LEAVES);
|
||||
search.push_back(CONTENT_APPLE_LEAVES);
|
||||
search.push_back(CONTENT_APPLE_BLOSSOM);
|
||||
search.push_back(CONTENT_APPLE);
|
||||
search.push_back(CONTENT_IGNORE);
|
||||
|
||||
core::map<v3s16, MapBlock*> modified_blocks;
|
||||
v3s16 tree_p = p;
|
||||
ManualMapVoxelManipulator vmanip(m_map);
|
||||
v3s16 tree_blockp = getNodeBlockPos(tree_p);
|
||||
vmanip.initialEmerge(tree_blockp - v3s16(1,1,1), tree_blockp + v3s16(1,1,1));
|
||||
if (!searchNearInv(p,v3s16(-10,2,-10),v3s16(10,12,10),search,NULL)) {
|
||||
mapgen::make_largetree(vmanip, tree_p);
|
||||
}else{
|
||||
mapgen::make_tree(vmanip, tree_p);
|
||||
}
|
||||
vmanip.blitBackAll(&modified_blocks);
|
||||
|
||||
// update lighting
|
||||
core::map<v3s16, MapBlock*> lighting_modified_blocks;
|
||||
for(core::map<v3s16, MapBlock*>::Iterator
|
||||
i = modified_blocks.getIterator();
|
||||
i.atEnd() == false; i++)
|
||||
{
|
||||
lighting_modified_blocks.insert(i.getNode()->getKey(), i.getNode()->getValue());
|
||||
}
|
||||
m_map->updateLighting(lighting_modified_blocks, modified_blocks);
|
||||
|
||||
// Send a MEET_OTHER event
|
||||
MapEditEvent event;
|
||||
event.type = MEET_OTHER;
|
||||
for(core::map<v3s16, MapBlock*>::Iterator
|
||||
i = modified_blocks.getIterator();
|
||||
i.atEnd() == false; i++)
|
||||
{
|
||||
v3s16 p = i.getNode()->getKey();
|
||||
event.modified_blocks.insert(p, true);
|
||||
}
|
||||
m_map->dispatchEvent(&event);
|
||||
// work-around for lighting bug
|
||||
MapNode nn = m_map->getNodeNoEx(p);
|
||||
m_map->addNodeWithEvent(p,nn);
|
||||
}else if (n.envticks > 15) {
|
||||
std::vector<content_t> search;
|
||||
search.push_back(CONTENT_AIR);
|
||||
search.push_back(CONTENT_TREE);
|
||||
|
@ -2142,7 +2199,42 @@ void ServerEnvironment::step(float dtime)
|
|||
|
||||
case CONTENT_APPLE_SAPLING:
|
||||
{
|
||||
if (n.envticks > 15) {
|
||||
if (n.envticks > 1000) {
|
||||
actionstream<<"A sapling grows into a tree at "<<PP(p)<<std::endl;
|
||||
|
||||
core::map<v3s16, MapBlock*> modified_blocks;
|
||||
v3s16 tree_p = p;
|
||||
ManualMapVoxelManipulator vmanip(m_map);
|
||||
v3s16 tree_blockp = getNodeBlockPos(tree_p);
|
||||
vmanip.initialEmerge(tree_blockp - v3s16(1,1,1), tree_blockp + v3s16(1,1,1));
|
||||
mapgen::make_appletree(vmanip, tree_p);
|
||||
vmanip.blitBackAll(&modified_blocks);
|
||||
|
||||
// update lighting
|
||||
core::map<v3s16, MapBlock*> lighting_modified_blocks;
|
||||
for(core::map<v3s16, MapBlock*>::Iterator
|
||||
i = modified_blocks.getIterator();
|
||||
i.atEnd() == false; i++)
|
||||
{
|
||||
lighting_modified_blocks.insert(i.getNode()->getKey(), i.getNode()->getValue());
|
||||
}
|
||||
m_map->updateLighting(lighting_modified_blocks, modified_blocks);
|
||||
|
||||
// Send a MEET_OTHER event
|
||||
MapEditEvent event;
|
||||
event.type = MEET_OTHER;
|
||||
for(core::map<v3s16, MapBlock*>::Iterator
|
||||
i = modified_blocks.getIterator();
|
||||
i.atEnd() == false; i++)
|
||||
{
|
||||
v3s16 p = i.getNode()->getKey();
|
||||
event.modified_blocks.insert(p, true);
|
||||
}
|
||||
m_map->dispatchEvent(&event);
|
||||
// work-around for lighting bug
|
||||
MapNode nn = m_map->getNodeNoEx(p);
|
||||
m_map->addNodeWithEvent(p,nn);
|
||||
}else if (n.envticks > 15) {
|
||||
std::vector<content_t> search;
|
||||
search.push_back(CONTENT_AIR);
|
||||
search.push_back(CONTENT_TREE);
|
||||
|
@ -2267,7 +2359,42 @@ void ServerEnvironment::step(float dtime)
|
|||
|
||||
case CONTENT_JUNGLESAPLING:
|
||||
{
|
||||
if (n.envticks > 15) {
|
||||
if (n.envticks > 1000) {
|
||||
actionstream<<"A sapling grows into a jungle tree at "<<PP(p)<<std::endl;
|
||||
|
||||
core::map<v3s16, MapBlock*> modified_blocks;
|
||||
v3s16 tree_p = p;
|
||||
ManualMapVoxelManipulator vmanip(m_map);
|
||||
v3s16 tree_blockp = getNodeBlockPos(tree_p);
|
||||
vmanip.initialEmerge(tree_blockp - v3s16(1,1,1), tree_blockp + v3s16(1,1,1));
|
||||
mapgen::make_jungletree(vmanip, tree_p);
|
||||
vmanip.blitBackAll(&modified_blocks);
|
||||
|
||||
// update lighting
|
||||
core::map<v3s16, MapBlock*> lighting_modified_blocks;
|
||||
for(core::map<v3s16, MapBlock*>::Iterator
|
||||
i = modified_blocks.getIterator();
|
||||
i.atEnd() == false; i++)
|
||||
{
|
||||
lighting_modified_blocks.insert(i.getNode()->getKey(), i.getNode()->getValue());
|
||||
}
|
||||
m_map->updateLighting(lighting_modified_blocks, modified_blocks);
|
||||
|
||||
// Send a MEET_OTHER event
|
||||
MapEditEvent event;
|
||||
event.type = MEET_OTHER;
|
||||
for(core::map<v3s16, MapBlock*>::Iterator
|
||||
i = modified_blocks.getIterator();
|
||||
i.atEnd() == false; i++)
|
||||
{
|
||||
v3s16 p = i.getNode()->getKey();
|
||||
event.modified_blocks.insert(p, true);
|
||||
}
|
||||
m_map->dispatchEvent(&event);
|
||||
// work-around for lighting bug
|
||||
MapNode nn = m_map->getNodeNoEx(p);
|
||||
m_map->addNodeWithEvent(p,nn);
|
||||
}else if (n.envticks > 15) {
|
||||
std::vector<content_t> search;
|
||||
search.push_back(CONTENT_AIR);
|
||||
search.push_back(CONTENT_TREE);
|
||||
|
@ -2394,7 +2521,42 @@ void ServerEnvironment::step(float dtime)
|
|||
|
||||
case CONTENT_CONIFER_SAPLING:
|
||||
{
|
||||
if (n.envticks > 15) {
|
||||
if (n.envticks > 1000) {
|
||||
actionstream<<"A sapling grows into a conifer tree at "<<PP(p)<<std::endl;
|
||||
|
||||
core::map<v3s16, MapBlock*> modified_blocks;
|
||||
v3s16 tree_p = p;
|
||||
ManualMapVoxelManipulator vmanip(m_map);
|
||||
v3s16 tree_blockp = getNodeBlockPos(tree_p);
|
||||
vmanip.initialEmerge(tree_blockp - v3s16(1,1,1), tree_blockp + v3s16(1,1,1));
|
||||
mapgen::make_conifertree(vmanip, tree_p);
|
||||
vmanip.blitBackAll(&modified_blocks);
|
||||
|
||||
// update lighting
|
||||
core::map<v3s16, MapBlock*> lighting_modified_blocks;
|
||||
for(core::map<v3s16, MapBlock*>::Iterator
|
||||
i = modified_blocks.getIterator();
|
||||
i.atEnd() == false; i++)
|
||||
{
|
||||
lighting_modified_blocks.insert(i.getNode()->getKey(), i.getNode()->getValue());
|
||||
}
|
||||
m_map->updateLighting(lighting_modified_blocks, modified_blocks);
|
||||
|
||||
// Send a MEET_OTHER event
|
||||
MapEditEvent event;
|
||||
event.type = MEET_OTHER;
|
||||
for(core::map<v3s16, MapBlock*>::Iterator
|
||||
i = modified_blocks.getIterator();
|
||||
i.atEnd() == false; i++)
|
||||
{
|
||||
v3s16 p = i.getNode()->getKey();
|
||||
event.modified_blocks.insert(p, true);
|
||||
}
|
||||
m_map->dispatchEvent(&event);
|
||||
// work-around for lighting bug
|
||||
MapNode nn = m_map->getNodeNoEx(p);
|
||||
m_map->addNodeWithEvent(p,nn);
|
||||
}else if (n.envticks > 15) {
|
||||
std::vector<content_t> search;
|
||||
search.push_back(CONTENT_AIR);
|
||||
search.push_back(CONTENT_TREE);
|
||||
|
|
|
@ -355,6 +355,8 @@ struct ContentFeatures
|
|||
bool often_contains_mineral;
|
||||
// Whether destructive mobs can destroy this node
|
||||
bool destructive_mob_safe;
|
||||
// Whether punching with fertilizer advances the growth rate of the noe
|
||||
bool fertilizer_affects;
|
||||
|
||||
// Inventory item string as which the node appears in inventory when dug.
|
||||
// Mineral overrides this.
|
||||
|
@ -469,6 +471,7 @@ struct ContentFeatures
|
|||
air_equivalent = false;
|
||||
often_contains_mineral = false;
|
||||
destructive_mob_safe = false;
|
||||
fertilizer_affects = false;
|
||||
dug_item = "";
|
||||
extra_dug_item = "";
|
||||
extra_dug_item_rarity = 2;
|
||||
|
|
|
@ -2950,6 +2950,49 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
|
|||
if (block)
|
||||
block->setChangedFlag();
|
||||
|
||||
for(core::map<u16, RemoteClient*>::Iterator
|
||||
i = m_clients.getIterator();
|
||||
i.atEnd()==false; i++)
|
||||
{
|
||||
RemoteClient *client = i.getNode()->getValue();
|
||||
client->SetBlocksNotSent(modified_blocks);
|
||||
client->SetBlockNotSent(blockpos);
|
||||
}
|
||||
}
|
||||
}else if (wield && wield->getContent() == CONTENT_CRAFTITEM_FERTILIZER) {
|
||||
if (content_features(n).fertilizer_affects) {
|
||||
n.envticks = 1024;
|
||||
// send the node
|
||||
core::list<u16> far_players;
|
||||
core::map<v3s16, MapBlock*> modified_blocks;
|
||||
sendAddNode(p_under, n, 0, &far_players, 30);
|
||||
/*
|
||||
Handle inventory
|
||||
*/
|
||||
InventoryList *ilist = player->inventory.getList("main");
|
||||
if(g_settings->getBool("infinite_inventory") == false && ilist) {
|
||||
// Remove from inventory and send inventory
|
||||
if (wield->getCount() == 1) {
|
||||
ilist->deleteItem(item_i);
|
||||
}else{
|
||||
wield->remove(1);
|
||||
}
|
||||
// Send inventory
|
||||
UpdateCrafting(peer_id);
|
||||
SendInventory(peer_id);
|
||||
}
|
||||
// the slow add to map
|
||||
{
|
||||
MapEditEventIgnorer ign(&m_ignore_map_edit_events);
|
||||
|
||||
std::string p_name = std::string(player->getName());
|
||||
m_env.getMap().addNodeAndUpdate(p_under, n, modified_blocks, p_name);
|
||||
}
|
||||
v3s16 blockpos = getNodeBlockPos(p_under);
|
||||
MapBlock *block = m_env.getMap().getBlockNoCreateNoEx(blockpos);
|
||||
if (block)
|
||||
block->setChangedFlag();
|
||||
|
||||
for(core::map<u16, RemoteClient*>::Iterator
|
||||
i = m_clients.getIterator();
|
||||
i.atEnd()==false; i++)
|
||||
|
@ -4135,7 +4178,11 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
|
|||
}
|
||||
}
|
||||
}
|
||||
}else if (item->getContent() == CONTENT_CRAFTITEM_MESEDUST) {
|
||||
}else if (
|
||||
(item->getContent()&CONTENT_CRAFTITEM_MASK) == CONTENT_CRAFTITEM_MASK
|
||||
&& content_craftitem_features(item->getContent()).drop_item != CONTENT_IGNORE
|
||||
&& (content_craftitem_features(item->getContent()).drop_item&CONTENT_MOB_MASK) != CONTENT_MOB_MASK
|
||||
) {
|
||||
if ((getPlayerPrivs(player) & PRIV_BUILD) == 0) {
|
||||
infostream<<"Not allowing player to drop item: "
|
||||
"no build privs"<<std::endl;
|
||||
|
@ -4144,7 +4191,7 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
|
|||
MapNode n = m_env.getMap().getNodeNoEx(p_over);
|
||||
if (n.getContent() != CONTENT_AIR)
|
||||
return;
|
||||
n.setContent(CONTENT_CIRCUIT_MESEWIRE);
|
||||
n.setContent(content_craftitem_features(item->getContent()).drop_item);
|
||||
core::list<u16> far_players;
|
||||
sendAddNode(p_over, n, 0, &far_players, 30);
|
||||
if (g_settings->getBool("infinite_inventory") == false) {
|
||||
|
|
Loading…
Reference in New Issue