diff --git a/.github/workflows/dotnet-release.yml b/.github/workflows/dotnet-release.yml index a27daa0be..0e68d8e48 100644 --- a/.github/workflows/dotnet-release.yml +++ b/.github/workflows/dotnet-release.yml @@ -1,9 +1,10 @@ +# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json + name: .NET Pre-Release on: push: branches: [ master ] - workflow_dispatch: jobs: @@ -26,7 +27,7 @@ jobs: run: dotnet build LinuxSolution.sln --no-restore - name: Test run: dotnet test LinuxSolution.sln --no-build --verbosity normal - + - name: Publish WindowsServer run: dotnet publish Barotrauma/BarotraumaServer/WindowsServer.csproj -c Release -clp:"ErrorsOnly;Summary" --self-contained -r win-x64 \/p:Platform="x64" - name: Publish WindowsClient @@ -42,38 +43,34 @@ jobs: - name: Publish MacClient run: dotnet publish Barotrauma/BarotraumaClient/MacClient.csproj -c Release -clp:"ErrorsOnly;Summary" --self-contained -r osx-x64 \/p:Platform="x64" - - name: Archive Windows Release uses: thedoctor0/zip-release@main with: - type: 'zip' - filename: 'barotrauma_lua_windows.zip' - #exclusions: '*.git* /*node_modules/* .editorconfig' - directory: 'Barotrauma/bin/ReleaseWindows/netcoreapp3.1/win-x64/publish' - + type: zip + filename: barotrauma_lua_windows.zip + directory: Barotrauma/bin/ReleaseWindows/netcoreapp3.1/win-x64/publish + - name: Archive Linux Release uses: thedoctor0/zip-release@main with: - type: 'zip' - filename: 'barotrauma_lua_linux.zip' - #exclusions: '*.git* /*node_modules/* .editorconfig' - directory: 'Barotrauma/bin/ReleaseLinux/netcoreapp3.1/linux-x64/publish' - + type: zip + filename: barotrauma_lua_linux.zip + directory: Barotrauma/bin/ReleaseLinux/netcoreapp3.1/linux-x64/publish + - name: Archive Mac Release uses: thedoctor0/zip-release@main with: - type: 'zip' - filename: 'barotrauma_lua_mac.zip' - #exclusions: '*.git* /*node_modules/* .editorconfig' - directory: 'Barotrauma/bin/ReleaseMac/netcoreapp3.1/osx-x64/publish' - + type: zip + filename: barotrauma_lua_mac.zip + directory: Barotrauma/bin/ReleaseMac/netcoreapp3.1/osx-x64/publish + - name: Automatic Release uses: marvinpinto/action-automatic-releases@v1.2.1 with: - repo_token: "${{ secrets.GITHUB_TOKEN }}" - automatic_release_tag: "latest" + repo_token: ${{ secrets.GITHUB_TOKEN }} + automatic_release_tag: latest prerelease: false - title: "Automatic Build" + title: Automatic Build files: | Barotrauma/bin/ReleaseWindows/netcoreapp3.1/win-x64/publish/barotrauma_lua_windows.zip Barotrauma/bin/ReleaseLinux/netcoreapp3.1/linux-x64/publish/barotrauma_lua_linux.zip diff --git a/.github/workflows/update-docs.yml b/.github/workflows/update-docs.yml index dddc9d133..f7c994d9d 100644 --- a/.github/workflows/update-docs.yml +++ b/.github/workflows/update-docs.yml @@ -1,8 +1,17 @@ +# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json + name: Update documentation on: workflow_dispatch: +env: + CI_DEPLOY_DIR: luacs-docs/ci-deploy + CI_ARTIFACTS_DIR: luacs-docs/ci-artifacts + DOCS_LUA_ROOT: luacs-docs/lua + DOCS_CS_ROOT: luacs-docs/cs + DOCS_LANDINGPAGE_ROOT: luacs-docs/landing-page + jobs: update-docs-lua: runs-on: ubuntu-latest @@ -19,22 +28,23 @@ jobs: - uses: leafo/gh-actions-luarocks@v4 - name: Run install script - working-directory: docs + working-directory: ${{ env.DOCS_LUA_ROOT }} run: ./scripts/install.sh - name: Run build script - working-directory: docs + working-directory: ${{ env.DOCS_LUA_ROOT }} run: ./scripts/build.sh - name: Create tarball - working-directory: docs/html - run: tar -czf ../../docs-lua.tar.gz . + run: | + mkdir -p "$CI_ARTIFACTS_DIR" + tar -czf "$CI_ARTIFACTS_DIR"/lua.tar.gz -C "$DOCS_LUA_ROOT"/build . - name: Upload tarball uses: actions/upload-artifact@v3 with: name: docs-lua - path: docs-lua.tar.gz + path: ${{ env.CI_ARTIFACTS_DIR }}/lua.tar.gz update-docs-cs: runs-on: ubuntu-latest @@ -42,38 +52,23 @@ jobs: - name: Checkout branch uses: actions/checkout@v3 - - name: Create directories - run: | - mkdir -p doxygen/build/baro-server - mkdir -p doxygen/build/baro-client + - name: Install doxygen + run: sudo apt-get update && sudo apt-get install -y doxygen - - name: Build server documentation - uses: mattnotmitt/doxygen-action@v1 - with: - working-directory: 'doxygen/baro-server' - doxyfile-path: './Doxyfile' - - - name: Build client documentation - uses: mattnotmitt/doxygen-action@v1 - with: - working-directory: 'doxygen/baro-client' - doxyfile-path: './Doxyfile' - - - name: Build containing documentation - uses: mattnotmitt/doxygen-action@v1 - with: - working-directory: 'doxygen/' - doxyfile-path: './Doxyfile' + - name: Run build script + working-directory: ${{ env.DOCS_CS_ROOT }} + run: ./scripts/build.sh - name: Create tarball - working-directory: doxygen/build - run: tar -czf ../../docs-cs.tar.gz . + run: | + mkdir -p "$CI_ARTIFACTS_DIR" + tar -czf "$CI_ARTIFACTS_DIR"/cs.tar.gz -C "$DOCS_CS_ROOT"/build . - name: Upload tarball uses: actions/upload-artifact@v3 with: name: docs-cs - path: docs-cs.tar.gz + path: ${{ env.CI_ARTIFACTS_DIR }}/cs.tar.gz deploy-docs: runs-on: ubuntu-latest @@ -82,33 +77,32 @@ jobs: - name: Checkout branch uses: actions/checkout@v3 - - run: mkdir -p docs_deploy + - run: mkdir -p "$CI_ARTIFACTS_DIR" "$CI_DEPLOY_DIR" - name: "Download build artifacts: lua docs" uses: actions/download-artifact@v3 with: name: docs-lua - path: docs_deploy + path: ${{ env.CI_ARTIFACTS_DIR }} - name: "Download build artifacts: cs docs" uses: actions/download-artifact@v3 with: name: docs-cs - path: docs_deploy - - - name: Copy landing page files - run: cp -r docs-landing-page/. docs_deploy/public + path: ${{ env.CI_ARTIFACTS_DIR }} - name: Extract lua and cs tarballs - working-directory: docs_deploy run: | - mkdir -p public/lua-docs public/cs-docs - tar -xzf docs-lua.tar.gz -C public/lua-docs - tar -xzf docs-cs.tar.gz -C public/cs-docs + mkdir -p "$CI_DEPLOY_DIR"/{lua,cs}-docs + tar -xzf "$CI_ARTIFACTS_DIR"/lua.tar.gz -C "$CI_DEPLOY_DIR"/lua-docs + tar -xzf "$CI_ARTIFACTS_DIR"/cs.tar.gz -C "$CI_DEPLOY_DIR"/cs-docs + + - name: Copy landing page files + run: cp -r "$DOCS_LANDINGPAGE_ROOT"/. "$CI_DEPLOY_DIR" - name: Deploy uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: docs_deploy/public + publish_dir: ${{ env.CI_DEPLOY_DIR }} keep_files: true diff --git a/.gitignore b/.gitignore index 7d4b67772..3009d17ba 100644 --- a/.gitignore +++ b/.gitignore @@ -13,12 +13,8 @@ bld/ [Rr]elease*/ *.o */Barotrauma*/doc/ -doxygen/html/ -doxygen/*/html/ -doxygen/*/*.tag -doxygen/build -# Misc vs crap +# Misc vs crap *.v12.suo *.suo *.csproj.user diff --git a/.gitmodules b/.gitmodules index 399c0ff11..568b2ac40 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,6 @@ [submodule "Libraries/moonsharp"] path = Libraries/moonsharp url = https://github.com/evilfactory/moonsharp.git -[submodule "docs/libs/ldoc"] - path = docs/libs/ldoc +[submodule "luacs-docs/lua/libs/ldoc"] + path = luacs-docs/lua/libs/ldoc url = https://github.com/impulsh/LDoc.git diff --git a/Barotrauma/BarotraumaShared/SharedSource/LuaCs/Lua/LuaDocs.cs b/Barotrauma/BarotraumaShared/SharedSource/LuaCs/Lua/LuaDocs.cs index 8079c42cc..a889f5a65 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/LuaCs/Lua/LuaDocs.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/LuaCs/Lua/LuaDocs.cs @@ -11,13 +11,14 @@ using System.Net; using System.Linq; using System.Xml.Linq; using System.Reflection; +using System.Diagnostics; +using System.Runtime.InteropServices; namespace Barotrauma { public static class LuaDocs { - public static string ConvertTypeName(string type) { switch (type) @@ -68,8 +69,68 @@ namespace Barotrauma return n; } - public static void GenerateDocsAll() + private static (bool Success, string Output, string Error) TryRunGitCommand(string args) + { + static string GetGitBinary() + { + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + return Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.Process) + ?.Split(';') + .Select(x => Path.Join(x, "git.exe")) + .FirstOrDefault(File.Exists); + } + else + { + return Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.Process) + ?.Split(':') + .Select(x => Path.Join(x, "git")) + .FirstOrDefault(File.Exists); + } + } + + var gitBinary = GetGitBinary(); + if (gitBinary == null) + { + throw new InvalidOperationException("Failed to find git binary in PATH"); + } + + using var process = Process.Start(new ProcessStartInfo(gitBinary, args) + { + WindowStyle = ProcessWindowStyle.Hidden, + CreateNoWindow = true, + UseShellExecute = false, + RedirectStandardInput = true, + RedirectStandardError = true, + RedirectStandardOutput = true, + }); + + process.Start(); + + var stdOut = process.StandardOutput.ReadToEndAsync(); + var stdErr = process.StandardError.ReadToEndAsync(); + Task.WhenAll(stdOut, stdErr).GetAwaiter().GetResult(); + process.WaitForExit(); + + return (process.ExitCode == 0, stdOut.Result.TrimEnd('\r', '\n'), stdErr.Result); + } + + + private static readonly Lazy GitDir = new Lazy(() => + { + var (success, gitDir, error) = TryRunGitCommand("rev-parse --show-toplevel"); + if (!success) + { + throw new InvalidDataException($"Failed to determine the root of the git repo: {error}"); + } + + return gitDir; + }); + + public static void GenerateDocs() { + var basePath = $"{GitDir.Value}/luacs-docs/lua"; + Directory.Delete($"{basePath}/lua/generated", true); GenerateDocs(typeof(Character), "Character.lua"); GenerateDocs(typeof(CharacterInfo), "CharacterInfo.lua"); GenerateDocs(typeof(CharacterHealth), "CharacterHealth.lua"); @@ -99,12 +160,13 @@ namespace Barotrauma GenerateDocs(typeof(GameSettings), "GameSettings.lua", "Game.Settings"); } - public static void GenerateDocs(Type type, string name, string categoryName = null) + private static void GenerateDocs(Type type, string file, string categoryName = null) { - GenerateDocs(type, "../../../../docs/baseluadocs/" + name, "../../../../docs/lua/generated/" + name, categoryName); + var basePath = $"{GitDir.Value}/luacs-docs/lua"; + GenerateDocs(type, $"{basePath}/baseluadocs/{file}", $"{basePath}/lua/generated/{file}", categoryName); } - public static void GenerateDocs(Type type, string baselua, string fileresult, string categoryName = null) + private static void GenerateDocs(Type type, string baselua, string fileresult, string categoryName = null) { var sb = new StringBuilder(); @@ -241,7 +303,7 @@ local {type.Name} = {EMPTY_TABLE}"; var returnName = ConvertTypeName(property.PropertyType.Name); - if (property.GetGetMethod().IsStatic) + if (property.GetGetMethod()?.IsStatic == true || property.GetSetMethod()?.IsStatic == true) name = type.Name + "." + property.Name; if (removed.Contains(name)) @@ -257,6 +319,7 @@ local {type.Name} = {EMPTY_TABLE}"; } } + new FileInfo(fileresult).Directory.Create(); File.WriteAllText(fileresult, sb.ToString()); } } diff --git a/docs-landing-page/index.html b/docs-landing-page/index.html deleted file mode 100644 index fcb6bb06b..000000000 --- a/docs-landing-page/index.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - LuaCs For Barotrauma - - - - -
-
-
- -
-
-
-
-
-
- -
-
-
- - \ No newline at end of file diff --git a/docs-landing-page/landing.css b/docs-landing-page/landing.css deleted file mode 100644 index 7efcd8809..000000000 --- a/docs-landing-page/landing.css +++ /dev/null @@ -1,132 +0,0 @@ -body{ - overflow: hidden; - font-size: 100%; - background-color: #777; -} - -.common-docs{ - z-index: 1; - text-justify: auto; - position: fixed; - top: 0; - bottom: 0; - transition-property: transform; - transition-duration: 0.5s; - transition-timing-function: ease-in-out; - overflow: hidden; -} -#lua-docs{ - left: -10%; - right: 50%; -} -#cs-docs{ - right: -10%; - left: 50%; -} - -#cs-docs::before,#lua-docs::before{ - content: ""; - background: url(bg.jpg) repeat; - background-size: 80%; - background-blend-mode: luminosity; - filter: blur(2px); - position: absolute; - height: 200%; - width: 200%; -} -#lua-docs::before{ - background-color: rgba(49, 49, 135, 1); -} -#cs-docs::before{ - background-color: rgba(105, 44, 120, 1); -} - -.common-docs:hover{ - z-index: 2; - font-size: 300%; - transform: scale(1.05); -} - -.inner-bg{ - position: relative; - width: 100%; - height: 100%; - display: flex; - align-items: center; - justify-content: center; - transition-duration: 0.5s; - transition-timing-function: ease-in-out; -} -.inner-bg:hover{ - background-color: rgba(255, 255, 255, 0.35); -} - -.inner-docs{ - height: 100%; - width: 100%; - display: flex; - align-items: center; - justify-content: center; - position: relative; - background: radial-gradient(circle, #222, rgba(0, 0, 0, 0)); -} - - -@media (min-width: 80em) { - .inner-docs img{ - height: 30%; - width: auto; - } - .common-docs{ - transform: skewX(-11deg); - } - #cs-docs::before,#lua-docs::before{ - transform: skewX(11deg); - } - .common-docs:hover{ - transform: skewX(-11deg) scale(1.05); - } - .inner-docs{ - transform: skewX(11deg); - } - .inner-docs img{ - height: 30%; - width: auto; - } -} -@media (max-width: 80em) { - .common-docs{ - transform: skewX(-9deg); - } - #cs-docs::before,#lua-docs::before{ - transform: skewX(9deg); - } - .common-docs:hover{ - transform: skewX(-9deg) scale(1.05); - } - .inner-docs{ - transform: skewX(9deg); - } - .inner-docs img{ - height: 30%; - width: auto; - } -} -@media (max-width: 70em) { - .common-docs{ - transform: skewX(0deg); - } - #cs-docs::before,#lua-docs::before{ - transform: skewX(0deg); - } - .common-docs:hover{ - transform: skewX(0deg) scale(1.05); - } - .inner-docs{ - transform: skewX(0deg); - } - .inner-docs img{ - height: auto; - width: 50%; - } -} \ No newline at end of file diff --git a/docs/css/ldoc.css b/docs/css/ldoc.css deleted file mode 100644 index 4f590feb1..000000000 --- a/docs/css/ldoc.css +++ /dev/null @@ -1,543 +0,0 @@ - -:root { - --content-width: 100%; - --sidebar-width: 25%; - - --padding-big: 48px; - --padding-normal: 24px; - --padding-small: 16px; - --padding-tiny: 10px; - - --font-massive: 32px; - --font-huge: 24px; - --font-big: 18px; - --font-normal: 16px; - --font-tiny: 12px; - - --font-style-normal: Segoe UI, Helvetica, Arial, sans-serif; - --font-style-code: Consolas, monospace; - - --color-accent: rgb(47, 100, 74); - --color-accent-dark: rgb(33, 33, 33); - --color-white: rgb(255, 255, 255); - --color-offwhite: rgb(200, 200, 200); - --color-white-accent: rgb(203, 190, 209); - --color-black: rgb(0, 0, 0); - --color-lightgrey: rgb(160, 160, 160); - --color-background-light: rgb(245, 245, 245); - --color-background-dark: rgb(33, 33, 33); - --color-background-dark-ish: rgb(44, 44, 44); - --color-outline: rgb(149, 34, 160); - --color-good: #5190ff; -} - -* { - padding: 0; - margin: 0; - box-sizing: border-box; -} - -body { - background-color: var(--color-background-dark); - font-family: var(--font-style-normal); - - display: flex; - flex-direction: column; -} - -a { - color: inherit; - text-decoration: inherit; -} - -h1, h2, h3, h4 { - font-weight: 400; -} - -ul li { - margin-left: var(--padding-small); -} - -/* landing */ -.landing { - background-color: var(--color-accent); - color: var(--color-white); - - padding: 128px 0 128px 0; -} - -.landing h1 { - margin: 0; - padding: 0; - border: none; - - font-weight: 100; - font-size: var(--font-massive); - text-align: center; -} - -.wrapper { - padding: var(--padding-small); -} - -details { - user-select: none; -} - -details summary { - outline: none; -} - -code { - font-family: "Source Code Pro", monospace; - font-size: 85%; - white-space: pre; - tab-size: 4; - -moz-tab-size: 4; - padding: 1px 4px; - background-color: #282a36; - outline-style: solid; - outline-color: black; - outline-width: 2px; -} - -pre { - background-color: rgb(0, 0, 0, 1); - margin-top: var(--padding-small); - padding: 2px; - overflow: auto; -} - -pre code { - background-color: transparent; -} - -span.realm { - width: 14px; - height: 14px; - border-radius: 3px; - display: inline-block; - margin-right: 5px; -} - -span.realm.shared { - background: linear-gradient(45deg, #f80 0%, #f80 50%, #08f 51%, #08f 100%); -} - -span.realm.client { - background-color: #f80; -} - -span.realm.server { - background-color: #08f; -} - - -.colorful-label { - color: rgb(31, 141, 155); -} - -/* wrapper element for sidebar/content */ -main { - display: flex; - flex-direction: row; - justify-content: space-between; - align-items: flex-start; - - width: var(--content-width); - margin: auto; -} - -/* sidebar */ -nav { - color: var(--color-offwhite); - background-color: var(--color-background-dark); - - position: fixed; - display: flex; - flex-direction: column; - - width: var(--sidebar-width); - height: 100%; -} - -/* sidebar header */ -nav header { - color: var(--color-white); - background-color: var(--color-accent); - - padding: var(--padding-small); -} - -nav header h1 { - font-size: var(--font-huge); - font-weight: 100; - text-align: center; - - margin-bottom: var(--padding-small); -} - -#search { - background-color: var(--color-accent-dark); - color: var(--color-white); - - border: none; - font-size: var(--font-normal); - outline: none; - - width: 100%; - padding: 6px; -} - -#search::placeholder { - color: var(--color-white-accent); -} - -#search::-webkit-search-cancel-button { - display: none; -} - -/* sidebar contents */ -nav section { - padding: var(--padding-small); - overflow: auto; -} - -nav section ul { - list-style-type: none; -} - -nav section::-webkit-scrollbar, -pre::-webkit-scrollbar { - width: 8px; - height: 8px; -} - -nav section::-webkit-scrollbar-track, -pre::-webkit-scrollbar-track { - background: transparent; -} - -nav section::-webkit-scrollbar-thumb { - background-color: var(--color-lightgrey); -} - -pre::-webkit-scrollbar-thumb { - background-color: var(--color-lightgrey); -} - -/* sidebar contents category */ -nav section details.category { - padding-top: var(--padding-tiny); -} - -nav section details.category > ul > li { - margin: 0; - line-height: 1.5; -} - -nav section details.category > ul > li a { - display: inline-block; - width: 90%; -} - -nav section details.category:first-of-type { - padding-top: calc(var(--padding-tiny) * -1); -} - -nav section details.category summary::-webkit-details-marker { - opacity: 0.5; - cursor: pointer; -} - -nav section details.category summary h2 { - color: var(--color-accent); - - font-size: var(--font-big); - letter-spacing: 2px; - text-transform: uppercase; - cursor: pointer; - - padding-bottom: var(--padding-tiny); -} - -/* content */ -article { - background-color: var(--color-background-dark-ish); - color: white; - width: calc(100% - var(--sidebar-width)); - min-height: 100vh; - margin-left: var(--sidebar-width); -} - -article .wrapper > *:first-child { - margin-top: 0; -} - -/* header */ -article header { - color: rgb(255, 255, 255); - background-color: var(--color-accent); - padding: var(--padding-tiny); -} - -article header h1 { - border-bottom: 1px solid rgba(255, 255, 255, 0.25); - padding-bottom: 8px; - font-family: var(--font-style-code); - margin: 0; -} - -article header h2 { - padding-top: var(--padding-tiny); - margin: 0; - font-size: var(--font-normal); - font-weight: normal; -} - -article header.module a { - color: white !important; - text-decoration: underline; -} - -details.category > summary { - list-style: none; -} - -details.category > summary::-webkit-details-marker { - display: none; -} - -article h1 { - font-size: 28px; - font-weight: 600; - border-bottom: 1px solid rgba(0, 0, 0, 0.25); - margin-top: 24px; - margin-bottom: 16px; - padding-bottom: 8px; -} - -article h2 { - font-size: 20px; - font-weight: 600; - margin-top: 12px; -} - -article h3 { - color: var(--color-good); - margin-top: var(--padding-tiny); - text-transform: uppercase; -} - -article p { - margin-top: var(--padding-small); -} - -article p a, -article ul li a, -article h1 a, -article h2 a { - color: var(--color-good); - font-weight: 600; -} - -article h1.title { - color: rgb(255, 255, 255); - background-color: var(--color-accent); - margin-top: var(--padding-small); - margin-bottom: 0; - padding: var(--padding-tiny); - - font-size: var(--font-big); - font-weight: 100; - letter-spacing: 2px; - text-transform: uppercase; -} - -a.reference { - color: var(--color-good); - float: right; - margin-top: 8px; - padding-left: 8px; - font-size: 14px; - font-weight: 600; -} - -.notice { - --color-notice-background: var(--color-accent); - --color-notice-text: var(--color-notice-background); - - margin-top: var(--padding-tiny); - border: 2px solid var(--color-notice-background); -} - -.notice.error { - --color-notice-background: rgb(194, 52, 130); -} - -.notice.warning { - --color-notice-background: rgb(224, 169, 112); - --color-notice-text: rgb(167, 104, 37); -} - -.notice .title { - color: var(--color-white); - background-color: var(--color-notice-background); - - padding: var(--padding-tiny); - font-size: var(--font-normal); - - text-transform: uppercase; - letter-spacing: 2px; -} - -.notice p { - color: var(--color-notice-text); - - margin: 0 !important; - padding: var(--padding-tiny); -} - -/* function/table */ -.method { - display: flex; - flex-flow: column; - padding: var(--padding-tiny); - margin-top: var(--padding-small); -} - -.method header { - color: white; - background-color: inherit; - padding: 0; - order: -1; -} - -.method header .anchor { - color: inherit; - text-decoration: inherit; -} - -.method:target { - background-color: var(--color-background-dark); - - outline: solid; - outline-width: 1px; - outline-color: var(--color-accent); -} - -.method header:target { - background-color: var(--color-accent); -} - -.method header h1 { - font-family: "Source Code Pro", monospace; - padding-bottom: var(--padding-tiny); - border-bottom: 1px solid var(--color-accent); - font-size: 20px; -} - -.method header p:first-of-type { - margin-top: var(--padding-tiny); -} - -.method h3 { - color: var(--color-good); - font-size: var(--font-normal); - letter-spacing: 2px; - text-transform: uppercase; -} - -.method pre { - margin-top: var(--padding-tiny); -} - -@media only screen and (max-width: 1100px) { - main nav { - position: inherit; - } - - main article { - margin-left: 0; - } -} - -.method ul { - margin-top: var(--padding-tiny); - background-color: inherit; -} - -.method ul li { - list-style: none; - margin: 4px 0 0 var(--padding-normal); -} - -.method ul li:first-of-type { - margin-top: 0; -} - -.method ul li p { - margin: 4px 0 0 var(--padding-normal); -} - -.method ul li pre { - margin: 4px 0 0 var(--padding-normal); -} - -.method ul li a { - color: rgb(115, 53, 142); - font-weight: 600; -} - -/* we have to manually specify these instead of making a shared class since you cannot customize the parameter class in ldoc */ -.parameter, .type, .default { - display: inline-block; - color: rgb(255, 255, 255) !important; - - padding: 4px; - font-size: 14px; - font-family: "Source Code Pro", monospace; -} - -.parameter { - background-color: rgb(115, 53, 142); -} - -.type { - background-color: rgb(31, 141, 155); -} - -a.type { - font-weight: 300 !important; - text-decoration: underline; -} - -.default { - background-color: rgb(193, 114, 11); -} - -.type a { - padding: 0; -} - -.or { - color: rgba(115, 53, 142, 0.5); - background-color: inherit; - - width: calc(100% - 32px); - height: 8px; - margin: 0 0 8px 32px; - - text-align: center; - font-weight: 600; - border-bottom: 1px solid rgba(115, 53, 142, 0.5); -} - -.or span { - background-color: inherit; - padding: 0 8px 0 8px; -} - -.strikethrough { - text-decoration: line-through; -} diff --git a/docs/js/app.js b/docs/js/app.js deleted file mode 100644 index ce0cee1ba..000000000 --- a/docs/js/app.js +++ /dev/null @@ -1,168 +0,0 @@ - -const skippedCategories = ["manual"]; - -class Node -{ - constructor(name, element, expandable, noAutoCollapse, children = []) - { - this.name = name; - this.element = element; - this.expandable = expandable; - this.noAutoCollapse = noAutoCollapse; - this.children = children; - } - - AddChild(name, element, expandable, noAutoCollapse, children) - { - let newNode = new Node(name, element, expandable, noAutoCollapse, children); - this.children.push(newNode); - - return newNode; - } -} - -class SearchManager -{ - constructor(input, contents) - { - this.input = input; - this.input.addEventListener("input", event => - { - this.OnInputUpdated(this.input.value.toLowerCase().replace(/:/g, ".")); - }); - - // setup search tree - this.tree = new Node("", document.createElement("null"), true, true); - this.entries = {}; - - const categoryElements = contents.querySelectorAll(".category"); - - // iterate each kind (hooks/libraries/classes/etc) - for (const category of categoryElements) - { - const nameElement = category.querySelector(":scope > summary > h2"); - - if (!nameElement) - { - continue; - } - - const categoryName = nameElement.textContent.trim().toLowerCase(); - - if (skippedCategories.includes(categoryName)) - { - continue; - } - - let categoryNode = this.tree.AddChild(categoryName, category, true, true); - const sectionElements = category.querySelectorAll(":scope > ul > li"); - - for (const section of sectionElements) - { - const entryElements = section.querySelectorAll(":scope > details > ul > li > a"); - const sectionName = section.querySelector(":scope > details > summary > a") - .textContent - .trim() - .toLowerCase(); - - let sectionNode = categoryNode.AddChild(sectionName, section.querySelector(":scope > details"), true); - - for (let i = 0; i < entryElements.length; i++) - { - const entryElement = entryElements[i]; - const entryName = entryElement.textContent.trim().toLowerCase(); - - sectionNode.AddChild(sectionName + "." + entryName, entryElement.parentElement); - } - } - } - } - - ResetVisibility(current) - { - current.element.style.display = ""; - - if (current.noAutoCollapse) - { - current.element.open = true; - } - else if (current.expandable) - { - current.element.open = false; - } - - for (let node of current.children) - { - this.ResetVisibility(node); - } - } - - Search(input, current) - { - let matched = false; - - if (current.name.indexOf(input) != -1) - { - matched = true; - } - - for (let node of current.children) - { - let childMatched = this.Search(input, node); - matched = matched || childMatched; - } - - if (matched) - { - current.element.style.display = ""; - - if (current.expandable) - { - current.element.open = true; - } - } - else - { - current.element.style.display = "none"; - - if (current.expandable) - { - current.element.open = false; - } - } - - return matched; - } - - OnInputUpdated(input) - { - if (input.length <= 1) - { - this.ResetVisibility(this.tree); - return; - } - - this.Search(input, this.tree); - } -} - -window.onload = function() -{ - const openDetails = document.querySelector(".category > ul > li > details[open]"); - - if (openDetails) - { - openDetails.scrollIntoView(); - } -} - -document.addEventListener("DOMContentLoaded", function() -{ - const searchInput = document.getElementById("search"); - const contents = document.querySelector("body > main > nav > section"); - - if (searchInput && contents) - { - new SearchManager(searchInput, contents); - } -}); diff --git a/docs/scripts/build.ps1 b/docs/scripts/build.ps1 deleted file mode 100644 index 850f8f7a3..000000000 --- a/docs/scripts/build.ps1 +++ /dev/null @@ -1,17 +0,0 @@ -try { - cd $PSScriptRoot/.. - - Remove-Item -Force -Recurse ./html | Out-Null - New-Item -ItemType Directory ./html | Out-Null - Copy-Item -Path ./css/. -Destination ./html -Recurse -Force | Out-Null - Copy-Item -Path ./js/. -Destination ./html -Recurse -Force | Out-Null - - if ((Get-Command "lua_modules/bin/ldoc" -ErrorAction SilentlyContinue) -eq $null) { - echo "ldoc not found; please run docs/scripts/install.ps1" - exit 1 - } - - lua_modules/bin/ldoc . -} finally { - popd -} diff --git a/docs/scripts/serve.ps1 b/docs/scripts/serve.ps1 deleted file mode 100644 index 9a9bffed2..000000000 --- a/docs/scripts/serve.ps1 +++ /dev/null @@ -1,12 +0,0 @@ -try { - cd $PSScriptRoot/.. - - if ((Get-Command "python3" -ErrorAction SilentlyContinue) -eq $null) { - echo "python3 not found" - exit 1 - } - - python3 -m http.server -d html -} finally { - popd -} diff --git a/docs/templates/landing.ltp b/docs/templates/landing.ltp deleted file mode 100644 index 060380193..000000000 --- a/docs/templates/landing.ltp +++ /dev/null @@ -1,24 +0,0 @@ - -
-

Lua For Barotrauma Documentation

-
- -
-

-

Welcome to the Lua For Barotrauma documentation!

-

This is a work in progress documentation, not everything is documented here, but because Barotrauma classes are exposed to Lua, you can check the Barotrauma source code for functions and fields that you can access.

- -

Installing Lua For Barotrauma

-

Downloading and using the Core Content Package from Workshop should be enough to have it installed, but if you want to install it manually, you can check out this guide. -

- -

Getting Started

-

If you want to get started with Lua For Barotrauma modding, check out this guide. -

- -

Links

-

- Github
- Discord Server -

-
diff --git a/docs/templates/ldoc.ltp b/docs/templates/ldoc.ltp deleted file mode 100644 index b42ac394c..000000000 --- a/docs/templates/ldoc.ltp +++ /dev/null @@ -1,138 +0,0 @@ - -{% -local baseUrl = ldoc.css:gsub("ldoc.css", "") -local repo = "https://github.com/evilfactory/Barotrauma-lua-attempt/" -local pageTitle = mod and (ldoc.display_name(mod) .. " - " .. ldoc.title) or ldoc.title - -local oldmarkup = ldoc.markup -function ldoc.markup(text, item) - return oldmarkup(text, item, ldoc.plain) -end - -function ldoc.url(path) - return baseUrl .. path -end - -function ldoc.realm_icon(realm) - return "" -end - -function ldoc.sidebar_item(item, module) - local text = "" - - local deprecated = item.tags.deprecated - if deprecated then - text = text .. "" - else - text = text .. "" - end - - text = text .. ldoc.realm_icon(item.tags.realm[1]) - text = text .. "" - - if ldoc.is_kind_classmethod(module.kind) then - text = text .. item.name:gsub(".+:", "") - else - text = text .. item.name:gsub(module.name .. ".", "") - end - - text = text - .. "" - .. "" - return text -end - -function ldoc.item_header(item) - local text = "" - - text = text .. "" - - local deprecated = item.tags.deprecated - if deprecated then - text = text .. "

" - else - text = text .. "

" - end - - text = text - .. ldoc.realm_icon(item.tags.realm[1]) - .. ldoc.display_name(item) - .. "

" - .. "
" - - return text -end - -function ldoc.is_kind_classmethod(kind) - return kind ~= "libraries" -end - -function ldoc.repo_reference(item) - return repo .. "tree/master" .. item.file.filename:gsub(item.file.base, "/gamemode") .. "#L" .. item.lineno -end - -local function moduleDescription(mod) - if (mod.type == "topic") then - return mod.body:gsub(mod.display_name, ""):gsub("#", ""):sub(1, 256) .. "..." - end - - return mod.summary -end -%} - - - - {{pageTitle}} - - - - - - {% if (mod) then %} - - {% else %} - - {% end %} - - - - - - - -
- {(templates/sidebar.ltp)} - -
- {% if (ldoc.root) then -- we're rendering the landing page (index.html) %} - {(templates/landing.ltp)} - {% elseif (ldoc.body) then -- we're rendering non-code elements %} -
- {* ldoc.body *} -
- {% elseif (module) then -- we're rendering libary contents %} -
- {(templates/module.ltp)} -
- {% end %} -
-
- - - - - - diff --git a/docs/templates/module.ltp b/docs/templates/module.ltp deleted file mode 100644 index b3903674c..000000000 --- a/docs/templates/module.ltp +++ /dev/null @@ -1,152 +0,0 @@ - -
-

{{mod.name}}

-

{* ldoc.markup(mod.summary) *}

-
- -

{* ldoc.markup(mod.description) *}

- -{% - local kinds = {} - local kindsIpairs = {} - for kind, items in mod.kinds() do - local name = kind - if kind == "Tables" then - name = "Fields" - end - - for item in items() do - if kinds[name] == nil then - kinds[name] = {} - - local value = {} - value.kind = name - value.items = kinds[name] - table.insert(kindsIpairs, value) - end - kinds[name][item] = true - end - end - - -%} - -{% for i, value in ipairs(kindsIpairs) do - local kind = value.kind - local items = value.items -%} -

{{kind}}

- - {% for item, _ in pairs(items) do %} -
-
- {* ldoc.item_header(item) *} - - {% if item.tags.deprecated then %} -
-
Deprecated
-

This API is deprecated and shouldn't be used anymore.

-
- {% end %} - - {% if (item.tags.internal) then %} -
-
Internal
-

This is an internal function! You are able to use it, but you risk unintended side effects if used incorrectly.

-
- {% end %} - - {% if (ldoc.descript(item):len() == 0) then %} -
-
Incomplete
-

Documentation for this section is incomplete and needs expanding.

-
- {% else %} -

{* ldoc.markup(ldoc.descript(item)) *}

- {% end %} -
- - {# function arguments #} - {% if (item.params and #item.params > 0) then %} - {% local subnames = mod.kinds:type_of(item).subnames %} - - {% if (subnames) then %} -

{{subnames}}

- {% end %} - - {% for argument in ldoc.modules.iter(item.params) do %} - {% local argument, sublist = item:subparam(argument) %} - -
    - {% for argumentName in ldoc.modules.iter(argument) do %} - {% local displayName = item:display_name_of(argumentName) %} - {% local type = ldoc.typename(item:type_of_param(argumentName)) %} - {% local default = item:default_of_param(argumentName) %} - -
  • - {{displayName}} - - {% if (type ~= "") then %} - {* type *} - {% end %} - - {% if (default and default ~= true) then %} - default: {{default}} - {% elseif (default) then %} - optional - {% end %} - -

    {* ldoc.markup(item.params.map[argumentName]) *}

    -
  • - {% end %} -
- {% end %} - {% end %} - - {# function returns #} - {% if ((not ldoc.no_return_or_parms) and item.retgroups) then %} - {% local groups = item.retgroups %} - -

Returns

-
    - {% for i, group in ldoc.ipairs(groups) do %} - {% for returnValue in group:iter() do %} - {% local type, ctypes = item:return_type(returnValue) %} - {% type = ldoc.typename(type) %} - -
  • - {% if (type ~= "") then %} - {* type *} - {% else -- we'll assume that it will return a variable type if none is set %} - any - {% end %} - -

    {* ldoc.markup(returnValue.text) *}

    -
  • - {% end %} - - {% if (i ~= #groups) then %} -
    OR
    - {% end %} - {% end %} -
- {% end %} - - {% if (item.usage) then -- function usage %} -

Example Usage

- {% for usage in ldoc.modules.iter(item.usage) do %} -
{* usage *}
- {% end %} - {% end %} - - {% if (item.see) then %} -

See Also

-
    - {% for see in ldoc.modules.iter(item.see) do %} -
  • {{see.label}}
  • - {% end %} -
- {% end %} -
- {% end %} -{% end %} diff --git a/docs/templates/sidebar.ltp b/docs/templates/sidebar.ltp deleted file mode 100644 index 322b3fd1f..000000000 --- a/docs/templates/sidebar.ltp +++ /dev/null @@ -1,102 +0,0 @@ - -{% -local function isKindExpandable(kind) - return kind ~= "Manual" -end -%} - - diff --git a/doxygen/DoxygenLayout.xml b/doxygen/DoxygenLayout.xml deleted file mode 100644 index 17afc9d01..000000000 --- a/doxygen/DoxygenLayout.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/doxygen/baro-client/DoxygenLayout.xml b/doxygen/baro-client/DoxygenLayout.xml deleted file mode 100644 index eff4d0fbb..000000000 --- a/doxygen/baro-client/DoxygenLayout.xml +++ /dev/null @@ -1,244 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/doxygen/baro-server/DoxygenLayout.xml b/doxygen/baro-server/DoxygenLayout.xml deleted file mode 100644 index 4eba30d35..000000000 --- a/doxygen/baro-server/DoxygenLayout.xml +++ /dev/null @@ -1,244 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/doxygen/build-docs.bat b/doxygen/build-docs.bat deleted file mode 100644 index 959a3bcf9..000000000 --- a/doxygen/build-docs.bat +++ /dev/null @@ -1,16 +0,0 @@ -@echo off -if not exist ".\build" mkdir ".\build" -if not exist ".\build\baro-server" mkdir ".\build\baro-server" -if not exist ".\build\baro-client" mkdir ".\build\baro-client" - -cd .\baro-server -echo Building server documentation -doxygen Doxyfile - -cd ..\baro-client -echo Building client documentation -doxygen Doxyfile - -cd .. -echo Building shared documentation -doxygen Doxyfile \ No newline at end of file diff --git a/doxygen/build-shared.bat b/doxygen/build-shared.bat deleted file mode 100644 index 7023da7f2..000000000 --- a/doxygen/build-shared.bat +++ /dev/null @@ -1,5 +0,0 @@ -@echo off -if not exist ".\build" mkdir ".\build" - -echo Building shared documentation -doxygen Doxyfile \ No newline at end of file diff --git a/luacs-docs/cs/.gitignore b/luacs-docs/cs/.gitignore new file mode 100644 index 000000000..297697bce --- /dev/null +++ b/luacs-docs/cs/.gitignore @@ -0,0 +1,4 @@ +html +*/html +*/*.tag +build diff --git a/doxygen/Doxyfile b/luacs-docs/cs/Doxyfile similarity index 100% rename from doxygen/Doxyfile rename to luacs-docs/cs/Doxyfile diff --git a/luacs-docs/cs/DoxygenLayout.xml b/luacs-docs/cs/DoxygenLayout.xml new file mode 100644 index 000000000..d43a0a564 --- /dev/null +++ b/luacs-docs/cs/DoxygenLayout.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/doxygen/baro-client/Doxyfile b/luacs-docs/cs/baro-client/Doxyfile similarity index 99% rename from doxygen/baro-client/Doxyfile rename to luacs-docs/cs/baro-client/Doxyfile index 16faf32d5..66f47267f 100644 --- a/doxygen/baro-client/Doxyfile +++ b/luacs-docs/cs/baro-client/Doxyfile @@ -906,8 +906,8 @@ WARN_LOGFILE = # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING # Note: If this tag is empty the current directory is searched. -INPUT = ../../Barotrauma/BarotraumaShared/SharedSource \ - ../../Barotrauma/BarotraumaClient/ClientSource +INPUT = ../../../Barotrauma/BarotraumaShared/SharedSource \ + ../../../Barotrauma/BarotraumaClient/ClientSource # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses diff --git a/luacs-docs/cs/baro-client/DoxygenLayout.xml b/luacs-docs/cs/baro-client/DoxygenLayout.xml new file mode 100644 index 000000000..8dc37b112 --- /dev/null +++ b/luacs-docs/cs/baro-client/DoxygenLayout.xml @@ -0,0 +1,243 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doxygen/baro-server/Doxyfile b/luacs-docs/cs/baro-server/Doxyfile similarity index 99% rename from doxygen/baro-server/Doxyfile rename to luacs-docs/cs/baro-server/Doxyfile index 9915adeeb..bf64a80e3 100644 --- a/doxygen/baro-server/Doxyfile +++ b/luacs-docs/cs/baro-server/Doxyfile @@ -906,8 +906,8 @@ WARN_LOGFILE = # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING # Note: If this tag is empty the current directory is searched. -INPUT = ../../Barotrauma/BarotraumaShared/SharedSource \ - ../../Barotrauma/BarotraumaServer/ServerSource +INPUT = ../../../Barotrauma/BarotraumaShared/SharedSource \ + ../../../Barotrauma/BarotraumaServer/ServerSource # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses diff --git a/luacs-docs/cs/baro-server/DoxygenLayout.xml b/luacs-docs/cs/baro-server/DoxygenLayout.xml new file mode 100644 index 000000000..e3cf9460f --- /dev/null +++ b/luacs-docs/cs/baro-server/DoxygenLayout.xml @@ -0,0 +1,243 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doxygen/custom.css b/luacs-docs/cs/custom.css similarity index 72% rename from doxygen/custom.css rename to luacs-docs/cs/custom.css index 33add5ebf..95930c3ac 100644 --- a/doxygen/custom.css +++ b/luacs-docs/cs/custom.css @@ -18,164 +18,137 @@ div.fragment { padding-left: 3px; padding-right: 3px; } - -body -{ + +body { background-color: #333333; /** for docs **/ color: #a1a1a1; } -#page-content -{ +#page-content { background-color: #333333; color: #bcbcbc; } -pre, pre.fragment -{ +pre, pre.fragment { background-color: #282828; } -.icon -{ +.icon { color: #333; background-color: #2f436b; /* from orig #728DC1; */; } -.arrow -{ +.arrow { color: #324872; /* from orig #9CAFD4; */; } /* to make keyword visible for above 'pre' */ -.highlight .nf -{ +.highlight .nf { color: #00adee; } -img -{ +img { background-color: #333333; } /** Note/Message boxes **/ -div.admonition, div.warning -{ +div.admonition, div.warning { background-color: #474747; } -div.admonition p.admonition-title, div.warning p.admonition-title -{ +div.admonition p.admonition-title, div.warning p.admonition-title { background-color: #707070; } /**** News ***/ -#content-outer -{ +#content-outer { background-color: #333333; } -.postmeta -{ +.postmeta { background-color: #474747; border-color: #595959; } /**** Blog ****/ -div.blogpost -{ +div.blogpost { background-color: #333; } -div.blogpost-header -{ +div.blogpost-header { background-color: #333; } -div.blogbody -{ +div.blogbody { background-color: #474747; } /**** Jobs ****/ -.dataTable tbody .even -{ +.dataTable tbody .even { background-color: #474747; } -.dataTable thead th -{ +.dataTable thead th { background-color: #6b6b6b; } /* Job Post Overlay */ -#fancybox-outer -{ +#fancybox-outer { color: #bcbcbc; background-color: #282828; } /***** Search box *****/ -#MSearchBox -{ +#MSearchBox { background-color: #333333; } -#MSearchBox .left -{ +#MSearchBox .left { filter: invert(80%); } -#MSearchSelect -{ +#MSearchSelect { background-color: transparent; } -.MSearchBoxActive #MSearchField -{ +.MSearchBoxActive #MSearchField { color: #333333; - /* this is inverted */; + /* this is inverted */ } -#MSearchBox .right -{ +#MSearchBox .right { filter: invert(80%); } -#MSearchCloseImg -{ +#MSearchCloseImg { background-color: transparent; } /** Magnifying glass dropdown list **/ -#MSearchSelectWindow -{ +#MSearchSelectWindow { background-color: #333333; border-color: #404040; } -a.SelectItem, a.SelectItem:focus, a.SelectItem:active -{ +a.SelectItem, a.SelectItem:focus, a.SelectItem:active { color: #999; } -a.SelectItem:hover -{ +a.SelectItem:hover { color: #bcbcbc; } /** Query Results dropdown list **/ -#MSearchResultsWindow -{ -/* left: !important; / * from orig 992px; * / dynamically generated value */ +#MSearchResultsWindow { + /* left: !important; / * from orig 992px; * / dynamically generated value */ border-color: #404040; } @@ -187,48 +160,47 @@ a.SelectItem:hover /* #MSearchCloseImg { } */ -.SRPage .SREntry -{ +.SRPage .SREntry { font-size: 80%; } -.SRResult:hover -{ +.SRResult:hover { background-color: #404040; } -.SRSymbol:hover -{ +.SRSymbol:hover { color: #4a69a9; /* from orig #425E97; */; } /***** For Docs *****/ -div.header -{ +div.header { background-color: #333333; border-bottom-color: #001; background-image: none; } -div.directory -{ +div.directory { border-top-color: #404040; border-bottom-color: #404040; } -td.memItemLeft, td.memItemRight, .mdescLeft, .mdescRight, .memdoc, .memTemplParams, .memTemplItemLeft, .memTemplItemRight -{ +td.memItemLeft, +td.memItemRight, +.mdescLeft, +.mdescRight, +.memdoc, +.memTemplParams, +.memTemplItemLeft, +.memTemplItemRight { background-color: #282828; } -.memSeparator -{ +.memSeparator { border-bottom-color: #333333; } -.memtitle -{ +.memtitle { background-color: #333333; background-image: none; border-top-color: #404040; @@ -236,8 +208,7 @@ td.memItemLeft, td.memItemRight, .mdescLeft, .mdescRight, .memdoc, .memTemplPara border-right-color: #404040; } -.memproto, dl.reflist dt -{ +.memproto, dl.reflist dt { /* 2nd for ToDo List */ color: #949b8c; /* #878f7e; */ @@ -249,57 +220,48 @@ td.memItemLeft, td.memItemRight, .mdescLeft, .mdescRight, .memdoc, .memTemplPara border-right-color: #404040; } -.memname -{ +.memname { background-color: #333333; } -a -{ +a { color: #adb8a1; } -a.el, a.el:visited -{ +a.el, a.el:visited { color: #6f8b4c; - /* #6d7c5d; */; + /* #6d7c5d; */; } -.memdoc -{ +.memdoc { background-image: none; } -.memdoc, dl.reflist dd -{ - /* 2nd for ToDo List */ +.memdoc, dl.reflist dd { + /* 2nd for ToDo List */ background-color: #282828; border-bottom-color: #404040; border-left-color: #404040; border-right-color: #404040; } -.paramname -{ +.paramname { color: #8f6262; } -img.formulaInl -{ +img.formulaInl { filter: invert(84%); background-color: #fff; } /* Template box headers */ -.memtemplate -{ +.memtemplate { color: #607fbb; /* from orignial #4665A2; */; } /* Labels - protected, static, virtual */ -span.mlabel -{ +span.mlabel { background-color: #282828; border-color: #333; color: #aaa; @@ -307,153 +269,127 @@ span.mlabel } /* Header */ -h2.groupheader -{ +h2.groupheader { color: #4c6db0; - /* from orig. #354C7B; */ + /* from orig. #354C7B; */ border-bottom-color: #333333; } -.inherit_header img -{ +.inherit_header img { background-color: #333333; } /* To make comments visible */ -span.comment -{ +span.comment { color: #7b7b7b; } /* Even rows of lists */ -.directory tr.even -{ +.directory tr.even { background-color: #303030; } /* Tables */ -table.fieldtable -{ +table.fieldtable { border-color: #404040; } -.fieldtable th -{ +.fieldtable th { color: #aaa; background-color: #333333; border-bottom-color: #404040; background-image: none; } -.fieldtable td.fieldtype, .fieldtable td.fieldname -{ +.fieldtable td.fieldtype, .fieldtable td.fieldname { border-right-color: #404040; border-bottom-color: #404040; } -.fieldtable td.fielddoc -{ +.fieldtable td.fielddoc { border-bottom-color: #404040; } -div.center > img -{ +div.center > img { background-color: #cccccc; filter: invert(100%); } /**** Source Code View ****/ -div.fragment -{ +div.fragment { background-color: #282828; border-color: #333333; } -.navpath li.navelem a -{ +.navpath li.navelem a { color: #d1d1d1; text-shadow: none; } -.navpath li.navelem a:hover -{ +.navpath li.navelem a:hover { color: #f1f1f1; text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); } -span.lineno -{ +span.lineno { background-color: #333333; border-right-color: #333333; color: #666; } -span.line -{ +span.line { background-color: #3f3f3f; } -span.lineno a -{ +span.lineno a { background-color: #333333; } -span.lineno a:hover -{ +span.lineno a:hover { background-color: #444444; } -a.code, a.code:visited, a.line, a.line:visited -{ +a.code, a.code:visited, a.line, a.line:visited { color: #4fa2b3; } -span.keyword -{ +span.keyword { color: #00b300; } -span.keywordtype -{ +span.keywordtype { color: #ac7339; } -span.stringliteral -{ +span.stringliteral { color: #0140ff; } -#powerTip -{ +#powerTip { background-color: #282828; } -#powerTip div -{ +#powerTip div { background-color: #282828; } /**** Navigation ****/ -#nav-tree -{ +#nav-tree { background-color: #282828; background-image: none; } -#nav-tree img -{ +#nav-tree img { background-color: #282828; } -#nav-tree .selected a -{ +#nav-tree .selected a { color: #bcbcbc; } /** Split bar **/ -.ui-resizable-e -{ +.ui-resizable-e { filter: invert(70%); opacity: 0.2; } @@ -462,32 +398,27 @@ span.stringliteral /*** Type 1 e.g. https://dartsim.github.io/api/ ***/ -.tabs, .tabs2, .tabs3 -{ +.tabs, .tabs2, .tabs3 { background-image: none; } -.tablist li -{ +.tablist li { background-image: none; } -.tablist li.current a -{ +.tablist li.current a { color: #aaa; background-image: none; background-color: #444; } -.tablist a -{ +.tablist a { color: #bcbcbc; text-shadow: none; background-image: none; } -.tablist a:hover -{ +.tablist a:hover { color: #bcbcbc; background-color: #444444; background-image: none; @@ -495,20 +426,17 @@ span.stringliteral /*** Type 2 e.g. https://clang.llvm.org/doxygen/ ***/ -.sm-dox -{ +.sm-dox { background-image: none; } -.sm-dox a, .sm-dox a.highlighted -{ +.sm-dox a, .sm-dox a.highlighted { color: #bcbcbc; text-shadow: none; background-image: none; } -.sm-dox a:focus, .sm-dox a:active, .sm-dox a:hover -{ +.sm-dox a:focus, .sm-dox a:active, .sm-dox a:hover { color: #bcbcbc; background-color: #444444; background-image: none; @@ -516,83 +444,69 @@ span.stringliteral /** Pop-Pane **/ -.sm-dox ul -{ +.sm-dox ul { background-color: #333333; border-color: #666; } -.sm-dox ul a, .sm-dox ul a:focus, .sm-dox ul a:hover, .sm-dox ul a:active -{ +.sm-dox ul a, .sm-dox ul a:focus, .sm-dox ul a:hover, .sm-dox ul a:active { background-color: #333333; } -.sm-dox span.scroll-up, .sm-dox span.scroll-down -{ +.sm-dox span.scroll-up, .sm-dox span.scroll-down { background-color: #333333; } -.sm-dox span.scroll-up:hover, .sm-dox span.scroll-down:hover -{ +.sm-dox span.scroll-up:hover, .sm-dox span.scroll-down:hover { background-color: #444444; } -.sm-dox a span.sub-arrow -{ +.sm-dox a span.sub-arrow { border-top-color: #bcbcbc; } -.sm-dox a:hover span.sub-arrow -{ +.sm-dox a:hover span.sub-arrow { border-top-color: #cccccc; } -.sm-dox ul a, .sm-dox ul a:hover, .sm-dox ul a:focus, .sm-dox ul a:active, .sm-dox ul a.highlighted -{ +.sm-dox ul a, .sm-dox ul a:hover, .sm-dox ul a:focus, .sm-dox ul a:active, .sm-dox ul a.highlighted { color: #bcbcbc; } -.sm-dox > li > ul::before, .sm-dox > li > ul::after -{ +.sm-dox > li > ul::before, .sm-dox > li > ul::after { border-bottom-color: #333333; } /* Top menu-item highlighted only, for contrast with arrow */ -.sm-dox a.highlighted -{ +.sm-dox a.highlighted { background-color: #444444; } -.sm-dox ul a.highlighted -{ +.sm-dox ul a.highlighted { background-color: #333333; } /**** Bottom Tab ****/ -.navpath ul -{ +.navpath ul { background-image: none; border-color: #666; } -img.footer -{ +img.footer { background-color: #333333; opacity: 0.1; } /**** Navigation Tab ****/ /* e.g. nlohmann.github.io/json */ -div.navtab -{ +div.navtab { background-color: #333333; } /**** Classes ****/ /*** Class List, Member List ***/ -td.indexkey, td.indexvalue, tr.memlist -{ +td.indexkey, td.indexvalue, tr.memlist { background-color: #333333; } -/* } */ \ No newline at end of file +/* } */ diff --git a/doxygen/intro.md b/luacs-docs/cs/intro.md similarity index 100% rename from doxygen/intro.md rename to luacs-docs/cs/intro.md diff --git a/luacs-docs/cs/scripts/build.ps1 b/luacs-docs/cs/scripts/build.ps1 new file mode 100644 index 000000000..8115ee92b --- /dev/null +++ b/luacs-docs/cs/scripts/build.ps1 @@ -0,0 +1,36 @@ +Import-Module $PSScriptRoot/../../scripts/location.ps1 + +try { + Change-Location $PSScriptRoot/.. + + if ((Get-Command "doxgen" -ErrorAction SilentlyContinue) -eq $null) { + echo "doxygen not found" + exit 1 + } + + Remove-Item -Force -Recurse ./build | Out-Null + New-Item -ItemType Directory ./build | Out-Null + New-Item -ItemType Directory ./build/baro-server | Out-Null + New-Item -ItemType Directory ./build/baro-client | Out-Null + + echo "Building server docs" + try { + Change-Location ./baro-server + doxygen ./Doxyfile + } finally { + Restore-Location + } + + echo "Building client docs" + try { + Change-Location ./baro-client + doxygen ./Doxyfile + } finally { + Restore-Location + } + + echo "Building shared docs" + doxygen ./Doxyfile +} finally { + Restore-Location +} diff --git a/luacs-docs/cs/scripts/build.sh b/luacs-docs/cs/scripts/build.sh new file mode 100755 index 000000000..4e697f227 --- /dev/null +++ b/luacs-docs/cs/scripts/build.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" +cd "$DIR/.." + +if ! command -v "doxygen" &> /dev/null; then + echo "doxygen not found" + exit 1 +fi + +rm -rf ./build +mkdir -p ./build +mkdir -p ./build/baro-server +mkdir -p ./build/baro-client + +echo "Building server docs" +( + cd ./baro-server + doxygen ./Doxyfile +) + +echo "Building client docs" +( + cd ./baro-client + doxygen ./Doxyfile +) + +echo "Building shared docs" +doxygen ./Doxyfile diff --git a/luacs-docs/cs/scripts/serve.ps1 b/luacs-docs/cs/scripts/serve.ps1 new file mode 100644 index 000000000..4dcffcfa1 --- /dev/null +++ b/luacs-docs/cs/scripts/serve.ps1 @@ -0,0 +1,18 @@ +Import-Module $PSScriptRoot/../../scripts/location.ps1 + +try { + Change-Location $PSScriptRoot/.. + + if ((Get-Command "python3" -ErrorAction SilentlyContinue) -eq $null) { + echo "python3 not found" + exit 1 + } + + python3 ../scripts/http_server.py ./build ` + --port 8001 ` + --route /:html ` + --route /baro-client:baro-client ` + --route /baro-server:baro-server +} finally { + Restore-Location +} diff --git a/luacs-docs/cs/scripts/serve.sh b/luacs-docs/cs/scripts/serve.sh new file mode 100755 index 000000000..c320059e6 --- /dev/null +++ b/luacs-docs/cs/scripts/serve.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" +cd "$DIR/.." + +if ! command -v "python3" &> /dev/null; then + echo "python3 not found" + exit 1 +fi + +python3 ../scripts/http_server.py ./build \ + --port 8001 \ + --route /:html \ + --route /baro-client:baro-client \ + --route /baro-server:baro-server diff --git a/doxygen/searchdata.xml b/luacs-docs/cs/searchdata.xml similarity index 100% rename from doxygen/searchdata.xml rename to luacs-docs/cs/searchdata.xml diff --git a/docs-landing-page/bg.jpg b/luacs-docs/landing-page/bg.jpg similarity index 100% rename from docs-landing-page/bg.jpg rename to luacs-docs/landing-page/bg.jpg diff --git a/docs-landing-page/cs_logo.png b/luacs-docs/landing-page/cs_logo.png similarity index 100% rename from docs-landing-page/cs_logo.png rename to luacs-docs/landing-page/cs_logo.png diff --git a/luacs-docs/landing-page/index.html b/luacs-docs/landing-page/index.html new file mode 100644 index 000000000..ab682ca7e --- /dev/null +++ b/luacs-docs/landing-page/index.html @@ -0,0 +1,25 @@ + + + + + LuaCs For Barotrauma + + + + +
+
+
+ +
+
+
+
+
+
+ +
+
+
+ + diff --git a/luacs-docs/landing-page/landing.css b/luacs-docs/landing-page/landing.css new file mode 100644 index 000000000..7ba88a55c --- /dev/null +++ b/luacs-docs/landing-page/landing.css @@ -0,0 +1,131 @@ +body { + overflow: hidden; + font-size: 100%; + background-color: #777; +} + +.common-docs { + z-index: 1; + text-justify: auto; + position: fixed; + top: 0; + bottom: 0; + transition-property: transform; + transition-duration: 0.5s; + transition-timing-function: ease-in-out; + overflow: hidden; +} +#lua-docs { + left: -10%; + right: 50%; +} +#cs-docs { + right: -10%; + left: 50%; +} + +#cs-docs::before, #lua-docs::before { + content: ""; + background: url(bg.jpg) repeat; + background-size: 80%; + background-blend-mode: luminosity; + filter: blur(2px); + position: absolute; + height: 200%; + width: 200%; +} +#lua-docs::before { + background-color: rgba(49, 49, 135, 1); +} +#cs-docs::before { + background-color: rgba(105, 44, 120, 1); +} + +.common-docs:hover { + z-index: 2; + font-size: 300%; + transform: scale(1.05); +} + +.inner-bg { + position: relative; + width: 100%; + height: 100%; + display: flex; + align-items: center; + justify-content: center; + transition-duration: 0.5s; + transition-timing-function: ease-in-out; +} +.inner-bg:hover { + background-color: rgba(255, 255, 255, 0.35); +} + +.inner-docs { + height: 100%; + width: 100%; + display: flex; + align-items: center; + justify-content: center; + position: relative; + background: radial-gradient(circle, #222, rgba(0, 0, 0, 0)); +} + +@media (min-width: 80em) { + .inner-docs img { + height: 30%; + width: auto; + } + .common-docs { + transform: skewX(-11deg); + } + #cs-docs::before, #lua-docs::before { + transform: skewX(11deg); + } + .common-docs:hover { + transform: skewX(-11deg) scale(1.05); + } + .inner-docs { + transform: skewX(11deg); + } + .inner-docs img { + height: 30%; + width: auto; + } +} +@media (max-width: 80em) { + .common-docs { + transform: skewX(-9deg); + } + #cs-docs::before, #lua-docs::before { + transform: skewX(9deg); + } + .common-docs:hover { + transform: skewX(-9deg) scale(1.05); + } + .inner-docs { + transform: skewX(9deg); + } + .inner-docs img { + height: 30%; + width: auto; + } +} +@media (max-width: 70em) { + .common-docs { + transform: skewX(0deg); + } + #cs-docs::before, #lua-docs::before { + transform: skewX(0deg); + } + .common-docs:hover { + transform: skewX(0deg) scale(1.05); + } + .inner-docs { + transform: skewX(0deg); + } + .inner-docs img { + height: auto; + width: 50%; + } +} diff --git a/docs-landing-page/lua_logo.png b/luacs-docs/landing-page/lua_logo.png similarity index 100% rename from docs-landing-page/lua_logo.png rename to luacs-docs/landing-page/lua_logo.png diff --git a/docs/.gitignore b/luacs-docs/lua/.gitignore similarity index 66% rename from docs/.gitignore rename to luacs-docs/lua/.gitignore index 97249b860..097e7e227 100644 --- a/docs/.gitignore +++ b/luacs-docs/lua/.gitignore @@ -1,2 +1,2 @@ -html +build lua_modules diff --git a/docs/baseluadocs/Affliction.lua b/luacs-docs/lua/baseluadocs/Affliction.lua similarity index 100% rename from docs/baseluadocs/Affliction.lua rename to luacs-docs/lua/baseluadocs/Affliction.lua diff --git a/docs/baseluadocs/AfflictionPrefab.lua b/luacs-docs/lua/baseluadocs/AfflictionPrefab.lua similarity index 100% rename from docs/baseluadocs/AfflictionPrefab.lua rename to luacs-docs/lua/baseluadocs/AfflictionPrefab.lua diff --git a/docs/baseluadocs/AnimController.lua b/luacs-docs/lua/baseluadocs/AnimController.lua similarity index 100% rename from docs/baseluadocs/AnimController.lua rename to luacs-docs/lua/baseluadocs/AnimController.lua diff --git a/docs/baseluadocs/Character.lua b/luacs-docs/lua/baseluadocs/Character.lua similarity index 100% rename from docs/baseluadocs/Character.lua rename to luacs-docs/lua/baseluadocs/Character.lua diff --git a/docs/baseluadocs/CharacterHealth.lua b/luacs-docs/lua/baseluadocs/CharacterHealth.lua similarity index 100% rename from docs/baseluadocs/CharacterHealth.lua rename to luacs-docs/lua/baseluadocs/CharacterHealth.lua diff --git a/docs/baseluadocs/CharacterInfo.lua b/luacs-docs/lua/baseluadocs/CharacterInfo.lua similarity index 100% rename from docs/baseluadocs/CharacterInfo.lua rename to luacs-docs/lua/baseluadocs/CharacterInfo.lua diff --git a/docs/baseluadocs/CharacterInventory.lua b/luacs-docs/lua/baseluadocs/CharacterInventory.lua similarity index 100% rename from docs/baseluadocs/CharacterInventory.lua rename to luacs-docs/lua/baseluadocs/CharacterInventory.lua diff --git a/docs/baseluadocs/Client.lua b/luacs-docs/lua/baseluadocs/Client.lua similarity index 100% rename from docs/baseluadocs/Client.lua rename to luacs-docs/lua/baseluadocs/Client.lua diff --git a/docs/baseluadocs/Entity.Spawner.lua b/luacs-docs/lua/baseluadocs/Entity.Spawner.lua similarity index 100% rename from docs/baseluadocs/Entity.Spawner.lua rename to luacs-docs/lua/baseluadocs/Entity.Spawner.lua diff --git a/docs/baseluadocs/Entity.lua b/luacs-docs/lua/baseluadocs/Entity.lua similarity index 100% rename from docs/baseluadocs/Entity.lua rename to luacs-docs/lua/baseluadocs/Entity.lua diff --git a/docs/baseluadocs/GameScreen.lua b/luacs-docs/lua/baseluadocs/GameScreen.lua similarity index 100% rename from docs/baseluadocs/GameScreen.lua rename to luacs-docs/lua/baseluadocs/GameScreen.lua diff --git a/docs/baseluadocs/GameSession.lua b/luacs-docs/lua/baseluadocs/GameSession.lua similarity index 100% rename from docs/baseluadocs/GameSession.lua rename to luacs-docs/lua/baseluadocs/GameSession.lua diff --git a/docs/baseluadocs/GameSettings.lua b/luacs-docs/lua/baseluadocs/GameSettings.lua similarity index 100% rename from docs/baseluadocs/GameSettings.lua rename to luacs-docs/lua/baseluadocs/GameSettings.lua diff --git a/docs/baseluadocs/Hull.lua b/luacs-docs/lua/baseluadocs/Hull.lua similarity index 100% rename from docs/baseluadocs/Hull.lua rename to luacs-docs/lua/baseluadocs/Hull.lua diff --git a/docs/baseluadocs/Inventory.lua b/luacs-docs/lua/baseluadocs/Inventory.lua similarity index 100% rename from docs/baseluadocs/Inventory.lua rename to luacs-docs/lua/baseluadocs/Inventory.lua diff --git a/docs/baseluadocs/Item.lua b/luacs-docs/lua/baseluadocs/Item.lua similarity index 100% rename from docs/baseluadocs/Item.lua rename to luacs-docs/lua/baseluadocs/Item.lua diff --git a/docs/baseluadocs/ItemInventory.lua b/luacs-docs/lua/baseluadocs/ItemInventory.lua similarity index 100% rename from docs/baseluadocs/ItemInventory.lua rename to luacs-docs/lua/baseluadocs/ItemInventory.lua diff --git a/docs/baseluadocs/ItemPrefab.lua b/luacs-docs/lua/baseluadocs/ItemPrefab.lua similarity index 100% rename from docs/baseluadocs/ItemPrefab.lua rename to luacs-docs/lua/baseluadocs/ItemPrefab.lua diff --git a/docs/baseluadocs/Job.lua b/luacs-docs/lua/baseluadocs/Job.lua similarity index 100% rename from docs/baseluadocs/Job.lua rename to luacs-docs/lua/baseluadocs/Job.lua diff --git a/docs/baseluadocs/JobPrefab.lua b/luacs-docs/lua/baseluadocs/JobPrefab.lua similarity index 100% rename from docs/baseluadocs/JobPrefab.lua rename to luacs-docs/lua/baseluadocs/JobPrefab.lua diff --git a/docs/baseluadocs/Level.lua b/luacs-docs/lua/baseluadocs/Level.lua similarity index 100% rename from docs/baseluadocs/Level.lua rename to luacs-docs/lua/baseluadocs/Level.lua diff --git a/docs/baseluadocs/NetLobbyScreen.lua b/luacs-docs/lua/baseluadocs/NetLobbyScreen.lua similarity index 100% rename from docs/baseluadocs/NetLobbyScreen.lua rename to luacs-docs/lua/baseluadocs/NetLobbyScreen.lua diff --git a/docs/baseluadocs/ServerSettings.lua b/luacs-docs/lua/baseluadocs/ServerSettings.lua similarity index 100% rename from docs/baseluadocs/ServerSettings.lua rename to luacs-docs/lua/baseluadocs/ServerSettings.lua diff --git a/docs/baseluadocs/Submarine.lua b/luacs-docs/lua/baseluadocs/Submarine.lua similarity index 100% rename from docs/baseluadocs/Submarine.lua rename to luacs-docs/lua/baseluadocs/Submarine.lua diff --git a/docs/baseluadocs/SubmarineInfo.lua b/luacs-docs/lua/baseluadocs/SubmarineInfo.lua similarity index 100% rename from docs/baseluadocs/SubmarineInfo.lua rename to luacs-docs/lua/baseluadocs/SubmarineInfo.lua diff --git a/docs/baseluadocs/WayPoint.lua b/luacs-docs/lua/baseluadocs/WayPoint.lua similarity index 100% rename from docs/baseluadocs/WayPoint.lua rename to luacs-docs/lua/baseluadocs/WayPoint.lua diff --git a/docs/baseluadocs/World.lua b/luacs-docs/lua/baseluadocs/World.lua similarity index 100% rename from docs/baseluadocs/World.lua rename to luacs-docs/lua/baseluadocs/World.lua diff --git a/docs/config.ld b/luacs-docs/lua/config.ld similarity index 99% rename from docs/config.ld rename to luacs-docs/lua/config.ld index bd278528e..545535ce6 100644 --- a/docs/config.ld +++ b/luacs-docs/lua/config.ld @@ -6,7 +6,7 @@ file = { module_file = {} -dir = "html" +dir = "build" project = "LuaForBarotrauma" title = "LuaForBarotrauma Documentation" diff --git a/docs/css/highlight.css b/luacs-docs/lua/css/highlight.css similarity index 99% rename from docs/css/highlight.css rename to luacs-docs/lua/css/highlight.css index 61447dba9..087149f5a 100644 --- a/docs/css/highlight.css +++ b/luacs-docs/lua/css/highlight.css @@ -10,7 +10,7 @@ * @author Zeno Rocha */ - .hljs { +.hljs { display: block; overflow-x: auto; padding: 0.5em; diff --git a/luacs-docs/lua/css/ldoc.css b/luacs-docs/lua/css/ldoc.css new file mode 100644 index 000000000..122b60cc8 --- /dev/null +++ b/luacs-docs/lua/css/ldoc.css @@ -0,0 +1,543 @@ + +:root { + --content-width: 100%; + --sidebar-width: 25%; + + --padding-big: 48px; + --padding-normal: 24px; + --padding-small: 16px; + --padding-tiny: 10px; + + --font-massive: 32px; + --font-huge: 24px; + --font-big: 18px; + --font-normal: 16px; + --font-tiny: 12px; + + --font-style-normal: Segoe UI, Helvetica, Arial, sans-serif; + --font-style-code: Consolas, monospace; + + --color-accent: rgb(47, 100, 74); + --color-accent-dark: rgb(33, 33, 33); + --color-white: rgb(255, 255, 255); + --color-offwhite: rgb(200, 200, 200); + --color-white-accent: rgb(203, 190, 209); + --color-black: rgb(0, 0, 0); + --color-lightgrey: rgb(160, 160, 160); + --color-background-light: rgb(245, 245, 245); + --color-background-dark: rgb(33, 33, 33); + --color-background-dark-ish: rgb(44, 44, 44); + --color-outline: rgb(149, 34, 160); + --color-good: #5190ff; +} + +* { + padding: 0; + margin: 0; + box-sizing: border-box; +} + +body { + background-color: var(--color-background-dark); + font-family: var(--font-style-normal); + + display: flex; + flex-direction: column; +} + +a { + color: inherit; + text-decoration: inherit; +} + +h1, h2, h3, h4 { + font-weight: 400; +} + +ul li { + margin-left: var(--padding-small); +} + +/* landing */ +.landing { + background-color: var(--color-accent); + color: var(--color-white); + + padding: 128px 0 128px 0; +} + +.landing h1 { + margin: 0; + padding: 0; + border: none; + + font-weight: 100; + font-size: var(--font-massive); + text-align: center; +} + +.wrapper { + padding: var(--padding-small); +} + +details { + user-select: none; +} + +details summary { + outline: none; +} + +code { + font-family: "Source Code Pro", monospace; + font-size: 85%; + white-space: pre; + tab-size: 4; + -moz-tab-size: 4; + padding: 1px 4px; + background-color: #282a36; + outline-style: solid; + outline-color: black; + outline-width: 2px; +} + +pre { + background-color: rgb(0, 0, 0, 1); + margin-top: var(--padding-small); + padding: 2px; + overflow: auto; +} + +pre code { + background-color: transparent; +} + +span.realm { + width: 14px; + height: 14px; + border-radius: 3px; + display: inline-block; + margin-right: 5px; +} + +span.realm.shared { + background: linear-gradient(45deg, #f80 0%, #f80 50%, #08f 51%, #08f 100%); +} + +span.realm.client { + background-color: #f80; +} + +span.realm.server { + background-color: #08f; +} + + +.colorful-label { + color: rgb(31, 141, 155); +} + +/* wrapper element for sidebar/content */ +main { + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: flex-start; + + width: var(--content-width); + margin: auto; +} + +/* sidebar */ +nav { + color: var(--color-offwhite); + background-color: var(--color-background-dark); + + position: fixed; + display: flex; + flex-direction: column; + + width: var(--sidebar-width); + height: 100%; +} + +/* sidebar header */ +nav header { + color: var(--color-white); + background-color: var(--color-accent); + + padding: var(--padding-small); +} + +nav header h1 { + font-size: var(--font-huge); + font-weight: 100; + text-align: center; + + margin-bottom: var(--padding-small); +} + +#search { + background-color: var(--color-accent-dark); + color: var(--color-white); + + border: none; + font-size: var(--font-normal); + outline: none; + + width: 100%; + padding: 6px; +} + +#search::placeholder { + color: var(--color-white-accent); +} + +#search::-webkit-search-cancel-button { + display: none; +} + +/* sidebar contents */ +nav section { + padding: var(--padding-small); + overflow: auto; +} + +nav section ul { + list-style-type: none; +} + +nav section::-webkit-scrollbar, +pre::-webkit-scrollbar { + width: 8px; + height: 8px; +} + +nav section::-webkit-scrollbar-track, +pre::-webkit-scrollbar-track { + background: transparent; +} + +nav section::-webkit-scrollbar-thumb { + background-color: var(--color-lightgrey); +} + +pre::-webkit-scrollbar-thumb { + background-color: var(--color-lightgrey); +} + +/* sidebar contents category */ +nav section details.category { + padding-top: var(--padding-tiny); +} + +nav section details.category > ul > li { + margin: 0; + line-height: 1.5; +} + +nav section details.category > ul > li a { + display: inline-block; + width: 90%; +} + +nav section details.category:first-of-type { + padding-top: calc(var(--padding-tiny) * -1); +} + +nav section details.category summary::-webkit-details-marker { + opacity: 0.5; + cursor: pointer; +} + +nav section details.category summary h2 { + color: var(--color-accent); + + font-size: var(--font-big); + letter-spacing: 2px; + text-transform: uppercase; + cursor: pointer; + + padding-bottom: var(--padding-tiny); +} + +/* content */ +article { + background-color: var(--color-background-dark-ish); + color: white; + width: calc(100% - var(--sidebar-width)); + min-height: 100vh; + margin-left: var(--sidebar-width); +} + +article .wrapper > *:first-child { + margin-top: 0; +} + +/* header */ +article header { + color: rgb(255, 255, 255); + background-color: var(--color-accent); + padding: var(--padding-tiny); +} + +article header h1 { + border-bottom: 1px solid rgba(255, 255, 255, 0.25); + padding-bottom: 8px; + font-family: var(--font-style-code); + margin: 0; +} + +article header h2 { + padding-top: var(--padding-tiny); + margin: 0; + font-size: var(--font-normal); + font-weight: normal; +} + +article header.module a { + color: white !important; + text-decoration: underline; +} + +details.category > summary { + list-style: none; +} + +details.category > summary::-webkit-details-marker { + display: none; +} + +article h1 { + font-size: 28px; + font-weight: 600; + border-bottom: 1px solid rgba(0, 0, 0, 0.25); + margin-top: 24px; + margin-bottom: 16px; + padding-bottom: 8px; +} + +article h2 { + font-size: 20px; + font-weight: 600; + margin-top: 12px; +} + +article h3 { + color: var(--color-good); + margin-top: var(--padding-tiny); + text-transform: uppercase; +} + +article p { + margin-top: var(--padding-small); +} + +article p a, +article ul li a, +article h1 a, +article h2 a { + color: var(--color-good); + font-weight: 600; +} + +article h1.title { + color: rgb(255, 255, 255); + background-color: var(--color-accent); + margin-top: var(--padding-small); + margin-bottom: 0; + padding: var(--padding-tiny); + + font-size: var(--font-big); + font-weight: 100; + letter-spacing: 2px; + text-transform: uppercase; +} + +a.reference { + color: var(--color-good); + float: right; + margin-top: 8px; + padding-left: 8px; + font-size: 14px; + font-weight: 600; +} + +.notice { + --color-notice-background: var(--color-accent); + --color-notice-text: var(--color-notice-background); + + margin-top: var(--padding-tiny); + border: 2px solid var(--color-notice-background); +} + +.notice.error { + --color-notice-background: rgb(194, 52, 130); +} + +.notice.warning { + --color-notice-background: rgb(224, 169, 112); + --color-notice-text: rgb(167, 104, 37); +} + +.notice .title { + color: var(--color-white); + background-color: var(--color-notice-background); + + padding: var(--padding-tiny); + font-size: var(--font-normal); + + text-transform: uppercase; + letter-spacing: 2px; +} + +.notice p { + color: var(--color-notice-text); + + margin: 0 !important; + padding: var(--padding-tiny); +} + +/* function/table */ +.method { + display: flex; + flex-flow: column; + padding: var(--padding-tiny); + margin-top: var(--padding-small); +} + +.method header { + color: white; + background-color: inherit; + padding: 0; + order: -1; +} + +.method header .anchor { + color: inherit; + text-decoration: inherit; +} + +.method:target { + background-color: var(--color-background-dark); + + outline: solid; + outline-width: 1px; + outline-color: var(--color-accent); +} + +.method header:target { + background-color: var(--color-accent); +} + +.method header h1 { + font-family: "Source Code Pro", monospace; + padding-bottom: var(--padding-tiny); + border-bottom: 1px solid var(--color-accent); + font-size: 20px; +} + +.method header p:first-of-type { + margin-top: var(--padding-tiny); +} + +.method h3 { + color: var(--color-good); + font-size: var(--font-normal); + letter-spacing: 2px; + text-transform: uppercase; +} + +.method pre { + margin-top: var(--padding-tiny); +} + +@media only screen and (max-width: 1100px) { + main nav { + position: inherit; + } + + main article { + margin-left: 0; + } +} + +.method ul { + margin-top: var(--padding-tiny); + background-color: inherit; +} + +.method ul li { + list-style: none; + margin: 4px 0 0 var(--padding-normal); +} + +.method ul li:first-of-type { + margin-top: 0; +} + +.method ul li p { + margin: 4px 0 0 var(--padding-normal); +} + +.method ul li pre { + margin: 4px 0 0 var(--padding-normal); +} + +.method ul li a { + color: rgb(115, 53, 142); + font-weight: 600; +} + +/* we have to manually specify these instead of making a shared class since you cannot customize the parameter class in ldoc */ +.parameter, .type, .default { + display: inline-block; + color: rgb(255, 255, 255) !important; + + padding: 4px; + font-size: 14px; + font-family: "Source Code Pro", monospace; +} + +.parameter { + background-color: rgb(115, 53, 142); +} + +.type { + background-color: rgb(31, 141, 155); +} + +a.type { + font-weight: 300 !important; + text-decoration: underline; +} + +.default { + background-color: rgb(193, 114, 11); +} + +.type a { + padding: 0; +} + +.or { + color: rgba(115, 53, 142, 0.5); + background-color: inherit; + + width: calc(100% - 32px); + height: 8px; + margin: 0 0 8px 32px; + + text-align: center; + font-weight: 600; + border-bottom: 1px solid rgba(115, 53, 142, 0.5); +} + +.or span { + background-color: inherit; + padding: 0 8px 0 8px; +} + +.strikethrough { + text-decoration: line-through; +} diff --git a/luacs-docs/lua/js/app.js b/luacs-docs/lua/js/app.js new file mode 100644 index 000000000..d5941fac8 --- /dev/null +++ b/luacs-docs/lua/js/app.js @@ -0,0 +1,138 @@ +const skippedCategories = ["manual"]; + +class Node { + constructor(name, element, expandable, noAutoCollapse, children = []) { + this.name = name; + this.element = element; + this.expandable = expandable; + this.noAutoCollapse = noAutoCollapse; + this.children = children; + } + + AddChild(name, element, expandable, noAutoCollapse, children) { + let newNode = new Node(name, element, expandable, noAutoCollapse, children); + this.children.push(newNode); + + return newNode; + } +} + +class SearchManager { + constructor(input, contents) { + this.input = input; + this.input.addEventListener("input", event => { + this.OnInputUpdated(this.input.value.toLowerCase().replace(/:/g, ".")); + }); + + // setup search tree + this.tree = new Node("", document.createElement("null"), true, true); + this.entries = {}; + + const categoryElements = contents.querySelectorAll(".category"); + + // iterate each kind (hooks/libraries/classes/etc) + for (const category of categoryElements) { + const nameElement = category.querySelector(":scope > summary > h2"); + + if (!nameElement) { + continue; + } + + const categoryName = nameElement.textContent.trim().toLowerCase(); + + if (skippedCategories.includes(categoryName)) { + continue; + } + + let categoryNode = this.tree.AddChild(categoryName, category, true, true); + const sectionElements = category.querySelectorAll(":scope > ul > li"); + + for (const section of sectionElements) { + const entryElements = section.querySelectorAll(":scope > details > ul > li > a"); + const sectionName = section.querySelector(":scope > details > summary > a") + .textContent + .trim() + .toLowerCase(); + + let sectionNode = categoryNode.AddChild(sectionName, section.querySelector(":scope > details"), true); + + for (let i = 0; i < entryElements.length; i++) { + const entryElement = entryElements[i]; + const entryName = entryElement.textContent.trim().toLowerCase(); + + sectionNode.AddChild(sectionName + "." + entryName, entryElement.parentElement); + } + } + } + } + + ResetVisibility(current) { + current.element.style.display = ""; + + if (current.noAutoCollapse) { + current.element.open = true; + } + else if (current.expandable) { + current.element.open = false; + } + + for (let node of current.children) { + this.ResetVisibility(node); + } + } + + Search(input, current) { + let matched = false; + + if (current.name.indexOf(input) != -1) { + matched = true; + } + + for (let node of current.children) { + let childMatched = this.Search(input, node); + matched = matched || childMatched; + } + + if (matched) { + current.element.style.display = ""; + + if (current.expandable) { + current.element.open = true; + } + } else { + current.element.style.display = "none"; + + if (current.expandable) { + current.element.open = false; + } + } + + return matched; + } + + OnInputUpdated(input) { + if (input.length <= 1) { + this.ResetVisibility(this.tree); + return; + } + + this.Search(input, this.tree); + } +} + +window.onload = function() { + const openDetails = document.querySelector(".category > ul > li > details[open]"); + + if (openDetails) { + openDetails.scrollIntoView(); + } +} + +document.addEventListener("DOMContentLoaded", function() { + const searchInput = document.getElementById("search"); + const contents = document.querySelector("body > main > nav > section"); + + if (searchInput && contents) { + new SearchManager(searchInput, contents); + } +}); diff --git a/docs/js/highlight.min.js b/luacs-docs/lua/js/highlight.min.js similarity index 100% rename from docs/js/highlight.min.js rename to luacs-docs/lua/js/highlight.min.js diff --git a/docs/libs/ldoc b/luacs-docs/lua/libs/ldoc similarity index 100% rename from docs/libs/ldoc rename to luacs-docs/lua/libs/ldoc diff --git a/docs/lua/File.lua b/luacs-docs/lua/lua/File.lua similarity index 100% rename from docs/lua/File.lua rename to luacs-docs/lua/lua/File.lua diff --git a/docs/lua/Game.lua b/luacs-docs/lua/lua/Game.lua similarity index 100% rename from docs/lua/Game.lua rename to luacs-docs/lua/lua/Game.lua diff --git a/docs/lua/Hooks.lua b/luacs-docs/lua/lua/Hooks.lua similarity index 100% rename from docs/lua/Hooks.lua rename to luacs-docs/lua/lua/Hooks.lua diff --git a/docs/lua/Networking.lua b/luacs-docs/lua/lua/Networking.lua similarity index 100% rename from docs/lua/Networking.lua rename to luacs-docs/lua/lua/Networking.lua diff --git a/docs/lua/Signal.lua b/luacs-docs/lua/lua/Signal.lua similarity index 100% rename from docs/lua/Signal.lua rename to luacs-docs/lua/lua/Signal.lua diff --git a/docs/lua/Steam.lua b/luacs-docs/lua/lua/Steam.lua similarity index 100% rename from docs/lua/Steam.lua rename to luacs-docs/lua/lua/Steam.lua diff --git a/docs/lua/Timer.lua b/luacs-docs/lua/lua/Timer.lua similarity index 100% rename from docs/lua/Timer.lua rename to luacs-docs/lua/lua/Timer.lua diff --git a/docs/lua/Vectors.lua b/luacs-docs/lua/lua/Vectors.lua similarity index 100% rename from docs/lua/Vectors.lua rename to luacs-docs/lua/lua/Vectors.lua diff --git a/docs/lua/enums/CauseOfDeathType.lua b/luacs-docs/lua/lua/enums/CauseOfDeathType.lua similarity index 100% rename from docs/lua/enums/CauseOfDeathType.lua rename to luacs-docs/lua/lua/enums/CauseOfDeathType.lua diff --git a/docs/lua/enums/ChatMessageType.lua b/luacs-docs/lua/lua/enums/ChatMessageType.lua similarity index 100% rename from docs/lua/enums/ChatMessageType.lua rename to luacs-docs/lua/lua/enums/ChatMessageType.lua diff --git a/docs/lua/enums/ClientPermissions.lua b/luacs-docs/lua/lua/enums/ClientPermissions.lua similarity index 100% rename from docs/lua/enums/ClientPermissions.lua rename to luacs-docs/lua/lua/enums/ClientPermissions.lua diff --git a/docs/lua/enums/DisconnectReason.lua b/luacs-docs/lua/lua/enums/DisconnectReason.lua similarity index 100% rename from docs/lua/enums/DisconnectReason.lua rename to luacs-docs/lua/lua/enums/DisconnectReason.lua diff --git a/docs/lua/enums/Hook.HookMethodType.lua b/luacs-docs/lua/lua/enums/Hook.HookMethodType.lua similarity index 100% rename from docs/lua/enums/Hook.HookMethodType.lua rename to luacs-docs/lua/lua/enums/Hook.HookMethodType.lua diff --git a/docs/lua/enums/InvSlotType.lua b/luacs-docs/lua/lua/enums/InvSlotType.lua similarity index 100% rename from docs/lua/enums/InvSlotType.lua rename to luacs-docs/lua/lua/enums/InvSlotType.lua diff --git a/docs/lua/enums/LimbType.lua b/luacs-docs/lua/lua/enums/LimbType.lua similarity index 100% rename from docs/lua/enums/LimbType.lua rename to luacs-docs/lua/lua/enums/LimbType.lua diff --git a/docs/lua/enums/NetEntityEvent.Type.lua b/luacs-docs/lua/lua/enums/NetEntityEvent.Type.lua similarity index 100% rename from docs/lua/enums/NetEntityEvent.Type.lua rename to luacs-docs/lua/lua/enums/NetEntityEvent.Type.lua diff --git a/docs/lua/enums/RandSync.lua b/luacs-docs/lua/lua/enums/RandSync.lua similarity index 100% rename from docs/lua/enums/RandSync.lua rename to luacs-docs/lua/lua/enums/RandSync.lua diff --git a/docs/lua/enums/ServerLogMessageType.lua b/luacs-docs/lua/lua/enums/ServerLogMessageType.lua similarity index 100% rename from docs/lua/enums/ServerLogMessageType.lua rename to luacs-docs/lua/lua/enums/ServerLogMessageType.lua diff --git a/docs/lua/enums/SpawnType.lua b/luacs-docs/lua/lua/enums/SpawnType.lua similarity index 100% rename from docs/lua/enums/SpawnType.lua rename to luacs-docs/lua/lua/enums/SpawnType.lua diff --git a/docs/lua/generated/Affliction.lua b/luacs-docs/lua/lua/generated/Affliction.lua similarity index 100% rename from docs/lua/generated/Affliction.lua rename to luacs-docs/lua/lua/generated/Affliction.lua diff --git a/docs/lua/generated/AfflictionPrefab.lua b/luacs-docs/lua/lua/generated/AfflictionPrefab.lua similarity index 100% rename from docs/lua/generated/AfflictionPrefab.lua rename to luacs-docs/lua/lua/generated/AfflictionPrefab.lua diff --git a/docs/lua/generated/AnimController.lua b/luacs-docs/lua/lua/generated/AnimController.lua similarity index 100% rename from docs/lua/generated/AnimController.lua rename to luacs-docs/lua/lua/generated/AnimController.lua diff --git a/docs/lua/generated/Character.lua b/luacs-docs/lua/lua/generated/Character.lua similarity index 100% rename from docs/lua/generated/Character.lua rename to luacs-docs/lua/lua/generated/Character.lua diff --git a/docs/lua/generated/CharacterHealth.lua b/luacs-docs/lua/lua/generated/CharacterHealth.lua similarity index 100% rename from docs/lua/generated/CharacterHealth.lua rename to luacs-docs/lua/lua/generated/CharacterHealth.lua diff --git a/docs/lua/generated/CharacterInfo.lua b/luacs-docs/lua/lua/generated/CharacterInfo.lua similarity index 100% rename from docs/lua/generated/CharacterInfo.lua rename to luacs-docs/lua/lua/generated/CharacterInfo.lua diff --git a/docs/lua/generated/CharacterInventory.lua b/luacs-docs/lua/lua/generated/CharacterInventory.lua similarity index 100% rename from docs/lua/generated/CharacterInventory.lua rename to luacs-docs/lua/lua/generated/CharacterInventory.lua diff --git a/docs/lua/generated/Client.lua b/luacs-docs/lua/lua/generated/Client.lua similarity index 100% rename from docs/lua/generated/Client.lua rename to luacs-docs/lua/lua/generated/Client.lua diff --git a/docs/lua/generated/Entity.Spawner.lua b/luacs-docs/lua/lua/generated/Entity.Spawner.lua similarity index 100% rename from docs/lua/generated/Entity.Spawner.lua rename to luacs-docs/lua/lua/generated/Entity.Spawner.lua diff --git a/docs/lua/generated/Entity.lua b/luacs-docs/lua/lua/generated/Entity.lua similarity index 100% rename from docs/lua/generated/Entity.lua rename to luacs-docs/lua/lua/generated/Entity.lua diff --git a/docs/lua/generated/GameScreen.lua b/luacs-docs/lua/lua/generated/GameScreen.lua similarity index 100% rename from docs/lua/generated/GameScreen.lua rename to luacs-docs/lua/lua/generated/GameScreen.lua diff --git a/docs/lua/generated/GameSession.lua b/luacs-docs/lua/lua/generated/GameSession.lua similarity index 100% rename from docs/lua/generated/GameSession.lua rename to luacs-docs/lua/lua/generated/GameSession.lua diff --git a/docs/lua/generated/GameSettings.lua b/luacs-docs/lua/lua/generated/GameSettings.lua similarity index 100% rename from docs/lua/generated/GameSettings.lua rename to luacs-docs/lua/lua/generated/GameSettings.lua diff --git a/docs/lua/generated/Hull.lua b/luacs-docs/lua/lua/generated/Hull.lua similarity index 100% rename from docs/lua/generated/Hull.lua rename to luacs-docs/lua/lua/generated/Hull.lua diff --git a/docs/lua/generated/Inventory.lua b/luacs-docs/lua/lua/generated/Inventory.lua similarity index 100% rename from docs/lua/generated/Inventory.lua rename to luacs-docs/lua/lua/generated/Inventory.lua diff --git a/docs/lua/generated/Item.lua b/luacs-docs/lua/lua/generated/Item.lua similarity index 100% rename from docs/lua/generated/Item.lua rename to luacs-docs/lua/lua/generated/Item.lua diff --git a/docs/lua/generated/ItemInventory.lua b/luacs-docs/lua/lua/generated/ItemInventory.lua similarity index 100% rename from docs/lua/generated/ItemInventory.lua rename to luacs-docs/lua/lua/generated/ItemInventory.lua diff --git a/docs/lua/generated/ItemPrefab.lua b/luacs-docs/lua/lua/generated/ItemPrefab.lua similarity index 100% rename from docs/lua/generated/ItemPrefab.lua rename to luacs-docs/lua/lua/generated/ItemPrefab.lua diff --git a/docs/lua/generated/Job.lua b/luacs-docs/lua/lua/generated/Job.lua similarity index 100% rename from docs/lua/generated/Job.lua rename to luacs-docs/lua/lua/generated/Job.lua diff --git a/docs/lua/generated/JobPrefab.lua b/luacs-docs/lua/lua/generated/JobPrefab.lua similarity index 100% rename from docs/lua/generated/JobPrefab.lua rename to luacs-docs/lua/lua/generated/JobPrefab.lua diff --git a/docs/lua/generated/Level.lua b/luacs-docs/lua/lua/generated/Level.lua similarity index 100% rename from docs/lua/generated/Level.lua rename to luacs-docs/lua/lua/generated/Level.lua diff --git a/docs/lua/generated/NetLobbyScreen.lua b/luacs-docs/lua/lua/generated/NetLobbyScreen.lua similarity index 100% rename from docs/lua/generated/NetLobbyScreen.lua rename to luacs-docs/lua/lua/generated/NetLobbyScreen.lua diff --git a/docs/lua/generated/ServerSettings.lua b/luacs-docs/lua/lua/generated/ServerSettings.lua similarity index 100% rename from docs/lua/generated/ServerSettings.lua rename to luacs-docs/lua/lua/generated/ServerSettings.lua diff --git a/docs/lua/generated/Submarine.lua b/luacs-docs/lua/lua/generated/Submarine.lua similarity index 100% rename from docs/lua/generated/Submarine.lua rename to luacs-docs/lua/lua/generated/Submarine.lua diff --git a/docs/lua/generated/SubmarineInfo.lua b/luacs-docs/lua/lua/generated/SubmarineInfo.lua similarity index 100% rename from docs/lua/generated/SubmarineInfo.lua rename to luacs-docs/lua/lua/generated/SubmarineInfo.lua diff --git a/docs/lua/generated/WayPoint.lua b/luacs-docs/lua/lua/generated/WayPoint.lua similarity index 100% rename from docs/lua/generated/WayPoint.lua rename to luacs-docs/lua/lua/generated/WayPoint.lua diff --git a/docs/lua/generated/World.lua b/luacs-docs/lua/lua/generated/World.lua similarity index 100% rename from docs/lua/generated/World.lua rename to luacs-docs/lua/lua/generated/World.lua diff --git a/docs/manual/common-questions.md b/luacs-docs/lua/manual/common-questions.md similarity index 100% rename from docs/manual/common-questions.md rename to luacs-docs/lua/manual/common-questions.md diff --git a/docs/manual/getting-started.md b/luacs-docs/lua/manual/getting-started.md similarity index 100% rename from docs/manual/getting-started.md rename to luacs-docs/lua/manual/getting-started.md diff --git a/docs/manual/how-to-use-hooks.md b/luacs-docs/lua/manual/how-to-use-hooks.md similarity index 100% rename from docs/manual/how-to-use-hooks.md rename to luacs-docs/lua/manual/how-to-use-hooks.md diff --git a/docs/manual/installing-lua-for-barotrauma-manually.md b/luacs-docs/lua/manual/installing-lua-for-barotrauma-manually.md similarity index 100% rename from docs/manual/installing-lua-for-barotrauma-manually.md rename to luacs-docs/lua/manual/installing-lua-for-barotrauma-manually.md diff --git a/docs/manual/lua-examples.md b/luacs-docs/lua/manual/lua-examples.md similarity index 100% rename from docs/manual/lua-examples.md rename to luacs-docs/lua/manual/lua-examples.md diff --git a/luacs-docs/lua/scripts/build.ps1 b/luacs-docs/lua/scripts/build.ps1 new file mode 100644 index 000000000..71b286024 --- /dev/null +++ b/luacs-docs/lua/scripts/build.ps1 @@ -0,0 +1,19 @@ +Import-Module $PSScriptRoot/../../scripts/location.ps1 + +try { + Change-Location $PSScriptRoot/.. + + Remove-Item -Force -Recurse ./build | Out-Null + New-Item -ItemType Directory ./build | Out-Null + Copy-Item -Path ./css/. -Destination ./build -Recurse -Force | Out-Null + Copy-Item -Path ./js/. -Destination ./build -Recurse -Force | Out-Null + + if ((Get-Command "lua_modules/bin/ldoc" -ErrorAction SilentlyContinue) -eq $null) { + echo "ldoc not found; please run docs/scripts/install.ps1" + exit 1 + } + + lua_modules/bin/ldoc . +} finally { + Restore-Location +} diff --git a/docs/scripts/build.sh b/luacs-docs/lua/scripts/build.sh similarity index 78% rename from docs/scripts/build.sh rename to luacs-docs/lua/scripts/build.sh index df79e31cd..a08f0df88 100755 --- a/docs/scripts/build.sh +++ b/luacs-docs/lua/scripts/build.sh @@ -10,10 +10,10 @@ if [[ ! -x "$ldoc_path" ]]; then exit 1 fi -rm -rf ./html -mkdir ./html +rm -rf ./build +mkdir ./build -cp -r ./js/. ./html -cp -r ./css/. ./html +cp -r ./js/. ./build +cp -r ./css/. ./build "$ldoc_path" . diff --git a/docs/scripts/install.ps1 b/luacs-docs/lua/scripts/install.ps1 similarity index 83% rename from docs/scripts/install.ps1 rename to luacs-docs/lua/scripts/install.ps1 index 262e7f93c..c028d722f 100644 --- a/docs/scripts/install.ps1 +++ b/luacs-docs/lua/scripts/install.ps1 @@ -1,5 +1,7 @@ +Import-Module $PSScriptRoot/../../scripts/location.ps1 + try { - cd $PSScriptRoot/.. + Change-Location $PSScriptRoot/.. $lua_binary = $env:LUA_BINARY if ($lua_binary -eq $null) { @@ -31,11 +33,11 @@ try { ) try { - cd ./libs/ldoc + Change-Location ./libs/ldoc luarocks @luarocks_args make } finally { - popd + Restore-Location } } finally { - popd + Restore-Location } diff --git a/docs/scripts/install.sh b/luacs-docs/lua/scripts/install.sh similarity index 100% rename from docs/scripts/install.sh rename to luacs-docs/lua/scripts/install.sh diff --git a/luacs-docs/lua/scripts/serve.ps1 b/luacs-docs/lua/scripts/serve.ps1 new file mode 100644 index 000000000..07b40bc67 --- /dev/null +++ b/luacs-docs/lua/scripts/serve.ps1 @@ -0,0 +1,14 @@ +Import-Module $PSScriptRoot/../../scripts/location.ps1 + +try { + Change-Location $PSScriptRoot/.. + + if ((Get-Command "python3" -ErrorAction SilentlyContinue) -eq $null) { + echo "python3 not found" + exit 1 + } + + python3 ../scripts/http_server.py ./build --port 8000 +} finally { + Restore-Location +} diff --git a/docs/scripts/serve.sh b/luacs-docs/lua/scripts/serve.sh similarity index 77% rename from docs/scripts/serve.sh rename to luacs-docs/lua/scripts/serve.sh index 198bca784..1c62a7171 100755 --- a/docs/scripts/serve.sh +++ b/luacs-docs/lua/scripts/serve.sh @@ -8,4 +8,4 @@ if ! command -v "python3" &> /dev/null; then exit 1 fi -python3 -m http.server -d html +python3 ../scripts/http_server.py ./build --port 8000 diff --git a/luacs-docs/lua/templates/landing.ltp b/luacs-docs/lua/templates/landing.ltp new file mode 100644 index 000000000..8080a8eec --- /dev/null +++ b/luacs-docs/lua/templates/landing.ltp @@ -0,0 +1,24 @@ + +
+

Lua For Barotrauma Documentation

+
+ +
+

+

Welcome to the Lua For Barotrauma documentation!

+

This is a work in progress documentation, not everything is documented here, but because Barotrauma classes are exposed to Lua, you can check the Barotrauma source code for functions and fields that you can access.

+ +

Installing Lua For Barotrauma

+

Downloading and using the Core Content Package from Workshop should be enough to have it installed, but if you want to install it manually, you can check out this guide. +

+ +

Getting Started

+

If you want to get started with Lua For Barotrauma modding, check out this guide. +

+ +

Links

+

+ Github
+ Discord Server +

+
diff --git a/luacs-docs/lua/templates/ldoc.ltp b/luacs-docs/lua/templates/ldoc.ltp new file mode 100644 index 000000000..fe92540f7 --- /dev/null +++ b/luacs-docs/lua/templates/ldoc.ltp @@ -0,0 +1,138 @@ + +{% +local baseUrl = ldoc.css:gsub("ldoc.css", "") +local repo = "https://github.com/evilfactory/Barotrauma-lua-attempt/" +local pageTitle = mod and (ldoc.display_name(mod) .. " - " .. ldoc.title) or ldoc.title + +local oldmarkup = ldoc.markup +function ldoc.markup(text, item) + return oldmarkup(text, item, ldoc.plain) +end + +function ldoc.url(path) + return baseUrl .. path +end + +function ldoc.realm_icon(realm) + return "" +end + +function ldoc.sidebar_item(item, module) + local text = "" + + local deprecated = item.tags.deprecated + if deprecated then + text = text .. "" + else + text = text .. "" + end + + text = text .. ldoc.realm_icon(item.tags.realm[1]) + text = text .. "" + + if ldoc.is_kind_classmethod(module.kind) then + text = text .. item.name:gsub(".+:", "") + else + text = text .. item.name:gsub(module.name .. ".", "") + end + + text = text + .. "" + .. "" + return text +end + +function ldoc.item_header(item) + local text = "" + + text = text .. "" + + local deprecated = item.tags.deprecated + if deprecated then + text = text .. "

" + else + text = text .. "

" + end + + text = text + .. ldoc.realm_icon(item.tags.realm[1]) + .. ldoc.display_name(item) + .. "

" + .. "
" + + return text +end + +function ldoc.is_kind_classmethod(kind) + return kind ~= "libraries" +end + +function ldoc.repo_reference(item) + return repo .. "tree/master" .. item.file.filename:gsub(item.file.base, "/gamemode") .. "#L" .. item.lineno +end + +local function moduleDescription(mod) + if (mod.type == "topic") then + return mod.body:gsub(mod.display_name, ""):gsub("#", ""):sub(1, 256) .. "..." + end + + return mod.summary +end +%} + + + + {{pageTitle}} + + + + + + {% if (mod) then %} + + {% else %} + + {% end %} + + + + + + + +
+ {(templates/sidebar.ltp)} + +
+ {% if (ldoc.root) then -- we're rendering the landing page (index.html) %} + {(templates/landing.ltp)} + {% elseif (ldoc.body) then -- we're rendering non-code elements %} +
+ {* ldoc.body *} +
+ {% elseif (module) then -- we're rendering libary contents %} +
+ {(templates/module.ltp)} +
+ {% end %} +
+
+ + + + + + diff --git a/luacs-docs/lua/templates/module.ltp b/luacs-docs/lua/templates/module.ltp new file mode 100644 index 000000000..17055615c --- /dev/null +++ b/luacs-docs/lua/templates/module.ltp @@ -0,0 +1,152 @@ + +
+

{{mod.name}}

+

{* ldoc.markup(mod.summary) *}

+
+ +

{* ldoc.markup(mod.description) *}

+ +{% + local kinds = {} + local kindsIpairs = {} + for kind, items in mod.kinds() do + local name = kind + if kind == "Tables" then + name = "Fields" + end + + for item in items() do + if kinds[name] == nil then + kinds[name] = {} + + local value = {} + value.kind = name + value.items = kinds[name] + table.insert(kindsIpairs, value) + end + kinds[name][item] = true + end + end + + +%} + +{% for i, value in ipairs(kindsIpairs) do + local kind = value.kind + local items = value.items +%} +

{{kind}}

+ + {% for item, _ in pairs(items) do %} +
+
+ {* ldoc.item_header(item) *} + + {% if item.tags.deprecated then %} +
+
Deprecated
+

This API is deprecated and shouldn't be used anymore.

+
+ {% end %} + + {% if (item.tags.internal) then %} +
+
Internal
+

This is an internal function! You are able to use it, but you risk unintended side effects if used incorrectly.

+
+ {% end %} + + {% if (ldoc.descript(item):len() == 0) then %} +
+
Incomplete
+

Documentation for this section is incomplete and needs expanding.

+
+ {% else %} +

{* ldoc.markup(ldoc.descript(item)) *}

+ {% end %} +
+ + {# function arguments #} + {% if (item.params and #item.params > 0) then %} + {% local subnames = mod.kinds:type_of(item).subnames %} + + {% if (subnames) then %} +

{{subnames}}

+ {% end %} + + {% for argument in ldoc.modules.iter(item.params) do %} + {% local argument, sublist = item:subparam(argument) %} + +
    + {% for argumentName in ldoc.modules.iter(argument) do %} + {% local displayName = item:display_name_of(argumentName) %} + {% local type = ldoc.typename(item:type_of_param(argumentName)) %} + {% local default = item:default_of_param(argumentName) %} + +
  • + {{displayName}} + + {% if (type ~= "") then %} + {* type *} + {% end %} + + {% if (default and default ~= true) then %} + default: {{default}} + {% elseif (default) then %} + optional + {% end %} + +

    {* ldoc.markup(item.params.map[argumentName]) *}

    +
  • + {% end %} +
+ {% end %} + {% end %} + + {# function returns #} + {% if ((not ldoc.no_return_or_parms) and item.retgroups) then %} + {% local groups = item.retgroups %} + +

Returns

+
    + {% for i, group in ldoc.ipairs(groups) do %} + {% for returnValue in group:iter() do %} + {% local type, ctypes = item:return_type(returnValue) %} + {% type = ldoc.typename(type) %} + +
  • + {% if (type ~= "") then %} + {* type *} + {% else -- we'll assume that it will return a variable type if none is set %} + any + {% end %} + +

    {* ldoc.markup(returnValue.text) *}

    +
  • + {% end %} + + {% if (i ~= #groups) then %} +
    OR
    + {% end %} + {% end %} +
+ {% end %} + + {% if (item.usage) then -- function usage %} +

Example Usage

+ {% for usage in ldoc.modules.iter(item.usage) do %} +
{* usage *}
+ {% end %} + {% end %} + + {% if (item.see) then %} +

See Also

+
    + {% for see in ldoc.modules.iter(item.see) do %} +
  • {{see.label}}
  • + {% end %} +
+ {% end %} +
+ {% end %} +{% end %} diff --git a/luacs-docs/lua/templates/sidebar.ltp b/luacs-docs/lua/templates/sidebar.ltp new file mode 100644 index 000000000..17b305563 --- /dev/null +++ b/luacs-docs/lua/templates/sidebar.ltp @@ -0,0 +1,102 @@ + +{% +local function isKindExpandable(kind) + return kind ~= "Manual" +end +%} + + diff --git a/luacs-docs/scripts/http_server.py b/luacs-docs/scripts/http_server.py new file mode 100644 index 000000000..aa5b1e3d1 --- /dev/null +++ b/luacs-docs/scripts/http_server.py @@ -0,0 +1,63 @@ +import os +import http.server +import argparse + +def Route(s): + try: + prefix, root = s.split(":", 1) + except: + raise argparse.ArgumentTypeError("Route mapping must be in the : format: " + s) + return (prefix, root) + +parser = argparse.ArgumentParser() +parser.add_argument("root", type=str) +parser.add_argument("--port", type=int, default=8000) +parser.add_argument("--route", type=Route, dest="routes", action="extend", nargs="*") + +class RequestHandler(http.server.SimpleHTTPRequestHandler): + base_dir = None + routes = [] + def translate_path(self, path): + path.lstrip() + for prefix, rootDir in self.routes: + if path.startswith(prefix): + # print("matched route: " + prefix) + path = path[len(prefix):] + root = rootDir + break + + path.lstrip() + if root == None: + raise Exception("No route matches path: " + path) + + # Make sure we don't have a path that starts with /, otherwise + # os.path.join() would resolve it to the root of the filesystem. + if path.startswith("/"): + path = "." + path + + resolved_path = os.path.join(self.base_dir, root, path) + + # print("base_dir: " + self.base_dir) + # print("root: " + root) + # print("path: " + path) + # print("resolved_path: " + resolved_path) + + return resolved_path + +if __name__ == "__main__": + args = parser.parse_args() + + # Make sure we have at least one route + if not args.routes: + args.routes = [("/", "")] + + # Routes listed first should have precedence over the rest + args.routes.reverse() + + RequestHandler.base_dir = args.root + RequestHandler.routes = args.routes + port = args.port + + httpd = http.server.HTTPServer(("127.0.0.1", port), RequestHandler) + print(f"Listening on port {port} (http://127.0.0.1:{port})") + httpd.serve_forever() diff --git a/luacs-docs/scripts/location.ps1 b/luacs-docs/scripts/location.ps1 new file mode 100644 index 000000000..d265e213f --- /dev/null +++ b/luacs-docs/scripts/location.ps1 @@ -0,0 +1,14 @@ +[System.Collections.ArrayList]$Locations = @() + +function Change-Location($path) { + $loc = Get-Location + $Locations.Add($loc) + Set-Location $path +} + +function Restore-Location { + $idx = $Locations.Count - 1 + $loc = $Locations[$idx] + $Locations.RemoveAt($idx) + Set-Location $loc +}