From fdfafd06e72b0f7eaa4254265bc9d88a9eb3383f Mon Sep 17 00:00:00 2001 From: Morb <14136326+Morb0@users.noreply.github.com> Date: Sat, 18 Feb 2023 23:49:55 -0800 Subject: [PATCH] Add evil twin + Secrets (#823) --- .github/workflows/publish.yml | 2 ++ .github/workflows/test-packaging.yml | 14 +++++++++++++ .github/workflows/validate-rgas.yml | 13 ++++++++++++ .github/workflows/validate-rsis.yml | 13 ++++++++++++ .github/workflows/validate_mapfiles.yml | 13 ++++++++++++ .gitignore | 4 ++++ .gitmodules | 7 ++++++- .../prototypes/roles/antags.ftl | 2 ++ .../station-events/events/evil-twin.ftl | 14 +++++++++++++ .../game-presets/preset-traitor.ftl | 6 +++--- Secrets | 1 + Tools/package_client_build.py | 1 + Tools/package_server_build.py | 20 ++++++++++++++++++- Tools/setup_secrets.ps1 | 2 ++ 14 files changed, 107 insertions(+), 5 deletions(-) create mode 100644 Resources/Locale/ru-RU/corvax-secrets/prototypes/roles/antags.ftl create mode 100644 Resources/Locale/ru-RU/corvax-secrets/station-events/events/evil-twin.ftl create mode 160000 Secrets create mode 100644 Tools/setup_secrets.ps1 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 263e8bf721c..cd088ba34b7 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -16,6 +16,8 @@ jobs: - uses: actions/checkout@v2 with: submodules: 'recursive' + ssh-key: ${{ secrets.SECRETS_PRIVATE_KEY }} + - name: Setup .NET Core uses: actions/setup-dotnet@v3 with: diff --git a/.github/workflows/test-packaging.yml b/.github/workflows/test-packaging.yml index 0dc33982b75..8bfa95d696b 100644 --- a/.github/workflows/test-packaging.yml +++ b/.github/workflows/test-packaging.yml @@ -46,6 +46,20 @@ jobs: run: | cd RobustToolbox/ git submodule update --init --recursive + + # Corvax-Secrets-Start + - name: Setup secrets + env: + SSH_KEY: ${{ secrets.SECRETS_PRIVATE_KEY }} + if: ${{ env.SSH_KEY != '' }} + run: | + mkdir ~/.ssh + echo "${{ secrets.SECRETS_PRIVATE_KEY }}" > ~/.ssh/id_rsa + chmod 600 ~/.ssh/id_rsa + echo "HOST *" > ~/.ssh/config + echo "StrictHostKeyChecking no" >> ~/.ssh/config + git -c submodule.Secrets.update=checkout submodule update --init + # Corvax-Secrets-End - name: Setup .NET Core uses: actions/setup-dotnet@v3 diff --git a/.github/workflows/validate-rgas.yml b/.github/workflows/validate-rgas.yml index 4143721fc65..a889172aee3 100644 --- a/.github/workflows/validate-rgas.yml +++ b/.github/workflows/validate-rgas.yml @@ -13,6 +13,19 @@ jobs: - uses: actions/checkout@v2 - name: Setup Submodule run: git submodule update --init + # Corvax-Secrets-Start + - name: Setup secrets + env: + SSH_KEY: ${{ secrets.SECRETS_PRIVATE_KEY }} + if: ${{ env.SSH_KEY != '' }} + run: | + mkdir ~/.ssh + echo "${{ secrets.SECRETS_PRIVATE_KEY }}" > ~/.ssh/id_rsa + chmod 600 ~/.ssh/id_rsa + echo "HOST *" > ~/.ssh/config + echo "StrictHostKeyChecking no" >> ~/.ssh/config + git -c submodule.Secrets.update=checkout submodule update --init + # Corvax-Secrets-End - name: Pull engine updates uses: space-wizards/submodule-dependency@v0.1.5 - uses: PaulRitter/yaml-schema-validator@v1 diff --git a/.github/workflows/validate-rsis.yml b/.github/workflows/validate-rsis.yml index 28102b8188c..00509f2b204 100644 --- a/.github/workflows/validate-rsis.yml +++ b/.github/workflows/validate-rsis.yml @@ -14,6 +14,19 @@ jobs: - uses: actions/checkout@v2 - name: Setup Submodule run: git submodule update --init + # Corvax-Secrets-Start + - name: Setup secrets + env: + SSH_KEY: ${{ secrets.SECRETS_PRIVATE_KEY }} + if: ${{ env.SSH_KEY != '' }} + run: | + mkdir ~/.ssh + echo "${{ secrets.SECRETS_PRIVATE_KEY }}" > ~/.ssh/id_rsa + chmod 600 ~/.ssh/id_rsa + echo "HOST *" > ~/.ssh/config + echo "StrictHostKeyChecking no" >> ~/.ssh/config + git -c submodule.Secrets.update=checkout submodule update --init + # Corvax-Secrets-End - name: Pull engine updates uses: space-wizards/submodule-dependency@v0.1.5 - name: Install Python dependencies diff --git a/.github/workflows/validate_mapfiles.yml b/.github/workflows/validate_mapfiles.yml index 1258fe01d48..c05c268f6e2 100644 --- a/.github/workflows/validate_mapfiles.yml +++ b/.github/workflows/validate_mapfiles.yml @@ -13,6 +13,19 @@ jobs: - uses: actions/checkout@v2 - name: Setup Submodule run: git submodule update --init + # Corvax-Secrets-Start + - name: Setup secrets + env: + SSH_KEY: ${{ secrets.SECRETS_PRIVATE_KEY }} + if: ${{ env.SSH_KEY != '' }} + run: | + mkdir ~/.ssh + echo "${{ secrets.SECRETS_PRIVATE_KEY }}" > ~/.ssh/id_rsa + chmod 600 ~/.ssh/id_rsa + echo "HOST *" > ~/.ssh/config + echo "StrictHostKeyChecking no" >> ~/.ssh/config + git -c submodule.Secrets.update=checkout submodule update --init + # Corvax-Secrets-End - name: Pull engine updates uses: space-wizards/submodule-dependency@v0.1.5 - uses: PaulRitter/yaml-schema-validator@v1 diff --git a/.gitignore b/.gitignore index 0686354bc83..16feebb7c8f 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,10 @@ # User-specific files (MonoDevelop/Xamarin Studio) *.userprefs +# Secret +Resources/Prototypes/CorvaxSecrets +Resources/Prototypes/CorvaxSecretsServer + # Build results [Dd]ebug/ [Dd]ebugPublic/ diff --git a/.gitmodules b/.gitmodules index 08e5dd6d0af..c93d76a5c3d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,9 @@ [submodule "RobustToolbox"] path = RobustToolbox url = https://github.com/space-wizards/RobustToolbox.git - branch = master \ No newline at end of file + branch = master +[submodule "Secrets"] + path = Secrets + url = git@gitlab.com:Morbo/corvax-secrets.git + branch = master + update = none diff --git a/Resources/Locale/ru-RU/corvax-secrets/prototypes/roles/antags.ftl b/Resources/Locale/ru-RU/corvax-secrets/prototypes/roles/antags.ftl new file mode 100644 index 00000000000..d332615011f --- /dev/null +++ b/Resources/Locale/ru-RU/corvax-secrets/prototypes/roles/antags.ftl @@ -0,0 +1,2 @@ +roles-antag-evil-twin-name = Злой двойник +roles-antag-evil-twin-objective = Замените свой оригинал. diff --git a/Resources/Locale/ru-RU/corvax-secrets/station-events/events/evil-twin.ftl b/Resources/Locale/ru-RU/corvax-secrets/station-events/events/evil-twin.ftl new file mode 100644 index 00000000000..ddfd6fb316a --- /dev/null +++ b/Resources/Locale/ru-RU/corvax-secrets/station-events/events/evil-twin.ftl @@ -0,0 +1,14 @@ +evil-twin-round-end-result = { $evil-twin-count -> + [one] Был один + *[other] Было { $evil-twin-count } +} { $evil-twin-count -> + [one] злой двойник + [few] злых двойника + *[other] злых двойников +}. +evil-twin-user-was-an-evil-twin = [color=gray]{$user}[/color] был злым двойником. +evil-twin-user-was-an-evil-twin-named = [color=white]{$name}[/color] ([color=gray]{$user}[/color]) был злым двойником. +evil-twin-was-an-evil-twin-named = [color=white]{$name}[/color] был злым двойником. +evil-twin-user-was-an-evil-twin-with-objectives = [color=gray]{$user}[/color] был(а) злым двойником со следующими целями: +evil-twin-user-was-an-evil-twin-with-objectives-named = [color=White]{$name}[/color] ([color=gray]{$user}[/color]) был(а) злым двойником со следующими целями: +evil-twin-was-an-evil-twin-with-objectives-named = [color=white]{$name}[/color] был(а) злым двойником со следующими целями: diff --git a/Resources/Locale/ru-RU/game-ticking/game-presets/preset-traitor.ftl b/Resources/Locale/ru-RU/game-ticking/game-presets/preset-traitor.ftl index a877b839bc5..76096490f0b 100644 --- a/Resources/Locale/ru-RU/game-ticking/game-presets/preset-traitor.ftl +++ b/Resources/Locale/ru-RU/game-ticking/game-presets/preset-traitor.ftl @@ -10,9 +10,9 @@ traitor-round-end-result = traitor-user-was-a-traitor = [color=gray]{ $user }[/color] был(а) предателем. traitor-user-was-a-traitor-named = [color=White]{ $name }[/color] ([color=gray]{ $user }[/color]) был(а) предателем. traitor-was-a-traitor-named = [color=White]{ $name }[/color] был(а) предателем. -traitor-user-was-a-traitor-with-objectives = [color=gray]{ $user }[/color] был(а) предателем, у которого(-ой) были следующие цели: -traitor-user-was-a-traitor-with-objectives-named = [color=White]{ $name }[/color] ([color=gray]{ $user }[/color]) был(а) предателем, у которого(-ой) были следующие цели: -traitor-was-a-traitor-with-objectives-named = [color=White]{ $name }[/color] был(а) предателем, у которого(-ой) были следующие цели: +traitor-user-was-a-traitor-with-objectives = [color=gray]{ $user }[/color] был(а) предателем со следующими целями: +traitor-user-was-a-traitor-with-objectives-named = [color=White]{ $name }[/color] ([color=gray]{ $user }[/color]) был(а) предателем со следующими целями: +traitor-was-a-traitor-with-objectives-named = [color=White]{ $name }[/color] был(а) предателем со следующими целями: preset-traitor-objective-issuer-syndicate = [color=#87cefa]Синдикат[/color] # Shown at the end of a round of Traitor traitor-objective-condition-success = { $condition } | [color={ $markupColor }]Успех![/color] diff --git a/Secrets b/Secrets new file mode 160000 index 00000000000..c145e1b73c1 --- /dev/null +++ b/Secrets @@ -0,0 +1 @@ +Subproject commit c145e1b73c1311d560d460051d4f7ff6c1011d18 diff --git a/Tools/package_client_build.py b/Tools/package_client_build.py index 15bc213cb98..b0aa05f5cad 100755 --- a/Tools/package_client_build.py +++ b/Tools/package_client_build.py @@ -40,6 +40,7 @@ def __getattr__(self, name): "ConfigPresets", "emotes.xml", "Groups", + "Prototypes/CorvaxSecretsServer", # Corvax-Secrets "engineCommandPerms.yml" } diff --git a/Tools/package_server_build.py b/Tools/package_server_build.py index 32a61722f63..8824fbff9b6 100755 --- a/Tools/package_server_build.py +++ b/Tools/package_server_build.py @@ -61,6 +61,7 @@ def __init__(self, rid: str, target_os: str, build_by_default: bool): # Assembly names to copy from content. # PDBs are included if available, .dll/.pdb appended automatically. SERVER_CONTENT_ASSEMBLIES = [ + "Content.CorvaxServer", # Corvax-Secrets "Content.Server.Database", "Content.Server", "Content.Shared", @@ -168,6 +169,22 @@ def build_platform(platform: PlatformReg, skip_build: bool, hybrid_acz: bool) -> "/p:FullRelease=True", "/m" ], check=True) + # Corvax-Secrets-Start + if os.path.exists(p("Secrets", "Content.CorvaxServer")): + print(Fore.GREEN + f"Secrets found. Building secret project for {platform.rid}..." + Style.RESET_ALL) + subprocess.run([ + "dotnet", + "build", + p("Secrets","Content.CorvaxServer", "Content.CorvaxServer.csproj"), + "-c", "Release", + "--nologo", + "/v:m", + f"/p:TargetOS={platform.target_os}", + "/t:Rebuild", + "/p:FullRelease=True", + "/m" + ], check=True) + # Corvax-Secrets-End publish_client_server(platform.rid, platform.target_os) @@ -271,7 +288,8 @@ def copy_content_assemblies(target, zipf): # Include content assemblies. for asm in base_assemblies: - files.append(asm + ".dll") + if os.path.exists(p(source_dir, asm + ".dll")): # Corvax-Secrets: Allow optional assemblies + files.append(asm + ".dll") # If PDB available, include it aswell. pdb_path = asm + ".pdb" if os.path.exists(p(source_dir, pdb_path)): diff --git a/Tools/setup_secrets.ps1 b/Tools/setup_secrets.ps1 new file mode 100644 index 00000000000..591626d4878 --- /dev/null +++ b/Tools/setup_secrets.ps1 @@ -0,0 +1,2 @@ +New-Item -ItemType Junction -Path "Resources\Prototypes\CorvaxSecrets" -Target "Secrets\Prototypes" +New-Item -ItemType Junction -Path "Resources\Prototypes\CorvaxSecretsServer" -Target "Secrets\ServerPrototypes"