[0.8.9][NK] Starting

johnycilohoklajohnycilohokla REGISTERED Posts: 283 Developer
edited January 2016 in Modding Tutorials
This tutorial covers:
  • Setting up mod files
  • TUG folder structure
  • Manifest file
  • Debugging Config options
  • ModScriptClass

Setting up mod files

First thing you will need to do before you start modding TUG is locate the TUG folder.

Steam users:
Steam -> right click on TUG -> Properties -> Local Files tab -> Browse Local Files...
or (if you have installed TUG to the default steam library)
[Steam]/steamapps/common/TUG/
or (if you have installed TUG to the custom steam library)
[SteamLibrary]/SteamApps/common/TUG/
Launcher users:
The directory that you have installed the launcher to contains a /Content/Game/ directory.
[Program Files (x86)]/Nerd Kingdom/TUG/Content/Game/
From now on I will reference the TUG folder as [TUG].

All game files and scripts are located in [TUG]/Game/

All mods are located in [TUG]/Mods/

A template mod is included in [TUG]/Mods/ModTemplate/, with basic script and basic folder structure, you can copy it and replace all [MyModName] with name of your mod.

TUG folder structure

Root [TUG] contains 3 important folders:
  • Config
    Contains:
    • mods.txt (list of all enabled mods)
    • user_config.txt (configuration)
    • keybinds.txt (default keybinds)
  • Game
  • Mods
Each Game/Mod folder contains the following structure (only Manifest.json is required)
  • Character
    • Contains static/animated models and texture for players, characters and tools
  • Data
    • Crafting
      • Contains crafting recipe files (those are not auto-loaded)
    • Effects
      • Contains effect files (JSON) for the data driven effects systems
    • GameObjects
      • Characters
        • Contains data files for characters
      • CrafterObjects
        • Contains data files for crafting stations
      • EquipableObjects
        • Contains data files for equipable objects
      • FirstPersonHands
        • Contains data file for 1st person hand object
      • PlaceableMaterials
        • Contains data files for placeable materials
      • PlaceableObjects
        • Contains data files for placeable objects
    • Generators
      • Contains generator file
    • TerrainMaterials
      • Contains terrain material files
  • Fonts
    • Contains fonts used in TUG
  • FX
    • Particles
    • Emitters
    • Attractors
    • Textures
  • Materials
    • Contains textures for materials
  • Models
    • Contains models and textures for game objects
  • Scripts
    • Contains Lua script files
  • Shaders
    • Contains HLSL shaders
  • Sky
    • Contains sky data
  • Sound
    • Contains sound files
  • UI
    • Contains user interface files (CEGUI)
  • Manifest.json
    • Mod configuration file

Manifest file

Manifest file is the main mod file, it contains:
  • Name (unique mod name, used as identifier for the mod)
  • Summary
  • Description
  • Version
  • TargetGame
  • Authors
  • Categories
  • Optional Script (used to define ModScriptClass)
Example Manifest.json
{
"Name": "ExampleMod",
"Version":
{
"Major": 0,
"Minor": 0,
"Revision": 1
},
"Summary": "ExampleMod mod",
"Description": "ExampleMod mod",
"TargetGame": {
"Name": "TUG",
"Version": {
"Major": 0,
"Minor": 8,
"Revision": 9
}
},
"Authors":
[
{
"GitUsername": "JohnyCilohokla",
"NkUsername": "JohnyCilohokla",
"Email": ""
}
],
"Categories":
[
"Example"
]
}

Debugging Config options

All of the config options are stored in [TUG]/Config/user_config.txt

There are 2 ways to enable console:
  • Always on, you will need to set
    	ENABLECONSOLE = 1
  • Toggled using `, you will need to set
    	TILDE_OPENS_CONSOLE = 1
There are 2 config option that look like mod development options, but those should stay off (0) as they are used for development environment (used to isolate scripts while testing).
	USEMANIFEST = 0
DEVMODE = 0
You may also want to set up full screen windowed mode (borderless), here is an example for 1080p:
	WINDOWWIDTH = 1920
WINDOWHEIGHT = 1080
FULLSCREEN = 2

ModScriptClass

To create a ModScriptClass you will need to create a new Lua file (the path needs to be defined in Manifest.json as Script->File) that contains a Subclass of EternusEngine.ModScriptClass (the name of this class need to be defined in Manifest.json as Script->Class).

Example of a Manifest.json file with Script defined.
{
"Name": "ExampleMod",
"Version":
{
"Major": 0,
"Minor": 0,
"Revision": 1
},
"Summary": "ExampleMod mod",
"Description": "ExampleMod mod",
"TargetGame": {
"Name": "TUG",
"Version": {
"Major": 0,
"Minor": 8,
"Revision": 9
}
},
"Authors":
[
{
"GitUsername": "JohnyCilohokla",
"NkUsername": "JohnyCilohokla",
"Email": ""
}
],
"Script":
{
"File": "Scripts/ExampleMod.lua",
"Class": "ExampleMod"
},
"Categories":
[
"Example"
]
}
Example of a very basic ModScriptClass class.
-------------------------------------------------------------------------------
if ExampleMod == nil then
ExampleMod = EternusEngine.ModScriptClass.Subclass("ExampleMod")
end

EntityFramework:RegisterModScript(ExampleMod)
The ModScriptClass is explained in detail in the ModScriptClass Tutorial.
My Blog
jc.png
  yt.png  t.png  
Sign In or Register to comment.