Code and documentation fixes (#1659)

* Update .lua-format

Adjust for observed coding standards.

* Update ATIS.lua

Correct measurement units and spelling (also changed in Utils.lua).

* Update Utils.lua

Format the file, fix typos, adjust minor text. Rename "celcius" to "celsius". Rename "farenheit" to "fahrenheit".

* Update Warehouse.lua

Adjust measurement unit text.

* Update STTS.lua

Adjust formatting, minor typos, and fix error in documentation (missing blank rows) introduced in previous update.

* Update Range.lua

Adjust minor typos and code formatting. Adjust for celsius/fahrenheit typo correction.

* Update PseudoATC.lua

Adjust for celsius/fahrenheit typo correction in utils.lua.

* Update Point.lua

Code formatting, fix minor typos, adjust for celsius/fahrenheit corrrection in utils.lua.

* Update Range.lua

Minor documentation fix.
This commit is contained in:
TommyC81 2021-12-08 22:52:29 +04:00 committed by GitHub
parent a57b9a9081
commit a4ca4bdc99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 1924 additions and 1955 deletions

View File

@ -21,9 +21,9 @@ chop_down_table: true
chop_down_kv_table: true chop_down_kv_table: true
column_table_limit: 500 column_table_limit: 500
table_sep: ',' table_sep: ','
extra_sep_at_table_end: false extra_sep_at_table_end: true
break_after_operator: true break_after_operator: true
single_quote_to_double_quote: true single_quote_to_double_quote: false
double_quote_to_single_quote: false double_quote_to_single_quote: false
spaces_before_call: 1 spaces_before_call: 1
spaces_inside_functiondef_parens: true spaces_inside_functiondef_parens: true

File diff suppressed because it is too large Load Diff

View File

@ -742,7 +742,7 @@ function PSEUDOATC:ReportWeather(GID, UID, position, location)
local T=position:GetTemperature() local T=position:GetTemperature()
-- Correct unit system. -- Correct unit system.
local _T=string.format('%d°F', UTILS.CelciusToFarenheit(T)) local _T=string.format('%d°F', UTILS.CelsiusToFahrenheit(T))
if settings:IsMetric() then if settings:IsMetric() then
_T=string.format('%d°C', T) _T=string.format('%d°C', T)
end end

View File

@ -260,7 +260,7 @@
-- -- Add bombing targets. A good hit is if the bomb falls less then 50 m from the target. -- -- Add bombing targets. A good hit is if the bomb falls less then 50 m from the target.
-- GoldwaterRange:AddBombingTargets(bombtargets, 50) -- GoldwaterRange:AddBombingTargets(bombtargets, 50)
-- --
-- -- Start range. -- -- Start Range.
-- GoldwaterRange:Start() -- GoldwaterRange:Start()
-- --
-- The [476th - Air Weapons Range Objects mod](http://www.476vfightergroup.com/downloads.php?do=file&id=287) is (implicitly) used in this example. -- The [476th - Air Weapons Range Objects mod](http://www.476vfightergroup.com/downloads.php?do=file&id=287) is (implicitly) used in this example.
@ -329,7 +329,7 @@ RANGE = {
instructor = nil, instructor = nil,
rangecontrolfreq = nil, rangecontrolfreq = nil,
rangecontrol = nil, rangecontrol = nil,
soundpath = "Range Soundfiles/" soundpath = "Range Soundfiles/",
} }
--- Default range parameters. --- Default range parameters.
@ -345,7 +345,7 @@ RANGE.Defaults = {
boxlength = 3000, -- meters boxlength = 3000, -- meters
boxwidth = 300, -- meters boxwidth = 300, -- meters
goodpass = 20, -- targethits per pass goodpass = 20, -- targethits per pass
foulline = 610 -- meters foulline = 610, -- meters
} }
--- Target type, i.e. unit, static, or coordinate. --- Target type, i.e. unit, static, or coordinate.
@ -500,7 +500,7 @@ RANGE.Sound = {
IRDecimal = { filename = "IR-Decimal.ogg", duration = 0.54 }, IRDecimal = { filename = "IR-Decimal.ogg", duration = 0.54 },
IRMegaHertz = { filename = "IR-MegaHertz.ogg", duration = 0.87 }, IRMegaHertz = { filename = "IR-MegaHertz.ogg", duration = 0.87 },
IREnterRange = { filename = "IR-EnterRange.ogg", duration = 4.83 }, IREnterRange = { filename = "IR-EnterRange.ogg", duration = 4.83 },
IRExitRange = { filename = "IR-ExitRange.ogg", duration = 3.10 } IRExitRange = { filename = "IR-ExitRange.ogg", duration = 3.10 },
} }
--- Global list of all defined range names. --- Global list of all defined range names.
@ -1089,7 +1089,7 @@ end
--- Set sound files folder within miz file. --- Set sound files folder within miz file.
-- @param #RANGE self -- @param #RANGE self
-- @param #string path Path for sound files. Default "ATIS Soundfiles/". Mind the slash "/" at the end! -- @param #string path Path for sound files. Default "Range Soundfiles/". Mind the slash "/" at the end!
-- @return #RANGE self -- @return #RANGE self
function RANGE:SetSoundfilesPath( path ) function RANGE:SetSoundfilesPath( path )
self.soundpath = tostring( path or "Range Soundfiles/" ) self.soundpath = tostring( path or "Range Soundfiles/" )
@ -1384,12 +1384,14 @@ end
-- --
-- -- Setup a Range -- -- Setup a Range
-- RangeOne = RANGE:New( "Range One" ) -- RangeOne = RANGE:New( "Range One" )
-- -- Find the STATIC target object as setup in the ME -- -- Find the STATIC target object as setup in the ME.
-- RangeOneBombTarget = STATIC:FindByName( "RangeOneBombTarget" ): -- RangeOneBombTarget = STATIC:FindByName( "RangeOneBombTarget" )
-- -- Add the coordinate of the STATIC target object as a bomb target (thus keeping the bomb function active, even if the STATIC target is destroyed) -- -- Add the coordinate of the STATIC target object as a bomb target (thus keeping the bomb function active, even if the STATIC target is destroyed).
-- RangeOne:AddBombingTargetCoordinate( RangeOneBombTarget:GetCoordinate(), "RangeOneBombTarget", 50) -- RangeOne:AddBombingTargetCoordinate( RangeOneBombTarget:GetCoordinate(), "RangeOneBombTarget", 50)
-- -- Or, add the coordinate of the STATIC target object as a bomb target using default values (name will be "Bomb Target", goodhitrange will be 25 m) -- -- Or, add the coordinate of the STATIC target object as a bomb target using default values (name will be "Bomb Target", goodhitrange will be 25 m).
-- RangeOne:AddBombingTargetCoordinate( RangeOneBombTarget:GetCoordinate() ) -- RangeOne:AddBombingTargetCoordinate( RangeOneBombTarget:GetCoordinate() )
-- -- Start Range.
-- RangeOne:Start()
-- --
function RANGE:AddBombingTargetCoordinate( coord, name, goodhitrange ) function RANGE:AddBombingTargetCoordinate( coord, name, goodhitrange )
@ -1436,6 +1438,17 @@ end
-- @param #string namepit Name of the strafe pit target object. -- @param #string namepit Name of the strafe pit target object.
-- @param #string namefoulline Name of the foul line distance marker object. -- @param #string namefoulline Name of the foul line distance marker object.
-- @return #number Foul line distance in meters. -- @return #number Foul line distance in meters.
-- @usage
--
-- -- Setup a Range
-- RangeOne = RANGE:New( "Range One" )
-- -- Get distance between strafe target objext and foul line distance marker object.
-- RangeOneFoulDistance = RangeOne:GetFoullineDistance( "RangeOneStrafeTarget" , "RangeOneFoulLineObject" )
-- -- Add a strafe pit using the measured foul line distance. Where nil is used, strafe pit default values will be used - adjust as required.
-- RangeOne:AddStrafePit( "RangeOneStrafeTarget", nil, nil, nil, nil, nil, RangeOneFoulDistance )
-- -- Start Range.
-- RangeOne:Start()
--
function RANGE:GetFoullineDistance( namepit, namefoulline ) function RANGE:GetFoullineDistance( namepit, namefoulline )
self:F( { namepit = namepit, namefoulline = namefoulline } ) self:F( { namepit = namepit, namefoulline = namefoulline } )
@ -2107,7 +2120,7 @@ function RANGE:onafterSave( From, Event, To )
_savefile( filename, scores ) _savefile( filename, scores )
end end
--- Function called before save event. Checks that io and lfs are desanitized. --- Function called before load event. Checks that io and lfs are desanitized.
-- @param #RANGE self -- @param #RANGE self
-- @param #string From From state. -- @param #string From From state.
-- @param #string Event Event. -- @param #string Event Event.
@ -2654,7 +2667,7 @@ function RANGE:_DisplayRangeWeather( _unitname )
local tW = string.format( "%.1f m/s", Ws ) local tW = string.format( "%.1f m/s", Ws )
local tP = string.format( "%.1f mmHg", P * hPa2mmHg ) local tP = string.format( "%.1f mmHg", P * hPa2mmHg )
if settings:IsImperial() then if settings:IsImperial() then
-- tT=string.format("%d°F", UTILS.CelciusToFarenheit(T)) -- tT=string.format("%d°F", UTILS.CelsiusToFahrenheit(T))
tW = string.format( "%.1f knots", UTILS.MpsToKnots( Ws ) ) tW = string.format( "%.1f knots", UTILS.MpsToKnots( Ws ) )
tP = string.format( "%.2f inHg", P * hPa2inHg ) tP = string.format( "%.2f inHg", P * hPa2inHg )
end end

