allow opening a form from the node next to the selected node, if onact_also_affects points to it

This commit is contained in:
darkrose 2015-10-04 16:40:23 +10:00
parent ddac408b1a
commit c2a3a62461
1 changed files with 27 additions and 0 deletions

View File

@ -1826,6 +1826,33 @@ void the_game(
client.playSound(sound,0);
}
client.setFormState(true);
}else{
MapNode nn = client.getNode(nodepos);
v3s16 aa = content_features(nn).onact_also_affects;
if (aa != v3s16(0,0,0)) {
v3s16 npos = nodepos+nn.getEffectedRotation();
NodeMetadata *ameta = client.getNodeMetadata(npos);
if (ameta && ameta->getDrawSpecString(client.getLocalPlayer()) != "") {
infostream<<"Launching custom inventory view"<<std::endl;
InventoryLocation inventoryloc;
inventoryloc.setNodeMeta(nodepos);
/* Create menu */
GUIFormSpecMenu *menu = new GUIFormSpecMenu(guienv, guiroot, -1, &g_menumgr, &client);
menu->setFormSpec(ameta->getDrawSpecString(client.getLocalPlayer()), inventoryloc);
menu->setFormIO(new NodeMetadataFormIO(npos, &client));
menu->drop();
{
std::string sound = content_features(nn.getContent()).sound_access;
if (sound == "")
sound = "open-menu";
client.playSound(sound,0);
}
client.setFormState(true);
}
}
}
}
if (input->getRightClicked()) {