forked from oerkki/voxelands
piston tweaks
This commit is contained in:
parent
b300923e6c
commit
8521a207a9
|
@ -3528,9 +3528,7 @@ bool PistonNodeMetadata::extend(v3s16 pos, v3s16 dir, content_t arm, MapNode pis
|
|||
v3s16 p_prev = pos;
|
||||
v3s16 p_cur = p_prev+dir;
|
||||
v3s16 p_next = p_cur+dir;
|
||||
core::map<v3s16,MapBlock*> modified_blocks;
|
||||
std::string st("");
|
||||
env->getMap().addNodeAndUpdate(pos,piston,modified_blocks,st);
|
||||
env->getMap().addNodeWithEvent(pos,piston);
|
||||
|
||||
if (arm == CONTENT_CIRCUIT_PISTON_ARM || arm == CONTENT_CIRCUIT_STICKYPISTON_ARM)
|
||||
n_prev = env->getMap().getNodeNoEx(p_prev);
|
||||
|
@ -3539,7 +3537,7 @@ bool PistonNodeMetadata::extend(v3s16 pos, v3s16 dir, content_t arm, MapNode pis
|
|||
for (int i=0; i<17; i++) {
|
||||
ContentFeatures &f = content_features(n_cur);
|
||||
n_next = env->getMap().getNodeNoEx(p_next);
|
||||
env->getMap().addNodeAndUpdate(p_cur,n_prev,modified_blocks,st);
|
||||
env->getMap().addNodeWithEvent(p_cur,n_prev);
|
||||
if (f.pressure_type == CST_CRUSHED)
|
||||
break;
|
||||
if (f.pressure_type == CST_CRUSHABLE && n_next.getContent() != CONTENT_AIR)
|
||||
|
@ -3551,24 +3549,14 @@ bool PistonNodeMetadata::extend(v3s16 pos, v3s16 dir, content_t arm, MapNode pis
|
|||
p_next += dir;
|
||||
}
|
||||
|
||||
MapEditEvent event;
|
||||
event.type = MEET_OTHER;
|
||||
for (core::map<v3s16, MapBlock*>::Iterator i = modified_blocks.getIterator(); i.atEnd() == false; i++) {
|
||||
v3s16 p = i->getKey();
|
||||
event.modified_blocks.insert(p, true);
|
||||
}
|
||||
env->getMap().dispatchEvent(&event);
|
||||
|
||||
return true;
|
||||
}
|
||||
bool PistonNodeMetadata::contract(v3s16 pos, v3s16 dir, bool sticky, MapNode piston, ServerEnvironment *env)
|
||||
{
|
||||
bool dropping = false;
|
||||
env->addEnvEvent(ENV_EVENT_SOUND,intToFloat(pos,BS),"env-piston");
|
||||
core::map<v3s16,MapBlock*> modified_blocks;
|
||||
std::string st("");
|
||||
env->getMap().addNodeAndUpdate(pos,piston,modified_blocks,st);
|
||||
env->getMap().removeNodeAndUpdate(pos+dir,modified_blocks);
|
||||
env->getMap().addNodeWithEvent(pos,piston);
|
||||
env->getMap().removeNodeWithEvent(pos+dir);
|
||||
if (dir.Y == 1)
|
||||
dropping = true;
|
||||
if (sticky || dropping) {
|
||||
|
@ -3624,8 +3612,8 @@ bool PistonNodeMetadata::contract(v3s16 pos, v3s16 dir, bool sticky, MapNode pis
|
|||
break;
|
||||
if ((!sticky || i) && f.pressure_type != CST_DROPABLE)
|
||||
break;
|
||||
env->getMap().removeNodeAndUpdate(p_next,modified_blocks);
|
||||
env->getMap().addNodeAndUpdate(p_cur,n,modified_blocks,st);
|
||||
env->getMap().removeNodeWithEvent(p_next);
|
||||
env->getMap().addNodeWithEvent(p_cur,n);
|
||||
if (!dropping)
|
||||
break;
|
||||
p_cur = p_next;
|
||||
|
@ -3634,13 +3622,5 @@ bool PistonNodeMetadata::contract(v3s16 pos, v3s16 dir, bool sticky, MapNode pis
|
|||
}
|
||||
}
|
||||
|
||||
MapEditEvent event;
|
||||
event.type = MEET_OTHER;
|
||||
for (core::map<v3s16, MapBlock*>::Iterator i = modified_blocks.getIterator(); i.atEnd() == false; i++) {
|
||||
v3s16 p = i->getKey();
|
||||
event.modified_blocks.insert(p, true);
|
||||
}
|
||||
env->getMap().dispatchEvent(&event);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -49,7 +49,6 @@ GUIDeathScreen::GUIDeathScreen(gui::IGUIEnvironment* env,
|
|||
GUIDeathScreen::~GUIDeathScreen()
|
||||
{
|
||||
removeChildren();
|
||||
m_menumgr->deletingMenu(this);
|
||||
delete m_respawner;
|
||||
}
|
||||
|
||||
|
|
|
@ -115,7 +115,6 @@ GUIFormSpecMenu::GUIFormSpecMenu(gui::IGUIEnvironment* env,
|
|||
GUIFormSpecMenu::~GUIFormSpecMenu()
|
||||
{
|
||||
removeChildren();
|
||||
m_menumgr->deletingMenu(this);
|
||||
|
||||
delete m_selected_item;
|
||||
delete m_form_io;
|
||||
|
|
|
@ -49,7 +49,6 @@ GUIKeyChangeMenu::GUIKeyChangeMenu(gui::IGUIEnvironment* env,
|
|||
GUIKeyChangeMenu::~GUIKeyChangeMenu()
|
||||
{
|
||||
removeChildren();
|
||||
m_menumgr->deletingMenu(this);
|
||||
}
|
||||
|
||||
void GUIKeyChangeMenu::removeChildren()
|
||||
|
|
|
@ -66,7 +66,6 @@ GUIMainMenu::GUIMainMenu(gui::IGUIEnvironment* env,
|
|||
GUIMainMenu::~GUIMainMenu()
|
||||
{
|
||||
removeChildren();
|
||||
m_menumgr->deletingMenu(this);
|
||||
}
|
||||
|
||||
void GUIMainMenu::removeChildren()
|
||||
|
|
|
@ -50,7 +50,6 @@ GUIMessageMenu::GUIMessageMenu(gui::IGUIEnvironment* env,
|
|||
GUIMessageMenu::~GUIMessageMenu()
|
||||
{
|
||||
removeChildren();
|
||||
m_menumgr->deletingMenu(this);
|
||||
}
|
||||
|
||||
void GUIMessageMenu::removeChildren()
|
||||
|
|
|
@ -58,7 +58,6 @@ GUIPasswordChange::GUIPasswordChange(gui::IGUIEnvironment* env,
|
|||
GUIPasswordChange::~GUIPasswordChange()
|
||||
{
|
||||
removeChildren();
|
||||
m_menumgr->deletingMenu(this);
|
||||
}
|
||||
|
||||
void GUIPasswordChange::removeChildren()
|
||||
|
|
|
@ -50,7 +50,6 @@ GUIPauseMenu::GUIPauseMenu(gui::IGUIEnvironment* env,
|
|||
GUIPauseMenu::~GUIPauseMenu()
|
||||
{
|
||||
removeChildren();
|
||||
m_menumgr->deletingMenu(this);
|
||||
}
|
||||
|
||||
void GUIPauseMenu::removeChildren()
|
||||
|
|
|
@ -55,7 +55,6 @@ GUITextInputMenu::~GUITextInputMenu()
|
|||
if (m_io)
|
||||
delete m_io;
|
||||
removeChildren();
|
||||
m_menumgr->deletingMenu(this);
|
||||
}
|
||||
|
||||
void GUITextInputMenu::removeChildren()
|
||||
|
|
Loading…
Reference in New Issue