All resources

rsg-cooking – Docs (v3.2.0)#

Contents#

  1. Files
  2. How it works
  3. Configuration
  4. Exports and events
  5. Database
  6. Security
  7. Server owner how-tos
  8. Troubleshooting

1. Files#

FilePurpose
fxmanifest.luaManifest; depends on rsg-core, rsg-inventory, rsg-target, oxmysql
shared/config.luaStations, campfire, fuels, levels, recipes
client/client.luaTargets, campfire placement, NUI bridge
server/server.luaStations, cooking ticks, actions, XP, exports
server/sv_config.lua, server/webhooks.luaWebhook settings and Discord logs
server/versionchecker.luaGitHub version check
html/NUI (same style as rsg-moonshine)
installation/rsg-cooking.sqlManual database install
installation/shared_items.luaItems to add to your items file
locales/*.jsonen, de, el, es, fr, ja, nl, pl, pt-br, ro, ru

2. How it works#

Works the same way as rsg-moonshine.

  1. Find a station: target a stove prop (Use Stove) or set up your own campfire.
  2. Choose a recipe by category tab; locked recipes show the level they need.
  3. Fill the pantry with each ingredient (up to MaxBatches batches). Unload takes them back.
  4. Feed the fire with resource_wood or resource_coal. Fuel burns only while a batch cooks; if it runs out the batch pauses.
  5. Wait. A batch starts when the pantry holds a full batch and the fire is lit; the next queues automatically.
  6. Collect finished food from the serving tray (up to OutputCap). Collecting gives the food and cooking XP.

To change recipe, the pantry, current batch and tray must be empty.

StationWhereNotes
stovestove props in WorldStations.modelsPrivate pot per character (WorldStations.private = false shares one pot)
campfirecampfire item or /setupcampfireOwned by the placer; only the owner can put it out (must be empty) and the kit is returned

3. Configuration#

shared/config.lua:

OptionDefaultMeaning
InteractDist3.0Server-side max distance
SpawnDist120.0Campfire prop spawn distance
MaxBatches10Pantry capacity per ingredient (in batches)
OutputCap100Tray capacity before cooking stops
TickInterval15Seconds between server ticks
ImagePathnui://rsg-inventory/html/images/Item images
StationTypestablefuel = true/false per type
WorldStationstableenabled, private, distance, models
CampfiretableCommand, Item, ReturnItem, Model, PlaceDistance, MinSpacing, MaxPerPlayer, SetupTime, OwnerOnly
FuelstableFuel item → burnTime seconds
Levels{0, 10, 50, 150, 400, 1000}XP needed per cooking level
RecipestableRecipes, inputs, outputs, level, category

Webhook URLs are in server/sv_config.lua.

4. Exports and events#

NameSideNotes
GetPlayerCookingXP(src)server export
GetPlayerCookingLevel(src)server export
GivePlayerCookingXP(src, amount)server export
GetCookingRecipes()server / client exportRecipe table (client takes an optional category)
GetRecipesByCookingType(stype)client export
CanCookItem(itemName)server export
AddCustomRecipe(recipe)server exportRegister a recipe from another resource
rsg-cooking:server:getStationscallbackAll stations
rsg-cooking:server:getStatecallback(id)
rsg-cooking:server:actioncallback(id, action, data) pantry, fuel, recipe, collect
rsg-cooking:server:getWorldStationcallback(coords, stype)
rsg-cooking:server:requestCampfire / placeCampfireserver events(coords, heading) for placement
rsg-cooking:client:syncStation / removeStationclient eventsStation updates
rsg-cooking:client:placeCampfireclient eventStart placement

Command: /setupcampfire (name from Campfire.Command).

5. Database#

rsg_cooking_stations: id, citizenid, world, stype, x, y, z, heading, recipe, hopper, output, fuel, batch_left, last_tick. Created automatically on start; installation/rsg-cooking.sql is optional.

6. Security#

The server validates distance, ownership, pantry contents, fuel and level for every action. Cooking runs on server ticks. Clients can't set output or XP.

7. How-tos#

  • Add a recipe: add it to Config.Recipes (or call AddCustomRecipe), and make sure all items exist in items.lua.
  • Items: wood and coal are resource_wood and resource_coal.
  • Language: setr rsg:locale "de" in server.cfg.

8. Troubleshooting#

ProblemFix
No stove optionCheck WorldStations.enabled and that rsg-target runs
Batch won't startPantry needs a full batch and the fire needs fuel
Can't change recipeEmpty the pantry, batch and tray first
Campfire won't placeMinSpacing, MaxPerPlayer, or the item is missing

rsg-skills integration#

Config.Skills = { Enabled, Skill, XPScale }. When food is collected (rsg-cooking collect callback) the server calls AddXP(src, 'cooking', xp * XPScale, 'cooking') next to the existing AddRep. GivePlayerCookingXP mirrors its XP the same way. Recipe level gates still use the rep value (Config.XpName). Skipped when rsg-skills is not started.

Support the Project : https://rexshack.tebex.store/

<!-- BEGIN AUTO-REFERENCE (generated from the code; re-run the generator instead of editing by hand) -->

Technical reference#

Generated from the source of rsg-cooking 3.3.0. Names, arguments and defaults below are read straight from the code.

Dependencies#

rsg-core, rsg-inventory, rsg-target, oxmysql

Database#

Tables: rsg_cooking_stations.

Tables are created automatically on start while Config.AutoDatabase = true (default). Nothing is ever dropped or overwritten. For a manual install set Config.AutoDatabase = false and import installation/rsg-cooking.sql once.

-- shared/config.lua
Config.AutoDatabase = true -- false = import the SQL file yourself

Configuration#

OptionDefaultNotes
Config.AutoDatabasetruebuild the database tables automatically on start (set false and import the SQL file for a manual install)
Config.InteractDist3.0server side max distance for actions
Config.SpawnDist120.0placed campfires only spawn as props within this distance
Config.MaxBatches10the pantry holds this many batches worth of each ingredient
Config.OutputCap100max items the serving tray can hold before cooking stops
Config.TickInterval15seconds between server cooking ticks
Config.ImagePath'nui://rsg-inventory/html/images/'
Config.StationTypestable
Config.WorldStationstableprivate = false -> one shared pot per stove, like rsg-moonshine world stills
Config.Campfiretable
Config.Command'setupcampfire'
Config.Item'campfire'
Config.ReturnItemtrue
Config.Modelp_campfirecombined01x
Config.PlaceDistance5.0
Config.MinSpacing3.0
Config.MaxPerPlayer1
Config.SetupTime5000
Config.OwnerOnlyfalse
Config.Fuelstable
Config.MaxFuel3600max seconds of fuel the firebox can hold
Config.CookFxtableoptional particle effects on a station while it is cooking (offsets relative to the prop)
Config.XpName'cooking'
Config.XpPerItem1xp for each item collected (recipes can override with xp)
Config.Levels{ 0, 10, 50, 150, 400, 1000 }total xp needed to reach each level (index = level)
Config.Recipestable
Config.SkillstableThe cooking XP above keeps working; this also awards XP to the shared rsg-skills skill.
Config.Enabledtrue
Config.Skill'cooking'
Config.XPScale1

Exports#

Server

ExportArgumentsFile
GetPlayerCookingXPsrcserver/server.lua
GetPlayerCookingLevelsrcserver/server.lua
GivePlayerCookingXPsrc, amountserver/server.lua
GetCookingRecipes``server/server.lua
CanCookItemitemNameserver/server.lua
AddCustomReciperecipeserver/server.lua

Client

ExportArgumentsFile
GetCookingRecipescategoryclient/client.lua
GetRecipesByCookingTypestypeclient/client.lua
-- example
local result = exports['rsg-cooking']:GetPlayerCookingXP(src)

Callbacks#

CallbackSideArgumentsFile
rsg-cooking:server:getStationsserver_, cbserver/server.lua
rsg-cooking:server:getStateserversrc, cb, idserver/server.lua
rsg-cooking:server:actionserversrc, cb, id, action, dataserver/server.lua
rsg-cooking:server:getWorldStationserversrc, cb, coords, stypeserver/server.lua
-- client side
RSGCore.Functions.TriggerCallback('rsg-cooking:server:getStations', function(result)
    -- use result
end)

Events#

Server events can be fired by any client, so every handler re-validates the player, the arguments and any permission, distance or cooldown on the server. Never add a reward to a handler without those checks.

EventSideArgumentsFile
RSGCore:Client:OnPlayerLoadedclient``client/client.lua
RSGCore:Client:OnPlayerUnloadclient``client/client.lua
rsg-cooking:client:syncStationclientsclient/client.lua
rsg-cooking:client:removeStationclientidclient/client.lua
rsg-cooking:client:placeCampfireclient``client/client.lua
rsg-cooking:server:requestCampfireserver``server/server.lua
rsg-cooking:server:placeCampfireservercoords, headingserver/server.lua
-- from a client script
TriggerServerEvent('rsg-cooking:server:requestCampfire')
-- from a server script
TriggerClientEvent('RSGCore:Client:OnPlayerLoaded', source)

Commands#

CommandNotesFile
/cooking_unfocusclient/client.lua

Locales#

Language files in locales/: de, el, en, es, fr, ja, nl, pl, pt-br, ro, ru. Set the language with setr rsg:locale "en".

<!-- END AUTO-REFERENCE -->