aboutsummaryrefslogtreecommitdiff
path: root/builtin/mainmenu/tab_settings.lua
Commit message (Expand)AuthorAge
* Fix parameter passing to gettext callPilzAdam2015-10-25
* Escape " in generated settings_translation_file.cppPilzAdam2015-10-25
* Fix setting commentsPilzAdam2015-10-24
* Don't allow games or mods to add secure. settingsPilzAdam2015-10-24
* Improve Lua settings menuPilzAdam2015-10-24
* Display sane output for empty descriptionsest312015-10-18
* New settings tab contain all possible settingsPilzAdam2015-10-17
* Add viewing range GUI settingkilbith2015-10-06
* Minor tweaks handle_settings_buttonsRui9142015-09-14
* Fix FSAA dropdown option reset after changing another dropdown optionjeanpatrick.guerrero@gmail.com2015-07-25
* Remove drivers dropdown in the settings tabkilbith2015-07-25
* Add antialiasing UI settingMark Schreiber2015-07-18
* Add new leaves style - simple (glasslike drawtype)RealBadAngel2015-07-08
* Allow filter and mipmap drop down menues to be translatedCraig Robbins2015-01-21
* Reorganize supported video driver query mechanismskwolekr2015-01-18
* Revert "Fix style on settings tab"kwolekr2015-01-18
* Fix style on settings tabjeanpatrick.guerrero@gmail.com2015-01-18
* Add missing return value for filter/mipmap dropdown in mainmenukilbith2015-01-15
* Reorganizing client and server tabsjeanpatrick.guerrero@gmail.com2015-01-15
* Remove vertlabels from main menu and relayout a bitKahrl2014-12-13
* Simplify loading of Android version of menuShadowNinja2014-11-20
* Add optional framed glasslike drawtypeBlockMen2014-10-02
* Fix wrong video_driver setting when changing in mainmenuSmallJoker2014-09-21
* Add video driver selection to settings menu (based uppon idea from webdesigne...sapier2014-08-23
* Add srollbar formspec elementsapier2014-07-16
* Add support for Android 2.3+sapier2014-06-29
* Fix bounding rect for formspec elements label vertlabel and checkboxessapier2014-06-18
* Re-add missing shaders setting. (Generate normalmaps)RealBadAngel2014-06-04
* Add formspec toolkit and refactor mainmenu to use itsapier2014-05-16
/span> Inventory *ServerInventoryManager::getInventory(const InventoryLocation &loc) { switch (loc.type) { case InventoryLocation::UNDEFINED: case InventoryLocation::CURRENT_PLAYER: break; case InventoryLocation::PLAYER: { RemotePlayer *player = m_env->getPlayer(loc.name.c_str()); if (!player) return NULL; PlayerSAO *playersao = player->getPlayerSAO(); if (!playersao) return NULL; return playersao->getInventory(); } break; case InventoryLocation::NODEMETA: { NodeMetadata *meta = m_env->getMap().getNodeMetadata(loc.p); if (!meta) return NULL; return meta->getInventory(); } break; case InventoryLocation::DETACHED: { auto it = m_detached_inventories.find(loc.name); if (it == m_detached_inventories.end()) return nullptr; return it->second.inventory; } break; default: sanity_check(false); // abort break; } return NULL; } void ServerInventoryManager::setInventoryModified(const InventoryLocation &loc) { switch (loc.type) { case InventoryLocation::UNDEFINED: break; case InventoryLocation::PLAYER: { RemotePlayer *player = m_env->getPlayer(loc.name.c_str()); if (!player) return; player->setModified(true); player->inventory.setModified(true); // Updates are sent in ServerEnvironment::step() } break; case InventoryLocation::NODEMETA: { MapEditEvent event; event.type = MEET_BLOCK_NODE_METADATA_CHANGED; event.p = loc.p; m_env->getMap().dispatchEvent(event); } break; case InventoryLocation::DETACHED: { // Updates are sent in ServerEnvironment::step() } break; default: sanity_check(false); // abort break; } } Inventory *ServerInventoryManager::createDetachedInventory( const std::string &name, IItemDefManager *idef, const std::string &player) { if (m_detached_inventories.count(name) > 0) { infostream << "Server clearing detached inventory \"" << name << "\"" << std::endl; delete m_detached_inventories[name].inventory; } else { infostream << "Server creating detached inventory \"" << name << "\"" << std::endl; } Inventory *inv = new Inventory(idef); sanity_check(inv); m_detached_inventories[name].inventory = inv; if (!player.empty()) { m_detached_inventories[name].owner = player; if (!m_env) return inv; // Mods are not loaded yet, ignore RemotePlayer *p = m_env->getPlayer(name.c_str()); // if player is connected, send him the inventory if (p && p->getPeerId() != PEER_ID_INEXISTENT) { m_env->getGameDef()->sendDetachedInventory( inv, name, p->getPeerId()); } } else { if (!m_env) return inv; // Mods are not loaded yet, don't send // Inventory is for everybody, broadcast m_env->getGameDef()->sendDetachedInventory(inv, name, PEER_ID_INEXISTENT); } return inv; } bool ServerInventoryManager::removeDetachedInventory(const std::string &name) { const auto &inv_it = m_detached_inventories.find(name); if (inv_it == m_detached_inventories.end()) return false; delete inv_it->second.inventory; const std::string &owner = inv_it->second.owner; if (!owner.empty()) { RemotePlayer *player = m_env->getPlayer(owner.c_str()); if (player && player->getPeerId() != PEER_ID_INEXISTENT) m_env->getGameDef()->sendDetachedInventory( nullptr, name, player->getPeerId()); } else { // Notify all players about the change m_env->getGameDef()->sendDetachedInventory( nullptr, name, PEER_ID_INEXISTENT); } m_detached_inventories.erase(inv_it); return true; } void ServerInventoryManager::sendDetachedInventories(const std::string &peer_name, bool incremental, std::function<void(const std::string &, Inventory *)> apply_cb) { for (const auto &detached_inventory : m_detached_inventories) { const DetachedInventory &dinv = detached_inventory.second; if (incremental) { if (!dinv.inventory || !dinv.inventory->checkModified()) continue; } // if we are pushing inventories to a specific player // we should filter to send only the right inventories if (!peer_name.empty()) { const std::string &attached_player = dinv.owner; if (!attached_player.empty() && peer_name != attached_player) continue; } apply_cb(detached_inventory.first, detached_inventory.second.inventory); } }