diff --git a/docs/developers/basics/creating-an-addon.md b/docs/developers/basics/creating-an-addon.md index 53173ea..70e5530 100644 --- a/docs/developers/basics/creating-an-addon.md +++ b/docs/developers/basics/creating-an-addon.md @@ -11,14 +11,14 @@ Additionally a [linter]() is a ni Additionally there are other lua addons available. All addons can be easily installed from inside VSCode itself with a single click. ???+ abstract "Ready to Use Editor With Version Control and GMod Linting" -![My VSCode](../../assets/images/article/vscode.png) + ![My VSCode](../../assets/images/article/vscode.png) ### Version Control It is generally recommended to use [Git](https://git-scm.com/) for the management of projects. Especially if they are software related. We're using [GitHub](http://github.com/) as our hosting platform, however you are free to use any alternative that you like. GitHub also offers an easy to use client that is really beginner friendly. It is called [GitHub Desktop](https://desktop.github.com/). ???+ abstract "Easy to Use Graphical Interface for GitHub" -![My Addons Folder](../../assets/images/article/github.png) + ![My Addons Folder](../../assets/images/article/github.png) Once your software is set up, you can create your first repository. Personally I do not like to create my local repository folders inside the garrysmod `addons/` folder since I prefer to have all my projects inside one folder to keep them organised. This creates a problem though, since it is really tedious to copy the contents from the `addons/` folder to your projects folder and back. [Symbolic links](https://en.wikipedia.org/wiki/Symbolic_link) are a neat solution for this. Personally on windows I use a graphical interface ([tutorial on setup and use](https://www.howtogeek.com/howto/16226/complete-guide-to-symbolic-links-symlinks-on-windows-or-linux/)), however it is up to your own preferences. @@ -27,7 +27,7 @@ Once your software is set up, you can create your first repository. Personally I All your addon files have to be placed into `GarrysMod/garrysmod/addons` and are automatically loaded when the game is started. Adding a new addon folder into this directory needs a restart of the game however. ???+ abstract "`addons/` Folder With Many Addons as Symbolic Links Inside" -![My Addons Folder](../../assets/images/article/folder.png) + ![My Addons Folder](../../assets/images/article/folder.png) See [this source](https://wiki.facepunch.com/gmod/Lua_Folder_Structure) for a detailed overview over the standard Garry's Mod project structure. @@ -70,19 +70,19 @@ The most easy way of publishing your addon is with the [GMPublisher](https://git In order to upload your addon to the Steam Workshop, you need to first compile it into a .gma file. 1. Your addon file must contain an "addon.json" within the `/` directory of your folder. This consists of a key:value pair table with information used by the Steam - Workshop to create tags for uploads. + Workshop to create tags for uploads. It should have a structure like this: - ???+ abstract "Example addon.json file" - ![addon_json.png](../../assets/images/article/addon_json.png) + ???+ abstract "Example addon.json file" + ![addon_json.png](../../assets/images/article/addon_json.png) - Type is the category which this addon fits into best. One of: - "ServerContent", "gamemode", "map", "weapon", "vehicle", "npc", "tool", "effects", "model". + Type is the category which this addon fits into best. One of: + "ServerContent", "gamemode", "map", "weapon", "vehicle", "npc", "tool", "effects", "model". - Tags are what describes your addon best. Choose two of: - "fun", "roleplay", "scenic", "movie", "realism", "cartoon", "water", "comic", "build". + Tags are what describes your addon best. Choose two of: + "fun", "roleplay", "scenic", "movie", "realism", "cartoon", "water", "comic", "build". - Ignore is what files (you can use the \* as a wildcard to ignore file extensions - e.g. \*.txt) you dont want gmad to compile for use in the resulting .gma file. + Ignore is what files (you can use the \* as a wildcard to ignore file extensions - e.g. \*.txt) you dont want gmad to compile for use in the resulting .gma file. 1. Navigate to your GarrysMod bin directory. (Usually in `Steam/steamapps/common/GarrysMod/bin`). @@ -91,14 +91,14 @@ In order to upload your addon to the Steam Workshop, you need to first compile i Alternatively you can use the cmd which gives you better error messages. Navigate to the GMod bin folder on the cmd and type gmad.exe, this gives you the gmad usage info. Input the directory to your addon folder and specify the output file directory and name. ???+ abstract "gmad help output" - ![gmad_info.png](../../assets/images/article/gmad_info.png) + ![gmad_info.png](../../assets/images/article/gmad_info.png) 1. Navigate to the bin folder via cmd to use gmpublish.exe. 1. Type `gmpublish.exe` to view usage information, input your icon and `*.gma` paths in their respective fields. ???+ abstract "gmpublish help output" - ![gmpublish_info.png](../../assets/images/article/gmpublish_info.png) + ![gmpublish_info.png](../../assets/images/article/gmpublish_info.png) 1. You have now published your addon onto the steam workshop. Visit the addon in the workshop via the link that gmpublish gives you to add information to it and make it public. diff --git a/docs/developers/content-creation/creating-a-class.md b/docs/developers/content-creation/creating-a-class.md index efd143b..0266bea 100644 --- a/docs/developers/content-creation/creating-a-class.md +++ b/docs/developers/content-creation/creating-a-class.md @@ -35,14 +35,14 @@ The `classData` argument is a table that contains all the important class settin ### General Class Settings ???+ example "Setting the Class Color" -The class color is stored in the color variable. This color value is used to display the class in the HUD and in other places like targetID. + The class color is stored in the color variable. This color value is used to display the class in the HUD and in other places like targetID. ```lua classData.color = -- [default: Color(255, 155, 0, 255)] ``` ???+ example "Setting the Language" -The language for the class consists of two parts: The name and the description. At least the name should be set, but it is good practise to set the description as well. + The language for the class consists of two parts: The name and the description. At least the name should be set, but it is good practise to set the description as well. The existing language identifiers can be found [inside these files](https://github.com/TTT-2/TTT2/tree/master/gamemodes/terrortown/gamemode/shared/lang). Currently these identifiers exist: `English`, `Deutsch`, `Русский`, `Polski`, `Italiano` @@ -51,14 +51,14 @@ The language for the class consists of two parts: The name and the description. ``` ???+ example "Setting a Class to Be Passive" -By default, classes are active. This means that they have an ability that is enabled on keypress and can only be used once activated. Besides these active feature, classes can have passive features as well (like armor for a class). However, if your class should only have passive features, set this variable to `true`. + By default, classes are active. This means that they have an ability that is enabled on keypress and can only be used once activated. Besides these active feature, classes can have passive features as well (like armor for a class). However, if your class should only have passive features, set this variable to `true`. ```lua classData.passive = -- [default: false] ``` ???+ example "Surpress Keep on Respawn" -If `true`, the player won't get the class back on respawn, no matter how the ConVar `ttt_classes_keep_on_respawn` is set. + If `true`, the player won't get the class back on respawn, no matter how the ConVar `ttt_classes_keep_on_respawn` is set. ```lua classData.surpressKeepOnRespawn = -- [default: false] @@ -67,7 +67,7 @@ If `true`, the player won't get the class back on respawn, no matter how the Con See [the Vendetta](https://github.com/TTT-2/ttt2h-pack-default/blob/master/lua/classes/classes/class_vendetta.lua) for an example. ???+ example "Class is Active During Death" -Should be set to `true`, if the class is getting active after the players death and should not get removed after death. This information is important for other addons like "TTTC Class Dropper". + Should be set to `true`, if the class is getting active after the players death and should not get removed after death. This information is important for other addons like "TTTC Class Dropper". ```lua classData.activeDuringDeath = -- [default: false] @@ -76,7 +76,7 @@ Should be set to `true`, if the class is getting active after the players death See [the Vendetta](https://github.com/TTT-2/ttt2h-pack-default/blob/master/lua/classes/classes/class_vendetta.lua) for an example. ???+ example "Deactivate Automatic Class Handling" -The class system handles each feature in predefined functions. However you might want to create a really custom class that does not rely on any standard implementations. By setting this variable to `true`, none of the following functions and tables will be used. + The class system handles each feature in predefined functions. However you might want to create a really custom class that does not rely on any standard implementations. By setting this variable to `true`, none of the following functions and tables will be used. ```lua classData.deactivated = -- [default: false] @@ -87,28 +87,28 @@ The class system handles each feature in predefined functions. However you might ### Passive Ability ???+ example "Passive Weapons" -A table of weapons given to the player once the class is set, they are automatically removed when the class is removed from the player. You can use the hook `TTTCPreventClassEquipment` to prevent the weapon hand-out and `TTTCPreventClassRemovement` to prevent the weapon removal to happen. + A table of weapons given to the player once the class is set, they are automatically removed when the class is removed from the player. You can use the hook `TTTCPreventClassEquipment` to prevent the weapon hand-out and `TTTCPreventClassRemovement` to prevent the weapon removal to happen. ```lua classData.passiveWeapons = {} ``` ???+ example "Passive Items" -A table of items given to the player once the class is set, they are automatically removed when the class is removed from the player. You can use the hook `TTTCPreventClassEquipment` to prevent the item hand-out and `TTTCPreventClassRemovement` to prevent the item removal to happen. + A table of items given to the player once the class is set, they are automatically removed when the class is removed from the player. You can use the hook `TTTCPreventClassEquipment` to prevent the item hand-out and `TTTCPreventClassRemovement` to prevent the item removal to happen. ```lua classData.passiveItems = {} ``` ???+ example "On Class Set Callback" -A function that is called when this class is given to a player after class change or on respawn. You can use the hook `TTTCPreventClassEquipment` to prevent this function to happen. + A function that is called when this class is given to a player after class change or on respawn. You can use the hook `TTTCPreventClassEquipment` to prevent this function to happen. ```lua classData.OnSet = function(ply) -- [default: nil] ``` ???+ example "On Class Unset Callback" -A function that is called when this class is removed from a player. You can use the hook `TTTCPreventClassRemovement` to prevent this function to happen. + A function that is called when this class is removed from a player. You can use the hook `TTTCPreventClassRemovement` to prevent this function to happen. ```lua classData.OnUnset = function(ply) -- [default: nil] @@ -117,21 +117,21 @@ A function that is called when this class is removed from a player. You can use ### Active Ability ???+ example "Active Weapons" -A table of weapons given to the player once the class is activated, they are automatically removed when the class is deactivated or removed from the player. + A table of weapons given to the player once the class is activated, they are automatically removed when the class is deactivated or removed from the player. ```lua classData.weapons = {} ``` ???+ example "Passive Items" -A table of items given to the player once the class is activated, they are automatically removed when the class is deactivated or removed from the player. + A table of items given to the player once the class is activated, they are automatically removed when the class is deactivated or removed from the player. ```lua classData.items = {} ``` ???+ example "Active Time" -The time how long the ability is enabled after the player activated it. If set to `0`, `onActivate` isn't called. You have to use `onDeactivated` in this case. This can be used for classes that have no active ability, but an ability that triggers an event. + The time how long the ability is enabled after the player activated it. If set to `0`, `onActivate` isn't called. You have to use `onDeactivated` in this case. This can be used for classes that have no active ability, but an ability that triggers an event. ```lua classData.time = -- [default: 60] @@ -140,63 +140,63 @@ The time how long the ability is enabled after the player activated it. If set t See [the Nebula](https://github.com/TTT-2/ttt2h-pack-default/blob/master/lua/classes/classes/class_nebula.lua) for an example of an event ability with a time of `0`. ???+ example "Cooldown Time" -The cooldown time after the usage of the active ability. + The cooldown time after the usage of the active ability. ```lua classData.cooldown = -- [default: 60] ``` ???+ example "Charging Time" -Defines how long the activation key must be pressed to activate the ability, `nil` for instant activation. + Defines how long the activation key must be pressed to activate the ability, `nil` for instant activation. ```lua classData.charging = -- [default: nil] ``` ???+ example "Max Activation Amount Per Round" -Defines how many times an ability can be activated per round, `nil` for infinite times. + Defines how many times an ability can be activated per round, `nil` for infinite times. ```lua classData.amount = -- [default: nil] ``` ???+ example "Endless Class Ability" -If `true`, the time of an ability is infinite and `time` is ignored. + If `true`, the time of an ability is infinite and `time` is ignored. ```lua classData.endless = -- [default: false] ``` ???+ example "Unstoppable Class Ability" -If `true`, the player can not disable the ability once they pressed the ability key. + If `true`, the player can not disable the ability once they pressed the ability key. ```lua classData.unstoppable = -- [default: false] ``` ???+ example "Avoid Weapon Reset" -By default, all weapons from the player inventory get removed once they activate their class ability. These weapons are given back after the ability is deactivated. If set to `true`, the player keeps his weapons while the class ability is active. + By default, all weapons from the player inventory get removed once they activate their class ability. These weapons are given back after the ability is deactivated. If set to `true`, the player keeps his weapons while the class ability is active. ```lua classData.avoidWeaponReset = -- [default: false] ``` ???+ example "On Class Activate Callback" -A function that is called on activation of an ability. If `avoidWeaponReset` is set to `false` weapons will be removed prior to this function call. + A function that is called on activation of an ability. If `avoidWeaponReset` is set to `false` weapons will be removed prior to this function call. ```lua classData.OnAbilityActivate = function(ply) -- [default: nil] ``` ???+ example "On Class Deactivate Callback" -A function that is called on deactivation of an ability. If `avoidWeaponReset` is set to `false` weapons will be given back prior to this function call. + A function that is called on deactivation of an ability. If `avoidWeaponReset` is set to `false` weapons will be given back prior to this function call. ```lua classData.OnAbilityDeactivate = function(ply) -- [default: nil] ``` ???+ example "On Class Prepare Callback" -A function that is called prior to `OnAbilityActivate`. If this function is set, the ability will be activated on the next ability-key press. This can be used to have a two step activation procedure + A function that is called prior to `OnAbilityActivate`. If this function is set, the ability will be activated on the next ability-key press. This can be used to have a two step activation procedure ```lua classData.OnStartPrepareAbilityActivation = function(ply) -- [default: nil] @@ -205,7 +205,7 @@ A function that is called prior to `OnAbilityActivate`. If this function is set, See [the Frost](https://github.com/TTT-2/ttt2h-pack-default/blob/master/lua/classes/classes/class_frost.lua) for an example. ???+ example "On Class Finish Prepare Callback" -This function will only be called if `OnStartPrepareAbilityActivation` was set. It is called on the second press of the ability key and is done directly before `OnAbilityActivate`. If the ability was canceled in this process, this function is called prior to `OnAbilityDeactivate`. + This function will only be called if `OnStartPrepareAbilityActivation` was set. It is called on the second press of the ability key and is done directly before `OnAbilityActivate`. If the ability was canceled in this process, this function is called prior to `OnAbilityDeactivate`. ```lua classData.OnFinishPrepareAbilityActivation = function(ply) -- [default: nil] @@ -214,14 +214,14 @@ This function will only be called if `OnStartPrepareAbilityActivation` was set. See [the Frost](https://github.com/TTT-2/ttt2h-pack-default/blob/master/lua/classes/classes/class_frost.lua) for an example. ???+ example "On Class Charge Callback" -This function is called once every frame after while a player is in the charging process, if the function is set and it returns `nil` or `false`, the charging process is stopped. + This function is called once every frame after while a player is in the charging process, if the function is set and it returns `nil` or `false`, the charging process is stopped. ```lua classData.OnCharge = function(ply) -- [default: nil] ``` ???+ example "Check Class Activation Callback" -This function is called when the ability should be activated. Activation fails if the function is set and it returns `nil` or `false`. + This function is called when the ability should be activated. Activation fails if the function is set and it returns `nil` or `false`. ```lua classData.CheckActivation = function(ply) -- [default: nil] @@ -232,7 +232,7 @@ This function is called when the ability should be activated. Activation fails i The `conVarData` table holds all default values for the convars to modify the class. ???+ example "Class Random" -This defines the spawn chance of a class. + This defines the spawn chance of a class. ```lua conVarData.random = -- [default: 100] diff --git a/docs/developers/content-creation/creating-a-weapon.md b/docs/developers/content-creation/creating-a-weapon.md index 9367391..bc0b66a 100644 --- a/docs/developers/content-creation/creating-a-weapon.md +++ b/docs/developers/content-creation/creating-a-weapon.md @@ -39,7 +39,7 @@ Custom sounds for your SWEP will need to be stored in this folder if you're not `/gamemodes/terrortown/content/sound/` ???+ note -Sounds types accepted are: `*.wav`, `*.mp3` and `*.ogg`. + Sounds types accepted are: `*.wav`, `*.mp3` and `*.ogg`. GMod default sound paths are found [here](https://wiki.facepunch.com/gmod/Common_Sounds). @@ -52,7 +52,7 @@ Each language file will need to be stored in this format: `/lua/terrortown/lang//.lua` ???+ note -The language identifier should be unique to prevent clashes with other addons' translations. + The language identifier should be unique to prevent clashes with other addons' translations. See the [Language Support](/developers/content-creation/language-support.md) page for more information on this topic. @@ -132,7 +132,7 @@ SWEP.Primary.Recoil = 1.5 ``` ???+ note -All of these attributes can also be applied to SWEP.Secondary which is right click by default. + All of these attributes can also be applied to SWEP.Secondary which is right click by default. ```lua SWEP.HoldType = "ar2" diff --git a/docs/developers/content-creation/using-event-system.md b/docs/developers/content-creation/using-event-system.md index a3fbaa5..cdd62fc 100644 --- a/docs/developers/content-creation/using-event-system.md +++ b/docs/developers/content-creation/using-event-system.md @@ -3,10 +3,10 @@ The event system is a powerful feature of TTT2 that allows content creators to display rich event information in the round end screen, assign scores or add data to the log. In the following article it is explained how it can be used. ???+ abstract "Round end screen with events" -![Icon Padding](../../assets/images/article/roundend.png) + ![Icon Padding](../../assets/images/article/roundend.png) ???+ note -If you just plan on modifying the scoring of your role, check out the [role scoring variables](/developers/content-creation/creating-a-role.md) first. + If you just plan on modifying the scoring of your role, check out the [role scoring variables](/developers/content-creation/creating-a-role.md) first. ## Registering an event @@ -17,7 +17,7 @@ An event is registered by simply placing an event file in the event folder of yo A basic event needs only the `Trigger(...)` function (which can have an arbitrary amount of parameters). However it is recommended to also define an `icon`, `title` and the `GetText()` function. `Serialize()` is recommended as well because it logs the event to the log file. `CalculateScore()` is used if the event should generate score. ???+ note -The event name is derived from the file name and stored in a global variable that can be accessed with `EVENT_`. + The event name is derived from the file name and stored in a global variable that can be accessed with `EVENT_`. Custom defined language strings (`title`, ...) do not have to use the `` notation, but it is recommended to do so. @@ -155,7 +155,7 @@ end ``` ???+ note -You shouldn't replace `EVENT_ROLECHANGE` because this event is used to generate the rolechange list in the round end screen. + You shouldn't replace `EVENT_ROLECHANGE` because this event is used to generate the rolechange list in the round end screen. [[Check out this example of a modified kill event that replaces the normal kill event]](https://github.com/TTT-2/ttt2-role_hit/blob/master/lua/terrortown/events/target_kill.lua) diff --git a/docs/developers/content-creation/using-karma.md b/docs/developers/content-creation/using-karma.md index d19c6be..ce82622 100644 --- a/docs/developers/content-creation/using-karma.md +++ b/docs/developers/content-creation/using-karma.md @@ -3,7 +3,7 @@ The mysterious karma system is mostly untouched in TTT2, but karma can now be easily added or subtracted and those changes are shown at the roundendscreen. ???+ abstract "Round end screen with detailed Karma" -![Icon Padding](../../assets/images/article/roundend_karma.png) + ![Icon Padding](../../assets/images/article/roundend_karma.png) ## Adding Karma @@ -19,7 +19,7 @@ function KARMA.DoKarmaChange(ply, amount, reason) ``` ???+ note -As an example the reason "karma_teamkill_tooltip" gets localized as seen in the picture at the top. + As an example the reason "karma_teamkill_tooltip" gets localized as seen in the picture at the top. [Check out how to work with language localization.](/developers/content-creation/language-support.md)