diff --git a/README.rst b/README.rst index a70995f1..67b0fd69 100644 --- a/README.rst +++ b/README.rst @@ -1,8 +1,11 @@ Titanfall 2 + Northstar Modding Docs -======================================= +==================================== -This repo contains the technical documentation on all things related to making Northstar mods. +This repo contains the technical documentation on all things related to making Northstar +mods. -Its currently in the early stages of development, so there might be some unpolished things about it. +Its currently in the early stages of development, so there might be some unpolished +things about it. -If you have some knowledge you want to share, but don't want to write a PR, you can make a issue explaining what you know and we can try to integrate that into the docs. +If you have some knowledge you want to share, but don't want to write a PR, you can make +a issue explaining what you know and we can try to integrate that into the docs. diff --git a/docs/source/api.rst b/docs/source/api.rst index b8bc4955..464101bb 100644 --- a/docs/source/api.rst +++ b/docs/source/api.rst @@ -2,4 +2,4 @@ API === .. autosummary:: - :toctree: generated + :toctree: generated diff --git a/docs/source/guides/gettingstarted.rst b/docs/source/guides/gettingstarted.rst index a8baac92..eae1db37 100644 --- a/docs/source/guides/gettingstarted.rst +++ b/docs/source/guides/gettingstarted.rst @@ -1,8 +1,8 @@ Getting Started -=================================== +=============== -Northstar supports the creation of many user mods. -This guide will teach you the basics of modding to get you started. +Northstar supports the creation of many user mods. This guide will teach you the basics +of modding to get you started. Check out the :doc:`usage` section for further information, including :ref:`installation`. @@ -10,76 +10,82 @@ Check out the :doc:`usage` section for further information, including Basics ------ -This guide assumes you have basic understanding with programming and know how to use developer environments. Listed below are tools useful for exporting file formats +This guide assumes you have basic understanding with programming and know how to use +developer environments. Listed below are tools useful for exporting file formats -If you'd like a more lengthy set of tutorials covering many topics. Look at: -`NoSkill modding guide `_ +If you'd like a more lengthy set of tutorials covering many topics. Look at: `NoSkill +modding guide `_ Tools ----- + To get started with modding for Northstar, we recommend getting yourself some tools. Check out the :doc:`tools` section for more information. - Quick Start ----------- -In order to get started with making your mod, create a folder in ``R2Northstar/mods``. -While it isn't required, it is best practise by mod authors to follow the naming scheme ``Author.ModName``, such as ``Northstar.Client``. -After making this folder, inside it add a folder named ``mod`` and a file named ``mod.json``. +In order to get started with making your mod, create a folder in ``R2Northstar/mods``. +While it isn't required, it is best practise by mod authors to follow the naming scheme +``Author.ModName``, such as ``Northstar.Client``. -Provided is a template ``mod.json``, for a detailed list of values read the :doc:`cheatsheet` +After making this folder, inside it add a folder named ``mod`` and a file named +``mod.json``. +Provided is a template ``mod.json``, for a detailed list of values read the +:doc:`cheatsheet` .. code-block:: json - { - "Name": "Yourname.Modname", - "Description": "Woo yeah wooo!", + { + "Name": "Yourname.Modname", + "Description": "Woo yeah wooo!", - "LoadPriority": 0, - "ConVars": [], - "Scripts": [], - "Localisation": [] - } + "LoadPriority": 0, + "ConVars": [], + "Scripts": [], + "Localisation": [] + } -Inside the ``mod`` folder, existing files found in the engine's virtual file system will be overwritten and new files can be added. -If you need to define new Squirrel files ``(.nut/.gnut)`` they *must* be declared in the ``"Scripts"`` array in `mod.json`. -An example for this might be: +Inside the ``mod`` folder, existing files found in the engine's virtual file system will +be overwritten and new files can be added. If you need to define new Squirrel files +``(.nut/.gnut)`` they *must* be declared in the ``"Scripts"`` array in `mod.json`. An +example for this might be: .. code-block:: json - "Scripts": [ - { - "Path": "path/to/file.nut", - "RunOn": "( CLIENT || SERVER ) && MP" - }, - { - "Path": "path/to/another_file.nut", - "RunOn": "( CLIENT || SERVER ) && MP", - "ClientCallback": { - "Before": "ClientPreMapspawnThing", - "After": "AfterMapspawnClientThing" - }, - "ServerCallback": { - "Before": "ServerPreMapspawncrap", - "After": "ServerAfterMapspawnWoo" - } - } - ] - - -``"Path"`` indicates where the script is, ``"RunOn"`` is the Squirrel VM context (see :doc:`../native/sqvm`) as an expression, and ``"ClientCallback"`` and ``"ServerCallback"`` specify a function call that can be ``"Before"`` and/or ``"After"`` map-spawn. + "Scripts": [ + { + "Path": "path/to/file.nut", + "RunOn": "( CLIENT || SERVER ) && MP" + }, + { + "Path": "path/to/another_file.nut", + "RunOn": "( CLIENT || SERVER ) && MP", + "ClientCallback": { + "Before": "ClientPreMapspawnThing", + "After": "AfterMapspawnClientThing" + }, + "ServerCallback": { + "Before": "ServerPreMapspawncrap", + "After": "ServerAfterMapspawnWoo" + } + } + ] +``"Path"`` indicates where the script is, ``"RunOn"`` is the Squirrel VM context (see +:doc:`../native/sqvm`) as an expression, and ``"ClientCallback"`` and +``"ServerCallback"`` specify a function call that can be ``"Before"`` and/or ``"After"`` +map-spawn. Detailed ``mod.json`` architecture ---------------------------------- -Located at your mod's root folder, the ``mod.json`` file is the entrypoint of your mod; -it contains human-readable information about it, which scripts to load, and a bunch -of interesting stuff. +Located at your mod's root folder, the ``mod.json`` file is the entrypoint of your mod; +it contains human-readable information about it, which scripts to load, and a bunch of +interesting stuff. -This guide will dig into each of the possible ``mod.json`` fields. Please note that +This guide will dig into each of the possible ``mod.json`` fields. Please note that ``mod.json`` keys must start with an uppercase letter. This is what a well-formatted ``mod.json`` looks like: @@ -117,57 +123,63 @@ This is what a well-formatted ``mod.json`` looks like: } .. note:: + The real ``Northstar.CustomServers`` mod contains more convars and scripts, some have been removed for the readability of the example. Name and description -^^^^^^^^^^^^^^^^^^^^ +~~~~~~~~~~~~~~~~~~~~ -Those ones are pretty self-explanatory. Both fields are used by Northstar itself -to display in-game information about your mod in the main screen ``Mods`` menu. +Those ones are pretty self-explanatory. Both fields are used by Northstar itself to +display in-game information about your mod in the main screen ``Mods`` menu. Best pratice for your mod's name is to use the ``Author.ModName`` convention. Version -^^^^^^^ +~~~~~~~ This field specifies version of your mod using ``X.Y.Z`` scheme; this field must be updated each time you release a new version of your mod. -Common use is to increase *Z* when you publish a fix (*e.g.* ``1.5.0`` to ``1.5.1``), and -increase *Y* when you release new features (*e.g.* ``1.5.1`` to ``1.6.0``). +Common use is to increase *Z* when you publish a fix (*e.g.* ``1.5.0`` to ``1.5.1``), +and increase *Y* when you release new features (*e.g.* ``1.5.1`` to ``1.6.0``). Best practise is to follow semantic versioning (https://semver.org/). LoadPriority -^^^^^^^^^^^^ +~~~~~~~~~~~~ This field defines the order in which all mods will be loaded by Northstar. For example, a mod with ``"LoadPriority": 1`` will be loaded after a mod with ``"LoadPriority": 0``. -If your mod uses code from another mod, make sure to set a greater LoadPriority than the +If your mod uses code from another mod, make sure to set a greater LoadPriority than the mod you're using code from. ConVars -^^^^^^^ +~~~~~~~ -This field lists configuration variables, that can be set by servers owners to modify +This field lists configuration variables, that can be set by servers owners to modify behaviour of your mod. -Each configuration variable must have a ``"Name"`` and a ``"DefaultValue"``. ConVars can also have an optional ``"Flags"`` field which specifies special behaviour and an optional ``"HelpString"`` field which specifies the usage of the ConVar which can be view in-game by running ``help ``. +Each configuration variable must have a ``"Name"`` and a ``"DefaultValue"``. ConVars can +also have an optional ``"Flags"`` field which specifies special behaviour and an +optional ``"HelpString"`` field which specifies the usage of the ConVar which can be +view in-game by running ``help ``. -You can access configuration variables from squirrel code using ``GetConVarInt``, +You can access configuration variables from squirrel code using ``GetConVarInt``, ``GetConVarFloat``, ``GetConVarBool`` or ``GetConVarString`` calls. .. warning:: - No matter the type of your variables, they have to be JSON strings, otherwise game won't start! + No matter the type of your variables, they have to be JSON strings, otherwise game + won't start! Example -""""""" ++++++++ -If I don't want to wait 15 seconds for matches to start on my server, ``Northstar.CustomServers`` -mod exposes a ConVar named ``ns_private_match_countdown_length`` in its ``mod.json`` manifesto: +If I don't want to wait 15 seconds for matches to start on my server, +``Northstar.CustomServers`` mod exposes a ConVar named +``ns_private_match_countdown_length`` in its ``mod.json`` manifesto: .. code-block:: json @@ -180,184 +192,196 @@ mod exposes a ConVar named ``ns_private_match_countdown_length`` in its ``mod.js ... ] -I can setup the ``ns_private_match_countdown_length`` variable in my -``R2Northstar/mods/Northstar.CustomServers/mod/cfg/autoexec_ns_server.cfg`` configuration file. +I can setup the ``ns_private_match_countdown_length`` variable in my +``R2Northstar/mods/Northstar.CustomServers/mod/cfg/autoexec_ns_server.cfg`` +configuration file. -When starting a match, ``Northstar.CustomServers`` mod will retrieve the configuration variable -value, or its default value if it hasn't been specified in configuration file: +When starting a match, ``Northstar.CustomServers`` mod will retrieve the configuration +variable value, or its default value if it hasn't been specified in configuration file: .. code-block:: javascript // start countdown - SetUIVar( level, "gameStartTime", Time() + GetConVarFloat( "ns_private_match_countdown_length" ) ) + SetUIVar( level, "gameStartTime", Time() + GetConVarFloat( "ns_private_match_countdown_length" ) ) .. note:: - All ``Northstar.CustomServers`` ConVars are listed here: https://r2northstar.gitbook.io/r2northstar-wiki/hosting-a-server-with-northstar/basic-listen-server + All ``Northstar.CustomServers`` ConVars are listed here: + https://r2northstar.gitbook.io/r2northstar-wiki/hosting-a-server-with-northstar/basic-listen-server Flags -""""" ++++++ -You can assign flags to configuration variables; to use several flags at once, just add their values. +You can assign flags to configuration variables; to use several flags at once, just add +their values. .. list-table:: Configuration variable flags - :widths: 20 15 55 - :header-rows: 1 - - * - Name - - Value - - Description - * - FCVAR_UNREGISTERED - - 1 - - If this is set, don't add to linked list, etc. - * - FCVAR_DEVELOPMENTONLY - - 2 - - Hidden in released products. Flag is removed automatically if ALLOW_DEVELOPMENT_CVARS is defined. - * - FCVAR_GAMEDLL - - 4 - - Defined by the game DLL - * - FCVAR_CLIENTDLL - - 8 - - Defined by the client DLL - * - FCVAR_HIDDEN - - 16 - - Hidden. Doesn't appear in find or auto complete. Not deterred by ALLOW_DEVELOPMENT_CVARS. - * - FCVAR_PROTECTED - - 32 - - It's a server cvar, but we don't send the data since it's a password, etc. Sends 1 if it's not bland/zero, 0 otherwise as value. - * - FCVAR_SPONLY - - 64 - - This cvar cannot be changed by clients connected to a multiplayer server. - * - FCVAR_ARCHIVE - - 128 - - Save this ConVar's value to vars.rc - this works both server and client-side. - * - FCVAR_NOTIFY - - 256 - - Notifies players when this ConVar's value was changed. - * - FCVAR_USERINFO - - 512 - - Changes the client's info string - * - FCVAR_PRINTABLEONLY - - 1024 - - This cvar's string cannot contain unprintable characters ( e.g., used for player name etc ). - * - FCVAR_UNLOGGED - - 2048 - - If this is a FCVAR_SERVER, don't log changes to the log file / console if we are creating a log - * - FCVAR_NEVER_AS_STRING - - 4096 - - never try to print that cvar - * - FCVAR_REPLICATED (AKA FCVAR_SERVER) - - 8192 - - This value is set by server and replicated by clients. - * - FCVAR_CHEAT - - 16384 - - Do NOT allow changing of this convar by console, unless sv_cheats is 1. - * - FCVAR_SS - - 32768 - - causes varnameN where N == 2 through max splitscreen slots for mod to be autogenerated - * - FCVAR_DEMO - - 65536 - - Record this cvar in a demo. - * - FCVAR_DONTRECORD - - 131072 - - Don't record this. - * - FCVAR_SS_ADDED - - 262144 - - This is one of the "added" FCVAR_SS variables for the splitscreen players - * - FCVAR_RELEASE - - 524288 - - This value is available to the end user. - * - FCVAR_RELOAD_MATERIALS - - 1048576 - - If this cvar changes, it forces a material reload - * - FCVAR_RELOAD_TEXTURES - - 2097152 - - If this cvar changes, it forces a texture reload - * - FCVAR_NOT_CONNECTED - - 4194304 - - cvar cannot be changed by a client that is connected to a server - * - FCVAR_MATERIAL_SYSTEM_THREAD - - 8388608 - - Indicates this cvar is read from the material system thread - * - FCVAR_ARCHIVE_PLAYERPROFILE - - 16777216 - - Save this, but to profile.cfg instead - meaning this only works for clients. - * - FCVAR_ACCESSIBLE_FROM_THREADS - - 33554432 - - used as a debugging tool necessary to check material system thread convars - * - FCVAR_SERVER_CAN_EXECUTE - - 268435456 - - the server is allowed to execute this command on clients via ClientCommand/NET_StringCmd/CBaseClientState::ProcessStringCmd - * - FCVAR_SERVER_CANNOT_QUERY - - 536870912 - - If this is set, then the server is not allowed to query this cvar's value (via IServerPluginHelpers::StartQueryCvarValue). - * - FCVAR_CLIENTCMD_CAN_EXECUTE - - 1073741824 - - IVEngineClient::ClientCmd is allowed to execute this command. Note: IVEngineClient::ClientCmd_Unrestricted can run any client command. + :widths: 20 15 55 + :header-rows: 1 + + - - Name + - Value + - Description + - - FCVAR_UNREGISTERED + - 1 + - If this is set, don't add to linked list, etc. + - - FCVAR_DEVELOPMENTONLY + - 2 + - Hidden in released products. Flag is removed automatically if + ALLOW_DEVELOPMENT_CVARS is defined. + - - FCVAR_GAMEDLL + - 4 + - Defined by the game DLL + - - FCVAR_CLIENTDLL + - 8 + - Defined by the client DLL + - - FCVAR_HIDDEN + - 16 + - Hidden. Doesn't appear in find or auto complete. Not deterred by + ALLOW_DEVELOPMENT_CVARS. + - - FCVAR_PROTECTED + - 32 + - It's a server cvar, but we don't send the data since it's a password, etc. Sends + 1 if it's not bland/zero, 0 otherwise as value. + - - FCVAR_SPONLY + - 64 + - This cvar cannot be changed by clients connected to a multiplayer server. + - - FCVAR_ARCHIVE + - 128 + - Save this ConVar's value to vars.rc - this works both server and client-side. + - - FCVAR_NOTIFY + - 256 + - Notifies players when this ConVar's value was changed. + - - FCVAR_USERINFO + - 512 + - Changes the client's info string + - - FCVAR_PRINTABLEONLY + - 1024 + - This cvar's string cannot contain unprintable characters ( e.g., used for player + name etc ). + - - FCVAR_UNLOGGED + - 2048 + - If this is a FCVAR_SERVER, don't log changes to the log file / console if we are + creating a log + - - FCVAR_NEVER_AS_STRING + - 4096 + - never try to print that cvar + - - FCVAR_REPLICATED (AKA FCVAR_SERVER) + - 8192 + - This value is set by server and replicated by clients. + - - FCVAR_CHEAT + - 16384 + - Do NOT allow changing of this convar by console, unless sv_cheats is 1. + - - FCVAR_SS + - 32768 + - causes varnameN where N == 2 through max splitscreen slots for mod to be + autogenerated + - - FCVAR_DEMO + - 65536 + - Record this cvar in a demo. + - - FCVAR_DONTRECORD + - 131072 + - Don't record this. + - - FCVAR_SS_ADDED + - 262144 + - This is one of the "added" FCVAR_SS variables for the splitscreen players + - - FCVAR_RELEASE + - 524288 + - This value is available to the end user. + - - FCVAR_RELOAD_MATERIALS + - 1048576 + - If this cvar changes, it forces a material reload + - - FCVAR_RELOAD_TEXTURES + - 2097152 + - If this cvar changes, it forces a texture reload + - - FCVAR_NOT_CONNECTED + - 4194304 + - cvar cannot be changed by a client that is connected to a server + - - FCVAR_MATERIAL_SYSTEM_THREAD + - 8388608 + - Indicates this cvar is read from the material system thread + - - FCVAR_ARCHIVE_PLAYERPROFILE + - 16777216 + - Save this, but to profile.cfg instead - meaning this only works for clients. + - - FCVAR_ACCESSIBLE_FROM_THREADS + - 33554432 + - used as a debugging tool necessary to check material system thread convars + - - FCVAR_SERVER_CAN_EXECUTE + - 268435456 + - the server is allowed to execute this command on clients via + ClientCommand/NET_StringCmd/CBaseClientState::ProcessStringCmd + - - FCVAR_SERVER_CANNOT_QUERY + - 536870912 + - If this is set, then the server is not allowed to query this cvar's value (via + IServerPluginHelpers::StartQueryCvarValue). + - - FCVAR_CLIENTCMD_CAN_EXECUTE + - 1073741824 + - IVEngineClient::ClientCmd is allowed to execute this command. Note: + IVEngineClient::ClientCmd_Unrestricted can run any client command. .. note:: - Some flags have been skipped due to them being generally useless unless you have very specific requirements. + Some flags have been skipped due to them being generally useless unless you have + very specific requirements. Scripts -^^^^^^^ +~~~~~~~ The scripts field lets you declare an array of Squirrel files to import into your mod. Each script entry must have a "Path" value and a "RunOn" value. .. code-block:: json - - "Scripts": [ - { - "Path": "path/to/file.nut", - "RunOn": "( CLIENT || SERVER ) && MP" - }, - { - "Path": "path/to/another_file.nut", - "RunOn": "( CLIENT || SERVER ) && MP", - "ClientCallback": { - "Before": "ClientPreMapspawnThing", - "After": "AfterMapspawnClientThing" - }, - "ServerCallback": { - "Before": "ServerPreMapspawncrap", - "After": "ServerAfterMapspawnWoo" - } - } - ] - + + "Scripts": [ + { + "Path": "path/to/file.nut", + "RunOn": "( CLIENT || SERVER ) && MP" + }, + { + "Path": "path/to/another_file.nut", + "RunOn": "( CLIENT || SERVER ) && MP", + "ClientCallback": { + "Before": "ClientPreMapspawnThing", + "After": "AfterMapspawnClientThing" + }, + "ServerCallback": { + "Before": "ServerPreMapspawncrap", + "After": "ServerAfterMapspawnWoo" + } + } + ] Path -"""" +++++ -Path of the Squirrel file to import, without ``mod/scripts/vscripts`` prefix (that's +Path of the Squirrel file to import, without ``mod/scripts/vscripts`` prefix (that's where your script files should go). RunOn -""""" ++++++ Squirrel VM context in which this script should be run. Expression examples: -* ``"SP"`` -* ``"SERVER && MP"`` -* ``"( CLIENT || SERVER ) && MP"`` +- ``"SP"`` +- ``"SERVER && MP"`` +- ``"( CLIENT || SERVER ) && MP"`` ClientCallback / ServerCallback -""""""""""""""""""""""""""""""" ++++++++++++++++++++++++++++++++ Specify methods that will be called before/after map spawn. - Localisation -^^^^^^^^^^^^ +~~~~~~~~~~~~ This field is an array listing localisation files relative paths. -For more info about localisation works on Northstar, read the :doc:`localisation` section. +For more info about localisation works on Northstar, read the :doc:`localisation` +section. .. note:: - This project is under active development. + This project is under active development. diff --git a/docs/source/guides/keyvalue/localisation.rst b/docs/source/guides/keyvalue/localisation.rst index 7f404008..8f1da083 100644 --- a/docs/source/guides/keyvalue/localisation.rst +++ b/docs/source/guides/keyvalue/localisation.rst @@ -1,23 +1,23 @@ Localisation ============ -For your content to reach as many people as possible, it is important to have it translated in users' natural language. -This guide will help you do that! +For your content to reach as many people as possible, it is important to have it +translated in users' natural language. This guide will help you do that! Languages list -------------- Languages natively supported by Titanfall2 are: -* English -* French -* German -* Italian -* Japanese -* Portuguese -* Russian -* Spanish -* Traditional Chinese (``"tchinese"``) +- English +- French +- German +- Italian +- Japanese +- Portuguese +- Russian +- Spanish +- Traditional Chinese (``"tchinese"``) Create translation files ------------------------ @@ -40,15 +40,21 @@ Here's what a translation file looks like: } } -It begins with the ``"lang"`` instruction, contains a ``"Language"`` key indicating language of current file's translations, and -a ``"Token"`` key indexing all translations. +It begins with the ``"lang"`` instruction, contains a ``"Language"`` key indicating +language of current file's translations, and a ``"Token"`` key indexing all +translations. -.. warning :: - If the translation file contains any non-ASCII character, it must use ``"UTF-16 LE"`` encoding. +.. warning:: -You'll have to create one file per supported language, and all your files must be named in a similar fashion. + If the translation file contains any non-ASCII character, it must use ``"UTF-16 + LE"`` encoding. -For example, Northstar translation files are named ``"northstar_client_localisation_english.txt"``, ``"northstar_client_localisation_french.txt"``, +You'll have to create one file per supported language, and all your files must be named +in a similar fashion. + +For example, Northstar translation files are named +``"northstar_client_localisation_english.txt"``, +``"northstar_client_localisation_french.txt"``, ``"northstar_client_localisation_german.txt"`` etc. You can import them from your ``mod.json`` manifesto this way: @@ -62,15 +68,19 @@ You can import them from your ``mod.json`` manifesto this way: } .. note:: - The ``"%language%"`` syntax allows VM to load up translations matching game language (e.g. an English client will automatically use + + The ``"%language%"`` syntax allows VM to load up translations matching game language + (e.g. an English client will automatically use ``"northstar_client_localisation_english.txt"`` file) Use translations in your code ----------------------------- -To translate UI elements like menus, you have to insert strings containing your translation keys, preceded by a ``#``. +To translate UI elements like menus, you have to insert strings containing your +translation keys, preceded by a ``#``. -For example, to translate the "Launch Northstar" button on main menu, instead of calling: +For example, to translate the "Launch Northstar" button on main menu, instead of +calling: .. code-block:: javascript @@ -91,11 +101,16 @@ You can also use the ``Localize`` method client-side: Northstar translations ---------------------- -Northstar adds new strings to the game which can be localised to match the language you are using on your Titanfall 2 installation. +Northstar adds new strings to the game which can be localised to match the language you +are using on your Titanfall 2 installation. -They're all located in ``"Northstar.Client"`` mod: `Northstar localisation files on GitHub `_ +They're all located in ``"Northstar.Client"`` mod: `Northstar localisation files on +GitHub +`_ + +.. note:: -.. note :: - - To test your modifications, change your game language: with Origin, go to `Origin (My games library) -> Titanfall 2 (right click) -> Game Properties -> Advanced Launch Options`; - with Steam, go to `Titanfall 2 page -> Manage (cog) -> Properties -> Language`. + To test your modifications, change your game language: with Origin, go to `Origin + (My games library) -> Titanfall 2 (right click) -> Game Properties -> Advanced + Launch Options`; with Steam, go to `Titanfall 2 page -> Manage (cog) -> Properties + -> Language`. diff --git a/docs/source/guides/publishing.rst b/docs/source/guides/publishing.rst index a50ca30a..2a4849e8 100644 --- a/docs/source/guides/publishing.rst +++ b/docs/source/guides/publishing.rst @@ -54,7 +54,7 @@ When uploading, it will verify your package structure and you can publish after To update a mod, change the version in ``mod.json`` and ``manifest.json``, and upload again. If the mod name is the same, it will update the previous version. Github Workflows ------ +---------------- If you want to create a Github repository for your mod, you can use a `template `_ that automatically packages and uploads your mod to Thunderstore when you create a Github release of your mod. diff --git a/docs/source/guides/scripting/gamemodemods.rst b/docs/source/guides/scripting/gamemodemods.rst index f2ef5eed..77ea9ff3 100644 --- a/docs/source/guides/scripting/gamemodemods.rst +++ b/docs/source/guides/scripting/gamemodemods.rst @@ -191,7 +191,7 @@ The comments should hopefully explain what most of everything does, but just to Now that we're done, name this file ``sh_gamemode_simplerandomiser.nut`` and place it in the ``yourmodsname/mod/scripts/vscripts/gamemodes`` folder. Server-side function ------------------- +-------------------- Now that we're down with defining the gamemode, its time to focus on the component on what makes the gamemode function in-game. For this, it will be mostly handled by the server scripts, so head into ``_gamemode_simplerandomiser.nut`` to begin writing the randomizing script. .. code-block:: javascript diff --git a/docs/source/guides/scripting/index.rst b/docs/source/guides/scripting/index.rst index 4c36fb8e..c5273117 100644 --- a/docs/source/guides/scripting/index.rst +++ b/docs/source/guides/scripting/index.rst @@ -1,7 +1,6 @@ Scripting tutorials --------------------- +=================== -.. toctree:: +.. toctree:: /guides/scripting/gamemodemods - diff --git a/docs/source/guides/tools/index.rst b/docs/source/guides/tools/index.rst index 915d4198..d78aa51c 100644 --- a/docs/source/guides/tools/index.rst +++ b/docs/source/guides/tools/index.rst @@ -1,9 +1,9 @@ Modding Tools -------------- +============= -.. toctree:: +.. toctree:: /guides/tools/rpakmodding /guides/tools/soundmodding /guides/tools/tools - /guides/tools/VTFModding \ No newline at end of file + /guides/tools/VTFModding diff --git a/docs/source/guides/tools/tools.rst b/docs/source/guides/tools/tools.rst index 9f9d997d..cf74921c 100644 --- a/docs/source/guides/tools/tools.rst +++ b/docs/source/guides/tools/tools.rst @@ -5,78 +5,94 @@ Source engine ------------- Titanfall -^^^^^^^^^ -* `Titanfall VPK Tool `_ -* `Harmony VPK Tool `_ -* `Legion `_ +~~~~~~~~~ +- `Titanfall VPK Tool `_ +- `Harmony VPK Tool `_ +- `Legion `_ RPSNVPK's -^^^^^^^^^ -* `squidgyberries RSPNVPK `_ -* `taskinoz RSPNVPK `_ -* `Provoxin RSPNVPK `_ +~~~~~~~~~ + +- `squidgyberries RSPNVPK `_ +- `taskinoz RSPNVPK `_ +- `Provoxin RSPNVPK `_ VTF & VMT -^^^^^^^^^ -* `VTFEdit `_ -* `VTF Shell Extensions `_ - `Info `_ +~~~~~~~~~ + +- `VTFEdit `_ +- `VTF Shell Extensions + `_ - `Info + `_ Other utilities --------------- File editors -^^^^^^^^^^^^ -* `Atom Text `_ +~~~~~~~~~~~~ - * `Syntax color KeyValue `_ - * `Syntax color Squirrel `_ - * `Color picker `_ +- `Atom Text `_ -* `TextCrawler 3 `_ -* `Visual Studio Code `_ -* `VSCodium `_ -* `Notepad++ `_ - -* `Kate `_ + - `Syntax color KeyValue `_ + - `Syntax color Squirrel `_ + - `Color picker `_ - * `Kate syntax highlighting for Squirrel `_ +- `TextCrawler 3 `_ +- `Visual Studio Code `_ +- `VSCodium `_ +- `Notepad++ `_ +- `Kate `_ + + - `Kate syntax highlighting for Squirrel + `_ Graphics / animation / color editors -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -* `Paint.net `_ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- `Paint.net `_ - * `Gradient Mapping plug-in `_ - * `Animation Helper `_ + - `Gradient Mapping plug-in + `_ + - `Animation Helper `_ -* `Source VMT Color `_ -* `GIMP `_ +- `Source VMT Color `_ +- `GIMP `_ - * `VTF plug-in `_ + - `VTF plug-in `_ -* `RGB Tool converter `_ -* `Color Pick Windows `_ -* `GIF splitter `_ -* `Rad Tools Bik `_ (needs `Quicktime 7.6 `_) +- `RGB Tool converter + `_ +- `Color Pick Windows `_ +- `GIF splitter `_ +- `Rad Tools Bik `_ (needs `Quicktime 7.6 + `_) Archives -^^^^^^^^ -* `7zip `_ +~~~~~~~~ + +- `7zip `_ Driver editors -^^^^^^^^^^^^^^ -* `NVidia Profile Inspector `_ -* `ATI Radeon Tray Tools `_ +~~~~~~~~~~~~~~ + +- `NVidia Profile Inspector `_ +- `ATI Radeon Tray Tools + `_ 3D Models -^^^^^^^^^ -* `Blender `_ +~~~~~~~~~ + +- `Blender `_ - * `Blender Source Tool `_ - * `Blender VMT `_ - * `IO import VMF & VMT `_ + - `Blender Source Tool + `_ + - `Blender VMT `_ + - `IO import VMF & VMT `_ -* `Crowbar `_ -* `Ninja Ripper v1.7.1 `_ +- `Crowbar `_ +- `Ninja Ripper v1.7.1 `_ -Highly recommended to check the `NoSkill Gitbook modding section `_ for more tools. +Highly recommended to check the `NoSkill Gitbook modding section +`_ +for more tools. diff --git a/docs/source/index.rst b/docs/source/index.rst index 9035e151..61e17de0 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -1,81 +1,90 @@ Welcome to the Northstar Modding Documentation! =============================================== - .. note:: - This project is under active development. Please PR everything you can! + This project is under active development. Please PR everything you can! - Check :doc:`/guides/contributing` section for getting started with `readthedocs `_ and `reStructuredText `_. + Check :doc:`/guides/contributing` section for getting started with `readthedocs + `_ and `reStructuredText + `_. Contents -------- -These docs contain info on squirrel usage and northstar/respawn functions. Its very much WIP. +These docs contain info on squirrel usage and northstar/respawn functions. Its very much +WIP. -If you know anything about any function, object or concept please dont hesitate to contribute it, even if its just a quick and dirty PR. +If you know anything about any function, object or concept please dont hesitate to +contribute it, even if its just a quick and dirty PR. Cheatsheet ========== -* `NoSkill modding guide (highly recommended to check out) `_ -* `Tools for modding `_ -* `All the Squirrel Constants `_ -* `Modding Documentation `_ -* `Squirrel Highlighting for Notepad++ and VSCode `_ -* `List of Console Commands `_ -* `Useful Squirrel `_ -* `List of squirrel funcs available to dedicated server with their signatures `_ -* `Native registered script functions `_, they are from Season 3 Apex but most also exist on Titanfall 2, especially the Titan functions. Also includes description for each function if the developers have given it one - - +- `NoSkill modding guide (highly recommended to check out) + `_ +- `Tools for modding `_ +- `All the Squirrel Constants + `_ +- `Modding Documentation + `_ +- `Squirrel Highlighting for Notepad++ and VSCode + `_ +- `List of Console Commands `_ +- `Useful Squirrel + `_ +- `List of squirrel funcs available to dedicated server with their signatures + `_ +- `Native registered script functions + `_, + they are from Season 3 Apex but most also exist on Titanfall 2, especially the Titan + functions. Also includes description for each function if the developers have given it + one .. toctree:: - :maxdepth: 2 - :hidden: + :maxdepth: 2 + :hidden: - /guides/index + /guides/index .. toctree:: - :maxdepth: 2 - :hidden: - :caption: Guides - - /guides/gettingstarted - /guides/keyvalue/index - /guides/scripting/index - /guides/tools/index - /guides/moddingtutorials - /guides/publishing - /guides/contributing + :maxdepth: 2 + :hidden: + :caption: Guides + + /guides/gettingstarted + /guides/keyvalue/index + /guides/scripting/index + /guides/tools/index + /guides/moddingtutorials + /guides/publishing + /guides/contributing .. toctree:: - :maxdepth: 3 - :hidden: - :caption: API Documentation - - /reference/index + :maxdepth: 3 + :hidden: + :caption: API Documentation + /reference/index .. toctree:: - :maxdepth: 5 - :hidden: - :caption: Squirrel Documentation + :maxdepth: 5 + :hidden: + :caption: Squirrel Documentation - /squirrel/index + /squirrel/index .. toctree:: - :maxdepth: 3 - :hidden: - :caption: RePak Documentation - - /repak/map - /repak/index + :maxdepth: 3 + :hidden: + :caption: RePak Documentation + /repak/map + /repak/index .. toctree:: - :maxdepth: 2 - :hidden: - :caption: Mapping Tools + :maxdepth: 2 + :hidden: + :caption: Mapping Tools - /mapping/info-dump + /mapping/info-dump diff --git a/docs/source/reference/index.rst b/docs/source/reference/index.rst index 5e1cd1c5..5b210805 100644 --- a/docs/source/reference/index.rst +++ b/docs/source/reference/index.rst @@ -1,5 +1,5 @@ Northstar API -------------- +============= .. toctree:: :maxdepth: 2 @@ -13,7 +13,7 @@ Northstar API /reference/northstar/usefulfuncs Respawn API ------------ +=========== .. toctree:: :maxdepth: 2 @@ -27,11 +27,11 @@ Respawn API /reference/respawn/movers HUD ---- +=== .. toctree:: :maxdepth: 1 /reference/respawn/hud_menus /reference/respawn/hud_element_notation - /reference/respawn/hud_script \ No newline at end of file + /reference/respawn/hud_script diff --git a/docs/source/reference/northstar/dependencyconstants.rst b/docs/source/reference/northstar/dependencyconstants.rst index e798232b..b3de2f1b 100644 --- a/docs/source/reference/northstar/dependencyconstants.rst +++ b/docs/source/reference/northstar/dependencyconstants.rst @@ -4,26 +4,27 @@ Dependency Constants and Compiler Directives Compiler Directives ------------------- -Compiler directives are a way to compile code only if a specific condition is met. -To use this you have the ``#if``, ``#endif``, ``#else`` and ``#elseif`` keyword. - -Contditons you can check for are - * ``SERVER`` Checks if the code is compiled on the server VM. - * ``CLIENT`` Checks if the code is compiled on the client VM. - * ``UI`` Checks if the code is compiled on the UI VM. - * ``MP`` Checks if the code is compiled in a multiplayer match. - * ``SP`` Checks if the code is compiled in a singeplayer match. - * ``DEV`` Checks if the code is compiled with the ``-dev`` keyword in the startup arguments. +Compiler directives are a way to compile code only if a specific condition is met. To +use this you have the ``#if``, ``#endif``, ``#else`` and ``#elseif`` keyword. + +Contditons you can check for are + - ``SERVER`` Checks if the code is compiled on the server VM. + - ``CLIENT`` Checks if the code is compiled on the client VM. + - ``UI`` Checks if the code is compiled on the UI VM. + - ``MP`` Checks if the code is compiled in a multiplayer match. + - ``SP`` Checks if the code is compiled in a singeplayer match. + - ``DEV`` Checks if the code is compiled with the ``-dev`` keyword in the startup + arguments. These conditions can also be combined with the regular squirrel boolean expressions -.. code:: javascript +.. code-block:: javascript #if SERVER Chat_ServerBroadcast("Message from the server VM") #endif -.. code:: javascript +.. code-block:: javascript #if (CLIENT && MP) || DEV ... @@ -34,11 +35,12 @@ These conditions can also be combined with the regular squirrel boolean expressi Dependency Constants -------------------- -Dependency constants are used to only compile code if a dependency your mod requires is loaded, these use the Compiler directives syntax. +Dependency constants are used to only compile code if a dependency your mod requires is +loaded, these use the Compiler directives syntax. Inside your ``mod.json`` define a constant as: -.. code:: javascript +.. code-block:: javascript { // mod.json stuff @@ -50,14 +52,14 @@ Inside your ``mod.json`` define a constant as: For Example: -.. code:: javascript +.. code-block:: javascript "PLAYER_HAS_ROGUELIKE_MOD": "TF|Roguelike" -Will define a constant ``PLAYER_HAS_ROGUELIKE_MOD`` that is set to ``0`` or ``1`` depending if the mod is enabled. It then can be used as a constant/compiler flag. - +Will define a constant ``PLAYER_HAS_ROGUELIKE_MOD`` that is set to ``0`` or ``1`` +depending if the mod is enabled. It then can be used as a constant/compiler flag. -.. code:: csharp +.. code-block:: csharp #if PLAYER_HAS_ROGUELIKE_MOD print("player has roguelike mod") diff --git a/docs/source/reference/northstar/serversiderui.rst b/docs/source/reference/northstar/serversiderui.rst index 6f8902ea..38da6622 100644 --- a/docs/source/reference/northstar/serversiderui.rst +++ b/docs/source/reference/northstar/serversiderui.rst @@ -1,5 +1,5 @@ Serverside RUI -====== +============== Server-side Rui provides a set of functions enabling servers to display complex hud elements on clients without requiring a client-side mod. These functions were introduced in Northstar ``1.10.0``. @@ -32,7 +32,7 @@ Creates a poll on ``player``. } Getting Response ------ +---------------- **Definition:** @@ -51,7 +51,7 @@ Returns the index of the item from ``options`` the player voted for. If the play } Large Message -^^^^^ +^^^^^^^^^^^^^ Sends a large message to ``player`` which will appear in the top right corner. @@ -75,7 +75,7 @@ Sends a large message to ``player`` which will appear in the top right corner. } Info Message -^^^^^ +^^^^^^^^^^^^ Sends a smaller message to ``player`` which will appear from the center right. @@ -123,7 +123,7 @@ Send a small popup to ``player`` which will appear in the lower half of their sc } Announcement -^^^^^ +^^^^^^^^^^^^ Sends a large announcement to ``player``. @@ -147,7 +147,7 @@ Sends a large announcement to ``player``. } Status -^^^^^ +^^^^^^ Status messages allow you to show live data to the player. Currently status messages are limited to 4 and there's no way to know if the player can see your message. diff --git a/docs/source/reference/northstar/usefulfuncs.rst b/docs/source/reference/northstar/usefulfuncs.rst index 454f51cc..a78dd1cf 100644 --- a/docs/source/reference/northstar/usefulfuncs.rst +++ b/docs/source/reference/northstar/usefulfuncs.rst @@ -3,17 +3,17 @@ Useful Functions Custom Ejection Messages -------------------- +------------------------ How ejection messages are chosen -~~~~~~~ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ When ejecting the game selects a random number between 0 and 1, if this number is greater than 0.15 then a random common eject message is returned, if it is less than 0.15 then a rare ejection message is returned. Adding new messages -~~~~~ +~~~~~~~~~~~~~~~~~~~ Using ``AddCommonEjectMessage( String message )`` and ``AddRareEjectMessage( String message )`` in script additional messages can be added to the pool of potential ejection messages Localisation -~~~~~~~ +~~~~~~~~~~~~ Like most things custom ejection messages can be localised through keyvalues There are no functions to remove ejection messages, however existing ones can be altered by modifying localisation files @@ -21,7 +21,7 @@ There are no functions to remove ejection messages, however existing ones can be Below are a list of useful functions added by Northstar. Player functions ---------- +---------------- Check for different weapon types on a player ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -122,7 +122,7 @@ Change a players invincibility .. cpp:function:: void function ScaleHealth( entity ent, float scale ) Entity functions ------------ +---------------- .. cpp:function:: float function GetEntHeight( entity ent ) @@ -146,7 +146,7 @@ Turret functions .. cpp:function:: void function UpdateTurretClientSideParticleEffects( entity turret ) Rest so far to be sorted -~~~~~~~~ +~~~~~~~~~~~~~~~~~~~~~~~~ .. cpp:function:: array function GetAllMinions() @@ -186,7 +186,7 @@ Titans Gamemode functions -------------- +------------------ .. cpp:function:: int function GetCurrentWinner( int defaultWinner = TEAM_MILITIA ) @@ -230,7 +230,7 @@ Threaded conditonals Random functions ------------------- +---------------- .. cpp:function:: bool function IsPlayerMalePilot( entity player ) @@ -254,10 +254,10 @@ Random functions Type Utilities --------- +-------------- Table -~~~~~~ +~~~~~ .. cpp:function:: void function TableRemoveInvalid( table Table ) @@ -324,7 +324,7 @@ Arrays .. note:: Returns a section of the array as new array. Copies from start to the end (not included). If start is negative the index is calculated as length + start, if end is negative the index is calculated as length + end. If end is omitted end is equal to the array length. String -~~~~~ +~~~~~~ .. cpp:function:: var function UniqueString( titleString = "" ) @@ -369,19 +369,19 @@ String Float -~~~~~~ +~~~~~ .. cpp:function:: float function RandomFloatRange( float min, float max) Integer -~~~~ +~~~~~~~ .. cpp:function:: int function RandomIntRange( int min, int max ) .. cpp:function:: int function RandomIntRangeInclusive( int min, int max ) Vectors -~~~~~~ +~~~~~~~ .. cpp:function:: vector function RandomVec( float range ) diff --git a/docs/source/reference/respawn/hud_element_notation.rst b/docs/source/reference/respawn/hud_element_notation.rst index 72e11e23..773322d4 100644 --- a/docs/source/reference/respawn/hud_element_notation.rst +++ b/docs/source/reference/respawn/hud_element_notation.rst @@ -53,7 +53,7 @@ If you're working on a **menu**, you need a ``menu`` object that contains all el It usually doesn't matter if you use quotation marks to assign string values to parameters. HUD & Panel files ----- +----------------- The first line of a ``.menu`` or ``.res`` file needs to be the resource path to itself, starting from the resource folder. @@ -74,7 +74,7 @@ The rest of the file needs to be wrapped in curly brackets. } Properties -~~~~ +~~~~~~~~~~ Capitalization of the properties shouldn't matter. @@ -85,7 +85,7 @@ Capitalization of the properties shouldn't matter. Unique string identifier used in scripts to look up an element. Every element is required to have a name. Inheritance / Parenting -^^^^ +^^^^^^^^^^^^^^^^^^^^^^^ .. cpp:function:: ControlName @@ -100,7 +100,7 @@ Inheritance / Parenting ``Hud_GetChild`` only works if the parent element is (has the ``ControlName``) a **CNestedPanel**! Identifying -^^^^ +^^^^^^^^^^^ .. cpp:function:: classname Classname used for identifying groups of elements @@ -110,7 +110,7 @@ Identifying Set an unique integer id for this element that's retrievable in script. Position -^^^^ +^^^^^^^^ .. cpp:function:: xpos diff --git a/docs/source/reference/respawn/hud_script.rst b/docs/source/reference/respawn/hud_script.rst index f386f6c5..90ea2aaa 100644 --- a/docs/source/reference/respawn/hud_script.rst +++ b/docs/source/reference/respawn/hud_script.rst @@ -1,10 +1,10 @@ HUD elements in Scripts -==== +======================= Script methods to manipulate hud elements. Element Tree & Locating Elements ----- +-------------------------------- .. cpp:function:: string Hud_GetHudName( var menu ) @@ -39,7 +39,7 @@ Element Tree & Locating Elements Returns the currently focused element. Element Position -^^^^ +^^^^^^^^^^^^^^^^ .. cpp:function:: void Hud_SetPos( var elem, int x, int y ) @@ -126,7 +126,7 @@ Element Position Set the angles of the element Visibility & Color ----- +------------------ .. cpp:function:: void Hud_Show( var elem ) @@ -175,7 +175,7 @@ Visibility & Color Change the opacity of the element over time after a delay Element Dimensions ----- +------------------ .. cpp:function:: int Hud_GetWidth( var elem ) @@ -251,7 +251,7 @@ Text .. cpp:function:: string Hud_GetUTF8Text( var elem ) Element Status ----- +-------------- .. cpp:function:: bool Hud_IsLocked( var elem ) @@ -300,7 +300,7 @@ Element Status Returns ``true`` if the element is a label Element RUI ----- +----------- .. cpp:function:: bool Hud_IsRuiPanel( var elem ) @@ -311,7 +311,7 @@ Element RUI Returns the rui instance of this element. Navigation ----- +---------- .. cpp:function:: void Hud_SetNavUp( var elem, var navTo ) @@ -330,7 +330,7 @@ Navigation Set the element that will be selected when navigating right (arrow right) from this selected element. Events ----- +------ .. cpp:function:: void Hud_HandleEvent( var elem, int event ) @@ -351,7 +351,7 @@ Events * ``UIE_CHANGE`` Other Visuals ----- +------------- .. cpp:function:: void Hud_SetNew( var elem, bool isNew ) @@ -364,7 +364,7 @@ Other Visuals .. cpp:function:: void Hud_RunAnimationScript( var elem, string animation ) Slider ----- +------ .. cpp:function:: void Hud_SliderControl_SetStepSize( var elem, float size ) @@ -375,19 +375,19 @@ Slider .. cpp:function:: float Hud_SliderControl_GetCurrentValue( var elem ) Graphs ----- +------ .. cpp:function:: void Hud_SetBarProgress( var elem, float progress ) Client Settings ----- +--------------- .. cpp:function:: void Hud_SetGamemodeIdx( var elem, int index ) .. cpp:function:: void Hud_SetPlaylistVarName( var elem, string playlist ) Uncategorized ----- +------------- .. cpp:function:: void Hud_DialogList_AddListItem( var elem, string val, string enum_ ) diff --git a/docs/source/reference/respawn/movers.rst b/docs/source/reference/respawn/movers.rst index 8fd544c7..49420830 100644 --- a/docs/source/reference/respawn/movers.rst +++ b/docs/source/reference/respawn/movers.rst @@ -6,7 +6,7 @@ Movers are entites that move and rotate smoothly. ``script_mover`` allows for smooth movement and rotation contrary to ``script_mover_lightweight`` which is not able to rotate. Create a Mover ------ +-------------- .. cpp:function:: entity CreateExpensiveScriptMover( vector origin , vector angles ) @@ -29,7 +29,7 @@ Create a Mover returns ``script_mover`` which will be at the location of the owner Moving ------ +------ .. cpp:function:: void NonPhysicsMoveTo( vector position, float time, float easeIn, float easeOut ) @@ -50,7 +50,7 @@ Moving Immediately stop this mover from moving Behaviour ------ +--------- .. cpp:function:: void ChangeNPCPathsOnMove( bool recalculate ) diff --git a/docs/source/reference/respawn/rui.rst b/docs/source/reference/respawn/rui.rst index 793d3c3b..04736ca4 100644 --- a/docs/source/reference/respawn/rui.rst +++ b/docs/source/reference/respawn/rui.rst @@ -1,5 +1,5 @@ Rui ------- +--- Functions for creating a rui, and methods of the rui object diff --git a/docs/source/repak/assets/datatable.rst b/docs/source/repak/assets/datatable.rst index 86b46fdb..81feb9a3 100644 --- a/docs/source/repak/assets/datatable.rst +++ b/docs/source/repak/assets/datatable.rst @@ -5,7 +5,7 @@ Examples: ========= 1. Example Datatable Asset ------------------------- +-------------------------- .. code-block:: json @@ -15,7 +15,7 @@ Examples: } 2. Example Datatable ``.csv`` File ------------------------- +---------------------------------- .. csv-table:: :header: "setFile", "titanRef", "difficulty", "isPrime", "coreBuildingIcon" diff --git a/docs/source/repak/assets/material.rst b/docs/source/repak/assets/material.rst index 28383d09..40c832a7 100644 --- a/docs/source/repak/assets/material.rst +++ b/docs/source/repak/assets/material.rst @@ -1,8 +1,8 @@ Materials - TODO -^^^^^^^^^^^^^^^^ +================ Examples: -========= +--------- Asset Structure: -================ \ No newline at end of file +---------------- diff --git a/docs/source/repak/assets/texture.rst b/docs/source/repak/assets/texture.rst index 475eefdf..d6266824 100644 --- a/docs/source/repak/assets/texture.rst +++ b/docs/source/repak/assets/texture.rst @@ -1,10 +1,12 @@ Textures -^^^^^^^^ +======== -Textures are the foundation of some RPak asset types. -They cannot be used directly by the game, but are instead referenced by other asset types which the game can use by itself. +Textures are the foundation of some RPak asset types. They cannot be used directly by +the game, but are instead referenced by other asset types which the game can use by +itself. -The image used by a texture must be in the .dds format and must be in one of the following compression types: +The image used by a texture must be in the .dds format and must be in one of the +following compression types: - BC1 SRGB - BC2 SRGB @@ -18,13 +20,15 @@ The image used by a texture must be in the .dds format and must be in one of the - BC5U UNORM .. warning:: - SRGB DDS compression types are preferred, as they can prevent the texture's colour from looking "washed out" + + SRGB DDS compression types are preferred, as they can prevent the texture's colour + from looking "washed out" Examples: -========= +--------- 1. Basic Texture Asset - No streaming -------------------------------------- +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: json @@ -35,13 +39,17 @@ Examples: } .. note:: - The image file in this texture asset will be called ``test_texture.dds`` and will be at ``/textures/models/humans/test_texture.dds`` + + The image file in this texture asset will be called ``test_texture.dds`` and will be + at ``/textures/models/humans/test_texture.dds`` .. note:: - Because ``disableStreaming`` is ``true``, this texture will not be stored in a .starpak file, and all mip levels will be stored in the .rpak file + + Because ``disableStreaming`` is ``true``, this texture will not be stored in a + .starpak file, and all mip levels will be stored in the .rpak file 2. Streamed Texture Asset -------------------------------------- +~~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: json @@ -52,74 +60,94 @@ Examples: } .. note:: - The image file in this texture asset will be called ``test_texture_2.dds`` and will be at ``/textures/models/humans/test_texture_2.dds`` + + The image file in this texture asset will be called ``test_texture_2.dds`` and will + be at ``/textures/models/humans/test_texture_2.dds`` .. note:: - Because ``disableStreaming`` is not present, this texture will have it's higher resolution mip levels stored in ``test_texture_2.starpak``, as defined by the ``starpakPath``. - It will not use the default ``starpakPath`` if one is defined outside of the ``files`` array + + Because ``disableStreaming`` is not present, this texture will have it's higher + resolution mip levels stored in ``test_texture_2.starpak``, as defined by the + ``starpakPath``. It will not use the default ``starpakPath`` if one is defined + outside of the ``files`` array Asset Structure: -================ +---------------- ``$type`` ---------- +~~~~~~~~~ For an asset to be a texture asset, the ``$type`` field must be ``"txtr"``. ``path`` --------- +~~~~~~~~ -The ``path`` field of a texture asset is used to determine the location in the RPak's ``assetsDir`` that the image file is in. +The ``path`` field of a texture asset is used to determine the location in the RPak's +``assetsDir`` that the image file is in. -It is also used as the asset's unique identifier, allowing other assets to reference and use it. +It is also used as the asset's unique identifier, allowing other assets to reference and +use it. The ``path`` field must start with ``textures/`` and must not end with a file extension. .. error:: - If RePak is unable to locate a file at the given ``path``, it will output the following error to the console: - ``Failed to find texture source file %s. Exiting...`` - where ``%s`` is the ``path`` field of the texture. + If RePak is unable to locate a file at the given ``path``, it will output the + following error to the console: + + ``Failed to find texture source file %s. Exiting...`` where ``%s`` is the ``path`` + field of the texture. .. error:: - If the file at the given ``path`` is not a .dds file, RePak will output the following error to the console: + + If the file at the given ``path`` is not a .dds file, RePak will output the + following error to the console: ``Attempted to add txtr asset '%s' that was not a valid DDS file (invalid magic).`` where ``%s`` is the ``path`` field of the texture. .. error:: - If an unsupported .dds compression type is used, RePak will output the following error to the console: - ``Attempted to add txtr asset '%s' that was not using a supported DDS type. Exiting...`` - where ``%s`` is the ``path`` field of the texture. + If an unsupported .dds compression type is used, RePak will output the following + error to the console: + + ``Attempted to add txtr asset '%s' that was not using a supported DDS type. + Exiting...`` where ``%s`` is the ``path`` field of the texture. ``starpakPath`` ---------------- +~~~~~~~~~~~~~~~ -The ``starpakPath`` field of a texture asset determines the path of the starpak in which the higher resolution mip levels should be stored. +The ``starpakPath`` field of a texture asset determines the path of the starpak in which +the higher resolution mip levels should be stored. -If no ``starpakPath`` value is specified, RePak will default to using the default ``starpakPath``, defined at file scope in the map file. +If no ``starpakPath`` value is specified, RePak will default to using the default +``starpakPath``, defined at file scope in the map file. -The ``starpakPath`` field should be a string, and importantly, should end in ``.starpak``. +The ``starpakPath`` field should be a string, and importantly, should end in +``.starpak``. .. note:: - If the starpak name ends in ``_hotswap.starpak`` (e.g. ``my_thing_hotswap.starpak``) then Titanfall 2 will view it as optional. - This allows the starpak to be moved, removed, or replaced while the game is running and streaming the texture. - This can be useful for debugging. + + If the starpak name ends in ``_hotswap.starpak`` (e.g. ``my_thing_hotswap.starpak``) + then Titanfall 2 will view it as optional. This allows the starpak to be moved, + removed, or replaced while the game is running and streaming the texture. This can + be useful for debugging. .. error:: - If the ``starpakPath`` is not present, and no ``starpakPath`` is defined at file scope, RePak will output the following error to the console. - ``attempted to add asset '%s' as a streaming asset, but no starpak files were available. - to fix: add 'starpakPath' as an rpak-wide variable - or: add 'starpakPath' as an asset specific variable`` - where %s is the ``path`` of the texture asset + If the ``starpakPath`` is not present, and no ``starpakPath`` is defined at file + scope, RePak will output the following error to the console. + + ``attempted to add asset '%s' as a streaming asset, but no starpak files were + available. to fix: add 'starpakPath' as an rpak-wide variable or: add 'starpakPath' + as an asset specific variable`` where %s is the ``path`` of the texture asset ``disableStreaming`` --------------------- +~~~~~~~~~~~~~~~~~~~~ -The ``disableStreaming`` field of a texture asset determines if the texture should use a starpak to store the higher resolution mip levels. +The ``disableStreaming`` field of a texture asset determines if the texture should use a +starpak to store the higher resolution mip levels. It should be a boolean value, with ``true`` disabling the use of a starpak, -``disableStreaming`` defaults to ``false`` if it is not present. \ No newline at end of file +``disableStreaming`` defaults to ``false`` if it is not present. diff --git a/docs/source/repak/assets/uiatlas.rst b/docs/source/repak/assets/uiatlas.rst index 1259ea72..b450661d 100644 --- a/docs/source/repak/assets/uiatlas.rst +++ b/docs/source/repak/assets/uiatlas.rst @@ -1,14 +1,15 @@ UI Image Atlases -^^^^^^^^^^^^^^^^ +================ -UI Image Atlases (``uimg``) are what the game uses to store multiple UI assets, -they reference a single texture asset, known as the ``atlas`` and have an array of ``textures`` which defines the different usable UI assets. +UI Image Atlases (``uimg``) are what the game uses to store multiple UI assets, they +reference a single texture asset, known as the ``atlas`` and have an array of +``textures`` which defines the different usable UI assets. Examples: -========= +--------- 1. Basic UI Image Atlas with 2 Textures ---------------------------------------- +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: json @@ -36,10 +37,12 @@ Examples: } .. note:: - This UI Image Atlas expects a texture with the path of ``rui/example1`` which is at least 256x128 + + This UI Image Atlas expects a texture with the path of ``rui/example1`` which is at + least 256x128 2. Full Map File With a UI Image Atlas ---------------------------------------- +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: json @@ -92,29 +95,34 @@ Examples: } .. note:: - This map file is a shortened version of the one used in EXRILL's `Blue Fire `_ mod + + This map file is a shortened version of the one used in EXRILL's `Blue Fire + `_ mod Asset Structure: -================ +---------------- ``$type`` ---------- +~~~~~~~~~ For an asset to be a UI Image Atlas asset, the ``$type`` field must be ``"uimg"``. ``path`` --------- +~~~~~~~~ -The ``path`` field for a UI Image Atlas asset is mostly unused, and as such can be set to almost any value. -It is used when logging information about the asset. +The ``path`` field for a UI Image Atlas asset is mostly unused, and as such can be set +to almost any value. It is used when logging information about the asset. ``atlas`` ---------- +~~~~~~~~~ -The ``atlas`` field for a UI Image Atlas asset determines which texture asset it will use. +The ``atlas`` field for a UI Image Atlas asset determines which texture asset it will +use. .. error:: - If the uimg asset doesn't contain a valid ``atlas`` field, RePak will output one of the following errors to the console: + + If the uimg asset doesn't contain a valid ``atlas`` field, RePak will output one of + the following errors to the console: ``Required field 'atlas' not found for uimg asset '%s'. Exiting...`` @@ -122,67 +130,87 @@ The ``atlas`` field for a UI Image Atlas asset determines which texture asset it where ``%s`` is the ``path`` field of the UI Image Atlas -.. error:: - If the texture asset cannot be found, RePak will output the following message to the console before exiting: +.. error:: + + If the texture asset cannot be found, RePak will output the following message to the + console before exiting: - ``Atlas asset was not found when trying to add uimg asset '%s'. Make sure that the txtr is above the uimg in your map file. Exiting..."`` + ``Atlas asset was not found when trying to add uimg asset '%s'. Make sure that the + txtr is above the uimg in your map file. Exiting..."`` where ``%s`` is the ``path`` field of the UI Image Atlas ``textures`` ------------- +~~~~~~~~~~~~ -The ``textures`` array in a UI Image Atlas asset defines the different UI textures that the atlas contains. -Any number of UI textures may be contained within one UI Image Atlas. +The ``textures`` array in a UI Image Atlas asset defines the different UI textures that +the atlas contains. Any number of UI textures may be contained within one UI Image +Atlas. ``path`` -******** +++++++++ -An entry in the ``textures`` array must have a ``path`` field, as the game must use it to identify and show the texture. +An entry in the ``textures`` array must have a ``path`` field, as the game must use it +to identify and show the texture. .. error:: - If the entry in the ``textures`` array doesn't contain a valid ``path`` field, RePak will output one of the following errors to the console: + + If the entry in the ``textures`` array doesn't contain a valid ``path`` field, RePak + will output one of the following errors to the console: ``Required field 'path' not found for a texture in uimg asset '%s'. Exiting...`` - ``'path' field is not of required type 'string' for a texture in uimg asset '%s'. Exiting...`` + ``'path' field is not of required type 'string' for a texture in uimg asset '%s'. + Exiting...`` where ``%s`` is the ``path`` field of the UI Image Atlas ``width`` and ``height`` -************************ +++++++++++++++++++++++++ -An entry in the ``textures`` array must have both a ``width`` and a ``height`` field, these values should both be integers. +An entry in the ``textures`` array must have both a ``width`` and a ``height`` field, +these values should both be integers. .. error:: - If the entry in the ``textures`` array doesn't contain a valid ``width`` or a valid ``height`` field, RePak will output one of the following errors to the console: + + If the entry in the ``textures`` array doesn't contain a valid ``width`` or a valid + ``height`` field, RePak will output one of the following errors to the console: ``Required field 'width' not found for texture '%s' in uimg asset '%s'. Exiting...`` - ``Required field 'height' not found for texture '%s' in uimg asset '%s'. Exiting...`` + ``Required field 'height' not found for texture '%s' in uimg asset '%s'. + Exiting...`` - ``'width' field is not of required type 'number' for texture '%s' in uimg asset '%s'. Exiting...`` + ``'width' field is not of required type 'number' for texture '%s' in uimg asset + '%s'. Exiting...`` - ``'height' field is not of required type 'number' for texture '%s' in uimg asset '%s'. Exiting...`` + ``'height' field is not of required type 'number' for texture '%s' in uimg asset + '%s'. Exiting...`` - where the first ``%s`` is the ``path`` field of the texture, and the second ``%s`` is the ``path`` field of the UI Image Atlas + where the first ``%s`` is the ``path`` field of the texture, and the second ``%s`` + is the ``path`` field of the UI Image Atlas ``posX`` and ``posY`` -********************* ++++++++++++++++++++++ -An entry in the ``textures`` array must have both a ``posX`` and a ``posY`` field, these values should both be integers. -These fields determine the location of the top-left pixel in the UI texture. +An entry in the ``textures`` array must have both a ``posX`` and a ``posY`` field, these +values should both be integers. These fields determine the location of the top-left +pixel in the UI texture. .. error:: - If the entry in the ``textures`` array doesn't contain a valid ``posX`` or a valid ``posY`` field, RePak will output one of the following errors to the console: + + If the entry in the ``textures`` array doesn't contain a valid ``posX`` or a valid + ``posY`` field, RePak will output one of the following errors to the console: ``Required field 'posX' not found for texture '%s' in uimg asset '%s'. Exiting...`` ``Required field 'posY' not found for texture '%s' in uimg asset '%s'. Exiting...`` - ``'posX' field is not of required type 'number' for texture '%s' in uimg asset '%s'. Exiting...`` - - ``'posY' field is not of required type 'number' for texture '%s' in uimg asset '%s'. Exiting...`` + ``'posX' field is not of required type 'number' for texture '%s' in uimg asset '%s'. + Exiting...`` - where the first ``%s`` is the ``path`` field of the texture, and the second ``%s`` is the ``path`` field of the UI Image Atlas + ``'posY' field is not of required type 'number' for texture '%s' in uimg asset '%s'. + Exiting...`` + where the first ``%s`` is the ``path`` field of the texture, and the second ``%s`` + is the ``path`` field of the UI Image Atlas diff --git a/docs/source/repak/index.rst b/docs/source/repak/index.rst index 906f8ded..b20f42cb 100644 --- a/docs/source/repak/index.rst +++ b/docs/source/repak/index.rst @@ -1,6 +1,5 @@ - Asset Types ------------ +=========== .. toctree:: :maxdepth: 4 diff --git a/docs/source/repak/map.rst b/docs/source/repak/map.rst index 5ff60590..1eafd279 100644 --- a/docs/source/repak/map.rst +++ b/docs/source/repak/map.rst @@ -1,11 +1,11 @@ Map Files -^^^^^^^^^ +========= Examples: -========= +--------- 1. Bare Minimum - No Assets ---------------------------- +~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``example1.json`` @@ -23,13 +23,16 @@ Examples: └── build └─ example1.rpak -.. note :: - This example map file is honestly pretty useless. It has no assets, because there is no ``files`` field. +.. note:: + + This example map file is honestly pretty useless. It has no assets, because there is + no ``files`` field. - It also will have the name ``new.rpak`` and will be created in the ``./build`` folder. + It also will have the name ``new.rpak`` and will be created in the ``./build`` + folder. 2. Single Texture + Single Starpak ----------------------------------- +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``example2.json`` @@ -64,17 +67,21 @@ Examples: ├─ example2.starpak └─ example2.rpak -.. note :: - This example map file creates an RPak named ``example2.rpak`` which contains 1 texture asset. - This texture will have it's higher resolution mip levels stored in example2.starpak +.. note:: + + This example map file creates an RPak named ``example2.rpak`` which contains 1 + texture asset. This texture will have it's higher resolution mip levels stored in + example2.starpak + +.. note:: + + The texture will replace any vanilla textures that have the same path. ( + ``textures/models/my_texture`` ) -.. note :: - The texture will replace any vanilla textures that have the same path. ( ``textures/models/my_texture`` ) - This is useful for creating basic skins and camos. 3. Multiple Textures + Multiple Starpaks ----------------------------------------- +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``example3.json`` @@ -122,95 +129,125 @@ Examples: └─ example3.rpak .. note:: - This example map file creates an RPak named ``example3.rpak`` which contains 3 texture assets. - These textures each have their higher resolution mip levels stored in starpaks. - ``my_texture_col`` and ``mp_texture_nml`` use ``example3.starpak``, as they do not specify their own ``starpakPath``. - This makes them use the default ``starpakPath`` that is defined at the file scope, instead of in the individual textures. + This example map file creates an RPak named ``example3.rpak`` which contains 3 + texture assets. These textures each have their higher resolution mip levels stored + in starpaks. - ``my_texture_spc`` uses ``example3-spc.starpak``, as it specifies it's own ``starpakPath``. + ``my_texture_col`` and ``mp_texture_nml`` use ``example3.starpak``, as they do not + specify their own ``starpakPath``. This makes them use the default ``starpakPath`` + that is defined at the file scope, instead of in the individual textures. + + ``my_texture_spc`` uses ``example3-spc.starpak``, as it specifies it's own + ``starpakPath``. .. note:: - This RPak is a good example of a skin that would normally require the skin tool to install. - The advantage of this method is that the skin can be uninstalled or temporarily disabled when packed as a mod. + + This RPak is a good example of a skin that would normally require the skin tool to + install. The advantage of this method is that the skin can be uninstalled or + temporarily disabled when packed as a mod. Structure: -========== +---------- ``name`` --------- +~~~~~~~~ The ``name`` field of a map file determines the name of the resulting RPak. -The ``name`` is appended with ``.rpak`` and defaults to ``new`` if no ``name`` is provided. -This results in a default RPak called ``new.rpak``. +The ``name`` is appended with ``.rpak`` and defaults to ``new`` if no ``name`` is +provided. This results in a default RPak called ``new.rpak``. .. warning:: - In the event that no ``name`` is provided in the map file, RePak will output the following warning to the console: - ``Map file should have a 'name' field containing the string name for the new rpak, but none was provided. Defaulting to 'new.rpak' and continuing...\n`` + In the event that no ``name`` is provided in the map file, RePak will output the + following warning to the console: + + ``Map file should have a 'name' field containing the string name for the new rpak, + but none was provided. Defaulting to 'new.rpak' and continuing...\n`` ``assetsDir`` -------------- +~~~~~~~~~~~~~ -The ``assetsDir`` field of a map file determines the root path which the program combines with the ``path`` for assets in order to find the correct file. -This path may be a relative path, or an absolute path. +The ``assetsDir`` field of a map file determines the root path which the program +combines with the ``path`` for assets in order to find the correct file. This path may +be a relative path, or an absolute path. -The ``assetsDir`` provided in the map file is appended with a slash ( ``\`` ) if necessary +The ``assetsDir`` provided in the map file is appended with a slash ( ``\`` ) if +necessary .. warning:: - If no ``assetsDir`` is provided, it defaults to the working directory ( ``.\`` ) as well as outputting the following warning to the console: - ``No assetsDir field provided. Assuming that everything is relative to the working directory.\n`` + If no ``assetsDir`` is provided, it defaults to the working directory ( ``.\`` ) as + well as outputting the following warning to the console: + + ``No assetsDir field provided. Assuming that everything is relative to the working + directory.\n`` ``outputDir`` -------------- +~~~~~~~~~~~~~ -The ``outputDir`` field of a map file determines the folder that the program will write the RPak and StaRPak files to once they have been created. -This path may be a relative path, or an absolute path. +The ``outputDir`` field of a map file determines the folder that the program will write +the RPak and StaRPak files to once they have been created. This path may be a relative +path, or an absolute path. -The ``outputDir`` provided in the map file is appended with a slash ( ``\`` ) if necessary +The ``outputDir`` provided in the map file is appended with a slash ( ``\`` ) if +necessary If no ``outputDir`` is provided in the map file, RePak defaults to ``.\build\`` ``version`` ------------ +~~~~~~~~~~~ The ``version`` field of a map file determines the RPak version that RePak will create. .. error:: - If no ``version`` field is provided, RePak will output the following error and the program will stop: - ``Map file doesn't specify an RPak version\nUse 'version: 7' for Titanfall 2 or 'version: 8' for Apex\n`` + If no ``version`` field is provided, RePak will output the following error and the + program will stop: + + ``Map file doesn't specify an RPak version\nUse 'version: 7' for Titanfall 2 or + 'version: 8' for Apex\n`` .. error:: - If an invalid ``version`` field is provided, RePak will output the following error and the program will stop: - ``Invalid RPak version specified\nUse 'version: 7' for Titanfall 2 or 'version: 8' for Apex\n`` + If an invalid ``version`` field is provided, RePak will output the following error + and the program will stop: + + ``Invalid RPak version specified\nUse 'version: 7' for Titanfall 2 or 'version: 8' + for Apex\n`` List of known ``version`` values: -""""""""""""""""""""""""""""""""" ++++++++++++++++++++++++++++++++++ -* ``6``: Titanfall 2: Tech Test **[UNSUPPORTED]** -* ``7``: Titanfall 2 -* ``8``: Apex Legends +- ``6``: Titanfall 2: Tech Test **[UNSUPPORTED]** +- ``7``: Titanfall 2 +- ``8``: Apex Legends ``starpakPath`` ---------------- +~~~~~~~~~~~~~~~ -The ``starpakPath`` field of a map file determines the default starpak path for textures (and other streamed assets) to use. +The ``starpakPath`` field of a map file determines the default starpak path for textures +(and other streamed assets) to use. .. note:: - If the starpak name ends in ``_hotswap.starpak`` (e.g. ``my_thing_hotswap.starpak``) then Titanfall 2 will view it as optional. - This allows the starpak to be moved, removed, or replaced while the game is running and streaming the texture. - This can be useful for debugging. + + If the starpak name ends in ``_hotswap.starpak`` (e.g. ``my_thing_hotswap.starpak``) + then Titanfall 2 will view it as optional. This allows the starpak to be moved, + removed, or replaced while the game is running and streaming the texture. This can + be useful for debugging. .. note:: - RePak will not throw any errors if no ``starpakPath`` field is specified, however the individual textures may throw errors if they do not have a ``starpakPath`` specified + + RePak will not throw any errors if no ``starpakPath`` field is specified, however + the individual textures may throw errors if they do not have a ``starpakPath`` + specified ``files`` ---------- +~~~~~~~~~ -The ``files`` field of a map file is an array of JSON objects, each one representing an RPak asset. +The ``files`` field of a map file is an array of JSON objects, each one representing an +RPak asset. -RePak will not throw any errors if no ``files`` field is specified, however the resulting RPak will contain no assets, rendering it useless. \ No newline at end of file +RePak will not throw any errors if no ``files`` field is specified, however the +resulting RPak will contain no assets, rendering it useless. diff --git a/docs/source/reverse-engineering/introduction.rst b/docs/source/reverse-engineering/introduction.rst index 6d5b7160..7b30fe26 100644 --- a/docs/source/reverse-engineering/introduction.rst +++ b/docs/source/reverse-engineering/introduction.rst @@ -1,6 +1,9 @@ Introduction ============ -The documentation for reverse engineering Titanfall2, adding new hooks to Northstar using information gathered during reverse engineering etc. is very much incomplete. +The documentation for reverse engineering Titanfall2, adding new hooks to Northstar +using information gathered during reverse engineering etc. is very much incomplete. -If you have experience with reversing Titanfall2 to develop for Northstar or just reverse engineering experience in general, feel free to add more information here, be it tools, workflows, etc. \ No newline at end of file +If you have experience with reversing Titanfall2 to develop for Northstar or just +reverse engineering experience in general, feel free to add more information here, be it +tools, workflows, etc. diff --git a/docs/source/squirrel/async.rst b/docs/source/squirrel/async.rst index 4d8cc281..4952b359 100644 --- a/docs/source/squirrel/async.rst +++ b/docs/source/squirrel/async.rst @@ -2,7 +2,7 @@ Threads, Signals and Flags ============================ Threads ----- +------- Squirrel allows scripts to spin off function calls in a thread. All subsequential function calls will be threaded as well. @@ -15,7 +15,7 @@ For more information, check out the `squirrel documentation on threads = this.maxAFKCount ) - ClientCommand( this, "disconnect You have been AFK too often in a match") - else - { - this.afkCount++ - SendHudMessage( this, format( "You are AFK!\nYou will get kicked after %i more violations", this.maxAFKCount - this.afkCount ), -1, 0.4, 255, 255, 255, 0, 0.5, 5, 0.9 ) - } - } - - // To trigger the method, do GetPlayerArray()[0].AFK() - } + global function InitCPlayerInsert + + void function InitCPlayerInsert() + { + CPlayer.afkCount <- 0 // Insert new property into the CPlayer class + CPlayer.maxAFKCount <- 3 + function CPlayer::AFK(){ // Kick a player when they are afk multiple times in a match + if ( this.afkCount >= this.maxAFKCount ) + ClientCommand( this, "disconnect You have been AFK too often in a match") + else + { + this.afkCount++ + SendHudMessage( this, format( "You are AFK!\nYou will get kicked after %i more violations", this.maxAFKCount - this.afkCount ), -1, 0.4, 255, 255, 255, 0, 0.5, 5, 0.9 ) + } + } + // To trigger the method, do GetPlayerArray()[0].AFK() + } -This will allow scripts to run the ``AFK`` method on CPlayer entities, which will kick a player after 3 +This will allow scripts to run the ``AFK`` method on CPlayer entities, which will kick a +player after 3 -Make sure to load this script **after** the class has been declared and **before** it's instantiated! +Make sure to load this script **after** the class has been declared and **before** it's +instantiated! -Note that any properties added to classes don't apply to other classes that are inherited from a modified class. +Note that any properties added to classes don't apply to other classes that are +inherited from a modified class. Instantiating Objects --------------------- @@ -194,18 +215,24 @@ It's also possible to create an instance without calling the constructor. var e = ExampleClass.instance() e.constructor(1) // Constructor is a normal function so you can call it manually. -Like the example above shows you can manipulate properties of a class directly. There is no way to make a private property. +Like the example above shows you can manipulate properties of a class directly. There is +no way to make a private property. -Methods from a class can be accessed without an instance. Note that the class itself doesn't have a reference to itself, meaning that the ``this`` keyword refers to the root table. +Methods from a class can be accessed without an instance. Note that the class itself +doesn't have a reference to itself, meaning that the ``this`` keyword refers to the root +table. .. code-block:: javascript - var class = ExampleClass - var instance = class.constructor() + + var class = ExampleClass + var instance = class.constructor() Cloning Instances ----------------- -Unlike other types, passing an object does not pass a copy of the object, but a reference to itself. This means that any modifications inside of a function are applied to the original object. +Unlike other types, passing an object does not pass a copy of the object, but a +reference to itself. This means that any modifications inside of a function are applied +to the original object. .. code-block:: javascript @@ -225,7 +252,8 @@ Unlike other types, passing an object does not pass a copy of the object, but a con.content = "manipulated string"; } -You can avoid this by using cloned objects. Use the ``clone`` keyword to create a copy of an object. +You can avoid this by using cloned objects. Use the ``clone`` keyword to create a copy +of an object. .. code-block:: javascript @@ -241,19 +269,21 @@ You can avoid this by using cloned objects. Use the ``clone`` keyword to create con.content = "manipulated string"; } -.. _Namespaces: +.. _namespaces: Emulating Namespaces -------------------- -Instead of declaring classes as a global var, you can use other types such as tables to hold multiple class objects that emulate the behaviour of namespaces to a certain extend. +Instead of declaring classes as a global var, you can use other types such as tables to +hold multiple class objects that emulate the behaviour of namespaces to a certain +extend. .. code-block:: javascript - global table fakeNamespace = { - class1 = null, - class2 = null - } + global table fakeNamespace = { + class1 = null, + class2 = null + } This allows you to group classes together in a single global variable. @@ -261,48 +291,53 @@ You can use the classes inside of the table like this: .. code-block:: javascript - // Create a class object in field - class fakeNamespace.class1 { constructor(){ print("constructing instance of class1") } } - class fakeNamespace.class2 { constructor(){ print("constructing instance of class2") } } + // Create a class object in field + class fakeNamespace.class1 { constructor(){ print("constructing instance of class1") } } + class fakeNamespace.class2 { constructor(){ print("constructing instance of class2") } } - // Access class object in field - var c1 = fakeNamespace.class1() - var c2 = fakeNamespace.class2() + // Access class object in field + var c1 = fakeNamespace.class1() + var c2 = fakeNamespace.class2() - // Insert functions into class object in field - fakeNamespace.class1.testfunc <- var function(){ print( "inserted function in class1" ) } + // Insert functions into class object in field + fakeNamespace.class1.testfunc <- var function(){ print( "inserted function in class1" ) } You can also declare classes in an array: .. code-block:: javascript - array classes // This has to be at file level + array classes // This has to be at file level - // This has to be inside of a function: - classes.append( class { constructor(){ print( "inline constructor" ) } ) - var instance = classes[0]() + // This has to be inside of a function: + classes.append( class { constructor(){ print( "inline constructor" ) } ) + var instance = classes[0]() And in a similar fashion in structs: .. code-block:: javascript - struct { - var class1 = null - var class2 = null - } classes // This has to be at file level + struct { + var class1 = null + var class2 = null + } classes // This has to be at file level - // This has to be inside of a function: - classes.class1 = class { constructor(){ print( "inline constructor" ) } ) - classes.class2 = class { constructor(){ print( "inline constructor" ) } ) - var c1 = classes.class1() - var c2 = classes.class2() + // This has to be inside of a function: + classes.class1 = class { constructor(){ print( "inline constructor" ) } ) + classes.class2 = class { constructor(){ print( "inline constructor" ) } ) + var c1 = classes.class1() + var c2 = classes.class2() .. warning:: - Respawn's fork doesn't appear to support inheritance. Using the ``extend`` keyword won't compile. + Respawn's fork doesn't appear to support inheritance. Using the ``extend`` keyword + won't compile. .. code-block:: javascript class Child extends Parent{} -Make sure you check out the squirrel documentation on `classes `_ and built in `class instance `_ methods for more information. \ No newline at end of file +Make sure you check out the squirrel documentation on `classes +`_ and built +in `class instance +`_ +methods for more information. diff --git a/docs/source/squirrel/functions.rst b/docs/source/squirrel/functions.rst index d8f904f8..a1a71d3a 100644 --- a/docs/source/squirrel/functions.rst +++ b/docs/source/squirrel/functions.rst @@ -4,7 +4,7 @@ Functions The vast majority of GNUT modding within northstar will be done through functions, so understanding the syntax of functions is important. Declaring Functions --------------------- +------------------- Functions in squirrel are first defined by stating the **return type** (output) followed by the keyword **function**. For example, if you wanted to define a function that returns TRUE or FALSE you would type: @@ -39,7 +39,7 @@ If a function is lacking a ``return`` statement or a return value, it will retur } Optional Parameters ------ +------------------- Optional parameters aren't required to call the function and will be assigned a default value if nothing was passed. @@ -58,7 +58,7 @@ To make a parameter optional, add a default after the parameter Optional parameters must be declared after all required parameters. Passing Functions as parameters ------ +------------------------------- If you want to pass a function as a parameter to another function, for example as a callback set their type as ``functionref( [parameters] )``. @@ -77,7 +77,7 @@ If you want to pass a function as a parameter to another function, for example a CallLiteral( FnLiteral ) Calling Functions ------ +----------------- You can call functions with opening and closing brackets containing all parameters or with the call function. @@ -98,7 +98,7 @@ You can also call functions with an array of parameters FnLiteral.acall( args ) // 13 Implicit parameters ------ +------------------- If you don't know how many parameters you get at compile time, you can use implicit parameters. @@ -117,7 +117,7 @@ If you don't know how many parameters you get at compile time, you can use impli XParameters( "req", "opt" ) Implicit Capture ------ +---------------- It's not possible to use locals from a parent function, but it is possible to capture them in an anonymous functions. diff --git a/docs/source/squirrel/index.rst b/docs/source/squirrel/index.rst index cbd27ea3..3e023104 100644 --- a/docs/source/squirrel/index.rst +++ b/docs/source/squirrel/index.rst @@ -1,45 +1,50 @@ rSquirrel ========= -Squirrel is the programming language used by Respawn to code Titanfall 2, however it was heavily modified fron the original version, it was roughly forked at version 2.3 . -The most notable change is the additon of types to the language. + +Squirrel is the programming language used by Respawn to code Titanfall 2, however it was +heavily modified fron the original version, it was roughly forked at version 2.3 . The +most notable change is the additon of types to the language. Syntax Highlighting ------------------- Notepad++ --------- -For Notepad++, define a custom language for Squirrel. -Luckily, `samisalreadytaken has written a squirrel highlighter `_. + +For Notepad++, define a custom language for Squirrel. Luckily, `samisalreadytaken has +written a squirrel highlighter +`_. 1. Download Squirrel.xml -2. At the top, edit ``ext="nut"`` to ``ext="nut gnut"`` so it works with gnut files as well +2. At the top, edit ``ext="nut"`` to ``ext="nut gnut"`` so it works with gnut files as + well 3. Open Notepad++ 4. Navigate to Language > User Defined Language > Define your language 5. Click import, and select Squirrel.xml -(If the colors/style are not to your taste) -1. Select '`Squirrel'`` in User Language at the top -2. Navigate through the tabs to find what you want to change -3. Click its '`Styler`' button and make the changes you wish to +(If the colors/style are not to your taste) 1. Select '`Squirrel'`` in User Language at +the top 2. Navigate through the tabs to find what you want to change 3. Click its +'`Styler`' button and make the changes you wish to VSCode ------ -VSCode has extensions avaliable for working with squirrel, and searching "squirrel" in the extensions marketplace will give you them. -However, installing this will only create an associastion for .nut files, and not .gnut files. -To fix this: +VSCode has extensions avaliable for working with squirrel, and searching "squirrel" in +the extensions marketplace will give you them. + +However, installing this will only create an associastion for .nut files, and not .gnut +files. To fix this: 1. Open a .gnut file 2. Do CTRL+K, M (not CTRL+K, CTRL+M) 3. Select ``Configure File Association for .gnut`` 4. Select ``Squirrel`` (only appears if you have the extension) - Kate ------ - -`Kate syntax highlighting for Squirrel `_ +---- +`Kate syntax highlighting for Squirrel +`_ .. toctree:: :maxdepth: 2 @@ -52,4 +57,4 @@ Kate /squirrel/statements /squirrel/class /squirrel/async - /squirrel/networking \ No newline at end of file + /squirrel/networking diff --git a/docs/source/squirrel/sqvm.rst b/docs/source/squirrel/sqvm.rst index 0f80a5fe..107877ca 100644 --- a/docs/source/squirrel/sqvm.rst +++ b/docs/source/squirrel/sqvm.rst @@ -1,2 +1,2 @@ Squirrel VM -=========== \ No newline at end of file +=========== diff --git a/docs/source/squirrel/statements.rst b/docs/source/squirrel/statements.rst index dccec5f8..f8e6749d 100644 --- a/docs/source/squirrel/statements.rst +++ b/docs/source/squirrel/statements.rst @@ -1,8 +1,8 @@ Statements -==== +========== If statements ---------------- +------------- If statements use a similar style to most programming languages and will execute their asigned code if the test placed inside returns the boolean value true. If I wanted to have something occur if, and only if, our previous ``ReturnTrueOrFalse`` function returned true, then you can use: @@ -27,12 +27,12 @@ The Syntax is ``condition ? if_condition_true : if_condition_false``. This is es string shortenedUsername = username.len() > 9 ? username.slice(0,6) + "..." : username; Loops ------- +----- Loops are used to execute the same code n times. While Loops -~~~~ +~~~~~~~~~~~ A while loop runs as long as the condition evaluates to a truthy value. @@ -61,7 +61,7 @@ A do while loop is the same as a while loop but the condition is checked **after } while( false ) For Loop -~~~~ +~~~~~~~~ A for loop also runs until a condition is met however it provides you with a counter variable. @@ -83,7 +83,7 @@ The Syntax is as follows: ``for( int counter; condition; behaviour_after_body_ex } Foreach Loop -~~~~ +~~~~~~~~~~~~ A foreach loop iterates over a ``table`` or an ``array`` and executes for each entry. The loop provides you with an optional counter for arrays or key for tables. @@ -108,7 +108,7 @@ A foreach loop iterates over a ``table`` or an ``array`` and executes for each e } Implicit conditional behavior ------------------ +----------------------------- Conditional statements, such as while loops and if statements, also implictly cast non-boolean inputs to booleans. For numbers, this means 0 is considered false and anything else is considered true. For instance variables like arrays and entities, ``null`` is considered false and anything else is considered true. For example, these inputs are considered true by the if statements: .. code-block:: javascript