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_prev = pos;
|
||||||
v3s16 p_cur = p_prev+dir;
|
v3s16 p_cur = p_prev+dir;
|
||||||
v3s16 p_next = p_cur+dir;
|
v3s16 p_next = p_cur+dir;
|
||||||
core::map<v3s16,MapBlock*> modified_blocks;
|
env->getMap().addNodeWithEvent(pos,piston);
|
||||||
std::string st("");
|
|
||||||
env->getMap().addNodeAndUpdate(pos,piston,modified_blocks,st);
|
|
||||||
|
|
||||||
if (arm == CONTENT_CIRCUIT_PISTON_ARM || arm == CONTENT_CIRCUIT_STICKYPISTON_ARM)
|
if (arm == CONTENT_CIRCUIT_PISTON_ARM || arm == CONTENT_CIRCUIT_STICKYPISTON_ARM)
|
||||||
n_prev = env->getMap().getNodeNoEx(p_prev);
|
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++) {
|
for (int i=0; i<17; i++) {
|
||||||
ContentFeatures &f = content_features(n_cur);
|
ContentFeatures &f = content_features(n_cur);
|
||||||
n_next = env->getMap().getNodeNoEx(p_next);
|
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)
|
if (f.pressure_type == CST_CRUSHED)
|
||||||
break;
|
break;
|
||||||
if (f.pressure_type == CST_CRUSHABLE && n_next.getContent() != CONTENT_AIR)
|
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;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
bool PistonNodeMetadata::contract(v3s16 pos, v3s16 dir, bool sticky, MapNode piston, ServerEnvironment *env)
|
bool PistonNodeMetadata::contract(v3s16 pos, v3s16 dir, bool sticky, MapNode piston, ServerEnvironment *env)
|
||||||
{
|
{
|
||||||
bool dropping = false;
|
bool dropping = false;
|
||||||
env->addEnvEvent(ENV_EVENT_SOUND,intToFloat(pos,BS),"env-piston");
|
env->addEnvEvent(ENV_EVENT_SOUND,intToFloat(pos,BS),"env-piston");
|
||||||
core::map<v3s16,MapBlock*> modified_blocks;
|
env->getMap().addNodeWithEvent(pos,piston);
|
||||||
std::string st("");
|
env->getMap().removeNodeWithEvent(pos+dir);
|
||||||
env->getMap().addNodeAndUpdate(pos,piston,modified_blocks,st);
|
|
||||||
env->getMap().removeNodeAndUpdate(pos+dir,modified_blocks);
|
|
||||||
if (dir.Y == 1)
|
if (dir.Y == 1)
|
||||||
dropping = true;
|
dropping = true;
|
||||||
if (sticky || dropping) {
|
if (sticky || dropping) {
|
||||||
|
@ -3624,8 +3612,8 @@ bool PistonNodeMetadata::contract(v3s16 pos, v3s16 dir, bool sticky, MapNode pis
|
||||||
break;
|
break;
|
||||||
if ((!sticky || i) && f.pressure_type != CST_DROPABLE)
|
if ((!sticky || i) && f.pressure_type != CST_DROPABLE)
|
||||||
break;
|
break;
|
||||||
env->getMap().removeNodeAndUpdate(p_next,modified_blocks);
|
env->getMap().removeNodeWithEvent(p_next);
|
||||||
env->getMap().addNodeAndUpdate(p_cur,n,modified_blocks,st);
|
env->getMap().addNodeWithEvent(p_cur,n);
|
||||||
if (!dropping)
|
if (!dropping)
|
||||||
break;
|
break;
|
||||||
p_cur = p_next;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,6 @@ GUIDeathScreen::GUIDeathScreen(gui::IGUIEnvironment* env,
|
||||||
GUIDeathScreen::~GUIDeathScreen()
|
GUIDeathScreen::~GUIDeathScreen()
|
||||||
{
|
{
|
||||||
removeChildren();
|
removeChildren();
|
||||||
m_menumgr->deletingMenu(this);
|
|
||||||
delete m_respawner;
|
delete m_respawner;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -115,7 +115,6 @@ GUIFormSpecMenu::GUIFormSpecMenu(gui::IGUIEnvironment* env,
|
||||||
GUIFormSpecMenu::~GUIFormSpecMenu()
|
GUIFormSpecMenu::~GUIFormSpecMenu()
|
||||||
{
|
{
|
||||||
removeChildren();
|
removeChildren();
|
||||||
m_menumgr->deletingMenu(this);
|
|
||||||
|
|
||||||
delete m_selected_item;
|
delete m_selected_item;
|
||||||
delete m_form_io;
|
delete m_form_io;
|
||||||
|
|
|
@ -49,7 +49,6 @@ GUIKeyChangeMenu::GUIKeyChangeMenu(gui::IGUIEnvironment* env,
|
||||||
GUIKeyChangeMenu::~GUIKeyChangeMenu()
|
GUIKeyChangeMenu::~GUIKeyChangeMenu()
|
||||||
{
|
{
|
||||||
removeChildren();
|
removeChildren();
|
||||||
m_menumgr->deletingMenu(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUIKeyChangeMenu::removeChildren()
|
void GUIKeyChangeMenu::removeChildren()
|
||||||
|
|
|
@ -66,7 +66,6 @@ GUIMainMenu::GUIMainMenu(gui::IGUIEnvironment* env,
|
||||||
GUIMainMenu::~GUIMainMenu()
|
GUIMainMenu::~GUIMainMenu()
|
||||||
{
|
{
|
||||||
removeChildren();
|
removeChildren();
|
||||||
m_menumgr->deletingMenu(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUIMainMenu::removeChildren()
|
void GUIMainMenu::removeChildren()
|
||||||
|
|
|
@ -50,7 +50,6 @@ GUIMessageMenu::GUIMessageMenu(gui::IGUIEnvironment* env,
|
||||||
GUIMessageMenu::~GUIMessageMenu()
|
GUIMessageMenu::~GUIMessageMenu()
|
||||||
{
|
{
|
||||||
removeChildren();
|
removeChildren();
|
||||||
m_menumgr->deletingMenu(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUIMessageMenu::removeChildren()
|
void GUIMessageMenu::removeChildren()
|
||||||
|
|
|
@ -58,7 +58,6 @@ GUIPasswordChange::GUIPasswordChange(gui::IGUIEnvironment* env,
|
||||||
GUIPasswordChange::~GUIPasswordChange()
|
GUIPasswordChange::~GUIPasswordChange()
|
||||||
{
|
{
|
||||||
removeChildren();
|
removeChildren();
|
||||||
m_menumgr->deletingMenu(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUIPasswordChange::removeChildren()
|
void GUIPasswordChange::removeChildren()
|
||||||
|
|
|
@ -50,7 +50,6 @@ GUIPauseMenu::GUIPauseMenu(gui::IGUIEnvironment* env,
|
||||||
GUIPauseMenu::~GUIPauseMenu()
|
GUIPauseMenu::~GUIPauseMenu()
|
||||||
{
|
{
|
||||||
removeChildren();
|
removeChildren();
|
||||||
m_menumgr->deletingMenu(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUIPauseMenu::removeChildren()
|
void GUIPauseMenu::removeChildren()
|
||||||
|
|
|
@ -55,7 +55,6 @@ GUITextInputMenu::~GUITextInputMenu()
|
||||||
if (m_io)
|
if (m_io)
|
||||||
delete m_io;
|
delete m_io;
|
||||||
removeChildren();
|
removeChildren();
|
||||||
m_menumgr->deletingMenu(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUITextInputMenu::removeChildren()
|
void GUITextInputMenu::removeChildren()
|
||||||
|
|
Loading…
Reference in New Issue