-
Notifications
You must be signed in to change notification settings - Fork 17
Getting Started
Short guide how to start editing this addon.
In the first place you have to know LUA, I'm not joking you have to know it to understand what's going on. Without enough knowledge you won't be able to do anything. You can try copy-pasting code to make what you want, but you will eventually make mistake and you will not know how to fix it and most likely no one will fix your mistakes for you.
First of all you have to have source code of this gamemode - download it from GitHub or unpack workshop addon. Create new directory in addons folder and then put there source code of gamemode (e.g. steamapps/common/GarrysMod/garrysmod/addons/scplc/). And remember to DISABLE workshop version of the gamemode!
Use your favorite editor, but I highly suggest you to use editor that support workspaces (like sublime text or VS Code) because it helps a lot. If you want (for some unknown reasons) to stick with Notepad++, you can do it, but it'll make your life harder.
All files are divided into 4 folders: core, languages, mapconfigs, modules. Each folder is designed to hold different types of files.
-
core- holds library files that don't interact with gamemode directly -
modules- holds most of gamemode files -
mapconfigs- holds configuration files for maps -
languages- holds all languages
All files are automatically included, that means you don't have (and you really shouldn't) use include function.
All files are named after their content, that means player related stuff will most likely be located in files containing player in name.
You shouldn't edit cl_init.lua, sv_init.lua and shared.lua files!
- Core
- Languages
- sh_module.lua
- cl/sv_module.lua
- Modules
- Map Config
Order of files inside folder is ascending by name. But if your code is well designed the loading order shouldn't be problem. If it's, you can always delay loading of things in timer.
If you want to add few simple things like classes, teams, SCPs and other things that don't required change in core of gamemode, you ca do it without editing gamemode! You can simply create lua files in autorun folder and in these files you can use provided hooks and functions to add your content.
You can always look for help in official discord. However, keep in mind that you should know how to write code, because you will most likely not understand anything.