Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ You can refer to the type annotations, but here is an example:
```lua
sirens = {
-- make sure to keep the base sirens ABOVE the addon sirens
base = { ... },
--base
{ ... },

addonSirenGroup1 = {
--Addon Group 1 (just a name for your reference)
{
sirenModes = {
--[[
This table has to be in the correct order, only 3 sirenModes (or steps (when pressing R) if you prefer) are supported
Expand Down
13 changes: 8 additions & 5 deletions client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,12 @@ stateBagWrapper('horn', function(veh, value)
local audioName = 'SIRENS_AIRHORN' -- Default sound
local audioRef

for _, sirenConfig in pairs(config.sirens) do
if (not sirenConfig.models or sirenConfig.models[vehModel]) and sirenConfig.sirenModes.horn then
audioName = sirenConfig.sirenModes.horn?.audioName or audioName
audioRef = sirenConfig.sirenModes.horn?.audioRef or audioRef
for i = 1, #config.sirens do
local sirenConfig = config.sirens[i]

if (not sirenConfig.models or sirenConfig.models[vehModel]) and sirenConfig.horn then
audioName = sirenConfig.horn?.audioName or audioName
audioRef = sirenConfig.horn?.audioRef or audioRef
-- no break here, allows it to take the base config and if there's another valid config after, replace it.
end
end
Expand Down Expand Up @@ -249,7 +251,8 @@ stateBagWrapper('sirenMode', function(veh, soundMode)
audioName = 'PLAYER_FUCKED_SIREN'
else
local vehModel = GetEntityModel(veh)
for _, sirenConfig in pairs(config.sirens) do
for i = 1, #config.sirens do
local sirenConfig = config.sirens[i]
if (not sirenConfig.models or sirenConfig.models[vehModel]) and sirenConfig.sirenModes[soundMode] then
audioName = sirenConfig.sirenModes[soundMode]?.audioName or audioName
audioRef = sirenConfig.sirenModes[soundMode]?.audioRef or audioRef
Expand Down
14 changes: 9 additions & 5 deletions config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ return {
useEngineHealth = false, -- Determine wether to use engine health over body health for siren damage
damageThreshold = 300, -- If the vehicle's health is below this value, the siren will be considered damaged

---@type table<string, SirenConfigTable>
---@type table<number, SirenConfigTable>
--- Configure what siren sounds to use for a specific model and siren mode
sirens = {
base = {
--base
{
sirenModes = {
{ audioName = 'VEHICLES_HORNS_SIREN_1' },
{ audioName = 'VEHICLES_HORNS_SIREN_2' },
Expand All @@ -36,7 +37,8 @@ return {
}
},

fire = {
--fire
{
sirenModes = {
{ audioName = 'RESIDENT_VEHICLES_SIREN_FIRETRUCK_QUICK_01' },
{ audioName = 'RESIDENT_VEHICLES_SIREN_FIRETRUCK_WAIL_01' },
Expand All @@ -53,7 +55,8 @@ return {
}
},

unmarked = {
--unmarked
{
sirenModes = {
{ audioName = 'RESIDENT_VEHICLES_SIREN_WAIL_02' },
{ audioName = 'RESIDENT_VEHICLES_SIREN_QUICK_02' }
Expand All @@ -66,7 +69,8 @@ return {
}
},

bikes = {
--bikes
{
sirenModes = {
{ audioName = 'RESIDENT_VEHICLES_SIREN_WAIL_03' },
{ audioName = 'RESIDENT_VEHICLES_SIREN_QUICK_03' }
Expand Down