Skip to content

Commit

Permalink
Merge pull request #95 from Gothic-Modding-Community/vacation-patch
Browse files Browse the repository at this point in the history
General fixes July 2023
  • Loading branch information
auronen authored Aug 31, 2023
2 parents 1100c33 + 58aada3 commit 8e15b79
Show file tree
Hide file tree
Showing 14 changed files with 52 additions and 32 deletions.
1 change: 1 addition & 0 deletions .github/workflows/dev.build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:

env:
GMC_ENABLE_ON_PUBLISH: true
GMC_ONLY_DEFAULT_LANG: false
GMC_DEV_URL: 'https://auronen.cokoliv.eu/gmc/'

jobs:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/master.build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:

env:
GMC_ENABLE_ON_PUBLISH: true
GMC_ONLY_DEFAULT_LANG: false

jobs:
deploy:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/pull.request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:

env:
GMC_ENABLE_ON_PUBLISH: true
GMC_ONLY_DEFAULT_LANG: false

jobs:
deploy:
Expand Down
2 changes: 1 addition & 1 deletion docs/zengin/scripts/extenders/index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Daedalus extenders
The default scripting language Daedalus can be quite limiting. Over the years the community created quite a few extenders to, well, extend the functionality. Before Union came along, the standard to interface with the engine was the script library [Ikarus](ikarus/index.md) and a collection of packages [LeGo](lego/index.md) built on top of that. Not so recently, an additional script packet was made (and is actively being worked on) [AF Script Packet](afsp/index.md) that offers even more functionality and is built on tom of Ikarus & LeGo.
With the adoption of Union and plugins the Union system can use a new extender emerged called [zParserExtender](../../scripts/extenders/zparserextender). Other Union plugins can, of course, implement their own external functions.
With the adoption of Union and plugins the Union system can use a new extender emerged called [zParserExtender](zparserextender/index.md). Other Union plugins can, of course, implement their own external functions.
A lot of scripts are also scattered on the Gothic forums, and documentation of some of them can be found in the [Standalone](standalone/index.md) section.
2 changes: 1 addition & 1 deletion docs/zengin/scripts/extenders/index.pl.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Extendery Daedalusa
Extendery to pakiety skryptowe rozszerzające składnię Daedalusa, która może być dosyć ograniczająca. Przez lata społeczność stworzyła całkiem sporo takich extenderów. Zanim pojawił się Union, standardową metodą na interfejs z silnikiem było wykorzystanie [Ikarusa](ikarus/index.md) i zbudowanej na jego bazie kolekcji pakietów [LeGo](lego/index.md). Nie tak niedawno powstał dodatkowy pakiet skryptowy (a prace nad nim wciąż trwają) [AF Script Packet](afsp/index.md), który oferuje jeszcze więcej funkcji i jest zbudowany na bazie Ikarusa i LeGo.
Wraz z pojawieniem się Uniona i jego systemu pluginów powstał nowy extender o nazwie [zParserExtender](../../scripts/extenders/zparserextender). Oczywiście również inne pluginy mogą implementować własne funkcje zewnętrzne.
Wraz z pojawieniem się Uniona i jego systemu pluginów powstał nowy extender o nazwie [zParserExtender](zparserextender/index.md). Oczywiście również inne pluginy mogą implementować własne funkcje zewnętrzne.
Wiele skryptów jest również rozsianych po forach Gothicowych, a dokumentacje niektórych z nich można znaleźć w sekcji [Samodzielne](standalone/index.md).
4 changes: 2 additions & 2 deletions docs/zengin/tools/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ The community has developed many tools to help with the creation of Gothic mods.
- [Ninja](https://github.com/szapp/Ninja) - Ninja introduces the possibility of true modular modifications for the
video games Gothic and Gothic 2 Night of the Raven.

**[VDFS tools](../general_info/vdfs)**
**[VDFS tools](../general_info/vdfs.md)**

- [GothicVDFS](vdfs_tools/gothic_vdfs.md) - NiceDE's viewer, extractor and builder for `.vdf` and `.mod` volumes
- [VDFS Tool](vdfs_tools/vdfs_tool.md) - Gratt's Union VDFS viewer, extractor, builder, optimizer and ZIP compressor for `.vdf` and `.mod` volumes

**[World Editors](../worlds)**
**[World Editors](../worlds/index.md)**

- Spacer - the original world editor for ZenGin, ships with the MDK
- [Union Gothic World Editor](https://worldofplayers.ru/threads/42322/) - Saturas' world editor, supports new object classes created with Union
Expand Down
2 changes: 1 addition & 1 deletion docs/zengin/tools/zSpy.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
**zSpy** is a debugging tool that displays most of the operations performed by the engine during the Gothic or Spacer running.

??? example "Example image of running zSpy"
![zSpy](../../../overrides/assets/images/zSpy.png)
![zSpy](../../assets/images/zSpy.png)

!!! Warning
zSpy must be started before Gothic or the Spacer is started so that the program can find it. Sometimes in Gothic I this has to be done manually, in Gothic II This is done by the GothicStarter_mod.
Expand Down
3 changes: 2 additions & 1 deletion docs/zengin/union/sdk/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ void Game_Init() {
}
```

Now we can Build (F7) the project to create the DLL. If we have set up **Output Directory** before, the plugin will deploy directly to the game. Otherwise, we can copy it manually from `Bin` to `<GOTHIC_DIR>/System/Autorun/MyPlugin.dll`. When we launch the game, a MessageBox should appear right before the main menu: [https://i.imgur.com/JsAn8iR.png](https://i.imgur.com/JsAn8iR.png)
Now we can Build (F7) the project to create the DLL. If we have set up **Output Directory** before, the plugin will deploy directly to the game. Otherwise, we can copy it manually from `Bin` to `<GOTHIC_DIR>/System/Autorun/MyPlugin.dll`. When we launch the game, a MessageBox should appear right before the main menu:
![Union SDK MessageBox](../../../assets/images/union_sdk_getting_started_messagebox.png){ style='min-width: 0;' }

#### Couldn't build the plugin?
If you could not build the plugin or it crashed the game, you have to do some debugging and find the root cause of that. For compilation errors look at the Visual Studio **Output** tab and read the errors.
Expand Down
6 changes: 3 additions & 3 deletions docs/zengin/union/sdk/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ Working with Union SDK requires at least basic knowledge of C++ programming. Kno
## Requirements
Union SDK requires Visual Studio IDE, NET Framework 4.7.2, and Visual C++ 2010 libraries. They are available on Microsoft websites:

* Visual Studio - [https://visualstudio.microsoft.com/pl/vs/](https://visualstudio.microsoft.com/pl/vs/)
* NET Framework 4.7.2 - [https://dotnet.microsoft.com/en-us/download/dotnet-framework/net472](https://dotnet.microsoft.com/en-us/download/dotnet-framework/net472)
* Visual C++ 2010 - [https://www.microsoft.com/en-us/download/details.aspx?id=26999](https://www.microsoft.com/en-us/download/details.aspx?id=26999)
* Visual Studio - [https://visualstudio.microsoft.com/vs/](https://visualstudio.microsoft.com/vs/)
* NET Framework 4.7.2 - [https://dotnet.microsoft.com/download/dotnet-framework/net472](https://dotnet.microsoft.com/download/dotnet-framework/net472)
* Visual C++ 2010 - [https://www.microsoft.com/download/details.aspx?id=26999](https://www.microsoft.com/download/details.aspx?id=26999)

## Resource Manager
The official installation of Union SDK is provided through [Resource Manager](https://worldofplayers.ru/threads/41415/). After the installation, Visual Studio will have a new project template "Union Plugin 1.0" that creates a basic Union plugin project.
4 changes: 2 additions & 2 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ markdown_extensions:
- pymdownx.caret
- pymdownx.details
- pymdownx.highlight:
use_pygments: !ENV [GMC_ENABLE_ON_PUBLISH, False]
use_pygments: true
linenums: true
anchor_linenums: true
# This sets the same ID for the <a> and <span> tags,
Expand Down Expand Up @@ -128,7 +128,7 @@ plugins:
- assets/javascripts/extra.js
- i18n:
default_language: !ENV [GMC_DEFAULT_LANG, en]
default_language_only: !ENV [GMC_ONLY_DEFAULT_LANG, False]
default_language_only: !ENV [GMC_ONLY_DEFAULT_LANG, True]
languages:
en:
name: en - English
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 4 additions & 7 deletions overrides/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,11 @@
{{ super() }}
{% if page %}
{% if not page.meta %}
{# Set page.meta to a hacky reference of the page itself #}
{% set _ = page.__setattr__("meta", page) %}
{# Let It Snow by setting the page object attribute #}
{% set _ = page.meta.__setattr__("ᴴₒᴴₒᴴₒ", True) %}
{% else %}
{# Let It Snow by updating the dict/mapping pair #}
{% set _ = page.meta.update({"ᴴₒᴴₒᴴₒ": True}) %}
{# Set page.meta to an empty dict/mapping #}
{% set _ = page.__setattr__("meta", {}) %}
{% endif %}
{# Let It Snow by updating the dict/mapping pair #}
{% set _ = page.meta.update({"ᴴₒᴴₒᴴₒ": True}) %}
{% endif %}
{% endblock %}

Expand Down
11 changes: 6 additions & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# Core Requirements
mkdocs-material==9.1.8
mkdocs-material==9.1.21
mkdocs-git-revision-date-localized-plugin==1.2.0
mkdocs-video==1.5.0
mkdocs-redirects==1.2.0
mkdocs-minify-plugin==0.6.4
# mkdocs-static-i18n==0.53
mkdocs-redirects==1.2.1
mkdocs-minify-plugin==0.7.1
# mkdocs-static-i18n==0.56
git+https://github.com/kamilkrzyskow/i18n.git@5e286be68ad6fafed7affd44cd57d3625c0a02cc#egg=mkdocs_static_i18n
git+https://github.com/kamilkrzyskow/gothic-lexer.git@b5ee7868a7e7397cd129ff1f847daa7d39c0e416#egg=gothic_lexer
mkdocs-awesome-pages-plugin==2.9.0
mkdocs-awesome-pages-plugin==2.9.1
git+https://github.com/kamilkrzyskow/pymdownx-fork.git@47b9281e910ad225279c8a2397c6b89399463897#egg=pymdown-extensions
36 changes: 27 additions & 9 deletions tests/test_localization.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
import json
import os
import unittest

import regex

# noinspection PyPackageRequirements
import yaml

from tests.path_constants import DOCS_DIR, OVERRIDES_DIR, ROOT_DIR
from mkdocs.utils import yaml_load
from path_constants import DOCS_DIR, OVERRIDES_DIR, ROOT_DIR


class LocalizationTest(unittest.TestCase):
Expand All @@ -19,25 +19,43 @@ class LocalizationTest(unittest.TestCase):
"""

config: dict = None
current_settings: list[tuple] = None
expected_settings: dict = None

@classmethod
def setUpClass(cls) -> None:
with open(os.path.join(ROOT_DIR, "mkdocs.yml"), encoding="utf8") as file:
lines = file.readlines()
content = file.read()

# Extract the ENV options, and assert that the selected boolean variables
# are set to the correct boolean values (aka weren't changed by mistake)
cls.current_settings = regex.findall(
r"\s*(.*?):\s*!ENV\s*\[(.*?)\s*,\s*(.*?)\s*\]", content
)

# The default safe loader doesn't handle values containing !, they're not needed for localization
# for the exception of !ENV which are important
lines = [regex.sub(r"!ENV.*,\s*?(\w+)\]", r"\g<1>", line) for line in lines]
output = "\n".join([regex.sub(r"!.*", "", line) for line in lines])
cls.expected_settings = {
"GMC_ENABLE_ON_PUBLISH": False,
"GMC_ONLY_DEFAULT_LANG": True,
}

for plugin in yaml.safe_load(output)["plugins"]:
for plugin in yaml_load(content)["plugins"]:
if isinstance(plugin, dict):
cls.config = plugin.get("i18n")
if cls.config is not None:
break

def setUp(self) -> None:
self.assertIsNot(self.config, None, msg="Localization config is None")
for setting_name, envar_name, raw_value in self.current_settings:
if envar_name not in self.expected_settings:
continue
actual = eval(raw_value)
expected = self.expected_settings[envar_name]
self.assertEqual(
actual,
expected,
msg=f"Setting '{setting_name}'->{envar_name} is set to {actual} instead of {expected}",
)

def test_default(self) -> None:
"""
Expand Down

0 comments on commit 8e15b79

Please sign in to comment.