add resin, copperwire, and pressure plates
This commit is contained in:
parent
cc26ec475f
commit
08cb480e77
Binary file not shown.
Before Width: | Height: | Size: 583 B |
Binary file not shown.
After Width: | Height: | Size: 477 B |
Binary file not shown.
After Width: | Height: | Size: 700 B |
Binary file not shown.
After Width: | Height: | Size: 676 B |
Binary file not shown.
After Width: | Height: | Size: 364 B |
|
@ -362,7 +362,7 @@ void content_craftitem_init()
|
|||
f->texture = "quartz_dust.png";
|
||||
f->name = "quartz_dust";
|
||||
f->description = "Quartz Dust";
|
||||
crafting::set1To1Recipe(CONTENT_CRAFTITEM_QUARTZ,CONTENT_CRAFTITEM_QUARTZ_DUST);
|
||||
crafting::set1To2Recipe(CONTENT_CRAFTITEM_QUARTZ,CONTENT_CRAFTITEM_QUARTZ_DUST);
|
||||
lists::add("craftguide",i);
|
||||
lists::add("creative",i);
|
||||
|
||||
|
@ -670,4 +670,12 @@ void content_craftitem_init()
|
|||
f->description = "Mese Dust";
|
||||
f->drop_count = 1;
|
||||
crafting::set1To2Recipe(CONTENT_MESE,CONTENT_CRAFTITEM_MESEDUST);
|
||||
|
||||
i = CONTENT_CRAFTITEM_RESIN;
|
||||
f = &g_content_craftitem_features[i];
|
||||
f->content = CONTENT_CRAFTITEM_RESIN;
|
||||
f->texture = "resin.png";
|
||||
f->name = "lump_of_resin";
|
||||
f->description = "Resin";
|
||||
f->drop_count = 1;
|
||||
}
|
||||
|
|
|
@ -98,5 +98,6 @@ CraftItemFeatures & content_craftitem_features(std::string subname);
|
|||
#define CONTENT_CRAFTITEM_GRAPE (CONTENT_CRAFTITEM_MASK | 0x40)
|
||||
#define CONTENT_CRAFTITEM_STRING (CONTENT_CRAFTITEM_MASK | 0x41)
|
||||
#define CONTENT_CRAFTITEM_MESEDUST (CONTENT_CRAFTITEM_MASK | 0x42)
|
||||
#define CONTENT_CRAFTITEM_RESIN (CONTENT_CRAFTITEM_MASK | 0x43)
|
||||
|
||||
#endif
|
||||
|
|
|
@ -795,12 +795,14 @@ void content_mapnode_init()
|
|||
}
|
||||
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
|
||||
f->fuel_time = 30/16;
|
||||
f->cook_result = std::string("CraftItem lump_of_resin 1");
|
||||
f->extra_dug_item = std::string("MaterialItem2 ")+itos(CONTENT_SAPLING)+" 1";
|
||||
f->extra_dug_item_rarity = 20;
|
||||
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
||||
f->type = CMT_PLANT;
|
||||
f->hardness = 0.15;
|
||||
lists::add("decrafting",i);
|
||||
lists::add("cooking",i);
|
||||
|
||||
i = CONTENT_APPLE_LEAVES;
|
||||
f = &content_features(i);
|
||||
|
@ -823,12 +825,14 @@ void content_mapnode_init()
|
|||
}
|
||||
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
|
||||
f->fuel_time = 30/16;
|
||||
f->cook_result = std::string("CraftItem lump_of_resin 1");
|
||||
f->extra_dug_item = std::string("MaterialItem2 ")+itos(CONTENT_APPLE_SAPLING)+" 1";
|
||||
f->extra_dug_item_rarity = 20;
|
||||
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
||||
f->type = CMT_PLANT;
|
||||
f->hardness = 0.15;
|
||||
lists::add("decrafting",i);
|
||||
lists::add("cooking",i);
|
||||
|
||||
i = CONTENT_JUNGLELEAVES;
|
||||
f = &content_features(i);
|
||||
|
@ -851,12 +855,14 @@ void content_mapnode_init()
|
|||
}
|
||||
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
|
||||
f->fuel_time = 30/16;
|
||||
f->cook_result = std::string("CraftItem lump_of_resin 1");
|
||||
f->extra_dug_item = std::string("MaterialItem2 ")+itos(CONTENT_JUNGLESAPLING)+" 1";
|
||||
f->extra_dug_item_rarity = 20;
|
||||
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
||||
f->type = CMT_PLANT;
|
||||
f->hardness = 0.15;
|
||||
lists::add("decrafting",i);
|
||||
lists::add("cooking",i);
|
||||
|
||||
i = CONTENT_CONIFER_LEAVES;
|
||||
f = &content_features(i);
|
||||
|
@ -879,12 +885,14 @@ void content_mapnode_init()
|
|||
}
|
||||
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
|
||||
f->fuel_time = 30/16;
|
||||
f->cook_result = std::string("CraftItem lump_of_resin 1");
|
||||
f->extra_dug_item = std::string("MaterialItem2 ")+itos(CONTENT_CONIFER_SAPLING)+" 1";
|
||||
f->extra_dug_item_rarity = 20;
|
||||
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
||||
f->type = CMT_PLANT;
|
||||
f->hardness = 0.15;
|
||||
lists::add("decrafting",i);
|
||||
lists::add("cooking",i);
|
||||
|
||||
i = CONTENT_TRIMMED_LEAVES;
|
||||
f = &content_features(i);
|
||||
|
@ -906,10 +914,12 @@ void content_mapnode_init()
|
|||
}
|
||||
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
|
||||
f->fuel_time = 30/16;
|
||||
f->cook_result = std::string("CraftItem lump_of_resin 1");
|
||||
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
||||
f->type = CMT_PLANT;
|
||||
f->hardness = 0.15;
|
||||
lists::add("creative",i);
|
||||
lists::add("cooking",i);
|
||||
|
||||
i = CONTENT_TRIMMED_APPLE_LEAVES;
|
||||
f = &content_features(i);
|
||||
|
@ -931,10 +941,12 @@ void content_mapnode_init()
|
|||
}
|
||||
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
|
||||
f->fuel_time = 30/16;
|
||||
f->cook_result = std::string("CraftItem lump_of_resin 1");
|
||||
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
||||
f->type = CMT_PLANT;
|
||||
f->hardness = 0.15;
|
||||
lists::add("creative",i);
|
||||
lists::add("cooking",i);
|
||||
|
||||
i = CONTENT_TRIMMED_JUNGLE_LEAVES;
|
||||
f = &content_features(i);
|
||||
|
@ -956,10 +968,12 @@ void content_mapnode_init()
|
|||
}
|
||||
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
|
||||
f->fuel_time = 30/16;
|
||||
f->cook_result = std::string("CraftItem lump_of_resin 1");
|
||||
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
||||
f->type = CMT_PLANT;
|
||||
f->hardness = 0.15;
|
||||
lists::add("creative",i);
|
||||
lists::add("cooking",i);
|
||||
|
||||
i = CONTENT_TRIMMED_CONIFER_LEAVES;
|
||||
f = &content_features(i);
|
||||
|
@ -981,10 +995,12 @@ void content_mapnode_init()
|
|||
}
|
||||
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
|
||||
f->fuel_time = 30/16;
|
||||
f->cook_result = std::string("CraftItem lump_of_resin 1");
|
||||
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
||||
f->type = CMT_PLANT;
|
||||
f->hardness = 0.15;
|
||||
lists::add("creative",i);
|
||||
lists::add("cooking",i);
|
||||
|
||||
i = CONTENT_APPLE_BLOSSOM;
|
||||
f = &content_features(i);
|
||||
|
@ -9049,6 +9065,36 @@ void content_mapnode_init()
|
|||
if (f->initial_metadata == NULL)
|
||||
f->initial_metadata = new CircuitNodeMetadata();
|
||||
lists::add("creative",i);
|
||||
lists::add("decrafting",i);
|
||||
|
||||
i = CONTENT_CIRCUIT_COPPERWIRE;
|
||||
f = &content_features(i);
|
||||
f->description = std::string("Copper Wire");
|
||||
f->setAllTextures("copper_wire.png");
|
||||
f->param_type = CPT_LIGHT;
|
||||
f->draw_type = CDT_WIRELIKE;
|
||||
f->energy_type = CET_CONDUCTIVE;
|
||||
f->walkable = false;
|
||||
f->light_propagates = true;
|
||||
f->sunlight_propagates = true;
|
||||
f->air_equivalent = true; // grass grows underneath
|
||||
f->solidness = 0; // drawn separately, makes no faces
|
||||
f->dug_item = std::string("MaterialItem2 ") + itos(i)+" 1";
|
||||
f->type = CMT_DIRT;
|
||||
f->hardness = 1.0;
|
||||
content_nodebox_carpet(f);
|
||||
if (f->initial_metadata == NULL)
|
||||
f->initial_metadata = new CircuitNodeMetadata();
|
||||
{
|
||||
u16 r[9] = {
|
||||
CONTENT_CRAFTITEM_RESIN, CONTENT_CRAFTITEM_COPPER_INGOT, CONTENT_IGNORE,
|
||||
CONTENT_IGNORE, CONTENT_IGNORE, CONTENT_IGNORE,
|
||||
CONTENT_IGNORE, CONTENT_IGNORE, CONTENT_IGNORE
|
||||
};
|
||||
crafting::setShapelessRecipe(r,CONTENT_CIRCUIT_COPPERWIRE,10);
|
||||
}
|
||||
lists::add("craftguide",i);
|
||||
lists::add("creative",i);
|
||||
|
||||
i = CONTENT_CIRCUIT_BATTERY;
|
||||
f = &content_features(i);
|
||||
|
@ -9075,7 +9121,7 @@ void content_mapnode_init()
|
|||
i = CONTENT_CIRCUIT_SWITCH;
|
||||
f = &content_features(i);
|
||||
f->description = std::string("Switch");
|
||||
f->setAllTextures("circuit_switch.png");
|
||||
f->setAllTextures("stone.png");
|
||||
f->setTexture(5,"circuit_switch_front.png");
|
||||
f->param_type = CPT_FACEDIR_WALLMOUNT;
|
||||
f->draw_type = CDT_NODEBOX;
|
||||
|
@ -9087,7 +9133,7 @@ void content_mapnode_init()
|
|||
f->type = CMT_STONE;
|
||||
f->hardness = 1.0;
|
||||
content_nodebox_switch(f);
|
||||
f->setInventoryTextureNodeBox(i,"circuit_switch.png","circuit_switch_front.png","circuit_switch.png");
|
||||
f->setInventoryTextureNodeBox(i,"stone.png","circuit_switch_front.png","stone.png");
|
||||
if (f->initial_metadata == NULL)
|
||||
f->initial_metadata = new SwitchNodeMetadata();
|
||||
{
|
||||
|
@ -9101,6 +9147,90 @@ void content_mapnode_init()
|
|||
lists::add("craftguide",i);
|
||||
lists::add("creative",i);
|
||||
|
||||
i = CONTENT_CIRCUIT_BUTTON;
|
||||
f = &content_features(i);
|
||||
f->description = std::string("Button");
|
||||
f->setAllTextures("stone.png");
|
||||
f->param_type = CPT_FACEDIR_WALLMOUNT;
|
||||
f->draw_type = CDT_NODEBOX;
|
||||
f->is_ground_content = true;
|
||||
f->energy_type = CET_SWITCH;
|
||||
f->energy_drop = 0;
|
||||
f->solidness = 0; // drawn separately, makes no faces
|
||||
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
||||
f->type = CMT_STONE;
|
||||
f->hardness = 1.0;
|
||||
content_nodebox_button(f);
|
||||
f->setInventoryTextureNodeBox(i,"stone.png","stone.png","stone.png");
|
||||
if (f->initial_metadata == NULL)
|
||||
f->initial_metadata = new ButtonNodeMetadata();
|
||||
{
|
||||
u16 recipe[9] = {
|
||||
CONTENT_IGNORE, CONTENT_CRAFTITEM_MESEDUST, CONTENT_IGNORE,
|
||||
CONTENT_IGNORE, CONTENT_STONE_KNOB, CONTENT_IGNORE,
|
||||
CONTENT_IGNORE, CONTENT_CRAFTITEM_QUARTZ_DUST, CONTENT_IGNORE
|
||||
};
|
||||
crafting::setRecipe(recipe,CONTENT_CIRCUIT_BUTTON,1);
|
||||
}
|
||||
lists::add("craftguide",i);
|
||||
lists::add("creative",i);
|
||||
|
||||
i = CONTENT_CIRCUIT_PRESSUREPLATE_STONE;
|
||||
f = &content_features(i);
|
||||
f->description = std::string("Stone Pressure Plate");
|
||||
f->setAllTextures("stone.png");
|
||||
f->setTexture(0,"pressureplate_stone_top.png");
|
||||
f->draw_type = CDT_NODEBOX;
|
||||
f->is_ground_content = true;
|
||||
f->energy_type = CET_SWITCH;
|
||||
f->energy_drop = 0;
|
||||
f->solidness = 0; // drawn separately, makes no faces
|
||||
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
||||
f->type = CMT_STONE;
|
||||
f->hardness = 1.0;
|
||||
content_nodebox_carpet(f);
|
||||
f->setInventoryTextureNodeBox(i,"pressureplate_stone_top.png","stone.png","stone.png");
|
||||
if (f->initial_metadata == NULL)
|
||||
f->initial_metadata = new ButtonNodeMetadata();
|
||||
{
|
||||
u16 recipe[9] = {
|
||||
CONTENT_IGNORE, CONTENT_CRAFTITEM_MESEDUST, CONTENT_IGNORE,
|
||||
CONTENT_IGNORE, CONTENT_STONE_SLAB, CONTENT_IGNORE,
|
||||
CONTENT_IGNORE, CONTENT_CRAFTITEM_QUARTZ_DUST, CONTENT_IGNORE
|
||||
};
|
||||
crafting::setRecipe(recipe,CONTENT_CIRCUIT_PRESSUREPLATE_STONE,1);
|
||||
}
|
||||
lists::add("craftguide",i);
|
||||
lists::add("creative",i);
|
||||
|
||||
i = CONTENT_CIRCUIT_PRESSUREPLATE_WOOD;
|
||||
f = &content_features(i);
|
||||
f->description = std::string("Wood Pressure Plate");
|
||||
f->setAllTextures("stone.png");
|
||||
f->setTexture(0,"pressureplate_wood_top.png");
|
||||
f->draw_type = CDT_NODEBOX;
|
||||
f->is_ground_content = true;
|
||||
f->energy_type = CET_SWITCH;
|
||||
f->energy_drop = 0;
|
||||
f->solidness = 0; // drawn separately, makes no faces
|
||||
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
||||
f->type = CMT_WOOD;
|
||||
f->hardness = 1.0;
|
||||
content_nodebox_carpet(f);
|
||||
f->setInventoryTextureNodeBox(i,"pressureplate_wood_top.png","stone.png","stone.png");
|
||||
if (f->initial_metadata == NULL)
|
||||
f->initial_metadata = new ButtonNodeMetadata();
|
||||
{
|
||||
u16 recipe[9] = {
|
||||
CONTENT_IGNORE, CONTENT_CRAFTITEM_MESEDUST, CONTENT_IGNORE,
|
||||
CONTENT_IGNORE, CONTENT_WOOD_SLAB, CONTENT_IGNORE,
|
||||
CONTENT_IGNORE, CONTENT_CRAFTITEM_QUARTZ_DUST, CONTENT_IGNORE
|
||||
};
|
||||
crafting::setRecipe(recipe,CONTENT_CIRCUIT_PRESSUREPLATE_WOOD,1);
|
||||
}
|
||||
lists::add("craftguide",i);
|
||||
lists::add("creative",i);
|
||||
|
||||
i = CONTENT_CIRCUIT_NOTGATE;
|
||||
f = &content_features(i);
|
||||
f->description = std::string("Not Gate");
|
||||
|
|
|
@ -542,6 +542,9 @@ MapNode mapnode_translate_to_internal(MapNode n_from, u8 version);
|
|||
#define CONTENT_CIRCUIT_WATERWHEEL 0xF22
|
||||
#define CONTENT_CIRCUIT_SWITCH 0xF23
|
||||
#define CONTENT_CIRCUIT_NOTGATE 0xF24
|
||||
#define CONTENT_CIRCUIT_BUTTON 0xF25
|
||||
#define CONTENT_CIRCUIT_PRESSUREPLATE_WOOD 0xF26
|
||||
#define CONTENT_CIRCUIT_PRESSUREPLATE_STONE 0xF27
|
||||
// circuits - gadgets
|
||||
#define CONTENT_CIRCUIT_LAMP 0xF40
|
||||
#define CONTENT_CIRCUIT_LAMP_OFF 0xF41
|
||||
|
|
|
@ -1233,6 +1233,13 @@ void content_nodebox_switch(ContentFeatures *f)
|
|||
));
|
||||
}
|
||||
|
||||
void content_nodebox_button(ContentFeatures *f)
|
||||
{
|
||||
f->setNodeBox(core::aabbox3d<f32>(
|
||||
-0.1875*BS,-0.0625*BS,0.375*BS,0.1875*BS,0.125*BS,0.5*BS
|
||||
));
|
||||
}
|
||||
|
||||
void content_nodebox_logicgate(ContentFeatures *f)
|
||||
{
|
||||
f->setNodeBox(core::aabbox3d<f32>(
|
||||
|
|
|
@ -47,6 +47,7 @@ void content_nodebox_couch_outer(ContentFeatures *f);
|
|||
void content_nodebox_knob(ContentFeatures *f);
|
||||
void content_nodebox_battery(ContentFeatures *f);
|
||||
void content_nodebox_switch(ContentFeatures *f);
|
||||
void content_nodebox_button(ContentFeatures *f);
|
||||
void content_nodebox_logicgate(ContentFeatures *f);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -2149,6 +2149,72 @@ bool SwitchNodeMetadata::energise(u8 level, v3s16 powersrc, v3s16 signalsrc, v3s
|
|||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
ButtonNodeMetadata
|
||||
*/
|
||||
|
||||
// Prototype
|
||||
ButtonNodeMetadata proto_ButtonNodeMetadata;
|
||||
|
||||
ButtonNodeMetadata::ButtonNodeMetadata()
|
||||
{
|
||||
m_energy = 0;
|
||||
m_ptime = 0;
|
||||
m_sources.clear();
|
||||
NodeMetadata::registerType(typeId(), create);
|
||||
}
|
||||
u16 ButtonNodeMetadata::typeId() const
|
||||
{
|
||||
return CONTENT_CIRCUIT_BUTTON;
|
||||
}
|
||||
NodeMetadata* ButtonNodeMetadata::create(std::istream &is)
|
||||
{
|
||||
ButtonNodeMetadata *d = new ButtonNodeMetadata();
|
||||
int temp;
|
||||
is>>temp;
|
||||
d->m_energy = temp;
|
||||
is>>temp;
|
||||
d->m_ptime = (float)temp/10;
|
||||
int i;
|
||||
is>>i;
|
||||
v3s16 p;
|
||||
for (; i > 0; i--) {
|
||||
is>>temp;
|
||||
p.X = temp;
|
||||
is>>temp;
|
||||
p.Y = temp;
|
||||
is>>temp;
|
||||
p.Z = temp;
|
||||
is>>temp;
|
||||
d->m_sources[p] = temp;
|
||||
}
|
||||
return d;
|
||||
}
|
||||
NodeMetadata* ButtonNodeMetadata::clone()
|
||||
{
|
||||
ButtonNodeMetadata *d = new ButtonNodeMetadata();
|
||||
return d;
|
||||
}
|
||||
bool ButtonNodeMetadata::step(float dtime, v3s16 pos, ServerEnvironment *env)
|
||||
{
|
||||
if (!m_energy)
|
||||
return false;
|
||||
|
||||
env->propogateEnergy(ENERGY_MAX,pos,pos,pos);
|
||||
m_energy = 0;
|
||||
return true;
|
||||
}
|
||||
bool ButtonNodeMetadata::energise(u8 level, v3s16 powersrc, v3s16 signalsrc, v3s16 pos)
|
||||
{
|
||||
m_ptime = 0;
|
||||
if (m_energy == level)
|
||||
return true;
|
||||
if (powersrc != pos)
|
||||
return false;
|
||||
m_energy = level;
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
SourceNodeMetadata
|
||||
*/
|
||||
|
|
|
@ -488,6 +488,17 @@ public:
|
|||
virtual NodeMetadata* clone();
|
||||
};
|
||||
|
||||
class ButtonNodeMetadata : public CircuitNodeMetadata
|
||||
{
|
||||
public:
|
||||
ButtonNodeMetadata();
|
||||
virtual u16 typeId() const;
|
||||
static NodeMetadata* create(std::istream &is);
|
||||
virtual NodeMetadata* clone();
|
||||
virtual bool step(float dtime, v3s16 pos, ServerEnvironment *env);
|
||||
virtual bool energise(u8 level, v3s16 powersrc, v3s16 signalsrc, v3s16 pos);
|
||||
};
|
||||
|
||||
class NotGateNodeMetadata : public CircuitNodeMetadata
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -806,6 +806,17 @@ void ServerEnvironment::step(float dtime)
|
|||
if (n.getContent() == CONTENT_GRASS) {
|
||||
n.setContent(CONTENT_GRASS_FOOTSTEPS);
|
||||
m_map->setNode(bottompos, n);
|
||||
}else{
|
||||
bottompos.Y += 1;
|
||||
MapNode n = m_map->getNode(bottompos);
|
||||
if (
|
||||
n.getContent() == CONTENT_CIRCUIT_PRESSUREPLATE_STONE
|
||||
|| n.getContent() == CONTENT_CIRCUIT_PRESSUREPLATE_WOOD
|
||||
) {
|
||||
NodeMetadata *meta = m_map->getNodeMetadata(bottompos);
|
||||
if (meta && !meta->getEnergy())
|
||||
meta->energise(ENERGY_MAX,bottompos,bottompos,bottompos);
|
||||
}
|
||||
}
|
||||
}catch (InvalidPositionException &e) {}
|
||||
}
|
||||
|
@ -2917,41 +2928,41 @@ bool ServerEnvironment::propogateEnergy(u8 level, v3s16 powersrc, v3s16 signalsr
|
|||
if (n.getContent() == CONTENT_IGNORE)
|
||||
return false;
|
||||
ContentFeatures &f = content_features(n);
|
||||
if (f.energy_type == CET_NONE)
|
||||
return false;
|
||||
if ((f.energy_type == CET_SOURCE || f.energy_type == CET_SWITCH) && pos != powersrc)
|
||||
return false;
|
||||
if (f.energy_type == CET_GATE && pos == powersrc && level != ENERGY_MAX)
|
||||
return false;
|
||||
m = m_map->getNodeMetadata(pos);
|
||||
if (!m)
|
||||
return false;
|
||||
{
|
||||
MapNode n = m_map->getNodeNoEx(pos);
|
||||
content_t c = n.getContent();
|
||||
if (c >= CONTENT_DOOR_MIN && c <= CONTENT_DOOR_MAX) {
|
||||
v3s16 mp(0,1,0);
|
||||
if ((c&CONTENT_DOOR_SECT_MASK) == CONTENT_DOOR_SECT_MASK)
|
||||
mp.Y = -1;
|
||||
if (f.energy_type == CET_NONE) {
|
||||
if (powersrc != signalsrc || n.getContent() != CONTENT_STONE)
|
||||
return false;
|
||||
}else{
|
||||
if ((f.energy_type == CET_SOURCE || f.energy_type == CET_SWITCH) && pos != powersrc)
|
||||
return false;
|
||||
if (f.energy_type == CET_GATE && pos == powersrc && level != ENERGY_MAX)
|
||||
return false;
|
||||
m = m_map->getNodeMetadata(pos);
|
||||
if (!m)
|
||||
return false;
|
||||
{
|
||||
MapNode n = m_map->getNodeNoEx(pos);
|
||||
content_t c = n.getContent();
|
||||
if (c >= CONTENT_DOOR_MIN && c <= CONTENT_DOOR_MAX) {
|
||||
v3s16 mp(0,1,0);
|
||||
if ((c&CONTENT_DOOR_SECT_MASK) == CONTENT_DOOR_SECT_MASK)
|
||||
mp.Y = -1;
|
||||
|
||||
if (signalsrc != pos+mp)
|
||||
propogateEnergy(level,powersrc,pos,pos+mp);
|
||||
if (signalsrc != pos+mp)
|
||||
propogateEnergy(level,powersrc,pos,pos+mp);
|
||||
}
|
||||
}
|
||||
if (!m->energise(level,powersrc,signalsrc,pos))
|
||||
return false;
|
||||
if (f.energy_type == CET_GATE)
|
||||
level = ENERGY_MAX;
|
||||
if (f.energy_type == CET_GATE && pos != powersrc)
|
||||
return false;
|
||||
}
|
||||
if (!m->energise(level,powersrc,signalsrc,pos))
|
||||
return false;
|
||||
if (f.energy_type == CET_GATE)
|
||||
level = ENERGY_MAX;
|
||||
if (f.energy_type == CET_GATE && pos != powersrc)
|
||||
return false;
|
||||
if (level) {
|
||||
if (f.powered_node != CONTENT_IGNORE) {
|
||||
n.setContent(f.powered_node);
|
||||
m_map->addNodeWithEvent(pos, n);
|
||||
}
|
||||
}else if (f.unpowered_node != CONTENT_IGNORE) {
|
||||
n.setContent(f.unpowered_node);
|
||||
m_map->addNodeWithEvent(pos, n);
|
||||
}
|
||||
|
||||
if (f.energy_type != CET_SOURCE && f.energy_type != CET_SWITCH)
|
||||
|
@ -3112,6 +3123,13 @@ bool ServerEnvironment::propogateEnergy(u8 level, v3s16 powersrc, v3s16 signalsr
|
|||
}else if (x_plus_y_minus) {
|
||||
if ((pos+v3s16(1,-1,0)) != signalsrc)
|
||||
propogateEnergy(level,powersrc,pos,pos+v3s16(1,-1,0));
|
||||
}else if (powersrc == pos) {
|
||||
if ((pos+v3s16(1,0,0)) != signalsrc && n_plus_x.getContent() == CONTENT_STONE)
|
||||
propogateEnergy(level,powersrc,pos,pos+v3s16(1,0,0));
|
||||
if ((pos+v3s16(1,1,0)) != signalsrc && n_plus_xy.getContent() == CONTENT_STONE)
|
||||
propogateEnergy(level,powersrc,pos,pos+v3s16(1,1,0));
|
||||
if ((pos+v3s16(1,-1,0)) != signalsrc && n_plus_x_y.getContent() == CONTENT_STONE)
|
||||
propogateEnergy(level,powersrc,pos,pos+v3s16(1,-1,0));
|
||||
}
|
||||
}
|
||||
if (gate_x_minus) {
|
||||
|
@ -3124,6 +3142,13 @@ bool ServerEnvironment::propogateEnergy(u8 level, v3s16 powersrc, v3s16 signalsr
|
|||
}else if (x_minus_y_minus) {
|
||||
if ((pos+v3s16(-1,-1,0)) != signalsrc)
|
||||
propogateEnergy(level,powersrc,pos,pos+v3s16(-1,-1,0));
|
||||
}else if (powersrc == pos) {
|
||||
if ((pos+v3s16(-1,0,0)) != signalsrc && n_minus_x.getContent() == CONTENT_STONE)
|
||||
propogateEnergy(level,powersrc,pos,pos+v3s16(-1,0,0));
|
||||
if ((pos+v3s16(-1,1,0)) != signalsrc && n_minus_xy.getContent() == CONTENT_STONE)
|
||||
propogateEnergy(level,powersrc,pos,pos+v3s16(-1,1,0));
|
||||
if ((pos+v3s16(-1,-1,0)) != signalsrc && n_minus_x_y.getContent() == CONTENT_STONE)
|
||||
propogateEnergy(level,powersrc,pos,pos+v3s16(-1,-1,0));
|
||||
}
|
||||
}
|
||||
if (gate_z_plus) {
|
||||
|
@ -3136,6 +3161,13 @@ bool ServerEnvironment::propogateEnergy(u8 level, v3s16 powersrc, v3s16 signalsr
|
|||
}else if (z_plus_y_minus) {
|
||||
if ((pos+v3s16(0,-1,1)) != signalsrc)
|
||||
propogateEnergy(level,powersrc,pos,pos+v3s16(0,-1,1));
|
||||
}else if (powersrc == pos) {
|
||||
if ((pos+v3s16(0,0,1)) != signalsrc && n_plus_z.getContent() == CONTENT_STONE)
|
||||
propogateEnergy(level,powersrc,pos,pos+v3s16(0,0,1));
|
||||
if ((pos+v3s16(0,1,1)) != signalsrc && n_plus_zy.getContent() == CONTENT_STONE)
|
||||
propogateEnergy(level,powersrc,pos,pos+v3s16(0,1,1));
|
||||
if ((pos+v3s16(0,-1,1)) != signalsrc && n_plus_z_y.getContent() == CONTENT_STONE)
|
||||
propogateEnergy(level,powersrc,pos,pos+v3s16(0,-1,1));
|
||||
}
|
||||
}
|
||||
if (gate_z_minus) {
|
||||
|
@ -3148,6 +3180,13 @@ bool ServerEnvironment::propogateEnergy(u8 level, v3s16 powersrc, v3s16 signalsr
|
|||
}else if (z_minus_y_minus) {
|
||||
if ((pos+v3s16(0,-1,-1)) != signalsrc)
|
||||
propogateEnergy(level,powersrc,pos,pos+v3s16(0,-1,-1));
|
||||
}else if (powersrc == pos) {
|
||||
if ((pos+v3s16(0,0,-1)) != signalsrc && n_minus_z.getContent() == CONTENT_STONE)
|
||||
propogateEnergy(level,powersrc,pos,pos+v3s16(0,0,-1));
|
||||
if ((pos+v3s16(0,1,-1)) != signalsrc && n_minus_zy.getContent() == CONTENT_STONE)
|
||||
propogateEnergy(level,powersrc,pos,pos+v3s16(0,1,-1));
|
||||
if ((pos+v3s16(0,-1,-1)) != signalsrc && n_minus_z_y.getContent() == CONTENT_STONE)
|
||||
propogateEnergy(level,powersrc,pos,pos+v3s16(0,-1,-1));
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue