Events, commands & keys ​
Server events ​
server
Server-local (AddEventHandler), never sent over the network. machine is the public machine.
| Event | Payload |
|---|---|
np_vending:server:ready |
none |
np_vending:server:machineCreated |
{ machine, by } (by: an identifier, 'world', 'admin' or a resource name) |
np_vending:server:machineRemoved |
{ machine, by } |
np_vending:server:ownerChanged |
{ machine, from, to, reason = 'buy' | 'market' | 'auction' | 'deed' | 'rent' | 'admin' } (operator keys) |
np_vending:server:sale |
{ source, machine, slot, item, qty, total, pay, operator } |
np_vending:server:restocked |
{ source, machine, slot, item, amount } |
np_vending:server:cashCollected |
{ source, machine, amount } |
np_vending:server:breakIn |
{ source, machine, kind = 'breakin' | 'vandalism', loot } |
np_vending:server:alarm |
{ machine, kind, coords } (also passed to Config.Crime.dispatch(src, data)) |
np_vending:server:rentDue |
{ machine, amount, status = 'soon' | 'unpaid' } |
np_vending:server:listingSold |
{ machine, seller, buyer, price, kind = 'sale' | 'auction' } |
np_vending:server:rulesChanged |
{ rules, by } (staff changed the spacing rules in /vendingadmin) |
lua
AddEventHandler('np_vending:server:ownerChanged', function(e)
print(('%s: %s -> %s (%s)'):format(e.machine.code, e.from, e.to, e.reason))
end)
np_vending:server:status (src, { thirst?, hunger?, stress? }) is fired for Drink now on servers without a
framework (standalone), so a status script can apply it.
Commands ​
| Command | Who | What |
|---|---|---|
/vending |
Everyone | Operator dashboard (also the vending_tablet item, the phone app, OpenDashboard()) |
/vending place [model] |
Everyone | Placement mode (also a vending_crate item, the dashboard's Place new machine) |
/vendingadmin |
Staff | The staff screen: spacing rules, zones, all machines, export |
The command names are in Config.Ui.commands. Both have key mappings (RegisterKeyMapping), unbound by default
(Config.Ui.keyMapping): players bind them in the game settings.
Keys ​
| Key | Where | Action |
|---|---|---|
E |
At a machine | Use it · hold with a crowbar in hand: pry the cash box |
G |
At a machine | Same again (last purchase) · hold with a crowbar: smash it · on a listing: inspect |
H |
At a machine | Service door (owner, key holder, restock job) · buy a city machine (press again to confirm) |
F |
Machine screen | Take the items from the tray |
Enter |
Machine screen | Buy the selected slot |
Esc |
Any screen | Close |
Mouse wheel (Shift fine) |
Placement | Rotate |
G / R / E / Backspace |
Placement | Snap to wall / rings / place / cancel |
hold E / G |
Jammed machine | Shake / refund |
The world keys are in Config.Ui.keys (use 38, again 47, service 74). With np_menu (or
ox_target / qb-target) the props also get context options: use, service, buy, pry, smash.