RedM documentation
Murphy's Doctor
Developers
NUI (user interface)
The interface is a React application. Its built version lives in ui/build/ (the manifest's ui_page is
ui/build/index.html); its source lives in ui_src/.
The React source (
ui_src/) ships with the open source package of the resource. With the standard package you only haveui/build/: you can still change the languages,config.jsand the images, but not the screens themselves.
How Lua talks to the UI
Lua to UI: SendNUIMessage({ type = "...", ...payload }). client/NUI.lua wraps it in SendToNUI(type, payload)
and in the Show* / Hide* / Update* exports (see Client exports).
The UI is tolerant about the message format:
- the message name can be in
typeor inaction(case-insensitive); - the payload can be flat, or nested under
payload(it is merged into the message); - any message that carries
localeswitches the UI language, and any message that carriestranslationsmerges custom translations for that language.
UI to Lua: the UI posts to https://murphy_doctor/<callback> and Lua answers through RegisterNUICallback.
Focus: the screens that need the mouse call SetNuiFocus(true, true) when they open and release it when they close.
The HUD and the notifications never take the focus. If a screen ever gets stuck, the player can type /doc:close
(always registered): it ends any examination, closes every screen and gives the mouse back. ui/build/failsafe.js
also lets Escape release the focus when the React app failed to load.
Opening a screen from another resource goes through the exports, never through SendNUIMessage (an NUI message only
reaches the UI page of the resource that sends it).
Messages (Lua to UI)
Canonical names. Payload fields are the keys of the message table.
Doctor and patient screens
| Message | Payload | Sent by | Focus |
|---|---|---|---|
SHOW_AUSCULTATION |
bodyState = { heartRate, parts = { [bodyPart] = { severity, label, icon } } } |
ShowAuscultation |
yes |
SET_BODY_STATE |
bodyState |
UpdateBodyState (examination refresh) |
- |
HIDE_AUSCULTATION |
none | HideAuscultation |
released |
SHOW_HEALTH |
bodyStatus = { { label, value, color } }, parts, symptoms = { { bodyPart, condition, severity } }, sex ("m" or "f", picks the anatomy plate) |
ShowHealth |
yes |
UPDATE_HEALTH_DATA |
same fields as SHOW_HEALTH |
UpdateHealthData |
- |
HIDE_HEALTH |
none | HideHealth |
released |
SHOW_COMA |
cooldownDuration (s), helpCallCooldown (s) |
ShowComa |
yes |
REDUCE_HELP_COOLDOWN |
none | ReduceHelpCooldown |
- |
HIDE_COMA |
none | HideComa |
released |
SHOW_POISON |
items = { { id, name, image } } |
ShowPoison |
yes |
HIDE_POISON |
none | HidePoison |
released |
SHOW_DISPENSARY |
title, members = { { id, name, rank, status, isChief } }, notes, playerIsMember, playerIsChief, treasury |
ShowDispensary |
yes |
UPDATE_DISPENSARY_DATA |
dispensaryData = { ... }, or any of title, members, notes |
UpdateDispensaryData |
- |
SET_DISPENSARY_NOTES |
notes |
SetDispensaryNotes |
- |
HIDE_DISPENSARY |
none | HideDispensary |
released |
SHOW_TREATMENT |
treatmentData = { doctor, patientName, patientSurname, patientSex, notes, constants, causeOfComa, symptoms, prescriptions, availableMedications, signature, signed, reportId, ... } |
ShowTreatment |
yes |
UPDATE_TREATMENT_DATA |
any subset of treatmentData |
UpdateTreatmentData |
- |
CLEAR_TREATMENT_DATA |
none | ClearTreatmentData |
- |
HIDE_TREATMENT |
none | HideTreatment |
released |
SHOW_ARCHIVES |
patients = { { id, name, surname, doctor, date } }, logo, meta = { total, page, pageSize, hasMore, search, adminMode } |
ShowArchives |
yes |
SET_ARCHIVE_TREATMENT |
patientId, treatmentData |
SetArchiveTreatment |
- |
SET_MEDICAL_FILE |
file (see GetMedicalFile in Server exports) |
client/archives.lua |
- |
HIDE_ARCHIVES |
none | HideArchives |
released |
SHOW_GRIMOIRE |
diseases = { { id, name, description, symptoms, treatment, image, ... } } |
ShowGrimoire |
yes |
HIDE_GRIMOIRE |
none | HideGrimoire |
released |
SHOW_INVOICES |
invoices = { { id, amount, reason, doctor, dispensary, at } }, highlightId, payBeforeCare |
invoice window (OpenMyInvoices, a new invoice) |
yes |
SET_INVOICES |
invoices |
after a payment | - |
HIDE_INVOICES |
none | invoice window | released |
SHOW_SURGERY |
injuries, anesthesia |
StartSurgery |
yes |
SURGERY_STARTED |
token, procedure, asleep, minigame, bullet, injury |
surgery flow | - |
SURGERY_ANCHOR |
x, y (screen position of the wound) |
client/surgery.lua |
- |
SURGERY_RESULT |
success, hits, rounds, slips, infected, procedure |
surgery flow | - |
HIDE_SURGERY |
none | surgery flow | released |
OPEN_CERTIFICATE |
findings (autopsy findings with their token) |
client/autopsy.lua |
yes |
CLOSE_CERTIFICATE |
none | client/autopsy.lua |
released |
CALLS_SHOW, CALLS_UPDATE |
calls, title, labels |
client/callboard.lua |
yes (show) |
CALLS_HIDE |
none | client/callboard.lua |
released |
CRAFT_SHOW |
title, recipes, labels |
client/craft.lua |
yes |
CRAFT_HIDE |
none | client/craft.lua |
released |
HUD, notifications and minigames
| Message | Payload | Sent by |
|---|---|---|
SHOW_METABOLISM |
indicators = { { id, icon, type = "percentage" or "state", percentage, visible } }, positions = { [id] = { x, y } } |
ShowMetabolism |
SET_METABOLISM_DATA |
indicators |
UpdateMetabolismData |
UPDATE_METABOLISM_INDICATOR |
id, and any of percentage, visible, icon, color |
UpdateMetabolismIndicator |
SET_METABOLISM_POSITIONS |
positions |
SetMetabolismPositions |
EDIT_METABOLISM |
none (takes the focus) | EnableMetabolismEdit |
HIDE_METABOLISM_EDIT |
none | DisableMetabolismEdit |
HIDE_METABOLISM |
none | HideMetabolism |
DOC_NOTIFY |
title, text, kind, duration, icon, zone, position, max |
Notify when the style is murphy and murphy_notify 2.x is not running |
MG3D_SHOW, MG3D_HIDE, MG3D_HUD, MG3D_GUIDE, MG3D_MARKS, MG3D_SFX, MG3D_ACTION |
minigame overlay data | client/minigame3d.lua (internal) |
Language and global
| Message | Payload | Effect |
|---|---|---|
SET_LOCALE |
locale, translations (optional) |
Switches the UI language (SetLocale export) |
SET_TRANSLATIONS |
locale, translations |
Merges custom translations for a language |
nui:locale:set |
payload = { locale, source } |
Sent by client/platform_locale.lua with Config.Locale, or the murphy_platform language |
HIDE_ALL |
none | Closes every screen (HideAllMenus) |
Aliases
For compatibility the UI also accepts OPEN_* for SHOW_* and CLOSE_* for HIDE_* (for example OPEN_HEALTH,
CLOSE_TREATMENT, CLOSE_ALL), UPDATE_BODY_STATE for SET_BODY_STATE, SET_HEALTH_DATA, SET_DISPENSARY_DATA,
SET_TREATMENT_DATA, UPDATE_METABOLISM_DATA, SET_METABOLISM_INDICATOR, SET_NOTES, ENABLE_METABOLISM_EDIT,
CLOSE_METABOLISM_EDIT, SET_ARCHIVE_DATA, and the bare SHOW / HIDE for the examination screen. Use the canonical
names in new code.
Callbacks (UI to Lua)
All registered in the client files, which you can read. Each answers "ok" or {} unless noted.
| Callback | Payload | Lua side |
|---|---|---|
nuiReady |
none | Answers { locale }: the murphy_platform language, else Config.Locale, else en |
closeMenuAuscultation |
none | StopAuscultation() |
closeMenuHealth |
none | HideHealth() |
closeMenuDispensary |
none | HideDispensary() |
closeMenuTreatment |
{ treatmentData } |
Stores the draft for the current patient, then closes |
closeMenuArchives |
none | HideArchives() |
closeMenuPoison |
none | Closes the poison picker (client/poison.lua) |
closeMenuGrimoire |
none | HideGrimoire() |
closeMenuMetabolismEdit |
none | Leaves the layout editor and refreshes the HUD |
saveMetabolismLayout |
{ positions } |
Saves the HUD layout on the server, leaves the editor |
cryForHelp |
{ reason } |
Help call from the coma screen |
getUp |
none | "Get up" button of the coma screen (refused until the timer is over) |
addDoctor |
none | Adds the closest player to the open dispensary board |
editDoctor |
{ id, ... } |
Edits a member |
deleteDoctor |
{ id } |
Removes a member |
updateNotes |
{ notes } |
Saves the board notes |
signTreatment |
treatment data (prescriptions, signature, invoiceAmount, invoiceReason...) |
Optional invoice, optional injection game, then the server signature |
addPrescription, updatePrescription, removePrescription |
prescription data / { id } |
Forwarded to the server |
deleteTreatmentReport |
none | Deletes the report and its draft |
resetTreatment |
none | Drops the draft and reloads the patient from the server |
selectArchivePatient |
{ id } |
Loads one report |
archivesQuery |
{ search } |
New archive search (page 1) |
archivesLoadMore |
none | Next archive page |
medicalFileGet |
{ patientId } |
Loads the medical file (answers through SET_MEDICAL_FILE) |
medicalFileSave |
{ patientId, bloodType, allergies, conditions, notes } |
Saves the doctors' notes |
poisonItem |
{ id } |
Closes the poison picker, then poisons the chosen item (one item per vial, client/poison.lua) |
issueInvoice |
{ amount, reason } |
Bills the patient of the open treatment screen |
payInvoice |
{ id } |
Pays one invoice |
closeInvoices |
none | Closes the invoice window |
treasuryWithdraw |
{ amount } |
Chief withdrawal at the board |
surgeryStart |
{ bodyPart, anesthesia } |
Starts an operation |
surgerySlip |
none | Bullet extraction: the forceps touched the wound |
surgerySound |
{ kind } |
Plays a Config.Surgery.Sounds cue |
surgeryFinish |
{ token, hits, slips, extracted, aborted } |
Sends the result to the server |
closeSurgery |
none | Closes the surgery window |
certificateSign |
{ token, name, notes, signature } |
Signs the death certificate |
certificateClose |
none | Closes the certificate |
callsClose |
none | Closes the call board |
callsAction |
{ id, action } |
route, take, release or done on a help call |
craftClose |
none | Closes the bench |
craftChoose |
{ id } |
Starts a preparation |
mg3dPointer, mg3dQuit, mg3dAction |
pointer data | 3D minigame input (internal) |
The server validates every action behind these callbacks.
Languages of the UI
| File | Role |
|---|---|
ui/build/locales/<code>.js |
One file per language, sets window.__DOCTOR_LOCALE__ = { ... } |
ui/build/config.js |
Static default (window.__DOCTOR_CONFIG__ = { locale: "en" }), used before Lua pushes the language |
ui_src/public/locales/, ui_src/public/config.js |
Source copies, copied into ui/build/ by every build |
At start the UI loads en.js as the fallback, then the configured language, and merges them: a key missing in your
language shows the English text. Lua pushes Config.Locale a couple of seconds after start, and the UI asks again
through nuiReady once it has loaded. When murphy_platform runs, its server-wide language wins.
Shipped UI languages: ar, cs, de, en, es, fr, hu, it, ja, ko, nl, pl, pt, pt-BR, ro,
ru, sv, tr, uk, zh, zh-CN, zh-TW.
To add one: copy ui/build/locales/en.js to ui/build/locales/<code>.js, translate the values (never the keys), set
Config.Locale = "<code>", restart the resource. No rebuild is needed. Lua strings live in shared/locales/; see
Localization.
Building the UI from source
Requires Node.js (a current LTS release) and the open source package.
ui_src/.env sends the build straight into ../ui/build (BUILD_PATH=../ui/build) without source maps
(GENERATE_SOURCEMAP=false). Restart the resource afterwards (ensure murphy_doctor), and clear the RedM cache if the
old interface still shows.
Things to know:
- The build replaces the whole
ui/build/folder. Anything you edited directly there (locales,config.js, images) is lost unless you made the same change inui_src/public/. When you work from source, editui_src/public/only. npm startopens the UI in a browser for layout work. Without the game, a development panel (Alt+M) lets you open each screen with sample data.- Do not ship
node_modules/with your server files.
Restyling
| What | Where |
|---|---|
| One screen | ui_src/src/components/templates/<Screen>/<Screen>.jsx and its <Screen>.module.css (ComaScreen, HealthScreen, AuscultationScreen, MedicalTreatmentScreen, MedicalArchivesScreen, DispensaryScreen, GrimoireScreen, PoisonScreen, InvoiceScreen, SurgeryScreen, DeathCertificateScreen), plus CallBoard.jsx, NotificationStack.jsx, Minigame3DOverlay.jsx |
| Shared pieces | ui_src/src/components/atoms, molecules, organisms (the HUD is organisms/MetabolismHUD) |
| Global styles and fonts | ui_src/src/styles/ (fonts.css declares the fonts stored in ui_src/src/assets/fonts/) |
| Images (paper, icons, injuries, items, grimoire illustrations) | ui_src/public/assets/images/, copied to ui/build/assets/images/ |
Images can be replaced directly in ui/build/assets/images/ without a rebuild, as long as the file name and format stay
the same. A grimoire illustration is found by the image field of its grimoire entry: image = "typhoid" loads
assets/images/grimoire/typhoid.png.
Keep the message and callback names of this page when you change a screen: the Lua side relies on them.
Last updated: November 20, 2026