Garry's Mod

Garry's Mod

Niums Brewery
 This topic has been pinned, so it's probably important
niumikus  [developer] 29 Feb, 2024 @ 11:09am
Making an Extension
Setup
You only need a single file, in lua/autorun/
additionally you can add materials


use hook.Add("NBREW_Extensions", ...

Localisation
Create a table in which you assign a type your loc

Example (Lots Omitted):
your_table = { apples = "Apples", apple_juice = "Apple juice", cider = "Apple Cider", rice = "Rice", beer_asar = "Beer (Asar)", honey = "Honey", mead = "Mead" }
then call NBrew_AddLoc(your_table)

Ingredients
Must have the same name as in the localisation

For spawnable types, example:

your_table = { yeast = { spawnable = { type = "package", amount = 5, }, unit = "Kg", candanger = false, color = Color(225, 198, 153, 240) }, }

spawnable types are "barrel" "package" and "crate"
Choose a color, a unit of measurement and if that ingridient can be dangerous

Intermediary
grape_juice = { ent = "nbrew_water", unit = "L", candanger = false, color = Color(87, 18, 64, 240) },
for ent use any spawnable nbrew_entity that has a model you want.

Wines
cider = { ent = "nbrew_agingbarrel", consumable = "nbrew_wine_bottled", materials = { ["wine_bottle_black"] = "wine_bottle_green", ["label_red_wine"] = "label_cider" }, unit = "L", abv = 0.11, candanger = true, color = Color(178, 255, 175, 240) },
For wines choose ent = "nbrew_agingbarrel" and as the consumable nbrew_wine_bottled
Additionally you can define materials for texture hot swapping (look below)

Spirits
spirit_vodka = { consumable = "nbrew_spirit_bottled", ent = "nbrew_agingbarrel", unit = "L", candanger = true, color = Color(228,170,12,240), materials = { ["spiritbottle_orange"] = "spiritbottle_grey", ["label_whiskey"] = "label_vodka" } },
same as with Wine, but choose nbrew_spirit_bottled
you likely want to use label_default for your custom drinks, unless you add your own label
Beer
beer_stout_imperial = { ent = "nbrew_beer_finished", unit = "L", candanger = true, abv = 0.12, logo = "barrel_beer", color = Color(112, 84, 42, 240), },
Same here, but define an ABV and set the ent to nbrew_beer_finished
you can choose a logo for the barrel from the hot textures (look below)
Hot Textures
Can be found in
{ barrel_default = "niumikus/nbrew/barrel/barrelsinc", barrel_wine = "niumikus/nbrew/barrel/wine", barrel_beer_nium = "niumikus/nbrew/barrel/Niumpilsner", barrel_beer = "niumikus/nbrew/barrel/beer", barrel_age = "niumikus/nbrew/barrel/barrelage", barrel_age_wood = "niumikus/nbrew/barrel/barrelagewood", spiritbottle_orange = "niumikus/nbrew/spiritbottle/bottlemain", spiritbottle_grey = "niumikus/nbrew/spiritbottle/bottlegrey", spiritbottle_brown = "niumikus/nbrew/spiritbottle/bottlebrown", spiritbottle_blue = "niumikus/nbrew/spiritbottle/bottleblue", label_whiskey = "niumikus/nbrew/spiritbottle/label", label_rum = "niumikus/nbrew/spiritbottle/rum", label_tequilla = "niumikus/nbrew/spiritbottle/tequilla", label_vodka = "niumikus/nbrew/spiritbottle/vodka", label_shochu = "niumikus/nbrew/spiritbottle/shochu", label_default = "niumikus/nbrew/spiritbottle/default_label", wine_bottle_black = "niumikus/nbrew/winebottle/glass", wine_bottle_green = "niumikus/nbrew/winebottle/glassgreen", label_red_wine = "niumikus/nbrew/winebottle/label", label_cider = "niumikus/nbrew/winebottle/cider",
}
DO NOT redifine this table
you can add your own hot textures by placing the vtf and vtm files in the materials
and definiting them in a table like this then calling NBrew_AddHotTexture(your_table)

Spawnables
defined like this
NBrew_Spawnables = { barrel = { icon = "materials/entities/nbrew_barrel.png", model = "models/props_borealis/bluebarrel001.mdl", }, package = { icon = "materials/entities/nbrew_package.png", model = "models/props_junk/cardboard_box001a.mdl", }, crate = { icon = "materials/entities/nbrew_crate.png", model = "models/props_junk/wood_crate001a.mdl", } }
Add your own using NBrew_AddSpawnable(your_table)
Recipies
Depends on the machine used.

Brewing Barrel
beer_pilsner = { modifiers = { time = 2 }, ingredients = { ["water"] = 100, ["hops"] = 0.2, ["malt"] = 20, ["yeast"] = 0.1, }, logo = "barrel_beer", processor = "nbrew_brewingbarrel" },
Defined using processor = "nbrew_brewingbarrel"
time is equal to the speed
again, use a logo or just barrel_default
the ingredients are the ingredients in a ratio. so 100:0.2:20:0.1 is a RATIO
Press
grape_juice = { ingredients = { "grapes" }, processor = "nbrew_press" },
Very simple, doesnt require explination
Distillery
spirit_tequilla = { ingredients = { "agave_juice_fermented" }, processor = "nbrew_distillery" },
same here

put all your recipies in a table, then add using NBrew_AddRecipie(your_table)

Enjoy!
Last edited by niumikus; 29 Feb, 2024 @ 11:19am