View File

@ -1601,7 +1601,7 @@ WAREHOUSE = {
-- @field #number range Range of the unit in meters. -- @field #number range Range of the unit in meters.
-- @field #number speedmax Maximum speed in km/h the group can do. -- @field #number speedmax Maximum speed in km/h the group can do.
-- @field #number size Maximum size in length and with of the asset in meters. -- @field #number size Maximum size in length and with of the asset in meters.
-- @field #number weight The weight of the whole asset group in kilo gramms. -- @field #number weight The weight of the whole asset group in kilograms.
-- @field DCS#Object.Desc DCSdesc All DCS descriptors. -- @field DCS#Object.Desc DCSdesc All DCS descriptors.
-- @field #WAREHOUSE.Attribute attribute Generalized attribute of the group. -- @field #WAREHOUSE.Attribute attribute Generalized attribute of the group.
-- @field #table cargobay Array of cargo bays of all units in an asset group. -- @field #table cargobay Array of cargo bays of all units in an asset group.

View File

@ -67,7 +67,7 @@
-- @field #string activerunway The active runway specified by the user. -- @field #string activerunway The active runway specified by the user.
-- @field #number subduration Duration how long subtitles are displayed in seconds. -- @field #number subduration Duration how long subtitles are displayed in seconds.
-- @field #boolean metric If true, use metric units. If false, use imperial (default). -- @field #boolean metric If true, use metric units. If false, use imperial (default).
-- @field #boolean PmmHg If true, give pressure in millimeters of Mercury. Default is inHg for imperial and hecto Pascal (=mili Bars) for metric units. -- @field #boolean PmmHg If true, give pressure in millimeters of Mercury. Default is inHg for imperial and hectopascal (hPa, which is the same as millibar - mbar) for metric units.
-- @field #boolean qnhonly If true, suppresses reporting QFE. Default is to report both QNH and QFE. -- @field #boolean qnhonly If true, suppresses reporting QFE. Default is to report both QNH and QFE.
-- @field #boolean TDegF If true, give temperature in degrees Fahrenheit. Default is in degrees Celsius independent of chosen unit system. -- @field #boolean TDegF If true, give temperature in degrees Fahrenheit. Default is in degrees Celsius independent of chosen unit system.
-- @field #number zuludiff Time difference local vs. zulu in hours. -- @field #number zuludiff Time difference local vs. zulu in hours.
@ -239,7 +239,7 @@
-- --
-- atisBatumi:SetMetricUnits() -- atisBatumi:SetMetricUnits()
-- --
-- With this, wind speed is given in meters per second, pressure in hecto Pascal (mbar), visibility in kilometers etc. -- With this, wind speed is given in meters per second, pressure in hectopascal (hPa, which is the same as millibar - mbar), visibility in kilometers etc.
-- --
-- # Sound Files -- # Sound Files
-- --
@ -1459,8 +1459,8 @@ function ATIS:onafterBroadcast(From, Event, To)
-- Convert to °F. -- Convert to °F.
if self.TDegF then if self.TDegF then
temperature=UTILS.CelciusToFarenheit(temperature) temperature=UTILS.CelsiusToFahrenheit(temperature)
dewpoint=UTILS.CelciusToFarenheit(dewpoint) dewpoint=UTILS.CelsiusToFahrenheit(dewpoint)
end end
local TEMPERATURE=string.format("%d", math.abs(temperature)) local TEMPERATURE=string.format("%d", math.abs(temperature))
@ -2280,7 +2280,7 @@ function ATIS:onafterReport(From, Event, To, Text)
local text=string.gsub(text, "°F", "degrees Fahrenheit") local text=string.gsub(text, "°F", "degrees Fahrenheit")
local text=string.gsub(text, "inHg", "inches of Mercury") local text=string.gsub(text, "inHg", "inches of Mercury")
local text=string.gsub(text, "mmHg", "millimeters of Mercury") local text=string.gsub(text, "mmHg", "millimeters of Mercury")
local text=string.gsub(text, "hPa", "hecto Pascals") local text=string.gsub(text, "hPa", "hectopascals")
local text=string.gsub(text, "m/s", "meters per second") local text=string.gsub(text, "m/s", "meters per second")
-- Replace ";" by "." -- Replace ";" by "."

View File

@ -3,9 +3,11 @@
-- --
-- @module Utils.STTS -- @module Utils.STTS
-- @image MOOSE.JPG -- @image MOOSE.JPG
--- [DCS Enum world](https://wiki.hoggitworld.com/view/DCS_enum_world) --- [DCS Enum world](https://wiki.hoggitworld.com/view/DCS_enum_world)
-- @type STTS -- @type STTS
-- @field #string DIRECTORY Path of the SRS directory. -- @field #string DIRECTORY Path of the SRS directory.
--- Simple Text-To-Speech --- Simple Text-To-Speech
-- --
-- Version 0.4 - Compatible with SRS version 1.9.6.0+ -- Version 0.4 - Compatible with SRS version 1.9.6.0+
@ -40,7 +42,7 @@
-- * OPTIONAL - Speed -10 to +10 -- * OPTIONAL - Speed -10 to +10
-- * OPTIONAL - Gender male, female or neuter -- * OPTIONAL - Gender male, female or neuter
-- * OPTIONAL - Culture - en-US, en-GB etc -- * OPTIONAL - Culture - en-US, en-GB etc
-- * OPTIONAL - Voice - a specfic voice by name. Run DCS-SR-ExternalAudio.exe with --help to get the ones you can use on the command line -- * OPTIONAL - Voice - a specific voice by name. Run DCS-SR-ExternalAudio.exe with --help to get the ones you can use on the command line
-- * OPTIONAL - Google TTS - Switch to Google Text To Speech - Requires STTS.GOOGLE_CREDENTIALS path and Google project setup correctly -- * OPTIONAL - Google TTS - Switch to Google Text To Speech - Requires STTS.GOOGLE_CREDENTIALS path and Google project setup correctly
-- --
-- --
@ -89,7 +91,7 @@ STTS.SRS_PORT = 5002
--- Google credentials file --- Google credentials file
STTS.GOOGLE_CREDENTIALS = "C:\\Users\\Ciaran\\Downloads\\googletts.json" STTS.GOOGLE_CREDENTIALS = "C:\\Users\\Ciaran\\Downloads\\googletts.json"
--- DONT CHANGE THIS UNLESS YOU KNOW WHAT YOU'RE DOING --- DON'T CHANGE THIS UNLESS YOU KNOW WHAT YOU'RE DOING
STTS.EXECUTABLE = "DCS-SR-ExternalAudio.exe" STTS.EXECUTABLE = "DCS-SR-ExternalAudio.exe"
--- Function for UUID. --- Function for UUID.
@ -117,11 +119,11 @@ function STTS.round( x, n )
end end
--- Function returns estimated speech time in seconds. --- Function returns estimated speech time in seconds.
-- Assumptions for time calc: 100 Words per min, avarage of 5 letters for english word so -- Assumptions for time calc: 100 Words per min, average of 5 letters for english word so
-- --
-- * 5 chars * 100wpm = 500 characters per min = 8.3 chars per second -- * 5 chars * 100wpm = 500 characters per min = 8.3 chars per second
-- --
-- So lengh of msg / 8.3 = number of seconds needed to read it. rounded down to 8 chars per sec map function: -- So length of msg / 8.3 = number of seconds needed to read it. rounded down to 8 chars per sec map function:
-- --
-- * (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min -- * (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min
-- --

File diff suppressed because it is too large Load Diff