mirror of
https://github.com/Michatec/wk_wars2x.git
synced 2026-04-01 08:26:27 +02:00
Operator menu defaults can now be set in the config
This commit is contained in:
57
cl_radar.lua
57
cl_radar.lua
@@ -106,23 +106,23 @@ RADAR.vars =
|
|||||||
-- These are the settings that are used in the operator menu
|
-- These are the settings that are used in the operator menu
|
||||||
settings = {
|
settings = {
|
||||||
-- Should the system calculate and display faster targets
|
-- Should the system calculate and display faster targets
|
||||||
["fastDisplay"] = true,
|
["fastDisplay"] = CONFIG.menuDefaults["fastDisplay"],
|
||||||
|
|
||||||
-- Sensitivty for each radar mode, this changes how far the antennas will detect vehicles
|
-- Sensitivity for each radar mode, this changes how far the antennas will detect vehicles
|
||||||
["same"] = 3,
|
["same"] = CONFIG.menuDefaults["same"],
|
||||||
["opp"] = 3,
|
["opp"] = CONFIG.menuDefaults["opp"],
|
||||||
|
|
||||||
-- The volume of the audible beep
|
-- The volume of the audible beep
|
||||||
["beep"] = 0.6,
|
["beep"] = CONFIG.menuDefaults["beep"],
|
||||||
|
|
||||||
-- The volume of the verbal lock confirmation
|
-- The volume of the verbal lock confirmation
|
||||||
["voice"] = 0.6,
|
["voice"] = CONFIG.menuDefaults["voice"],
|
||||||
|
|
||||||
-- The volume of the plate reader audio
|
-- The volume of the plate reader audio
|
||||||
["plateAudio"] = 0.6,
|
["plateAudio"] = CONFIG.menuDefaults["plateAudio"],
|
||||||
|
|
||||||
-- The speed unit used in conversions
|
-- The speed unit used in conversions
|
||||||
["speedType"] = "mph"
|
["speedType"] = CONFIG.menuDefaults["speedType"]
|
||||||
},
|
},
|
||||||
|
|
||||||
-- These 3 variables are for the in-radar menu that can be accessed through the remote control, the menuOptions table
|
-- These 3 variables are for the in-radar menu that can be accessed through the remote control, the menuOptions table
|
||||||
@@ -130,13 +130,13 @@ RADAR.vars =
|
|||||||
menuActive = false,
|
menuActive = false,
|
||||||
currentOptionIndex = 1,
|
currentOptionIndex = 1,
|
||||||
menuOptions = {
|
menuOptions = {
|
||||||
{ displayText = { "¦¦¦", "FAS" }, optionsText = { "On¦", "Off" }, options = { true, false }, optionIndex = 1, settingText = "fastDisplay" },
|
{ displayText = { "¦¦¦", "FAS" }, optionsText = { "On¦", "Off" }, options = { true, false }, optionIndex = -1, settingText = "fastDisplay" },
|
||||||
{ displayText = { "¦SL", "SEn" }, optionsText = { "¦1¦", "¦2¦", "¦3¦", "¦4¦", "¦5¦" }, options = { 0.2, 0.4, 0.6, 0.8, 1.0 }, optionIndex = 3, settingText = "same" },
|
{ displayText = { "¦SL", "SEn" }, optionsText = { "¦1¦", "¦2¦", "¦3¦", "¦4¦", "¦5¦" }, options = { 0.2, 0.4, 0.6, 0.8, 1.0 }, optionIndex = -1, settingText = "same" },
|
||||||
{ displayText = { "¦OP", "SEn" }, optionsText = { "¦1¦", "¦2¦", "¦3¦", "¦4¦", "¦5¦" }, options = { 0.2, 0.4, 0.6, 0.8, 1.0 }, optionIndex = 3, settingText = "opp" },
|
{ displayText = { "¦OP", "SEn" }, optionsText = { "¦1¦", "¦2¦", "¦3¦", "¦4¦", "¦5¦" }, options = { 0.2, 0.4, 0.6, 0.8, 1.0 }, optionIndex = -1, settingText = "opp" },
|
||||||
{ displayText = { "bEE", "P¦¦" }, optionsText = { "Off", "¦1¦", "¦2¦", "¦3¦", "¦4¦", "¦5¦" }, options = { 0.0, 0.2, 0.4, 0.6, 0.8, 1.0 }, optionIndex = 4, settingText = "beep" },
|
{ displayText = { "bEE", "P¦¦" }, optionsText = { "Off", "¦1¦", "¦2¦", "¦3¦", "¦4¦", "¦5¦" }, options = { 0.0, 0.2, 0.4, 0.6, 0.8, 1.0 }, optionIndex = -1, settingText = "beep" },
|
||||||
{ displayText = { "VOI", "CE¦" }, optionsText = { "Off", "¦1¦", "¦2¦", "¦3¦", "¦4¦", "¦5¦" }, options = { 0.0, 0.2, 0.4, 0.6, 0.8, 1.0 }, optionIndex = 4, settingText = "voice" },
|
{ displayText = { "VOI", "CE¦" }, optionsText = { "Off", "¦1¦", "¦2¦", "¦3¦", "¦4¦", "¦5¦" }, options = { 0.0, 0.2, 0.4, 0.6, 0.8, 1.0 }, optionIndex = -1, settingText = "voice" },
|
||||||
{ displayText = { "PLt", "AUd" }, optionsText = { "Off", "¦1¦", "¦2¦", "¦3¦", "¦4¦", "¦5¦" }, options = { 0.0, 0.2, 0.4, 0.6, 0.8, 1.0 }, optionIndex = 4, settingText = "plateAudio" },
|
{ displayText = { "PLt", "AUd" }, optionsText = { "Off", "¦1¦", "¦2¦", "¦3¦", "¦4¦", "¦5¦" }, options = { 0.0, 0.2, 0.4, 0.6, 0.8, 1.0 }, optionIndex = -1, settingText = "plateAudio" },
|
||||||
{ displayText = { "Uni", "tS¦" }, optionsText = { "USA", "INT" }, options = { "mph", "kmh" }, optionIndex = 1, settingText = "speedType" }
|
{ displayText = { "Uni", "tS¦" }, optionsText = { "USA", "INT" }, options = { "mph", "kmh" }, optionIndex = -1, settingText = "speedType" }
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Player's vehicle speed, mainly used in the dynamic thread wait update
|
-- Player's vehicle speed, mainly used in the dynamic thread wait update
|
||||||
@@ -377,6 +377,28 @@ function RADAR:OpenRemote()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Updates the operator menu option indexes, as the default menu values can be changed in the config, we
|
||||||
|
-- need to update the indexes otherwise the menu will display the wrong values
|
||||||
|
function RADAR:UpdateOptionIndexes()
|
||||||
|
-- Iterate through each of the internal settings
|
||||||
|
for k, v in pairs( self.vars.settings ) do
|
||||||
|
-- Iterate through all of the menu options
|
||||||
|
for i, t in pairs( self.vars.menuOptions ) do
|
||||||
|
-- If the current menu option is the same as the current setting
|
||||||
|
if ( t.settingText == k ) then
|
||||||
|
-- Iterate through the option values of the current menu option
|
||||||
|
for oi, ov in pairs( t.options ) do
|
||||||
|
-- If the value of the current option set in the config matches the current value of
|
||||||
|
-- the option value, then we update the option index variable
|
||||||
|
if ( v == ov ) then
|
||||||
|
t.optionIndex = oi
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Returns if the fast limit option should be available for the radar
|
-- Returns if the fast limit option should be available for the radar
|
||||||
function RADAR:IsFastLimitAllowed()
|
function RADAR:IsFastLimitAllowed()
|
||||||
return CONFIG.allow_fast_limit
|
return CONFIG.allow_fast_limit
|
||||||
@@ -1574,7 +1596,10 @@ Citizen.CreateThread( function()
|
|||||||
RADAR:CacheNumRays()
|
RADAR:CacheNumRays()
|
||||||
|
|
||||||
-- Update the end coordinates for the ray traces based on the config, again, reduced hard coding
|
-- Update the end coordinates for the ray traces based on the config, again, reduced hard coding
|
||||||
RADAR:UpdateRayEndCoords()
|
RADAR:UpdateRayEndCoords()
|
||||||
|
|
||||||
|
-- Update the operator menu positions
|
||||||
|
RADAR:UpdateOptionIndexes()
|
||||||
|
|
||||||
-- If the fast limit feature is allowed, create the config in the radar variables
|
-- If the fast limit feature is allowed, create the config in the radar variables
|
||||||
if ( RADAR:IsFastLimitAllowed() ) then
|
if ( RADAR:IsFastLimitAllowed() ) then
|
||||||
|
|||||||
39
config.lua
39
config.lua
@@ -8,6 +8,12 @@
|
|||||||
-- Do not touch this
|
-- Do not touch this
|
||||||
CONFIG = {}
|
CONFIG = {}
|
||||||
|
|
||||||
|
-- Radar fast limit locking
|
||||||
|
-- When enabled, the player will be able to define a fast limit within the radar's menu, when a vehicle
|
||||||
|
-- exceeds the fast limit, it will be locked into the fast box. Default setting is disabled to maintain realism
|
||||||
|
CONFIG.allow_fast_limit = true
|
||||||
|
|
||||||
|
-- Sets all of the controls
|
||||||
CONFIG.keys =
|
CONFIG.keys =
|
||||||
{
|
{
|
||||||
-- Remote control key
|
-- Remote control key
|
||||||
@@ -61,7 +67,32 @@ CONFIG.keys =
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Radar fast limit locking
|
-- Here you can change the default values for the operator menu, do note, if any of these values are not
|
||||||
-- When enabled, the player will be able to define a fast limit within the radar's menu, when a vehicle
|
-- one of the options listed, the script will not work.
|
||||||
-- exceeds the fast limit, it will be locked into the fast box. Default setting is disabled to maintain realism
|
CONFIG.menuDefaults =
|
||||||
CONFIG.allow_fast_limit = true
|
{
|
||||||
|
-- Should the system calculate and display faster targets
|
||||||
|
-- Options: true or false
|
||||||
|
["fastDisplay"] = true,
|
||||||
|
|
||||||
|
-- Sensitivity for each radar mode, this changes how far the antennas will detect vehicles
|
||||||
|
-- Options: 0.2, 0.4, 0.6, 0.8, 1.0
|
||||||
|
["same"] = 0.6,
|
||||||
|
["opp"] = 0.6,
|
||||||
|
|
||||||
|
-- The volume of the audible beep
|
||||||
|
-- Options: 0.0, 0.2, 0.4, 0.6, 0.8, 1.0
|
||||||
|
["beep"] = 0.6,
|
||||||
|
|
||||||
|
-- The volume of the verbal lock confirmation
|
||||||
|
-- Options: 0.0, 0.2, 0.4, 0.6, 0.8, 1.0
|
||||||
|
["voice"] = 0.6,
|
||||||
|
|
||||||
|
-- The volume of the plate reader audio
|
||||||
|
-- Options: 0.0, 0.2, 0.4, 0.6, 0.8, 1.0
|
||||||
|
["plateAudio"] = 0.6,
|
||||||
|
|
||||||
|
-- The speed unit used in conversions
|
||||||
|
-- Options: mph or kmh
|
||||||
|
["speedType"] = "mph"
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user