forked from oerkki/voxelands
replace locking doors with spring closing doors
This commit is contained in:
parent
74a70f8135
commit
3fa63b9af2
|
@ -6603,8 +6603,6 @@ void content_mapnode_init()
|
|||
f->is_ground_content = true;
|
||||
f->dug_item = std::string("MaterialItem2 ")+itos(i+1)+" 1";
|
||||
content_mapnode_nodebox_door(f);
|
||||
if(f->initial_metadata == NULL)
|
||||
f->initial_metadata = new LockedDoorNodeMetadata();
|
||||
f->type = CMT_STONE;
|
||||
f->hardness = 5.0;
|
||||
i = CONTENT_STEEL_DOOR_LT;
|
||||
|
@ -6624,8 +6622,6 @@ void content_mapnode_init()
|
|||
f->is_ground_content = true;
|
||||
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
||||
content_mapnode_nodebox_door(f);
|
||||
if(f->initial_metadata == NULL)
|
||||
f->initial_metadata = new LockedDoorNodeMetadata();
|
||||
f->type = CMT_STONE;
|
||||
f->hardness = 5.0;
|
||||
crafting::set1over1Recipe(CONTENT_STEEL_HATCH,CONTENT_STEEL_HATCH,CONTENT_STEEL_DOOR_LT);
|
||||
|
@ -6748,8 +6744,6 @@ void content_mapnode_init()
|
|||
f->is_ground_content = true;
|
||||
f->dug_item = std::string("MaterialItem2 ")+itos(i+1)+" 1";
|
||||
content_mapnode_nodebox_door(f);
|
||||
if(f->initial_metadata == NULL)
|
||||
f->initial_metadata = new LockedDoorNodeMetadata();
|
||||
f->type = CMT_STONE;
|
||||
f->hardness = 5.0;
|
||||
i = CONTENT_STEEL_W_DOOR_LT;
|
||||
|
@ -6770,8 +6764,6 @@ void content_mapnode_init()
|
|||
f->is_ground_content = true;
|
||||
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
||||
content_mapnode_nodebox_doorw(f);
|
||||
if(f->initial_metadata == NULL)
|
||||
f->initial_metadata = new LockedDoorNodeMetadata();
|
||||
f->type = CMT_STONE;
|
||||
f->hardness = 5.0;
|
||||
crafting::set1over1Recipe(CONTENT_STEEL_W_HATCH,CONTENT_STEEL_HATCH,CONTENT_STEEL_W_DOOR_LT);
|
||||
|
@ -6892,8 +6884,6 @@ void content_mapnode_init()
|
|||
f->is_ground_content = true;
|
||||
f->dug_item = std::string("MaterialItem2 ")+itos(i+1)+" 1";
|
||||
content_mapnode_nodebox_door(f);
|
||||
if(f->initial_metadata == NULL)
|
||||
f->initial_metadata = new LockedDoorNodeMetadata();
|
||||
f->type = CMT_STONE;
|
||||
f->hardness = 5.0;
|
||||
i = CONTENT_STEEL_DOOR_RT;
|
||||
|
@ -6913,8 +6903,6 @@ void content_mapnode_init()
|
|||
f->is_ground_content = true;
|
||||
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
||||
content_mapnode_nodebox_door(f);
|
||||
if(f->initial_metadata == NULL)
|
||||
f->initial_metadata = new LockedDoorNodeMetadata();
|
||||
f->type = CMT_STONE;
|
||||
f->hardness = 5.0;
|
||||
crafting::set1To1Recipe(CONTENT_GLASS_DOOR_LT,CONTENT_GLASS_DOOR_RT);
|
||||
|
@ -6988,8 +6976,6 @@ void content_mapnode_init()
|
|||
f->is_ground_content = true;
|
||||
f->dug_item = std::string("MaterialItem2 ")+itos(i+1)+" 1";
|
||||
content_mapnode_nodebox_door(f);
|
||||
if(f->initial_metadata == NULL)
|
||||
f->initial_metadata = new LockedDoorNodeMetadata();
|
||||
f->type = CMT_STONE;
|
||||
f->hardness = 5.0;
|
||||
i = CONTENT_STEEL_W_DOOR_RT;
|
||||
|
@ -7010,8 +6996,6 @@ void content_mapnode_init()
|
|||
f->is_ground_content = true;
|
||||
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
||||
content_mapnode_nodebox_doorw(f);
|
||||
if(f->initial_metadata == NULL)
|
||||
f->initial_metadata = new LockedDoorNodeMetadata();
|
||||
f->type = CMT_STONE;
|
||||
f->hardness = 5.0;
|
||||
crafting::set1To1Recipe(CONTENT_STEEL_W_DOOR_LT,CONTENT_STEEL_W_DOOR_RT);
|
||||
|
@ -7118,8 +7102,6 @@ void content_mapnode_init()
|
|||
f->is_ground_content = true;
|
||||
f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_STEEL_DOOR_LT)+" 1";
|
||||
content_mapnode_nodebox_doorol(f);
|
||||
if(f->initial_metadata == NULL)
|
||||
f->initial_metadata = new LockedDoorNodeMetadata();
|
||||
f->type = CMT_STONE;
|
||||
f->hardness = 5.0;
|
||||
i = CONTENT_STEEL_DOOR_LT_OPEN;
|
||||
|
@ -7138,8 +7120,6 @@ void content_mapnode_init()
|
|||
f->is_ground_content = true;
|
||||
f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_STEEL_DOOR_LT)+" 1";
|
||||
content_mapnode_nodebox_doorol(f);
|
||||
if(f->initial_metadata == NULL)
|
||||
f->initial_metadata = new LockedDoorNodeMetadata();
|
||||
f->type = CMT_STONE;
|
||||
f->hardness = 5.0;
|
||||
|
||||
|
@ -7200,8 +7180,6 @@ void content_mapnode_init()
|
|||
f->is_ground_content = true;
|
||||
f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_STEEL_W_DOOR_LT)+" 1";
|
||||
content_mapnode_nodebox_doorol(f);
|
||||
if(f->initial_metadata == NULL)
|
||||
f->initial_metadata = new LockedDoorNodeMetadata();
|
||||
f->type = CMT_STONE;
|
||||
f->hardness = 5.0;
|
||||
i = CONTENT_STEEL_W_DOOR_LT_OPEN;
|
||||
|
@ -7220,8 +7198,6 @@ void content_mapnode_init()
|
|||
f->is_ground_content = true;
|
||||
f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_STEEL_W_DOOR_LT)+" 1";
|
||||
content_mapnode_nodebox_doorwol(f);
|
||||
if(f->initial_metadata == NULL)
|
||||
f->initial_metadata = new LockedDoorNodeMetadata();
|
||||
f->type = CMT_STONE;
|
||||
f->hardness = 5.0;
|
||||
|
||||
|
@ -7334,8 +7310,6 @@ void content_mapnode_init()
|
|||
f->is_ground_content = true;
|
||||
f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_STEEL_DOOR_RT)+" 1";
|
||||
content_mapnode_nodebox_dooror(f);
|
||||
if(f->initial_metadata == NULL)
|
||||
f->initial_metadata = new LockedDoorNodeMetadata();
|
||||
f->type = CMT_STONE;
|
||||
f->hardness = 5.0;
|
||||
i = CONTENT_STEEL_DOOR_RT_OPEN;
|
||||
|
@ -7356,8 +7330,6 @@ void content_mapnode_init()
|
|||
f->is_ground_content = true;
|
||||
f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_STEEL_DOOR_RT)+" 1";
|
||||
content_mapnode_nodebox_dooror(f);
|
||||
if(f->initial_metadata == NULL)
|
||||
f->initial_metadata = new LockedDoorNodeMetadata();
|
||||
f->type = CMT_STONE;
|
||||
f->hardness = 5.0;
|
||||
|
||||
|
@ -7424,8 +7396,6 @@ void content_mapnode_init()
|
|||
f->is_ground_content = true;
|
||||
f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_STEEL_W_DOOR_RT)+" 1";
|
||||
content_mapnode_nodebox_dooror(f);
|
||||
if(f->initial_metadata == NULL)
|
||||
f->initial_metadata = new LockedDoorNodeMetadata();
|
||||
f->type = CMT_STONE;
|
||||
f->hardness = 5.0;
|
||||
i = CONTENT_STEEL_W_DOOR_RT_OPEN;
|
||||
|
@ -7446,8 +7416,6 @@ void content_mapnode_init()
|
|||
f->is_ground_content = true;
|
||||
f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_STEEL_W_DOOR_RT)+" 1";
|
||||
content_mapnode_nodebox_doorwor(f);
|
||||
if(f->initial_metadata == NULL)
|
||||
f->initial_metadata = new LockedDoorNodeMetadata();
|
||||
f->type = CMT_STONE;
|
||||
f->hardness = 5.0;
|
||||
|
||||
|
@ -7487,8 +7455,6 @@ void content_mapnode_init()
|
|||
f->is_ground_content = true;
|
||||
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
||||
content_mapnode_nodebox_hatch(f);
|
||||
if(f->initial_metadata == NULL)
|
||||
f->initial_metadata = new LockedDoorNodeMetadata();
|
||||
f->type = CMT_STONE;
|
||||
f->hardness = 5.0;
|
||||
crafting::setSoftBlockRecipe(CONTENT_CRAFTITEM_STEEL_INGOT,CONTENT_STEEL_HATCH);
|
||||
|
@ -7535,8 +7501,6 @@ void content_mapnode_init()
|
|||
f->is_ground_content = true;
|
||||
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
||||
content_mapnode_nodebox_hatchw(f);
|
||||
if(f->initial_metadata == NULL)
|
||||
f->initial_metadata = new LockedDoorNodeMetadata();
|
||||
f->type = CMT_STONE;
|
||||
f->hardness = 5.0;
|
||||
crafting::set1over1Recipe(CONTENT_GLASS,CONTENT_STEEL_HATCH,CONTENT_STEEL_W_HATCH);
|
||||
|
@ -7589,8 +7553,6 @@ void content_mapnode_init()
|
|||
f->is_ground_content = true;
|
||||
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
||||
content_mapnode_nodebox_gate(f);
|
||||
if(f->initial_metadata == NULL)
|
||||
f->initial_metadata = new LockedDoorNodeMetadata();
|
||||
f->type = CMT_STONE;
|
||||
f->hardness = 5.0;
|
||||
crafting::setGateRecipe(CONTENT_CRAFTITEM_STEEL_INGOT,CONTENT_STEEL,CONTENT_STEEL_GATE);
|
||||
|
@ -7639,8 +7601,6 @@ void content_mapnode_init()
|
|||
f->climbable = true;
|
||||
f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_STEEL_HATCH)+" 1";
|
||||
content_mapnode_nodebox_hatcho(f);
|
||||
if(f->initial_metadata == NULL)
|
||||
f->initial_metadata = new LockedDoorNodeMetadata();
|
||||
f->type = CMT_STONE;
|
||||
f->hardness = 5.0;
|
||||
|
||||
|
@ -7685,8 +7645,6 @@ void content_mapnode_init()
|
|||
f->climbable = true;
|
||||
f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_STEEL_W_HATCH)+" 1";
|
||||
content_mapnode_nodebox_hatchwo(f);
|
||||
if(f->initial_metadata == NULL)
|
||||
f->initial_metadata = new LockedDoorNodeMetadata();
|
||||
f->type = CMT_STONE;
|
||||
f->hardness = 5.0;
|
||||
|
||||
|
@ -7728,8 +7686,6 @@ void content_mapnode_init()
|
|||
f->is_ground_content = true;
|
||||
f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_STEEL_GATE)+" 1";
|
||||
content_mapnode_nodebox_gateo(f);
|
||||
if(f->initial_metadata == NULL)
|
||||
f->initial_metadata = new LockedDoorNodeMetadata();
|
||||
f->type = CMT_STONE;
|
||||
f->hardness = 5.0;
|
||||
|
||||
|
|
|
@ -388,44 +388,6 @@ std::string BorderStoneNodeMetadata::infoText()
|
|||
return std::string("Border Stone owned by '")+m_text+"'";
|
||||
}
|
||||
|
||||
/*
|
||||
LockedDoorNodeMetadata
|
||||
*/
|
||||
|
||||
// Prototype
|
||||
LockedDoorNodeMetadata proto_LockedDoorNodeMetadata;
|
||||
|
||||
LockedDoorNodeMetadata::LockedDoorNodeMetadata()
|
||||
{
|
||||
NodeMetadata::registerType(typeId(), create);
|
||||
}
|
||||
LockedDoorNodeMetadata::~LockedDoorNodeMetadata()
|
||||
{
|
||||
}
|
||||
u16 LockedDoorNodeMetadata::typeId() const
|
||||
{
|
||||
return CONTENT_WOOD_DOOR_LT;
|
||||
}
|
||||
NodeMetadata* LockedDoorNodeMetadata::create(std::istream &is)
|
||||
{
|
||||
LockedDoorNodeMetadata *d = new LockedDoorNodeMetadata();
|
||||
d->setOwner(deSerializeString(is));
|
||||
return d;
|
||||
}
|
||||
NodeMetadata* LockedDoorNodeMetadata::clone()
|
||||
{
|
||||
LockedDoorNodeMetadata *d = new LockedDoorNodeMetadata();
|
||||
return d;
|
||||
}
|
||||
void LockedDoorNodeMetadata::serializeBody(std::ostream &os)
|
||||
{
|
||||
os<<serializeString(m_text);
|
||||
}
|
||||
std::string LockedDoorNodeMetadata::infoText()
|
||||
{
|
||||
return std::string("Locked Door owned by '")+m_text+"'";
|
||||
}
|
||||
|
||||
/*
|
||||
FurnaceNodeMetadata
|
||||
*/
|
||||
|
|
|
@ -161,25 +161,6 @@ private:
|
|||
std::string m_text;
|
||||
};
|
||||
|
||||
class LockedDoorNodeMetadata : public NodeMetadata
|
||||
{
|
||||
public:
|
||||
LockedDoorNodeMetadata();
|
||||
~LockedDoorNodeMetadata();
|
||||
|
||||
virtual u16 typeId() const;
|
||||
static NodeMetadata* create(std::istream &is);
|
||||
virtual NodeMetadata* clone();
|
||||
virtual void serializeBody(std::ostream &os);
|
||||
virtual std::string infoText();
|
||||
|
||||
virtual std::string getOwner(){ return m_text; }
|
||||
virtual void setOwner(std::string t){ m_text = t; }
|
||||
|
||||
private:
|
||||
std::string m_text;
|
||||
};
|
||||
|
||||
class FurnaceNodeMetadata : public NodeMetadata
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -2734,6 +2734,44 @@ void ServerEnvironment::step(float dtime)
|
|||
|
||||
break;
|
||||
}
|
||||
case CONTENT_STEEL_DOOR_LB_OPEN:
|
||||
case CONTENT_STEEL_W_DOOR_LB_OPEN:
|
||||
case CONTENT_STEEL_DOOR_RB_OPEN:
|
||||
case CONTENT_STEEL_W_DOOR_RB_OPEN:
|
||||
case CONTENT_STEEL_HATCH_OPEN:
|
||||
case CONTENT_STEEL_W_HATCH_OPEN:
|
||||
case CONTENT_STEEL_GATE_OPEN:
|
||||
{
|
||||
v3s16 mp(0,1,0);
|
||||
if ((n.getContent()&CONTENT_DOOR_SECT_MASK) == CONTENT_DOOR_SECT_MASK)
|
||||
mp.Y = -1;
|
||||
|
||||
MapNode m = m_map->getNodeNoEx(p+mp);
|
||||
if ((n.getContent()&CONTENT_HATCH_MASK) != CONTENT_HATCH_MASK) {
|
||||
if (m.getContent() < CONTENT_DOOR_MIN || m.getContent() > CONTENT_DOOR_MAX) {
|
||||
m_map->removeNodeWithEvent(p);
|
||||
break;
|
||||
}else{
|
||||
if ((n.getContent()&CONTENT_DOOR_OPEN_MASK) == CONTENT_DOOR_OPEN_MASK) {
|
||||
n.setContent(n.getContent()&~CONTENT_DOOR_OPEN_MASK);
|
||||
m.setContent(m.getContent()&~CONTENT_DOOR_OPEN_MASK);
|
||||
}else{
|
||||
n.setContent(n.getContent()|CONTENT_DOOR_OPEN_MASK);
|
||||
m.setContent(m.getContent()|CONTENT_DOOR_OPEN_MASK);
|
||||
}
|
||||
}
|
||||
m_map->addNodeWithEvent(p, n);
|
||||
m_map->addNodeWithEvent(p+mp, m);
|
||||
}else{
|
||||
if ((n.getContent()&CONTENT_DOOR_OPEN_MASK) == CONTENT_DOOR_OPEN_MASK) {
|
||||
n.setContent(n.getContent()&~CONTENT_DOOR_OPEN_MASK);
|
||||
}else{
|
||||
n.setContent(n.getContent()|CONTENT_DOOR_OPEN_MASK);
|
||||
}
|
||||
m_map->addNodeWithEvent(p, n);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
|
|
|
@ -2420,14 +2420,6 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
|
|||
MapNode n = m_env.getMap().getNodeNoEx(p_under);
|
||||
if (n.getContent() >= CONTENT_DOOR_MIN && n.getContent() <= CONTENT_DOOR_MAX) {
|
||||
v3s16 mp(0,1,0);
|
||||
if ((n.getContent()&CONTENT_DOOR_STEEL_MASK) == CONTENT_DOOR_STEEL_MASK) {
|
||||
NodeMetadata *meta = m_env.getMap().getNodeMetadata(p_under);
|
||||
if (meta && meta->typeId() == CONTENT_WOOD_DOOR_LT) {
|
||||
LockedDoorNodeMetadata *ldm = (LockedDoorNodeMetadata*)meta;
|
||||
if (ldm->getOwner() != player->getName())
|
||||
return;
|
||||
}
|
||||
}
|
||||
if ((n.getContent()&CONTENT_DOOR_SECT_MASK) == CONTENT_DOOR_SECT_MASK)
|
||||
mp.Y = -1;
|
||||
|
||||
|
|
Loading…
Reference in New Issue