Configuring JMod - Jackarunda/gmod GitHub Wiki

Variable Configuration

JMod has a robust JSON-based configuration system that allows you to change almost every aspect of it with a text file.

The config file is located at Garry's Mod/garrysmod/data/jmod_config.txt. Open it with your favorite text editor, but it is strongly recommended you do not use Windows's Notepad (a good alternative is Notepad++).

For those of you who know JSON, everything should be straightforward. However, if you are unfamiliar with it, take note that indentation, commas and brackets are very important and you should preserve the format given in the file. Use an online JSON parser (like this one) to make sure you do not make errors.

After making your desired changes, use the concommand jmod_reloadconfig to refresh the configuration file (if you are in a game already).

Note that config files can get obsolete as new updates push new features. If it happens to you, your outdated config file will be renamed as jmod_config_old.txt in the same folder.

Lua Configuration

Build Functions

Some blueprints, like the HL2 Jeep, needs a special function to be spawned. You can add these functions without editing JMod as well.

You need to have an autorun Lua file. Either place one in garrysmod/lua/autorun, or garrysmod/addons/YOUR_ADDON_NAME/lua_autorun. The contents should look as follows:

-- Autorun file
AddCSLuaFile()

JMod = JMod or {}
JMod.LuaConfig = JMod.LuaConfig or {}
JMod.LuaConfig.BuildFuncs = JMod.LuaConfig.BuildFuncs or {}

JMod.LuaConfig.BuildFuncs["spawnMyThing"] = function(playa, position, angles)
        local Ent = ents.Create("my_special_thing")
        Ent:SetModel("models/mymodel.mdl")
        Ent:SetPos(position)
        Ent:SetAngles(angles)
        Ent.Owner=playa
        Ent:Spawn()
    end

After that, you can use the name of the function as part of the config file, as follows:

"My Cool Thing": {
			"craftingReqs": {
				"basic parts": 999999.0
			},
			"results": "FUNC MyCoolThing",
			"sizeScale": 1.5,
			"category": "TRLRS",
			"craftingType": "toolbox",
			"description": "MyCoolThing"
		}

You can also use \n like above to split up long lines to nicely format your descriptions, should they get lengthy. Workbench and Build Kit items have their descriptions as above, but radio orders have theirs as below instead.

"gas": {
		"category": "Resources",
		"results": [
			        [
		                        "ent_jack_gmod_ezgas",
				         3.0
			        ]
		],
		"description": "3 canisters of gas used for crafting items and powering the EZ Workbench"
	},

Armor Offsets

JMod's armor may not fit properly on every playermodel. Armor offsets allow you to define custom position, angles and scale for armor on specific playermodels so that they look good.

The table follows the format of JMod.ArmorTable with the outermost table being the playermodel. That is to say,

JMod.LuaConfig.ArmorOffsets = JMod.LuaConfig.ArmorOffsets or {}

JMod.LuaConfig.ArmorOffsets["player_model_file.mdl"] = {
    ["GasMask"]={
        siz=Vector(1,1,1),
        pos=Vector(0,1.7,0),
        ang=Angle(100,180,90),
    }
    -- etc.
}

As with build functions, the best practice is to have your own autorun file. You can find all existing armor values in lua/jmod/sh_armor.lua, and edit the values from there.