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

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore7
-rw-r--r--assets/opensb/interface/opensb/shaders/select.pngbin4583 -> 4514 bytes
-rw-r--r--assets/opensb/interface/opensb/shaders/selectend.pngbin4094 -> 4046 bytes
-rw-r--r--assets/opensb/interface/title/barstound.pngbin77149 -> 76361 bytes
-rw-r--r--assets/opensb/interface/title/starbound.pngbin76785 -> 75764 bytes
-rw-r--r--assets/opensb/rendering/sprites/error.pngbin145 -> 144 bytes
-rw-r--r--assets/opensb/scripts/opensb/player/commands.lua2
-rw-r--r--assets/opensb/sky/orbitals/bluestar.pngbin10007 -> 9975 bytes
-rw-r--r--assets/opensb/sky/orbitals/whitestar.pngbin10491 -> 10456 bytes
-rw-r--r--assets/opensb/sky/orbitals/yellowstar.pngbin10513 -> 10481 bytes
-rw-r--r--doc/lua/openstarbound/player.md10
-rw-r--r--source/CMakePresets.json23
-rw-r--r--source/client/StarClientApplication.cpp7
-rw-r--r--source/client/StarClientApplication.hpp2
-rw-r--r--source/core/StarLua.cpp2
-rw-r--r--source/core/StarStringView.cpp17
-rw-r--r--source/frontend/StarActionBar.cpp3
-rw-r--r--source/rendering/StarTextPainter.cpp3
18 files changed, 53 insertions, 23 deletions
diff --git a/.gitignore b/.gitignore
index eec550c..2b6ebe1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -40,12 +40,7 @@ CTestTestfile.cmake
_deps
-.vscode/*
-!.vscode/settings.json
-!.vscode/tasks.json
-!.vscode/launch.json
-!.vscode/extensions.json
-!.vscode/*.code-snippets
+.vscode/
# Local History for Visual Studio Code
.history/
diff --git a/assets/opensb/interface/opensb/shaders/select.png b/assets/opensb/interface/opensb/shaders/select.png
index dc649b4..880a270 100644
--- a/assets/opensb/interface/opensb/shaders/select.png
+++ b/assets/opensb/interface/opensb/shaders/select.png
Binary files differ
diff --git a/assets/opensb/interface/opensb/shaders/selectend.png b/assets/opensb/interface/opensb/shaders/selectend.png
index 99908d6..b524acf 100644
--- a/assets/opensb/interface/opensb/shaders/selectend.png
+++ b/assets/opensb/interface/opensb/shaders/selectend.png
Binary files differ
diff --git a/assets/opensb/interface/title/barstound.png b/assets/opensb/interface/title/barstound.png
index d6e14af..23324ab 100644
--- a/assets/opensb/interface/title/barstound.png
+++ b/assets/opensb/interface/title/barstound.png
Binary files differ
diff --git a/assets/opensb/interface/title/starbound.png b/assets/opensb/interface/title/starbound.png
index 33647cc..c650d46 100644
--- a/assets/opensb/interface/title/starbound.png
+++ b/assets/opensb/interface/title/starbound.png
Binary files differ
diff --git a/assets/opensb/rendering/sprites/error.png b/assets/opensb/rendering/sprites/error.png
index b5bd3e7..84a4a55 100644
--- a/assets/opensb/rendering/sprites/error.png
+++ b/assets/opensb/rendering/sprites/error.png
Binary files differ
diff --git a/assets/opensb/scripts/opensb/player/commands.lua b/assets/opensb/scripts/opensb/player/commands.lua
index 2d83106..0094dba 100644
--- a/assets/opensb/scripts/opensb/player/commands.lua
+++ b/assets/opensb/scripts/opensb/player/commands.lua
@@ -22,6 +22,8 @@ register("run", function(src)
return "^#f00;error: " .. result
elseif result == nil then
return nil
+ elseif type(result) == "string" then
+ return result
else
local success, printed = pcall(sb.printJson, result)
if not success then
diff --git a/assets/opensb/sky/orbitals/bluestar.png b/assets/opensb/sky/orbitals/bluestar.png
index d174138..11cd274 100644
--- a/assets/opensb/sky/orbitals/bluestar.png
+++ b/assets/opensb/sky/orbitals/bluestar.png
Binary files differ
diff --git a/assets/opensb/sky/orbitals/whitestar.png b/assets/opensb/sky/orbitals/whitestar.png
index 87e11eb..8ebafb3 100644
--- a/assets/opensb/sky/orbitals/whitestar.png
+++ b/assets/opensb/sky/orbitals/whitestar.png
Binary files differ
diff --git a/assets/opensb/sky/orbitals/yellowstar.png b/assets/opensb/sky/orbitals/yellowstar.png
index 8979000..216a63a 100644
--- a/assets/opensb/sky/orbitals/yellowstar.png
+++ b/assets/opensb/sky/orbitals/yellowstar.png
Binary files differ
diff --git a/doc/lua/openstarbound/player.md b/doc/lua/openstarbound/player.md
index a392ef9..47ec980 100644
--- a/doc/lua/openstarbound/player.md
+++ b/doc/lua/openstarbound/player.md
@@ -86,11 +86,17 @@ Sets the player's emote directives.
---
-#### `String` player.hair()
+#### `void` player.setHair(`String` hairGroup, `String` hairType, `String` hairDirectives)
+
+Sets the player's hair group, type, and directives.
+
+---
+
+#### `String` player.hairGroup()
Returns the player's hair group.
-#### `void` player.setHair(`String` hairGroup)
+#### `void` player.setHairGroup(`String` hairGroup)
Sets the player's hair group.
diff --git a/source/CMakePresets.json b/source/CMakePresets.json
index e59a78f..defd840 100644
--- a/source/CMakePresets.json
+++ b/source/CMakePresets.json
@@ -41,6 +41,12 @@
}
},
{
+ "inherits": "windows-release",
+ "name": "windows-release-VS2022",
+ "displayName": "Windows x64 (Visual Studio 2022)",
+ "generator": "Visual Studio 17 2022"
+ },
+ {
"inherits": "base",
"name": "linux-release",
"displayName": "Linux x64",
@@ -98,6 +104,20 @@
"configurePreset": "windows-release"
},
{
+ "name": "windows-debug",
+ "configurePreset": "windows-release"
+ },
+ {
+ "name": "windows-release-VS2022",
+ "configurePreset": "windows-release-VS2022",
+ "configuration": "Release"
+ },
+ {
+ "name": "windows-debug-VS2022",
+ "configurePreset": "windows-release-VS2022",
+ "configuration": "Debug"
+ },
+ {
"name": "linux-release",
"configurePreset": "linux-release"
},
@@ -120,7 +140,8 @@
{
"inherits": "base",
"name": "windows-release",
- "configurePreset": "windows-release"
+ "configurePreset": "windows-release",
+ "configuration": "Release"
},
{
"inherits": "base",
diff --git a/source/client/StarClientApplication.cpp b/source/client/StarClientApplication.cpp
index f79226e..dfe79eb 100644
--- a/source/client/StarClientApplication.cpp
+++ b/source/client/StarClientApplication.cpp
@@ -1213,12 +1213,13 @@ void ClientApplication::updateCamera(float dt) {
const float deadzone = 0.1f;
const float panFactor = 1.5f;
float cameraSpeedFactor = 30.0f / m_root->configuration()->get("cameraSpeedFactor").toFloat();
+ cameraSpeedFactor /= (dt * 60.f);
auto playerCameraPosition = m_player->cameraPosition();
if (isActionTaken(InterfaceAction::CameraShift)) {
m_snapBackCameraOffset = false;
- m_cameraOffsetDownTicks++;
+ m_cameraOffsetDownTime += dt;
Vec2F aim = m_universeClient->worldClient()->geometry().diff(m_mainInterface->cursorWorldPosition(), playerCameraPosition);
float magnitude = aim.magnitude() / (triggerRadius / camera.pixelRatio());
@@ -1234,13 +1235,13 @@ void ClientApplication::updateCamera(float dt) {
m_cameraYOffset = (m_cameraYOffset * (cameraSpeedFactor - 1.0) + cameraYOffset) / cameraSpeedFactor;
}
} else {
- if ((m_cameraOffsetDownTicks > 0) && (m_cameraOffsetDownTicks < 20))
+ if (m_cameraOffsetDownTime > 0.0f && m_cameraOffsetDownTime < 0.333333f)
m_snapBackCameraOffset = true;
if (m_snapBackCameraOffset) {
m_cameraXOffset = (m_cameraXOffset * (cameraSpeedFactor - 1.0)) / cameraSpeedFactor;
m_cameraYOffset = (m_cameraYOffset * (cameraSpeedFactor - 1.0)) / cameraSpeedFactor;
}
- m_cameraOffsetDownTicks = 0;
+ m_cameraOffsetDownTime = 0.f;
}
Vec2F newCameraPosition;
diff --git a/source/client/StarClientApplication.hpp b/source/client/StarClientApplication.hpp
index 8824ea0..5f05657 100644
--- a/source/client/StarClientApplication.hpp
+++ b/source/client/StarClientApplication.hpp
@@ -126,7 +126,7 @@ private:
float m_cameraXOffset = 0.0f;
float m_cameraYOffset = 0.0f;
bool m_snapBackCameraOffset = false;
- int m_cameraOffsetDownTicks = 0;
+ float m_cameraOffsetDownTime = 0.f;
Vec2F m_cameraPositionSmoother;
Vec2F m_cameraSmoothDelta;
int m_cameraZoomDirection = 0;
diff --git a/source/core/StarLua.cpp b/source/core/StarLua.cpp
index 201f238..b70fe59 100644
--- a/source/core/StarLua.cpp
+++ b/source/core/StarLua.cpp
@@ -319,7 +319,7 @@ LuaEnginePtr LuaEngine::create(bool safe) {
luaL_requiref(self->m_state, "os", luaopen_os, true);
if (safe) {
- StringSet osWhitelist = {"clock", "difftime", "time"};
+ StringSet osWhitelist = {"clock", "difftime", "time", "date"};
lua_pushnil(self->m_state);
while (lua_next(self->m_state, -2) != 0) {
diff --git a/source/core/StarStringView.cpp b/source/core/StarStringView.cpp
index 2bc9cd5..535d350 100644
--- a/source/core/StarStringView.cpp
+++ b/source/core/StarStringView.cpp
@@ -113,8 +113,11 @@ bool StringView::beginsWith(StringView beg, CaseSensitivity cs) const {
auto it = begin();
auto itEnd = end();
for (size_t i = 0; i != begSize; ++i)
- if (it++ == itEnd)
+ {
+ if (it == itEnd)
return false;
+ it++;
+ }
return compare(0, begSize, beg, 0, NPos, cs) == 0;
}
@@ -352,18 +355,20 @@ StringView StringView::substr(size_t position, size_t n) const {
auto it = begin();
for (size_t i = 0; i != position; ++i) {
- if (it++ == itEnd)
+ if (it == itEnd)
throw OutOfRangeException(strf("out of range in StringView::substr({}, {})", position, n));
+ it++;
}
- const char* start = &*it.base();
+ const auto itStart = it;
for (size_t i = 0; i != n; ++i) {
- if (it++ == itEnd)
- return StringView(start, &*it.base() - start - 1);
+ if (it == itEnd)
+ break;
+ ++it;
}
- return StringView(start, &*it.base() - start);
+ return StringView(&*itStart.base(), it.base() - itStart.base());
}
int StringView::compare(size_t selfOffset, size_t selfLen, StringView other,
diff --git a/source/frontend/StarActionBar.cpp b/source/frontend/StarActionBar.cpp
index 9f78626..7a850b7 100644
--- a/source/frontend/StarActionBar.cpp
+++ b/source/frontend/StarActionBar.cpp
@@ -172,7 +172,8 @@ bool ActionBar::sendEvent(InputEvent const& event) {
}
for (auto action : context()->actions(event)) {
- if (action >= InterfaceAction::InterfaceBar1 && action <= InterfaceAction::InterfaceBar6)
+ if (action >= InterfaceAction::InterfaceBar1 && action <= InterfaceAction::InterfaceBar10
+ && ((int)action - (int)InterfaceAction::InterfaceBar1) < inventory->customBarIndexes())
inventory->selectActionBarLocation((CustomBarIndex)((int)action - (int)InterfaceAction::InterfaceBar1));
if (action >= InterfaceAction::EssentialBar1 && action <= InterfaceAction::EssentialBar4)
diff --git a/source/rendering/StarTextPainter.cpp b/source/rendering/StarTextPainter.cpp
index 7fc02bc..76670ff 100644
--- a/source/rendering/StarTextPainter.cpp
+++ b/source/rendering/StarTextPainter.cpp
@@ -139,8 +139,7 @@ bool TextPainter::processWrapText(StringView text, unsigned* wrapWidth, WrapText
bool finished = true;
auto slice = [](StringView::const_iterator a, StringView::const_iterator b) -> StringView {
- const char* aPtr = &*a.base();
- return StringView(aPtr, &*b.base() - aPtr);
+ return StringView(&*a.base(), b.base() - a.base());
};
while (iterator != end) {