new documentation and some fixes in code
This commit is contained in:
Vendored
+28
@@ -0,0 +1,28 @@
|
||||
|
||||
<div class="landing">
|
||||
<h1>Lua For Barotrauma Documentation</h1>
|
||||
</div>
|
||||
|
||||
<div class="wrapper">
|
||||
<p style="text-align: center;"></p>
|
||||
<h2>Welcome to the Lua For Barotrauma documentation!</h2>
|
||||
<p>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.</p>
|
||||
|
||||
<h2>Installing Lua For Barotrauma</h2>
|
||||
<p>Downloading and using the Core Content Package from <a href="https://steamcommunity.com/sharedfiles/filedetails/?id=2559634234" target="_blank">Workshop</a> should be enough to have it installed, but if you want to install it manually, you can check out <a href="{* ldoc.url('manual/installing-lua-for-barotrauma-manually') *}">this guide.</a>
|
||||
</p>
|
||||
|
||||
<h2>Getting Started</h2>
|
||||
<p>If you want to get started with Lua For Barotrauma modding, check out <a href="{* ldoc.url('manual/getting-started') *}">this guide.</a>
|
||||
</p>
|
||||
|
||||
<h2>Client-Side support</h2>
|
||||
<p>Client-Side support will be supported at some point, but currently it's server-side only.
|
||||
</p>
|
||||
|
||||
<h2>Links</h2>
|
||||
<p>
|
||||
<a href="https://github.com/evilfactory/Barotrauma-lua-attempt" target="_blank">Github</a><br>
|
||||
<a href="https://discord.gg/f9zvNNuxu9" target="_blank">Discord Server</a>
|
||||
</p>
|
||||
</div>
|
||||
Vendored
+90
@@ -0,0 +1,90 @@
|
||||
|
||||
{%
|
||||
local baseUrl = ldoc.css:gsub("ldoc.css", "")
|
||||
local repo = "https://github.com/nebulouscloud/helix/"
|
||||
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 "<span class=\"realm " .. (realm or "") .. "\"></span>";
|
||||
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
|
||||
%}
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>{{pageTitle}}</title>
|
||||
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:title" content="{{pageTitle}}" />
|
||||
<meta property="og:site_name" content="Helix Documentation" />
|
||||
|
||||
{% if (mod) then %}
|
||||
<meta property="og:description" content="{{moduleDescription(mod)}}" />
|
||||
{% else %}
|
||||
<meta property="og:description" content="Documentation and function reference for the Helix framework." />
|
||||
{% end %}
|
||||
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Code+Pro" />
|
||||
<link rel="stylesheet" href="{* ldoc.css *}" />
|
||||
<link rel="stylesheet" href="{* ldoc.url('highlight.css') *}" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<main>
|
||||
{(docs/templates/sidebar.ltp)}
|
||||
|
||||
<article>
|
||||
{% if (ldoc.root) then -- we're rendering the landing page (index.html) %}
|
||||
{(docs/templates/landing.ltp)}
|
||||
{% elseif (ldoc.body) then -- we're rendering non-code elements %}
|
||||
<div class="wrapper">
|
||||
{* ldoc.body *}
|
||||
</div>
|
||||
{% elseif (module) then -- we're rendering libary contents %}
|
||||
<div class="wrapper">
|
||||
{(docs/templates/module.ltp)}
|
||||
</div>
|
||||
{% end %}
|
||||
</article>
|
||||
</main>
|
||||
|
||||
<script type="text/javascript" src="{* ldoc.url('app.js') *}"></script>
|
||||
<script type="text/javascript" src="{* ldoc.url('highlight.min.js') *}"></script>
|
||||
<script type="text/javascript">
|
||||
var elements = document.querySelectorAll("pre code")
|
||||
|
||||
hljs.configure({
|
||||
languages: ["lua"]
|
||||
});
|
||||
|
||||
for (var i = 0; i < elements.length; i++)
|
||||
{
|
||||
hljs.highlightBlock(elements[i]);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Vendored
+123
@@ -0,0 +1,123 @@
|
||||
|
||||
<header class="module">
|
||||
<h1>{{mod.name}}</h1>
|
||||
<h2>{* ldoc.markup(mod.summary) *}</h2>
|
||||
</header>
|
||||
|
||||
<p>{* ldoc.markup(mod.description) *}</p>
|
||||
|
||||
{% for kind, items in mod.kinds() do %}
|
||||
<h1 class="title">{{kind}}</h1>
|
||||
|
||||
{% for item in items() do %}
|
||||
<section class="method" id="{{item.name}}">
|
||||
<header>
|
||||
<a class="anchor">
|
||||
<h1>{* ldoc.realm_icon(item.tags.realm[1]) *}</span>{{ldoc.display_name(item)}}</h1>
|
||||
</a>
|
||||
|
||||
{% if (item.tags.internal) then %}
|
||||
<div class="notice error">
|
||||
<div class="title">Internal</div>
|
||||
<p>This is an internal function! You are able to use it, but you risk unintended side effects if used incorrectly.</p>
|
||||
</div>
|
||||
{% end %}
|
||||
|
||||
{% if (item.module and item.module.type ~= "hooks") then %}
|
||||
<a class="reference" href="{* ldoc.repo_reference(item) *}">View source »</a>
|
||||
{% end %}
|
||||
|
||||
{% if (ldoc.descript(item):len() == 0) then %}
|
||||
<div class="notice warning">
|
||||
<div class="title">Incomplete</div>
|
||||
<p>Documentation for this section is incomplete and needs expanding.</p>
|
||||
</div>
|
||||
{% else %}
|
||||
<p>{* ldoc.markup(ldoc.descript(item)) *}</p>
|
||||
{% end %}
|
||||
</header>
|
||||
|
||||
{# function arguments #}
|
||||
{% if (item.params and #item.params > 0) then %}
|
||||
{% local subnames = mod.kinds:type_of(item).subnames %}
|
||||
|
||||
{% if (subnames) then %}
|
||||
<h3>{{subnames}}</h3>
|
||||
{% end %}
|
||||
|
||||
{% for argument in ldoc.modules.iter(item.params) do %}
|
||||
{% local argument, sublist = item:subparam(argument) %}
|
||||
|
||||
<ul>
|
||||
{% 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) %}
|
||||
|
||||
<li>
|
||||
<span class="tag parameter">{{displayName}}</span>
|
||||
|
||||
{% if (type ~= "") then %}
|
||||
<span class="tag">{* type *}</span>
|
||||
{% end %}
|
||||
|
||||
{% if (default and default ~= true) then %}
|
||||
<span class="tag default">default: {{default}}</span>
|
||||
{% elseif (default) then %}
|
||||
<span class="tag default">optional</span>
|
||||
{% end %}
|
||||
|
||||
<p>{* ldoc.markup(item.params.map[argumentName]) *}</p>
|
||||
</li>
|
||||
{% end %}
|
||||
</ul>
|
||||
{% end %}
|
||||
{% end %}
|
||||
|
||||
{# function returns #}
|
||||
{% if ((not ldoc.no_return_or_parms) and item.retgroups) then %}
|
||||
{% local groups = item.retgroups %}
|
||||
|
||||
<h3>Returns</h3>
|
||||
<ul>
|
||||
{% 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) %}
|
||||
|
||||
<li>
|
||||
{% if (type ~= "") then %}
|
||||
{* type *}
|
||||
{% else -- we'll assume that it will return a variable type if none is set %}
|
||||
<span class="tag type">any</span>
|
||||
{% end %}
|
||||
|
||||
<p>{* ldoc.markup(returnValue.text) *}</p>
|
||||
</li>
|
||||
{% end %}
|
||||
|
||||
{% if (i ~= #groups) then %}
|
||||
<div class="or"><span>OR</span></div>
|
||||
{% end %}
|
||||
{% end %}
|
||||
</ul>
|
||||
{% end %}
|
||||
|
||||
{% if (item.usage) then -- function usage %}
|
||||
<h3>Example Usage</h3>
|
||||
{% for usage in ldoc.modules.iter(item.usage) do %}
|
||||
<pre><code>{* usage *}</code></pre>
|
||||
{% end %}
|
||||
{% end %}
|
||||
|
||||
{% if (item.see) then %}
|
||||
<h3>See Also</h3>
|
||||
<ul>
|
||||
{% for see in ldoc.modules.iter(item.see) do %}
|
||||
<li><a href="{* ldoc.href(see) *}">{{see.label}}</a></li>
|
||||
{% end %}
|
||||
</ul>
|
||||
{% end %}
|
||||
</section>
|
||||
{% end %}
|
||||
{% end %}
|
||||
Vendored
+69
@@ -0,0 +1,69 @@
|
||||
|
||||
{%
|
||||
local function isKindExpandable(kind)
|
||||
return kind ~= "Manual"
|
||||
end
|
||||
%}
|
||||
|
||||
<nav>
|
||||
<header>
|
||||
{% if (not ldoc.root) then %}
|
||||
<h1><a href="{* ldoc.url('') *}">Lua For Barotrauma Documentation</a></h1>
|
||||
{% end %}
|
||||
<input id="search" type="search" autocomplete="off" placeholder="Search..." />
|
||||
</header>
|
||||
|
||||
<section>
|
||||
{% for kind, mods, type in ldoc.kinds() do %}
|
||||
{% if (ldoc.allowed_in_contents(type, mod)) then %}
|
||||
<details class="category" open>
|
||||
<summary>
|
||||
<h2>{{kind}}</h2>
|
||||
</summary>
|
||||
|
||||
<ul>
|
||||
{% for currentMod in mods() do %}
|
||||
{% local name = ldoc.display_name(currentMod) %}
|
||||
<li>
|
||||
{% if (isKindExpandable(kind)) then %}
|
||||
<details {{currentMod.name == (mod or {}).name and "open" or ""}}>
|
||||
<summary><a href="{* ldoc.ref_to_module(currentMod) *}">{{name}}</a></summary>
|
||||
|
||||
<ul>
|
||||
{% else %}
|
||||
<a href="{* ldoc.ref_to_module(currentMod) *}">{{name}}</a>
|
||||
{% end %}
|
||||
|
||||
{% if (isKindExpandable(kind)) then
|
||||
currentMod.items:sort(function(a, b)
|
||||
return a.name < b.name
|
||||
end)
|
||||
end %}
|
||||
|
||||
{% for k, v in pairs(currentMod.items) do %}
|
||||
{% if (v.kind == "functions") then %}
|
||||
<li>
|
||||
{* ldoc.realm_icon(v.tags.realm[1]) *}
|
||||
<a href="{* ldoc.ref_to_module(currentMod) *}#{{v.name}}">
|
||||
{% if (ldoc.is_kind_classmethod(currentMod.kind)) then
|
||||
echo((v.name:gsub(".+:", "")))
|
||||
else
|
||||
echo((v.name:gsub(currentMod.name .. ".", "")))
|
||||
end %}
|
||||
</a>
|
||||
</li>
|
||||
{% end %}
|
||||
{% end %}
|
||||
|
||||
{% if (isKindExpandable(kind)) then %}
|
||||
</ul>
|
||||
</details>
|
||||
{% end %}
|
||||
</li>
|
||||
{% end %}
|
||||
</ul>
|
||||
</details>
|
||||
{% end %}
|
||||
{% end %}
|
||||
</section>
|
||||
</nav>
|
||||
Reference in New Issue
Block a user