Developer
Overview
Other scripts integrate through the editable handler files in open/ and through exports. An error in one of the hack hooks counts as a deny. Mutating server exports are allowlist-gated: ml_* resources are allowed automatically, anything else must be added to Config.AllowedExportResources in server/config_server.lua.
Server Exports
Broadcast
GetActiveBroadcast(frequency): Current broadcast data for a frequency, ornil.IsFrequencyBroadcasting(frequency):truewhile a station or autoplay is live on that frequency.CanTransmitOnFrequency(src, frequency): checks the station permission of that frequency. Returnstrueon any frequency without a station.BootstrapAutoplay(stationId): Starts a station's autoplay playlist. Allowlist-gated.PauseAutoplay(stationId)/ResumeAutoplay(stationId): Suspend and resume autoplay. Allowlist-gated.
Antennas
GetFixedAntennas(): Table of fixed towers with their live state. Allowlist-gated, returns{}otherwise.DamageFixedAntenna(id, amount): Applies damage to a fixed tower. Allowlist-gated.GetJammers(): Table of active jammers. Allowlist-gated, returns{}otherwise.
Client Exports
Interface
OpenRadioUI()/CloseRadioUI(): Open or close the handset interface.OpenStereoMenu(stereoId)/CloseStereoMenu(): Stereo control panel.OpenJammerMenu(jammerId)/CloseJammerMenu(): Jammer control panel for a placed jammer.GetActiveTheme(): Current interface theme name.
Signal
CalculateSignal(coords): signal value at those coordinates.GetSignalQuality(value): Quality tier for a signal value.IsSignalLost():truewhile the player has no usable reception.IsInsideJammer():trueinside an active jammer radius.
Broadcast Audio
IsBroadcastPlaying(): Whether station audio is playing locally.SetBroadcastVolume(volume): Local station audio volume, from 0 to 100.StopAllBroadcasts(): Stops all locally playing station audio.IsInSpeakerZone():trueinside a configured speaker zone.
Battery
RechargeBattery(): uses oneConfig.Items.batteryitem and addsConfig.Battery.chargeAmountto the held radio.
Server Handlers
Located in open/server.lua. The hack hooks run in a protected call, and an error there counts as a deny.
OnChannelJoin
1function OpenServer.OnChannelJoin(src, frequency)
2endRuns after a player joins a frequency. Its return value is ignored. To refuse a frequency, use ValidateFrequency.
OnChannelLeave
1function OpenServer.OnChannelLeave(src, frequency)
2endNotification only, fires after a player leaves a frequency.
CanHack
1function OpenServer.CanHack(src, antenna, isFixed)
2 return true
3endAuthorizes an antenna hack attempt, after the distance, lockout and requireSkill checks and before the item check. Return false plus a locale key to deny with a custom message.
OnHackStart
1function OpenServer.OnHackStart(src, antenna, isFixed, itemUsed)
2endFires when the server commits to the attempt, before the progress bar runs. Useful for attempt logs or stat counters.
OnHackSuccess
1function OpenServer.OnHackSuccess(src, antenna, isFixed, itemUsed)
2endFires after a successful hack: the item is consumed, the lockout and hack damage are applied, and clients are updated.
Client Handler
Located in open/client.lua.
1function OpenClient.BeforeOpenUI(data)
2 return true
3endRuns before the handset opens. data.isPoweredOn tells whether the radio is on. Return false to keep it closed.
Shared Handler
Located in open/shared.lua and called on the server.
1function OpenHandlers.ValidateFrequency(frequency)
2 return true
3endRuns when a player tunes the main or secondary channel. Return false to refuse that frequency.
Examples
1function OpenServer.OnHackStart(src, antenna, isFixed, itemUsed)
2 exports.ml_skills:AddXp('hacking', 5, src)
3end
4
5function OpenServer.OnHackSuccess(src, antenna, isFixed, itemUsed)
6 exports.ml_skills:AddXp('hacking', 50, src)
7end1function OpenServer.CanHack(src, antenna, isFixed)
2 if not exports.ml_skills:HasUnlockedSkill(nil, 'signals_mastery_3', src) then
3 return false, 'hack_skill_missing'
4 end
5 return true
6endThe calling resource must be an ml_* resource or listed in Config.AllowedExportResources.
1exports.ml_radio:BootstrapAutoplay('radio_station')