All resources

rsg-moonshine — Developer Docs#

Version 3.0.2 · RSG Framework (rsg-core) · no ox_lib dependency

Dependencies#

  • rsg-core (locales, notify, callbacks, progress bar, text UI)
  • rsg-inventory
  • rsg-target (targeting; replaces ox_target)
  • oxmysql

Framework functions used#

PurposeCall
Locales@rsg-core/shared/locale.lua in shared_scripts, locale('key'); language via setr rsg:locale "en"
Client notifyRSGCore.Functions.Notify({ title, description, type })
Server notifyTriggerClientEvent('RSGCore:Client:Notify', src, data)
Callbacksserver RSGCore.Functions.CreateCallback(name, function(src, cb, ...) cb(x) end) · client RSGCore.Functions.AwaitCallback(name, nil, ...)
Progress barRSGCore.Functions.ProgressBar({ duration, label, canCancel, disable = { move, combat, mount }, anim })
Text UIexports['rsg-core']:DrawText(text) / exports['rsg-core']:HideText()
Targetingexports['rsg-target']:addLocalEntity / removeLocalEntity / addModel / removeModel

Server callbacks#

NameArgsReturns
rsg-moonshine:server:getStills—list of public still data
rsg-moonshine:server:getStateidUI state, or nil if too far / throttled
rsg-moonshine:server:actionid, action, dataupdated UI state, or nil (closed / rejected)
rsg-moonshine:server:getWorldStillcoords (vector3)public data for a static map still (created on first use)

All callbacks validate the player, distance (Config.InteractDist) and are rate-limited server side.

Events#

Server (net): rsg-moonshine:server:placeStill (coords, heading), rsg-moonshine:server:destroy (id) — law-only destroy. Client: rsg-moonshine:client:placeStill, rsg-moonshine:client:syncStill (still), rsg-moonshine:client:removeStill (id).

Usable item#

Config.StillItem (moonshine_still) starts placement.

Database#

Table rsg_moonshine_stills is created automatically on start; installation/rsg-moonshine.sql remains for manual install.

Changelog#

  • 3.0.2 — Removed ox_lib: locales, notify, callbacks, progress bar and text UI moved to rsg-core; ox_target replaced with rsg-target; cache.ped replaced with PlayerPedId(). Language convar is now rsg:locale (falls back to ox:locale).
<!-- BEGIN AUTO-REFERENCE (generated from the code; re-run the generator instead of editing by hand) -->

Technical reference#

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

Dependencies#

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

Database#

Tables: rsg_moonshine_stills.

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-moonshine.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.StillItem'moonshine_still'usable item that places a still
Config.StillPropmp001_p_mp_still02xstill prop model
Config.MaxStills2max stills per character
Config.MinStillDist10.0min distance between any two stills
Config.InteractDist3.0server side max distance for actions
Config.PlaceDist5.0server side max distance between player and placed still
Config.SpawnDist120.0stills only spawn as props within this distance of the player
Config.OwnerOnlyfalsetrue = only owner can brew/collect
Config.MaxBatches10hopper holds this many batches worth of each ingredient
Config.EmptyJug'moonshine_jug_empty'one empty jug is needed per bottle collected
Config.OutputCap50max bottles the still can hold before it stops brewing
Config.TickInterval15seconds between server brewing ticks
Config.ImagePath'nui://rsg-inventory/html/images/'
Config.WorldStillstableeach one gets its own saved state the first time it is used (shared by everyone, can't be picked up)
Config.Fuelstablefuel only burns while a batch is cooking; when it runs out the batch pauses
Config.MaxFuel7200max seconds of fuel the firebox can hold
Config.BrewFxtableparticle effects shown on the still while a batch is brewing (offsets are relative to the prop)
Config.BlockedZonestableno stills inside these zones (towns etc.)
Config.XpName'moonshiner'
Config.XpPerBottle2xp earned for each bottle collected (recipes can override with xpPerBottle)
Config.Levels{ 0, 100, 250, 500, 1000, 2000 }total xp needed to reach each level (index = level)
Config.Recipestable
Config.LawJobs{ 'vallaw', 'rholaw', 'blklaw', 'strlaw', 'stdenlaw' }
Config.LawRequireDutytrue
Config.DestroyTime10000ms
Config.DestroyReward15cash paid to lawman per still destroyed
Config.Speakeasytable

Callbacks#

CallbackSideArgumentsFile
rsg-moonshine:server:getStillsserversource, cbserver/server.lua
rsg-moonshine:server:getStateserversrc, cb, idserver/server.lua
rsg-moonshine:server:actionserversrc, cb, id, action, dataserver/server.lua
rsg-moonshine:server:getWorldStillserversrc, cb, coordsserver/server.lua
-- client side
RSGCore.Functions.TriggerCallback('rsg-moonshine:server:getStills', 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-moonshine:client:syncStillclientsclient/client.lua
rsg-moonshine:client:removeStillclientidclient/client.lua
rsg-moonshine:client:placeStillclient``client/client.lua
rsg-moonshine:server:placeStillservercoords, headingserver/server.lua
rsg-moonshine:server:destroyserveridserver/server.lua
-- from a client script
TriggerServerEvent('rsg-moonshine:server:placeStill', coords, heading)
-- from a server script
TriggerClientEvent('RSGCore:Client:OnPlayerLoaded', source)

Commands#

CommandNotesFile
/moonshine_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 -->