diff --git a/.github/workflows/appimage.yml b/.github/workflows/appimage.yml
index d38d39b23..8f959eea8 100644
--- a/.github/workflows/appimage.yml
+++ b/.github/workflows/appimage.yml
@@ -11,6 +11,11 @@ on:
required: true
type: string
description: 'Build name passed as VC_BUILD_NAME define'
+ version_patch:
+ required: false
+ type: string
+ default: ''
+ description: 'Engine version patch number passed as VC_VERSION_PATCH define'
jobs:
build-appimage:
@@ -36,7 +41,7 @@ jobs:
sudo ln -s /usr/lib/x86_64-linux-gnu/libluajit-5.1.a /usr/lib/x86_64-linux-gnu/liblua5.1.a
sudo ln -s /usr/include/luajit-2.1 /usr/include/lua
- name: Configure
- run: cmake -S . -B build -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -DCMAKE_BUILD_TYPE=Release -DVOXELENGINE_BUILD_APPDIR=1 -DVOXELENGINE_BUILD_TESTS=ON -DVC_BUILD_NAME="${{ inputs.build_name }}"
+ run: cmake -S . -B build -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -DCMAKE_BUILD_TYPE=Release -DVOXELENGINE_BUILD_APPDIR=1 -DVOXELENGINE_BUILD_TESTS=ON -DVC_BUILD_NAME="${{ inputs.build_name }}" -DVC_VERSION_PATCH="${{ inputs.version_patch }}"
- name: Build
run: cmake --build build -t install
- name: Run tests
diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml
index 081ba662a..60bf1c628 100644
--- a/.github/workflows/macos.yml
+++ b/.github/workflows/macos.yml
@@ -11,6 +11,11 @@ on:
required: true
type: string
description: 'Build name passed as VC_BUILD_NAME define'
+ version_patch:
+ required: false
+ type: string
+ default: ''
+ description: 'Engine version patch number passed as VC_VERSION_PATCH define'
jobs:
build-dmg:
@@ -29,7 +34,7 @@ jobs:
run: |
cmake -DOPENAL_INCLUDE_DIR=$(brew --prefix openal-soft)/include \
-DOPENAL_LIBRARY=$(brew --prefix openal-soft)/lib/libopenal.dylib \
- -S . -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo -DVOXELENGINE_BUILD_TESTS=ON -DVOXELENGINE_BUILD_APPDIR=1 -DVC_BUILD_NAME="${{ inputs.build_name }}"
+ -S . -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo -DVOXELENGINE_BUILD_TESTS=ON -DVOXELENGINE_BUILD_APPDIR=1 -DVC_BUILD_NAME="${{ inputs.build_name }}" -DVC_VERSION_PATCH="${{ inputs.version_patch }}"
- name: Build
run: |
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index f6b539ba1..78250be9b 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -13,24 +13,32 @@ jobs:
prepare:
runs-on: ubuntu-latest
steps:
- - run: echo "exists just for outputs"
+ - id: version
+ run: |
+ if [[ "$RELEASE_VERSION" =~ ^[0-9]+\.[0-9]+\.([0-9]+) ]]; then
+ echo "patch=${BASH_REMATCH[1]}" >> "$GITHUB_OUTPUT"
+ fi
outputs:
build_name: '${{ env.RELEASE_VERSION }}'
+ version_patch: '${{ steps.version.outputs.patch }}'
build_linux:
needs: [prepare]
uses: ./.github/workflows/appimage.yml
with:
build_name: '${{ needs.prepare.outputs.build_name }}'
+ version_patch: '${{ needs.prepare.outputs.version_patch }}'
build_macos:
needs: [prepare]
uses: ./.github/workflows/macos.yml
with:
build_name: '${{ needs.prepare.outputs.build_name }}'
+ version_patch: '${{ needs.prepare.outputs.version_patch }}'
build_windows:
needs: [prepare]
uses: ./.github/workflows/windows-clang.yml
with:
build_name: '${{ needs.prepare.outputs.build_name }}'
+ version_patch: '${{ needs.prepare.outputs.version_patch }}'
publish_release:
runs-on: ubuntu-latest
needs: [build_linux, build_macos, build_windows]
diff --git a/.github/workflows/windows-clang.yml b/.github/workflows/windows-clang.yml
index 1fe591ac8..d8fd69677 100644
--- a/.github/workflows/windows-clang.yml
+++ b/.github/workflows/windows-clang.yml
@@ -11,6 +11,11 @@ on:
required: true
type: string
description: 'Build name passed as VC_BUILD_NAME define'
+ version_patch:
+ required: false
+ type: string
+ default: ''
+ description: 'Engine version patch number passed as VC_VERSION_PATCH define'
jobs:
build-windows:
@@ -53,7 +58,7 @@ jobs:
export VCPKG_ROOT=$(pwd)/vcpkg
mkdir build
cd build
- cmake -G "MinGW Makefiles" -DVCPKG_TARGET_TRIPLET=x64-mingw-static -DVC_BUILD_NAME="${{ inputs.build_name }}" -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=./vcpkg/scripts/buildsystems/vcpkg.cmake ..
+ cmake -G "MinGW Makefiles" -DVCPKG_TARGET_TRIPLET=x64-mingw-static -DVC_BUILD_NAME="${{ inputs.build_name }}" -DVC_VERSION_PATCH="${{ inputs.version_patch }}" -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=./vcpkg/scripts/buildsystems/vcpkg.cmake ..
cmake --build . --config Release
- name: Package for Windows
run: |
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8d93b56a4..4e44e8532 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -12,6 +12,14 @@ option(VOXELENGINE_BUILD_TESTS "Build tests" OFF)
add_compile_definitions(VC_BUILD_NAME="${VC_BUILD_NAME}")
+set(VC_VERSION_PATCH "" CACHE STRING "Engine version patch number")
+if(NOT VC_VERSION_PATCH STREQUAL "")
+ if(NOT VC_VERSION_PATCH MATCHES "^[0-9]+$")
+ message(FATAL_ERROR "invalid VC_VERSION_PATCH: '${VC_VERSION_PATCH}'")
+ endif()
+ add_compile_definitions(VC_VERSION_PATCH=${VC_VERSION_PATCH})
+endif()
+
# Need for static compilation on Windows with MSVC clang TODO: Make single build
# on Windows to avoid dependence on combinations of platforms and compilers and
# make it independent
diff --git a/dev/tests/client/creating_new_world.lua b/dev/tests/client/creating_new_world.lua
new file mode 100644
index 000000000..7f2667b77
--- /dev/null
+++ b/dev/tests/client/creating_new_world.lua
@@ -0,0 +1,40 @@
+app.tick()
+app.set_setting("ui.language", "en_US")
+
+local main_page = Document.new("core:pages/main")
+test.click(main_page.worlds_btn)
+
+local worlds_page = Document.new("core:pages/worlds")
+test.click(worlds_page.new_world_btn)
+
+local page = Document.new("core:pages/new_world")
+local world_name = "test-"..random.uuid()
+test.fill(page.name_box, world_name)
+test.fill(page.seed_box, "randomseed")
+test.click(page.generator_btn)
+
+local generators_page = Document.new("core:pages/generators")
+test.click(test.find_by_text(generators_page.root, "Flat_grass"))
+
+local new_world_page = Document.new("core:pages/new_world")
+test.click(new_world_page.create_world_btn)
+
+app.sleep_until(function() return gui.root["hud.hotbar"].exists end)
+
+test.press("escape")
+local pause_page = Document.new("core:pages/pause")
+test.click(pause_page.quit_btn)
+
+test.click(main_page.worlds_btn)
+
+local world_button = test.find_by_text(worlds_page.root, world_name).parent
+local delete_button = test.find_by_attr(world_button, "src", "gui/delete_icon")
+test.click(delete_button)
+
+assert(test.find_by_text(
+ gui.root.root, string.format("Do you want to delete world forever? (user:worlds/%s)", world_name)
+), "World deletion confirm dialog not shown")
+
+test.press("enter")
+
+assert(not world_button.exists, "World still shown in worlds list after deletion")
diff --git a/doc/en/scripting/builtins/libapp.md b/doc/en/scripting/builtins/libapp.md
index 018350b2e..a3eec7986 100644
--- a/doc/en/scripting/builtins/libapp.md
+++ b/doc/en/scripting/builtins/libapp.md
@@ -119,7 +119,8 @@ app.close_world(
```lua
-- Returns the major and minor versions of the engine.
-app.get_version() -> int, int
+-- If a patch number is available, it also returns it.
+app.get_version() -> int, int, int | nil
-- Returns the value of a setting.
-- Throws an exception if the setting does not exist.
diff --git a/doc/ru/scripting/builtins/libapp.md b/doc/ru/scripting/builtins/libapp.md
index 2cfd7f2fa..bb6490835 100644
--- a/doc/ru/scripting/builtins/libapp.md
+++ b/doc/ru/scripting/builtins/libapp.md
@@ -116,7 +116,8 @@ app.close_world(
```lua
-- Возвращает мажорную и минорную версии движка.
-app.get_version() -> int, int
+-- При наличии номера патча возвращает и его.
+app.get_version() -> int, int, int | nil
-- Возвращает значение настройки.
-- Бросает исключение, если настройки не существует.
diff --git a/res/layouts/pages/main.xml b/res/layouts/pages/main.xml
index b05ac7158..66f6793b2 100644
--- a/res/layouts/pages/main.xml
+++ b/res/layouts/pages/main.xml
@@ -1,5 +1,5 @@
-
+
diff --git a/res/layouts/pages/new_world.xml b/res/layouts/pages/new_world.xml
index fc13d5084..1bfc625c4 100644
--- a/res/layouts/pages/new_world.xml
+++ b/res/layouts/pages/new_world.xml
@@ -7,11 +7,11 @@
-
diff --git a/res/layouts/pages/worlds.xml b/res/layouts/pages/worlds.xml
index 34fe3400c..f28ffe572 100644
--- a/res/layouts/pages/worlds.xml
+++ b/res/layouts/pages/worlds.xml
@@ -1,5 +1,5 @@
- @New World
+ @New World
diff --git a/res/scripts/components/pathfinding.lua b/res/scripts/components/pathfinding.lua
index beba84f50..e98fb3c80 100644
--- a/res/scripts/components/pathfinding.lua
+++ b/res/scripts/components/pathfinding.lua
@@ -47,6 +47,25 @@ function next_waypoint()
return route[#route]
end
+local function is_passed(waypoint, next_point, pos)
+ local wx, wz = waypoint[1] + 0.5, waypoint[3] + 0.5
+ local dx, dz = pos[1] - wx, pos[3] - wz
+ if dx * dx + dz * dz > 2.25 then
+ return false
+ end
+ return dx * (next_point[1] + 0.5 - wx) + dz * (next_point[3] + 0.5 - wz) > 0
+end
+
+local function drop_passed_waypoints(new_route)
+ table.remove(new_route, #new_route)
+ local pos = tsf:get_pos()
+ while #new_route >= 2 and
+ is_passed(new_route[#new_route], new_route[#new_route - 1], pos) do
+ table.remove(new_route, #new_route)
+ end
+ return new_route
+end
+
local refresh_internal = 100
local frameid = math.random(0, refresh_internal)
@@ -66,7 +85,7 @@ function on_update()
else
local new_route = pathfinding.pull_route(agent)
if new_route then
- route = new_route
+ route = drop_passed_waypoints(new_route)
started = false
end
end
diff --git a/src/constants.hpp b/src/constants.hpp
index 4cc29bbdf..259e5f8e7 100644
--- a/src/constants.hpp
+++ b/src/constants.hpp
@@ -7,6 +7,11 @@
inline constexpr int ENGINE_VERSION_MAJOR = 0;
inline constexpr int ENGINE_VERSION_MINOR = 33;
+#ifdef VC_VERSION_PATCH
+inline constexpr int ENGINE_VERSION_PATCH = VC_VERSION_PATCH;
+#else
+inline constexpr int ENGINE_VERSION_PATCH = 0;
+#endif
#ifdef NDEBUG
inline constexpr bool ENGINE_DEBUG_BUILD = false;
@@ -14,7 +19,13 @@ inline constexpr bool ENGINE_DEBUG_BUILD = false;
inline constexpr bool ENGINE_DEBUG_BUILD = true;
#endif // NDEBUG
-inline const std::string ENGINE_VERSION_STRING = "0.33";
+inline const std::string ENGINE_VERSION_STRING =
+ std::to_string(ENGINE_VERSION_MAJOR) + "." +
+ std::to_string(ENGINE_VERSION_MINOR)
+#ifdef VC_VERSION_PATCH
+ + "." + std::to_string(ENGINE_VERSION_PATCH)
+#endif
+ ;
inline constexpr uint MAX_SUBPROCESSES = 1;
inline constexpr uint MAX_SUBPROCESS_DEPTH = 2;
diff --git a/src/engine/WindowControl.cpp b/src/engine/WindowControl.cpp
index 5a14c02ba..c3d7be4a9 100644
--- a/src/engine/WindowControl.cpp
+++ b/src/engine/WindowControl.cpp
@@ -42,8 +42,7 @@ WindowControl::Result WindowControl::initialize() {
#endif
title += "VoxelCore v";
if (buildName.empty()) {
- title += std::to_string(ENGINE_VERSION_MAJOR) + "." +
- std::to_string(ENGINE_VERSION_MINOR);
+ title += ENGINE_VERSION_STRING;
} else {
title += buildName;
}
diff --git a/src/logic/scripting/lua/libs/libapp.cpp b/src/logic/scripting/lua/libs/libapp.cpp
index 243c9a154..d8a63c720 100644
--- a/src/logic/scripting/lua/libs/libapp.cpp
+++ b/src/logic/scripting/lua/libs/libapp.cpp
@@ -328,10 +328,15 @@ static int l_delete_world(lua::State* L) {
}
/// @brief Get engine version
-/// @return major, minor
+/// @return major, minor, [patch]
static int l_get_version(lua::State* L) {
return lua::pushvec_stack(
- L, glm::vec2(ENGINE_VERSION_MAJOR, ENGINE_VERSION_MINOR)
+ L,
+#ifdef VC_VERSION_PATCH
+ glm::vec3(ENGINE_VERSION_MAJOR, ENGINE_VERSION_MINOR, ENGINE_VERSION_PATCH)
+#else
+ glm::vec2(ENGINE_VERSION_MAJOR, ENGINE_VERSION_MINOR)
+#endif
);
}