From 25e4d04a331a6a0b9d897d4f721757730771ff97 Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Sat, 18 Nov 2017 16:00:29 -0500 Subject: More documentation * Documented the item table * Documented the inventory table * Started writing tutorials --- doc/examples/babysfirstaddon.md | 29 +++++++++++++++++++++++++++++ doc/examples/setup.md | 22 ++++++++++++++++++++++ doc/for_developers/structs/dropped_item.md | 14 -------------- doc/for_developers/structs/inventories.md | 5 ----- doc/for_developers/structs/player.md | 17 ----------------- doc/structs/dropped_item.md | 14 -------------- 6 files changed, 51 insertions(+), 50 deletions(-) create mode 100644 doc/examples/babysfirstaddon.md create mode 100644 doc/examples/setup.md delete mode 100644 doc/for_developers/structs/dropped_item.md delete mode 100644 doc/for_developers/structs/inventories.md delete mode 100644 doc/for_developers/structs/player.md delete mode 100644 doc/structs/dropped_item.md (limited to 'doc') diff --git a/doc/examples/babysfirstaddon.md b/doc/examples/babysfirstaddon.md new file mode 100644 index 0000000..595ad77 --- /dev/null +++ b/doc/examples/babysfirstaddon.md @@ -0,0 +1,29 @@ +# Tut 0x01 - Baby's First Addon + +A quick primer on addons for Garry's Mod, and Artery. + +You may have seen on the gmod wiki, instructions on running lua code. One way is to place files in your `garrysmod/lua/autorun` directory, and they will be run automatically when you enter single player. This can get messy though, another way to run lua is by making a folder in `garrysmod/addons//lua/autorun`, and placing your scripts in that (i.e. so that `garrysmod/addons/my_first_addon/lua/autorun/hello.lua` is a valid file). As it turns out, all folders under `garrysmod/addons/` get reflected! This means that if you have a file `garrysmod/addons/data/pac3/my_pac.txt` it will appear in the pac editor and a pac you can load! + +This is the method used by addons for Artery. Since Garry's Mod loads addons's autorun BEFORE gamemodes, Artery uses the `data/artery/global/` folder to run scripts after the gamemode as loaded (and therefore has access to the nrequire() function, more on this later). + +## Lets get started + +Start by creating a new folder under `garrysmod/addons/` called `artery_rougelite`. We'll be using this folder for the rest of the tutorials to build a small rougelike gamemode to explore the different features artery provides. + +Now create another folder under the folder you just made `garrysmod/addons/artery_rougelite/data` + +Now another `garrysmod/addons/artery_rougelite/data/artery/` + +And another `garrysmod/addons/artery_rougelite/data/artery/global/` + +With the folder structure set up, we're ready to actually write some lua. + +Create a file `garrysmod/addons/artery_routelite/data/artery/global/helloworld.txt` + +and copy+paste the following code into it. + +``` +print("Hello, world!") +``` + +Now start up garrysmod with the Artery gamemode selected. Head into flatgrass or something. Open your console, you should see "Hello, world!" printed. diff --git a/doc/examples/setup.md b/doc/examples/setup.md new file mode 100644 index 0000000..2f9e0ce --- /dev/null +++ b/doc/examples/setup.md @@ -0,0 +1,22 @@ +# Tut 0x00 Setup & Installation + +This tutorial covers how to set up Artery so you can begin developing. + +First, you'll need to download the Artery gamemode base. This can be done for updates with [git](https://git-scm.com)(reccomended) or just downloaded as a zip and extracted + +## Git setup + +1. Download [git](https://git-scm.com) +2. Follow the setup instructions +3. Open command prompt and type in `git --version`, verify that version information is printed. +4. Use the `cd` command to go into your Garry's Mod directory. This is usuallly `C:\Program Files (x86)\Steam\steamapps\common\GarrysMod\garrysmod` (i.e. the command would be `cd "C:\Program Files (x86)\Steam\steamapps\common\GarrysMod\garrysmod"`). You can alternatively go to this location in your file browser, then click the file path at the top, and copy+paste it into your command prompt. +5. Use `cd` again to go into your `gamemodes` directory (i.e `cd gamemodes`) +6. Clone the repository `git clone http://cogarr.net/source/cgit.cgi/artery` +7. Go back and clone the artery_editor addon (`cd ../addons` then `git clone http://cogarr.net/source/cgit.cgi/artery_editor`) +8. Another one `git clone https://cogarr.net/source/cgit.cgi/zones` _*_ Please note that this is a fork of [bobleheadbob's original api](https://github.com/Luabee/Zones), all it does is put the files into an addon format. +9. Finally, be sure you are subscribed to PAC3 on the steam workshop +10. Boot up gmod, select the artery addon, and load into gm_flatgrass to make sure it works! You can skip the next section, and go on to the next tutorial. + +## Non-git setup + +You'll be doing almost the same thing, only downloading zips instead of using the `git clone` command diff --git a/doc/for_developers/structs/dropped_item.md b/doc/for_developers/structs/dropped_item.md deleted file mode 100644 index ffabfbd..0000000 --- a/doc/for_developers/structs/dropped_item.md +++ /dev/null @@ -1,14 +0,0 @@ -# Dropped item - -Droped items are represented as a name-data combo - - local i = - local e = ents.Create("art_droppeditem") - e.Item = { - Name = i.Name - Data = i:Serialize() - } - -This structure is used in: -* gamemode/core/inventory/sv_invtracker.lua -* entities/entities/art_droppeditem/init.lua diff --git a/doc/for_developers/structs/inventories.md b/doc/for_developers/structs/inventories.md deleted file mode 100644 index d965597..0000000 --- a/doc/for_developers/structs/inventories.md +++ /dev/null @@ -1,5 +0,0 @@ -# Inventories - -A player starts off with 2 inventories, a equipment inventory, and a shaped inventory (5x5) - -the equipment inventory is in the first slot, the shaped inventory in the second. diff --git a/doc/for_developers/structs/player.md b/doc/for_developers/structs/player.md deleted file mode 100644 index 130927d..0000000 --- a/doc/for_developers/structs/player.md +++ /dev/null @@ -1,17 +0,0 @@ -# Player - -A player has the following fields - -`ply.data` - stores all data needed to save & create a player - -# Data - -A players data consists of the following - -`data.inventories :: array` the inventories a player posesses, remember that all inventories must have a :serialize() method - -`data.skills :: table` the skills a player has picked up - -`data.quests :: table` the quests a player knows about - -`data.prayers :: tabe` the prayers that a player can do diff --git a/doc/structs/dropped_item.md b/doc/structs/dropped_item.md deleted file mode 100644 index ffabfbd..0000000 --- a/doc/structs/dropped_item.md +++ /dev/null @@ -1,14 +0,0 @@ -# Dropped item - -Droped items are represented as a name-data combo - - local i = - local e = ents.Create("art_droppeditem") - e.Item = { - Name = i.Name - Data = i:Serialize() - } - -This structure is used in: -* gamemode/core/inventory/sv_invtracker.lua -* entities/entities/art_droppeditem/init.lua -- cgit v1.2.3-70-g09d2