Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWereTech <17415815+WereTech@users.noreply.github.com>2025-02-23 16:31:03 -0600
committerGitHub <noreply@github.com>2025-02-23 16:31:03 -0600
commit0245e639ecc51d948f0256eb4a773d42fbb8ade5 (patch)
tree7fc9b120efda129c09e522fc08af2d28e52d3eb6
parent3108120076bad6b934c43526200f2beed4c96753 (diff)
parent5dda9f47306a6eea5eb4e676c68f81b8285d9dfe (diff)
Merge branch 'OpenStarbound:main' into main
-rw-r--r--assets/opensb/interface/windowconfig/charselection.config.patch21
-rw-r--r--assets/opensb/scripts/opensb/player/identity.lua9
-rw-r--r--source/base/StarConfiguration.cpp8
-rw-r--r--source/base/StarConfiguration.hpp4
-rw-r--r--source/frontend/StarCharSelection.cpp18
-rw-r--r--source/frontend/StarCharSelection.hpp2
-rw-r--r--source/frontend/StarClientCommandProcessor.cpp6
-rw-r--r--source/frontend/StarMainInterface.cpp25
-rw-r--r--source/frontend/StarMainInterfaceTypes.cpp3
-rw-r--r--source/frontend/StarMainInterfaceTypes.hpp3
-rw-r--r--source/windowing/StarLargeCharPlateWidget.cpp2
11 files changed, 86 insertions, 15 deletions
diff --git a/assets/opensb/interface/windowconfig/charselection.config.patch b/assets/opensb/interface/windowconfig/charselection.config.patch
index d38f03a..63a01db 100644
--- a/assets/opensb/interface/windowconfig/charselection.config.patch
+++ b/assets/opensb/interface/windowconfig/charselection.config.patch
@@ -1,4 +1,23 @@
{
+ "toggleDismissCheckbox": {
+ "type": "button",
+ "base" : "/interface/optionsmenu/checkboxnocheck.png",
+ "hover" : "/interface/optionsmenu/checkboxnocheckhover.png",
+ "baseImageChecked" : "/interface/optionsmenu/checkboxcheck.png",
+ "hoverImageChecked" : "/interface/optionsmenu/checkboxcheckhover.png",
+ "checkable" : true,
+ "checked" : false,
+ "position": [ 23, 244 ],
+ "pressedOffset": [ 0, 0 ],
+ "visible" : false
+ },
+ "toggleDismissLabel": {
+ "type" : "label",
+ "position" : [ 35, 244 ],
+ "hAnchor" : "left",
+ "value" : "DISMISS ON SWAP",
+ "visible" : false
+ },
"createCharButton": {
"type": "button",
"base": "/interface/title/createcharacter.png",
@@ -10,7 +29,7 @@
"type": "textbox",
"hint": "Search...",
"position": [ 130, 244 ],
- "maxWidth": 68
+ "maxWidth": 69
},
"clearSearch": {
"type": "button",
diff --git a/assets/opensb/scripts/opensb/player/identity.lua b/assets/opensb/scripts/opensb/player/identity.lua
index c1f8a31..5c4c403 100644
--- a/assets/opensb/scripts/opensb/player/identity.lua
+++ b/assets/opensb/scripts/opensb/player/identity.lua
@@ -33,4 +33,13 @@ commands.register("identity", function(args)
else
return "Usage: /identity <get|set> [path] [value]"
end
+end)
+
+commands.register("description", function(args)
+ if not args or args == "" then
+ return player.description()
+ else
+ player.setDescription(args)
+ return "Description set to " .. args .. ". Warp or rejoin for it to take effect."
+ end
end) \ No newline at end of file
diff --git a/source/base/StarConfiguration.cpp b/source/base/StarConfiguration.cpp
index 89ec7fa..1d888a0 100644
--- a/source/base/StarConfiguration.cpp
+++ b/source/base/StarConfiguration.cpp
@@ -21,14 +21,14 @@ String Configuration::printConfiguration() const {
return m_currentConfig.printJson(2, true);
}
-Json Configuration::get(String const& key) const {
+Json Configuration::get(String const& key, Json def) const {
MutexLocker locker(m_mutex);
- return m_currentConfig.get(key, {});
+ return m_currentConfig.get(key, def);
}
-Json Configuration::getPath(String const& path) const {
+Json Configuration::getPath(String const& path, Json def) const {
MutexLocker locker(m_mutex);
- return m_currentConfig.query(path, {});
+ return m_currentConfig.query(path, def);
}
Json Configuration::getDefault(String const& key) const {
diff --git a/source/base/StarConfiguration.hpp b/source/base/StarConfiguration.hpp
index ffa66c3..4f5d97c 100644
--- a/source/base/StarConfiguration.hpp
+++ b/source/base/StarConfiguration.hpp
@@ -18,8 +18,8 @@ public:
Json currentConfiguration() const;
String printConfiguration() const;
- Json get(String const& key) const;
- Json getPath(String const& path) const;
+ Json get(String const& key, Json def = {}) const;
+ Json getPath(String const& path, Json def = {}) const;
Json getDefault(String const& key) const;
Json getDefaultPath(String const& path) const;
diff --git a/source/frontend/StarCharSelection.cpp b/source/frontend/StarCharSelection.cpp
index 6cbfb9b..2c00b42 100644
--- a/source/frontend/StarCharSelection.cpp
+++ b/source/frontend/StarCharSelection.cpp
@@ -37,8 +37,11 @@ CharSelectionPane::CharSelectionPane(PlayerStoragePtr playerStorage,
updateCharacterPlates();
});
guiReader.registerCallback("clearSearch", [=](Widget*) {
- auto searchCharacter = fetchChild<TextBoxWidget>("searchCharacter");
- searchCharacter->setText("");
+ fetchChild<TextBoxWidget>("searchCharacter")->setText("");
+ });
+ guiReader.registerCallback("toggleDismissCheckbox", [=](Widget* widget) {
+ auto configuration = Root::singleton().configuration();
+ configuration->set("characterSwapDismisses", as<ButtonWidget>(widget)->isChecked());
});
guiReader.construct(root.assets()->json("/interface/windowconfig/charselection.config"), this);
@@ -63,6 +66,7 @@ void CharSelectionPane::show() {
Pane::show();
m_downScroll = 0;
+ fetchChild<TextBoxWidget>("searchCharacter")->setText("");
updateCharacterPlates();
}
@@ -96,14 +100,18 @@ void CharSelectionPane::updateCharacterPlates() {
if (m_filteredList.size() > 0 && scrollPosition < m_filteredList.size()) {
auto playerUuid = m_filteredList.get(scrollPosition);
if (auto player = m_playerStorage->loadPlayer(playerUuid)) {
+ charSelector->show();
player->humanoid()->setFacingDirection(Direction::Right);
charSelector->setPlayer(player);
- charSelector->enableDelete([this, playerUuid](Widget*) { m_deleteCallback(playerUuid); });
+ if (!m_readOnly)
+ charSelector->enableDelete([this, playerUuid](Widget*) { m_deleteCallback(playerUuid); });
return;
}
}
charSelector->setPlayer(PlayerPtr());
charSelector->disableDelete();
+ if (m_readOnly)
+ charSelector->hide();
};
updatePlayerLine("charSelector1", m_downScroll + 0);
@@ -122,4 +130,8 @@ void CharSelectionPane::updateCharacterPlates() {
fetchChild("playerDownButton")->hide();
}
+void CharSelectionPane::setReadOnly(bool readOnly) {
+ findChild("createCharButton")->setVisibility(!(m_readOnly = readOnly));
+}
+
}
diff --git a/source/frontend/StarCharSelection.hpp b/source/frontend/StarCharSelection.hpp
index b4837ca..eb4d906 100644
--- a/source/frontend/StarCharSelection.hpp
+++ b/source/frontend/StarCharSelection.hpp
@@ -19,6 +19,7 @@ public:
bool sendEvent(InputEvent const& event) override;
void show() override;
void updateCharacterPlates();
+ void setReadOnly(bool readOnly);
private:
void shiftCharacters(int movement);
@@ -28,6 +29,7 @@ private:
unsigned m_downScroll;
String m_search;
List<Uuid> m_filteredList;
+ bool m_readOnly = false;
CreateCharCallback m_createCallback;
SelectCharacterCallback m_selectCallback;
diff --git a/source/frontend/StarClientCommandProcessor.cpp b/source/frontend/StarClientCommandProcessor.cpp
index c19c68f..da0cbd6 100644
--- a/source/frontend/StarClientCommandProcessor.cpp
+++ b/source/frontend/StarClientCommandProcessor.cpp
@@ -426,8 +426,10 @@ String ClientCommandProcessor::upgradeShip(String const& argumentsString) {
String ClientCommandProcessor::swap(String const& argumentsString) {
auto arguments = m_parser.tokenizeToStringList(argumentsString);
- if (arguments.size() == 0)
- return "Not enough arguments to /swap";
+ if (arguments.size() == 0) {
+ m_paneManager->displayRegisteredPane(MainInterfacePanes::CharacterSwap);
+ return "";
+ }
if (m_universeClient->switchPlayer(arguments[0]))
return "Successfully swapped player";
diff --git a/source/frontend/StarMainInterface.cpp b/source/frontend/StarMainInterface.cpp
index 8468f7f..e3b1860 100644
--- a/source/frontend/StarMainInterface.cpp
+++ b/source/frontend/StarMainInterface.cpp
@@ -27,6 +27,7 @@
#include "StarCanvasWidget.hpp"
#include "StarLabelWidget.hpp"
#include "StarItemSlotWidget.hpp"
+#include "StarButtonWidget.hpp"
#include "StarPlayer.hpp"
#include "StarPlayerLog.hpp"
#include "StarMonster.hpp"
@@ -57,6 +58,7 @@
#include "StarContainerInteractor.hpp"
#include "StarChatBubbleManager.hpp"
#include "StarNpc.hpp"
+#include "StarCharSelection.hpp"
namespace Star {
@@ -168,6 +170,29 @@ MainInterface::MainInterface(UniverseClientPtr client, WorldPainterPtr painter,
planetName->addChild("planetText", m_planetText);
m_paneManager.registerPane(MainInterfacePanes::PlanetText, PaneLayer::Hud, planetName);
+ auto charSelectionMenu = make_shared<CharSelectionPane>(m_client->playerStorage(), [=]() {},
+ [=](PlayerPtr mainPlayer) {
+ m_client->switchPlayer(mainPlayer->uuid());
+ auto configuration = Root::singleton().configuration();
+ if (configuration->get("characterSwapMovesToFront", false).toBool())
+ m_client->playerStorage()->moveToFront(mainPlayer->uuid());
+ if (configuration->get("characterSwapDismisses", false).toBool())
+ m_paneManager.dismissRegisteredPane(MainInterfacePanes::CharacterSwap);
+ }, [=](Uuid) {});
+ charSelectionMenu->setReadOnly(true);
+ charSelectionMenu->setAnchor(PaneAnchor::Center);
+ charSelectionMenu->unlockPosition();
+ auto backgrounds = charSelectionMenu->getBG();
+ backgrounds.header = std::move(backgrounds.body);
+ charSelectionMenu->setBG(backgrounds);
+ charSelectionMenu->findChild("toggleDismissLabel")->setVisibility(true);
+ auto toggleDismiss = charSelectionMenu->findChild<ButtonWidget>("toggleDismissCheckbox");
+ auto configuration = Root::singleton().configuration();
+ toggleDismiss->setChecked(configuration->get("characterSwapDismisses", false).toBool());
+ toggleDismiss->setVisibility(true);
+
+ m_paneManager.registerPane(MainInterfacePanes::CharacterSwap, PaneLayer::Window, charSelectionMenu);
+
m_nameplatePainter = make_shared<NameplatePainter>();
m_questIndicatorPainter = make_shared<QuestIndicatorPainter>(m_client);
m_chatBubbleManager = make_shared<ChatBubbleManager>();
diff --git a/source/frontend/StarMainInterfaceTypes.cpp b/source/frontend/StarMainInterfaceTypes.cpp
index 957b69d..9ba23ad 100644
--- a/source/frontend/StarMainInterfaceTypes.cpp
+++ b/source/frontend/StarMainInterfaceTypes.cpp
@@ -29,7 +29,8 @@ EnumMap<MainInterfacePanes> const MainInterfacePanesNames{
{MainInterfacePanes::CraftingPlain, "CraftingPlain"},
{MainInterfacePanes::QuestTracker, "QuestTracker"},
{MainInterfacePanes::MmUpgrade, "MmUpgrade"},
- {MainInterfacePanes::Collections, "Collections"}
+ {MainInterfacePanes::Collections, "Collections"},
+ {MainInterfacePanes::CharacterSwap, "CharacterSwap"}
};
MainInterfaceConfigPtr MainInterfaceConfig::loadFromAssets() {
diff --git a/source/frontend/StarMainInterfaceTypes.hpp b/source/frontend/StarMainInterfaceTypes.hpp
index b5f228a..afa9fb2 100644
--- a/source/frontend/StarMainInterfaceTypes.hpp
+++ b/source/frontend/StarMainInterfaceTypes.hpp
@@ -34,7 +34,8 @@ enum class MainInterfacePanes {
CraftingPlain,
QuestTracker,
MmUpgrade,
- Collections
+ Collections,
+ CharacterSwap
};
extern EnumMap<MainInterfacePanes> const MainInterfacePanesNames;
diff --git a/source/windowing/StarLargeCharPlateWidget.cpp b/source/windowing/StarLargeCharPlateWidget.cpp
index 5088f73..eb6c438 100644
--- a/source/windowing/StarLargeCharPlateWidget.cpp
+++ b/source/windowing/StarLargeCharPlateWidget.cpp
@@ -171,7 +171,7 @@ void LargeCharPlateWidget::update(float dt) {
return;
auto humanoid = m_player->humanoid();
- if (m_delete->isHovered()) {
+ if (m_delete && m_delete->isHovered()) {
humanoid->setEmoteState(HumanoidEmote::Sad);
humanoid->setState(Humanoid::Run);
} else {