Skip to content

Instantly share code, notes, and snippets.

@wyozi
Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wyozi/80200b8bb334113079ef to your computer and use it in GitHub Desktop.
Save wyozi/80200b8bb334113079ef to your computer and use it in GitHub Desktop.
gace help docs
<!DOCTYPE html>
<html>
<head>
<link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
<style>
body {
background-color: rgb(218, 223, 225);
color: black;
font-family: 'Open Sans', sans-serif;
font-size: 14px;
margin: 0;
padding: 0 3px 0 3px;
}
#toc {
padding: 10px;
}
#goup {
position: fixed;
top: 0px;
right: 0px;
padding: 0 5px 2px 5px;
border-left: 1px solid black;
border-bottom: 1px solid black;
background-color: rgb(236,236,236);
}
h1, h2, h3 {
padding-left: 6px;
color: rgb(238, 238, 238);
}
h1 {
background-color: rgb(30, 130, 76);
margin-top: 35px;
}
h2 {
background-color: rgb(58, 83, 155);
}
p {
text-align: justify;
}
table {
border-collapse: collapse;
width: 100%;
}
tr {
border: 1px solid black;
}
thead tr {
font-weight: 800;
}
td {
padding: 3px;
}
notice {
background-color: white;
border: 1px solid black;
padding: 5px 10px 5px 10px;
font-size: 28px;
}
notice.success {
background-color: rgb(46, 204, 113);
color: black;
}
notice.error {
background-color: rgb(217, 30, 24);
color: white;
}
notice.warning {
background-color: rgb(245, 171, 53);
color: black;
}
/* Source: Mozilla Developer Network */
kbd {
background-color: #F4F7F8;
border-radius: 3px;
border: 1px solid #B4B4B4;
box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.2), 0px 2px 0px 0px rgba(255, 255, 255, 0.7) inset;
display: inline-block;
font-family: inherit;
font-size: 0.85em;
line-height: 1.2;
padding: 2px 4px;
white-space: nowrap;
}
gace-button {
color: white;
margin: 2px;
padding: 2px 20px 2px 20px;
}
gace-button.vfs {
background-color: rgb(150, 40, 27);
}
gace-button.editor {
background-color: rgb(230, 126, 34);
}
gace-button.luarun {
background-color: rgb(142, 68, 173);
}
gace-button.luarunent {
background-color: rgb(39, 174, 96);
}
</style>
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/styles/default.min.css">
</head>
<body>
<div id="toc"></div>
<a href="#toc" id="goup">Go up</a>
<h1>Version information</h1>
<p>
<b>Latest version:</b> <span id="latestversion">0.0.1</span><br>
<b>Your version:</b> <span id="userversion"></span><br>
</p>
<notice id="versnotice"></notice>
<h1>Filesystem access</h1>
<p>
G-Ace uses a Virtual FileSystem, which means that all types of folders,
such as real folders on your computer and the Garry's Mod data folder, are
accessed the same way. It allows for example copying a file from a real
folder to a temporary in-memory folder.
</p>
<h2>Adding a temporary folder</h2>
<p>
Press the<gace-button class="vfs">VFS</gace-button> button to open a menu,
that easily allows easy creation of new virtual folders.
</p>
<table>
<thead>
<tr>
<td style="width: 125px">VFolder name</td>
<td>Explanation</td>
</tr>
</thead>
<tr>
<td>real-gaceio</td>
<td>Real folder on the your computer. Asks for the folder location on
creation. Requires g-ace-io binary module</td>
</tr>
<tr>
<td>memory</td>
<td>A in-memory folder. Data is not saved over map changes or server restarts. Mostly for testing.</td>
</tr>
<tr>
<td>real-data</td>
<td>Real folder inside the data folder. </td>
</tr>
</table>
<h2>Adding a permanent folder</h2>
<p>
Adding a permanent virtual folder currently requires writing code,
that should get run at map initialization. Either saving following code
to <i>lua/autorun/server</i> or inserting it into an addon inside a <i>Initialize</i>
hook would work.
</p>
<p>
Following code creates a real-gaceio folder called <i>folder</i> that maps
to <i>garrysmod/addons/gitaddon</i> on your computer
</p>
<pre><code class="lua">local f = gace.VFS.RealGIOFolder("folder", "./garrysmod/addons/gitaddon")
f:grantPermission("players", gace.VFS.ServerPermission)
gace.Root:addVirtualFolder(f)</code></pre>
<h1>Editing and hotkeys</h1>
<h2>Hotkeys</h2>
<p>
To see all hotkeys available for the editor, press <gace-button class="editor">Ace- editor</gace-button>
and click on <i>Shortcuts</i>
</p>
<p>
Hotkeys listed here require the editor to be focused (the cursor should be
visible and blinking in the editor)
</p>
<table>
<thead>
<tr>
<td>Name</td>
<td>Shortcut</td>
<td>Explanation</td>
</tr>
</thead>
<tr>
<td>Create file</td>
<td><kbd>Ctrl</kbd> + <kbd>N</kbd></td>
<td>Opens a new unnamed file to a new tab</td>
</tr>
<tr>
<td>Close current file</td>
<td><kbd>Ctrl</kbd> + <kbd>W</kbd></td>
<td></td>
</tr>
<tr>
<td>Search from GLua documentation</td>
<td><kbd>Ctrl</kbd> + <kbd>Q</kbd></td>
<td>Automatically uses the word cursor is on as the query</td>
</tr>
<tr>
<td>Add next instance of selected text to selection</td>
<td><kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <kbd>D</kbd></td>
<td></td>
</tr>
</table>
<h2>Creating a new file</h2>
<p>
Creating a new unnamed file: <kbd>Ctrl</kbd> + <kbd>N</kbd> (while editor
is focused)<br>
Creating a named file: Right click a folder in the filetree and select
<i>Create File</i>
</p>
<h1>Running Lua code (including SENTs and SWEPs)</h1>
<p>
G-Ace comes with a built-in ability to run Lua code and update SWEP/SENT code.
Simply use the buttons in the action bar:
</p>
<table>
<thead>
<tr>
<td>Button</td>
<td>Action</td>
</tr>
</thead>
<tr>
<td><gace-button class="luarun">Self</gace-button></td>
<td>Run current file on your client</td>
</tr>
<tr>
<td><gace-button class="luarun">Server</gace-button></td>
<td>Run current file on server</td>
</tr>
<tr>
<td><gace-button class="luarun">Shared</gace-button></td>
<td>Run current file on both server and all clients</td>
</tr>
<tr>
<td><gace-button class="luarun">Clients</gace-button></td>
<td>Run current file on all clients</td>
</tr>
<tr>
<td><gace-button class="luarunent">SWEP</gace-button></td>
<td>Run current file as a SWEP. Uses file name without extension as the SWEP name.</td>
</tr>
<tr>
<td><gace-button class="luarunent">SENT</gace-button></td>
<td>Run current file as a S. Uses file name without extension as the S name.</td>
</tr>
</table>
<h1>Collaboration</h1>
<p>
G-Ace uses operational transformation libraries to allow collaborative
file editing.
</p>
<h2>Collaborating on a file</h2>
<p>
Simply right click the file on the file tree and press <i>Collaborate on</i>.
This opens a new tab using the file's current contents, which is shows
changes made to it in real time.
</p>
<p>
Note: only the changes on files with <i>.ot</i> extension are shared. <i>.ot</i>
extension is automatically added to files that are collaborated on. To keep
things simple, saving an <i>.ot</i> file overwrites the file that was collaborated
on even though it technically has an <i>.ot</i> extension.
</p>
<script src="http://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/highlight.min.js"></script>
<script>
// Init syntax highlighting
hljs.initHighlightingOnLoad();
// Get user version from GET parameter and compare it to latest
var QueryString = function () {
var query_string = {};
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
// If first entry with this name
if (typeof query_string[pair[0]] === "undefined") {
query_string[pair[0]] = pair[1];
// If second entry with this name
} else if (typeof query_string[pair[0]] === "string") {
var arr = [ query_string[pair[0]], pair[1] ];
query_string[pair[0]] = arr;
// If third or later entry with this name
} else {
query_string[pair[0]].push(pair[1]);
}
}
return query_string;
} ();
var el_versionNotice = document.getElementById("versnotice");
var el_userVersion = document.getElementById("userversion");
var el_latestVersion = document.getElementById("latestversion");
var userVersion = QueryString.vers || "0.0.0";
var latestVersion = "0.0.1";
el_userVersion.textContent = userVersion;
el_latestVersion.textContent = latestVersion;
if (userVersion !== latestVersion) {
el_versionNotice.classList.add("warning");
el_versionNotice.textContent = "G-Ace is outdated!";
}
else {
el_versionNotice.classList.add("success");
el_versionNotice.textContent = "G-Ace is up to date.";
}
// Create table of contents
var el_toc = document.getElementById("toc");
var tocLevels = [0, 0];
var headers = document.querySelectorAll("h1,h2,h3");
for (var i = 0;i < headers.length; i++) {
var el_hdr = headers[i];
var nm = el_hdr.textContent.toLowerCase().replace(" ", "");
el_hdr.setAttribute("id", nm);
var level = parseInt(el_hdr.tagName.substring(1));
tocLevels[level-1] = (tocLevels[level-1] || 0) + 1;
for (var lvl = 0; lvl < level-1; lvl++) {
el_toc.innerHTML += "&nbsp;&nbsp;&nbsp;";
}
for (var lvl = level; lvl < tocLevels.length; lvl++) {
tocLevels[lvl] = 0;
}
var levelStr = tocLevels.join(".");
el_toc.innerHTML += "<a href='#" + nm + "'>" + levelStr + " " + el_hdr.textContent + "</a><br>";
el_hdr.textContent = levelStr + " " + el_hdr.textContent;
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment