From 837eb64d8c1f89d30f02d79bbbfd891d0b20cc1d Mon Sep 17 00:00:00 2001 From: "Rasmus (VIKING)" Date: Tue, 15 Jun 2021 01:20:32 +0200 Subject: [PATCH] [stable] 0.13 --- README.md | 13 ++- lua/entities/fin_os_brain/init.lua | 8 +- lua/entities/gmod_wire_finos_fin.lua | 114 +++++++++++++++----------- lua/weapons/fin_os/hooks/cl_hooks.lua | 6 +- lua/weapons/fin_os/init.lua | 6 ++ lua/weapons/fin_os/shared.lua | 24 ++++-- lua/wire/stools/finos_fin.lua | 36 ++++---- 7 files changed, 126 insertions(+), 81 deletions(-) diff --git a/README.md b/README.md index db0f80e..fdf5032 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,11 @@ ### You can find the stand alone tool under: **Weapons => Tools => Fin OS Tool** -**Made from scratch, and based on the modern lift equation: https://wright.nasa.gov/airplane/lifteq.html** +**Made from scratch, and based on the modern lift/drag equations: https://wright.nasa.gov/airplane/lifteq.html & ( https://www.grc.nasa.gov/www/k-12/airplane/sized.html, https://www.grc.nasa.gov/www/k-12/airplane/dragco.html, https://www.grc.nasa.gov/www/k-12/airplane/drageq.html, https://www.grc.nasa.gov/www/k-12/airplane/presar.html )** + + +### Quick start: +**Left-Click** to add two vector points for the forward direction vector. (this should normally be in the direction the creations forward reference is) After that, create the area of the fin. Done. You can also add a flap if you want with **( IN_USE + Left-Click )** on a fin and prop. Reload will remove fin and flap, or flap. **Right-Click** will track selected fin (real-time physics). **( IN_USE + Sroll Wheel )** will increase/decrease the scalar value of the fin you are looking at. The server admin can adjust server settings with the console variables underneath. ### How to use: * You can find the stand alone tool under: ***Weapons => Tools => Fin OS Tool*** @@ -17,7 +21,7 @@ * **( IN_USE + MIDDLE_MOUSE ) to open** the client settings panel ### How it works: -* It uses **real physics** to calculate lift from the center of the prop, and real life formula for calculating lift: *Force[LIFT] = .5 * rho[AIR] * Velocity[m/s]^2 * Area[m^2] * C[L - angle of attack]* +* It uses **real physics** to calculate lift from the center of the prop, and real life formula for calculating lift: *Force[LIFT] = .5 * rho[AIR] * Velocity[m/s]^2 * Area[m^2] * C[L - angle of attack]* - also about uses the same logic for the drag ### Features: * Supports duplication @@ -28,12 +32,14 @@ * Supports Wiremod input/output ( *Physics => FIN OS Tool* ) ### Console Variables +*Server* * ```finos_maxfin_os_ent ( def. = 20 ) [ FCVAR_PROTECTED, FCVAR_ARCHIVE ]``` - Amount of Fin OS fin's possible for each Player to spawn ( only for multiplayer ). * ```finos_rhodensistyfluidvalue ( def. = 1.29 ) [ FCVAR_PROTECTED, FCVAR_ARCHIVE ]``` - Mass density ( rho ) that will be applied to Fin OS fin. * ```finos_maxscalarvalue ( def. = 69 ) [ FCVAR_PROTECTED, FCVAR_ARCHIVE ]``` - Maximum scalar value a player can apply to a Fin OS fin. * ```finos_disablestrictmode ( def. = 0 ) [ FCVAR_PROTECTED, FCVAR_ARCHIVE ]``` - Disables checking for angle of prop and crossing vector lines, if you just want to be joking around ( other servers might not accept the duplicate tho ). * ```finos_disableprintchatmessages ( def. = 1 ) [ FCVAR_PROTECTED, FCVAR_ARCHIVE ]``` - Disables printing messages in chat ( only legacy ). +*Client* * ```finos_cl_enableHoverRingBall_fin ( def. = 1 ) [ FCVAR_ARCHIVE ]``` - Clientside. Activate or deactivate the markers for a fin. * ```finos_cl_enableHoverRingBall_flap ( def. = 1 ) [ FCVAR_ARCHIVE ]``` - Clientside. Activate or deactivate the markers for a flap. * ```finos_cl_enableAlignAngleHelpers ( def. = 1 ) [ FCVAR_ARCHIVE ]``` - Clientside. Activate or deactivate the "Correct Start Angle Helpers". @@ -47,6 +53,9 @@ * ```finos_cl_gridColorB ( def. = 241 ) [ FCVAR_ARCHIVE ]``` - Clientside. Change the Blue channel for the grid color. **WIND Settings:** +*Server* +* ```finos_wind_disableAllServerLimits ( def. = 0 ) [ FCVAR_PROTECTED, FCVAR_ARCHIVE ]``` - Disables all wind limits set by server. + * ```finos_wind_maxForcePerSquareMeterAreaAllowed ( def. = 6000 => ( -6000 - 6000 ) ) [ FCVAR_PROTECTED, FCVAR_ARCHIVE ]``` - Max. Allowed Wind Force Per. Square Meter of Area. * ```finos_wind_minWindScaleAllowed ( def. = 0.1 ) [ FCVAR_PROTECTED, FCVAR_ARCHIVE ]``` - Min. Allowed Wild Wind Scale. * ```finos_wind_maxWindScaleAllowed ( def. = 6 ) [ FCVAR_PROTECTED, FCVAR_ARCHIVE ]``` - Max. Allowed Wild Wind Scale. diff --git a/lua/entities/fin_os_brain/init.lua b/lua/entities/fin_os_brain/init.lua index b6b9769..98072c9 100644 --- a/lua/entities/fin_os_brain/init.lua +++ b/lua/entities/fin_os_brain/init.lua @@ -172,10 +172,11 @@ function ENT:ApplyForceLiftToFinWing( entFinParentProp ) local timeDeltaTime = ( tonumber( self:GetVelocityTimeB() ) - tonumber( self:GetVelocityTimeA() ) ) -- 1 foot = 12 units = 0.3048 meter - local CURRENT_VELOCITY_UnitsSecond = ( ( vectorDeltaDistanceABLength_Units / timeDeltaTime ) / 3 ) -- The actual velocity in Units/s ( fraction by 3, to get it more realistic ( based on normal walking speed of humans 5 km/h ) ) - local CURRENT_VELOCITY_MeterSecond = ( ( CURRENT_VELOCITY_UnitsSecond / 12 * 0.3048 ) ) -- The actual velocity in m/s - local CURRENT_VELOCITY_KmHour = ( CURRENT_VELOCITY_MeterSecond * 3.6 ) -- The actual velocity in km/h + local CURRENT_VELOCITY_UnitsSecond = ( ( vectorDeltaDistanceABLength_Units / timeDeltaTime ) / 3 ) -- The actual velocity in Units/s ( fraction by 3, to get it more realistic ( based on normal walking speed of humans 5 km/h ) ) + local CURRENT_VELOCITY_MeterSecond = ( ( CURRENT_VELOCITY_UnitsSecond / 12 * 0.3048 ) ) -- The actual velocity in m/s + local CURRENT_VELOCITY_KmHour = ( CURRENT_VELOCITY_MeterSecond * 3.6 ) -- The actual velocity in km/h local CURRENT_VELOCITY_MilesPerHour = ( CURRENT_VELOCITY_MeterSecond * 2.24 ) -- The actual velocity in mph + local CURRENT_VELOCITY_Knots = ( CURRENT_VELOCITY_KmHour * 1.852 ) -- The actual velocity in knots [1 knot = 1.85200 km/h] local entPhysicsObject = entFinParentProp:GetPhysicsObject() @@ -415,6 +416,7 @@ function ENT:ApplyForceLiftToFinWing( entFinParentProp ) FIN_FinBeingTracked = entBeingTracked, FIN_AttackAngle_Pitch = FINATTACKANGLE, + FIN_VelocityKnots = CURRENT_VELOCITY_Knots, FIN_VelocityKmH = CURRENT_VELOCITY_KmHour, FIN_VelocityMpH = CURRENT_VELOCITY_MeterSecond, FIN_VelocityMps = CURRENT_VELOCITY_MilesPerHour, diff --git a/lua/entities/gmod_wire_finos_fin.lua b/lua/entities/gmod_wire_finos_fin.lua index e9611d5..62396e0 100644 --- a/lua/entities/gmod_wire_finos_fin.lua +++ b/lua/entities/gmod_wire_finos_fin.lua @@ -13,7 +13,7 @@ if WireToolSetup then local WireInputsNames = { "Entity(FinOS FIN)", - "AttackAngle(PITCH)", + "AngleOfAttack(PITCH)", "WindForceBeingApplied(NEWTONS)", "Scalar(LIFT/DRAG)" @@ -32,7 +32,7 @@ if WireToolSetup then local WireOutputsNames2 = {} local WireOutputsNames = { - "AttackAngle(PITCH)", + "AngleOfAttack(PITCH)", "Area1(meters[FLOAT])", "Area2(inches[FLOAT])", "LiftForce(NEWTONS)", @@ -40,9 +40,10 @@ if WireToolSetup then "WindEnabled[BOOL]", "WindForceBeingApplied(NEWTONS)", "Scalar(LIFT/DRAG)", - "Speed1(KPH)", - "Speed2(MPH)", - "Speed3(MPS)", + "Speed1(KNOTS)", + "Speed2(KPH)", + "Speed3(MPH)", + "Speed4(MPS)", "BeingTracked(anyone[BOOL])" } @@ -85,7 +86,7 @@ if WireToolSetup then local fallbackStr, fallbackInt = "n/a", ( 0 / 0 ) --[[ nan ]] local BaseTriOut = { - fallbackStr .. "˚", fallbackInt, + "AOA: " .. fallbackStr .. "˚", fallbackInt, fallbackStr .. " m²", fallbackInt, fallbackStr .. " In²", fallbackInt, fallbackStr .. " N", fallbackInt, @@ -93,9 +94,10 @@ if WireToolSetup then fallbackStr, fallbackInt, fallbackStr .. " N", fallbackInt, fallbackStr, fallbackInt, - fallbackStr .. " kph", fallbackInt, - fallbackStr .. " mph", fallbackInt, - fallbackStr .. " mps", fallbackInt, + fallbackStr .. " KNOTS",fallbackInt, + fallbackStr .. " KPH", fallbackInt, + fallbackStr .. " MPH", fallbackInt, + fallbackStr .. " MPS", fallbackInt, fallbackStr, fallbackInt } @@ -111,7 +113,7 @@ if WireToolSetup then end - function ENT:Setup( out_AAP, out_AM, out_AI, out_LFN, out_DFN, out_WE, out_WFA, out_SCALAR, out_SKMH, out_SMPH, out_MPS, out_BT ) + function ENT:Setup( out_AAP, out_AM, out_AI, out_LFN, out_DFN, out_WE, out_WFA, out_SCALAR, out_KNOTS, out_SKMH, out_SMPH, out_MPS, out_BT ) -- For duplication self.out_AAP = out_AAP @@ -122,6 +124,7 @@ if WireToolSetup then self.out_WE = out_WE self.out_WFA = out_WFA self.out_SCALAR = out_SCALAR + self.out_KNOTS = out_KNOTS self.out_SKMH = out_SKMH self.out_SMPH = out_SMPH self.out_MPS = out_MPS @@ -140,27 +143,29 @@ if WireToolSetup then BaseTriOut[ 17 ], BaseTriOut[ 18 ], BaseTriOut[ 19 ], BaseTriOut[ 20 ], BaseTriOut[ 21 ], BaseTriOut[ 22 ], + BaseTriOut[ 23 ], BaseTriOut[ 24 ], BaseTriOut[ 23 ], BaseTriOut[ 24 ] ) end - function ENT:ShowOutput( AAP, AM, AI, LFN, DFN, WE, WE_str, WFA, SCALAR, SKMH, SMPH, MPS, BT, BT_str ) + function ENT:ShowOutput( AAP, AM, AI, LFN, DFN, WE, WE_str, WFA, SCALAR, KNOTS, SKMH, SMPH, MPS, BT, BT_str ) local txt = "OUTPUT DATA: \n" - if self.out_AAP and AAP then txt = txt .. string.format( "\nPitch Attack Angle = %s", AAP .. "˚" ) end - if self.out_AM and AM then txt = txt .. string.format( "\nArea (meters) = %s", AM .. " m²" ) end - if self.out_AI and AI then txt = txt .. string.format( "\nArea (inches) = %s", AI .. " In²" ) end + if self.out_AAP and AAP then txt = txt .. string.format( "\nAOA (PITCH) = %s", AAP .. "˚" ) end + if self.out_AM and AM then txt = txt .. string.format( "\nArea [METERS] = %s", AM .. " m²" ) end + if self.out_AI and AI then txt = txt .. string.format( "\nArea [INCHES] = %s", AI .. " In²" ) end if self.out_LFN and LFN then txt = txt .. string.format( "\nLift Force = %s", LFN .. " N" ) end if self.out_DFN and DFN then txt = txt .. string.format( "\nDrag Force = %s", DFN .. " N" ) end if self.out_WE and WE then txt = txt .. string.format( "\nWind Enabled = %s", WE_str .. " ( " .. WE .. " )" )end if self.out_WFA and WFA then txt = txt .. string.format( "\nWind Force Applied = %s", WFA .. " N" ) end if self.out_SCALAR and SCALAR then txt = txt .. string.format( "\nScalar = %s", SCALAR ) end - if self.out_SKMH and SKMH then txt = txt .. string.format( "\nSpeed (kph) = %s", SKMH .. " kph" ) end - if self.out_SMPH and SMPH then txt = txt .. string.format( "\nSpeed (mph) = %s", SMPH .. " mph" ) end - if self.out_MPS and MPS then txt = txt .. string.format( "\nSpeed (mps) = %s", MPS .. " mps" ) end + if self.out_KNOTS and KNOTS then txt = txt .. string.format( "\nSpeed [KNOTS] = %s", KNOTS .. " KNOTS" ) end + if self.out_SKMH and SKMH then txt = txt .. string.format( "\nSpeed [KPH] = %s", SKMH .. " KPH" ) end + if self.out_SMPH and SMPH then txt = txt .. string.format( "\nSpeed [MPH] = %s", SMPH .. " MPH" ) end + if self.out_MPS and MPS then txt = txt .. string.format( "\nSpeed [MPS] = %s", MPS .. " MPS" ) end if self.out_BT and BT then txt = txt .. string.format( "\nBeing tracked = %s", BT_str .. " ( " .. BT .. " )" ) end self:SetOverlayText( txt .. "\n" ) @@ -187,7 +192,7 @@ if WireToolSetup then end - function ENT:TriggerOutput( AAP_str, AAP, AM_str, AM, AI_str, AI, LFN_str, LFN, DFN_str, DFN, WE, WE_str, WFA, WFA_str, SCALAR_str, SCALAR, SKMH_str, SKMH, SMPH_str, SMPH, MPS_str, MPS, BT_str, BT ) + function ENT:TriggerOutput( AAP_str, AAP, AM_str, AM, AI_str, AI, LFN_str, LFN, DFN_str, DFN, WE, WE_str, WFA, WFA_str, SCALAR_str, SCALAR, KNOTS_str, KNOTS, SKMH_str, SKMH, SMPH_str, SMPH, MPS_str, MPS, BT_str, BT ) if self.out_AAP then WireLib.TriggerOutput( self, WireOutputs[ 1 ], AAP_str ) @@ -221,28 +226,32 @@ if WireToolSetup then WireLib.TriggerOutput( self, WireOutputs[ 15 ], SCALAR_str ) WireLib.TriggerOutput( self, WireOutputs[ 16 ], SCALAR ) end + if self.out_KNOTS then + WireLib.TriggerOutput( self, WireOutputs[ 17 ], KNOTS_str ) + WireLib.TriggerOutput( self, WireOutputs[ 18 ], KNOTS ) + end if self.out_SKMH then - WireLib.TriggerOutput( self, WireOutputs[ 17 ], SKMH_str ) - WireLib.TriggerOutput( self, WireOutputs[ 18 ], SKMH ) + WireLib.TriggerOutput( self, WireOutputs[ 19 ], SKMH_str ) + WireLib.TriggerOutput( self, WireOutputs[ 20 ], SKMH ) end if self.out_SMPH then - WireLib.TriggerOutput( self, WireOutputs[ 19 ], SMPH_str ) - WireLib.TriggerOutput( self, WireOutputs[ 20 ], SMPH ) + WireLib.TriggerOutput( self, WireOutputs[ 21 ], SMPH_str ) + WireLib.TriggerOutput( self, WireOutputs[ 22 ], SMPH ) end if self.out_MPS then - WireLib.TriggerOutput( self, WireOutputs[ 21 ], MPS_str ) - WireLib.TriggerOutput( self, WireOutputs[ 22 ], MPS ) + WireLib.TriggerOutput( self, WireOutputs[ 23 ], MPS_str ) + WireLib.TriggerOutput( self, WireOutputs[ 24 ], MPS ) end if self.out_BT then - WireLib.TriggerOutput( self, WireOutputs[ 23 ], BT_str ) - WireLib.TriggerOutput( self, WireOutputs[ 24 ], BT ) + WireLib.TriggerOutput( self, WireOutputs[ 25 ], BT_str ) + WireLib.TriggerOutput( self, WireOutputs[ 26 ], BT ) end - self:ShowOutput( AAP, AM, AI, LFN, DFN, WE, WE_str, WFA, SCALAR, SKMH, SMPH, MPS, BT, BT_str ) + self:ShowOutput( AAP, AM, AI, LFN, DFN, WE, WE_str, WFA, SCALAR, KNOTS, SKMH, SMPH, MPS, BT, BT_str ) end - duplicator.RegisterEntityClass( "gmod_wire_finos_fin", WireLib.MakeWireEnt, "Data", "out_AAP", "out_AM", "out_AI", "out_LFN", "out_DFN", "out_WE", "out_WFA", "out_SCALAR", "out_SKMH", "out_SMPH", "out_MPS", "out_BT" ) + duplicator.RegisterEntityClass( "gmod_wire_finos_fin", WireLib.MakeWireEnt, "Data", "out_AAP", "out_AM", "out_AI", "out_LFN", "out_DFN", "out_WE", "out_WFA", "out_SCALAR", "out_KNOTS", "out_SKMH", "out_SMPH", "out_MPS", "out_BT" ) function ENT:FINOS_UpdateInputValueWireModGlobally( InputData, FINOSDATA_InputWireModTable, TableID, NWBoolString ) @@ -268,10 +277,11 @@ if WireToolSetup then local WE = BaseTriOut[ 12 ] local WFA = BaseTriOut[ 14 ] local SCALAR = BaseTriOut[ 16 ] - local SKMH = BaseTriOut[ 18 ] - local SMPH = BaseTriOut[ 20 ] - local MPS = BaseTriOut[ 22 ] - local BT = BaseTriOut[ 24 ] + local KNOTS = BaseTriOut[ 18 ] + local SKMH = BaseTriOut[ 20 ] + local SMPH = BaseTriOut[ 22 ] + local MPS = BaseTriOut[ 24 ] + local BT = BaseTriOut[ 26 ] local AAP_str = BaseTriOut[ 1 ] local AM_str = BaseTriOut[ 3 ] @@ -281,10 +291,11 @@ if WireToolSetup then local WE_str = BaseTriOut[ 11 ] local WFA_str = BaseTriOut[ 13 ] local SCALAR_str = BaseTriOut[ 15 ] - local SKMH_str = BaseTriOut[ 17 ] - local SMPH_str = BaseTriOut[ 19 ] - local MPS_str = BaseTriOut[ 21 ] - local BT_str = BaseTriOut[ 23 ] + local KNOTS_str = BaseTriOut[ 17 ] + local SKMH_str = BaseTriOut[ 19 ] + local SMPH_str = BaseTriOut[ 21 ] + local MPS_str = BaseTriOut[ 23 ] + local BT_str = BaseTriOut[ 25 ] local FinEnt = self.FinEntity @@ -304,6 +315,7 @@ if WireToolSetup then WIREFINFLAPOUTPUTDATA[ "FIN_WindEnabled" ] and WIREFINFLAPOUTPUTDATA[ "FIN_WindAppliedForceNewtons" ] and WIREFINFLAPOUTPUTDATA[ "FIN_Scalar" ] and + WIREFINFLAPOUTPUTDATA[ "FIN_VelocityKnots" ] and WIREFINFLAPOUTPUTDATA[ "FIN_VelocityKmH" ] and WIREFINFLAPOUTPUTDATA[ "FIN_VelocityMpH" ] and WIREFINFLAPOUTPUTDATA[ "FIN_VelocityMps" ] and @@ -321,12 +333,13 @@ if WireToolSetup then WE = round( WIREFINFLAPOUTPUTDATA[ "FIN_WindEnabled" ] ) WFA = round( WIREFINFLAPOUTPUTDATA[ "FIN_WindAppliedForceNewtons" ] ) SCALAR = WIREFINFLAPOUTPUTDATA[ "FIN_Scalar" ] - SKMH = round( WIREFINFLAPOUTPUTDATA[ "FIN_VelocityKmH" ] ) - SMPH = round( WIREFINFLAPOUTPUTDATA[ "FIN_VelocityMpH" ] ) - MPS = round( WIREFINFLAPOUTPUTDATA[ "FIN_VelocityMps" ] ) + KNOTS = round( WIREFINFLAPOUTPUTDATA[ "FIN_VelocityKnots" ], 1 ) + SKMH = round( WIREFINFLAPOUTPUTDATA[ "FIN_VelocityKmH" ], 1 ) + SMPH = round( WIREFINFLAPOUTPUTDATA[ "FIN_VelocityMpH" ], 1 ) + MPS = round( WIREFINFLAPOUTPUTDATA[ "FIN_VelocityMps" ], 1 ) BT = WIREFINFLAPOUTPUTDATA[ "FIN_FinBeingTracked" ] - AAP_str = AAP .. "˚" + AAP_str = "AOA: " .. AAP .. "˚" AM_str = AM .. " m²" AI_str = AI .. " In²" LFN_str = LFN .. " N" @@ -334,9 +347,10 @@ if WireToolSetup then if WE < 1 then WE_str = "No" else WE_str = "Yes" end WFA_str = WFA .. " N" SCALAR_str = tostring( SCALAR ) - SKMH_str = SKMH .. " kph" - SMPH_str = SMPH .. " mph" - MPS_str = MPS .. " mps" + KNOTS_str = KNOTS .. " KNOTS" + SKMH_str = SKMH .. " KPH" + SMPH_str = SMPH .. " MPH" + MPS_str = MPS .. " MPS" if BT < 1 then BT_str = "No" else BT_str = "Yes" end end @@ -349,16 +363,20 @@ if WireToolSetup then -- Tell Fin OS Brain to ignore the original scalar angle from fin prop -- Tell Fin OS Brain to ignore the original Wind Force Being Applied from fin prop -- Tell Fin OS Brain to ignore the real pitch angle from fin prop - local FINOSDATA_InputWireModTable = FinEnt[ "FinOS_data" ][ "fin_os__Wiremod_InputValues" ] + if FinEnt[ "FinOS_data" ] and FinEnt[ "FinOS_data" ][ "fin_os__Wiremod_InputValues" ] then + + local FINOSDATA_InputWireModTable = FinEnt[ "FinOS_data" ][ "fin_os__Wiremod_InputValues" ] - --[[ ATTACK ANGLE ]]self:FINOS_UpdateInputValueWireModGlobally( AttackPitchAngleInput, FINOSDATA_InputWireModTable, "AttackAngle_Pitch_Wiremod", "IgnoreRealPitchAttackAngle" ) - --[[ WIND ]] self:FINOS_UpdateInputValueWireModGlobally( WindForceBeingApplied, FINOSDATA_InputWireModTable, "WindAmountNewtonsForArea_Wiremod", "IgnoreRealWindForceApplied" ) - --[[ LIFT ]] self:FINOS_UpdateInputValueWireModGlobally( LiftScalarInput, FINOSDATA_InputWireModTable, "FinOS_LiftForceScalarValue_Wiremod", "IgnoreRealScalarValue" ) + --[[ ATTACK ANGLE ]]self:FINOS_UpdateInputValueWireModGlobally( AttackPitchAngleInput, FINOSDATA_InputWireModTable, "AttackAngle_Pitch_Wiremod", "IgnoreRealPitchAttackAngle" ) + --[[ WIND ]] self:FINOS_UpdateInputValueWireModGlobally( WindForceBeingApplied, FINOSDATA_InputWireModTable, "WindAmountNewtonsForArea_Wiremod", "IgnoreRealWindForceApplied" ) + --[[ LIFT ]] self:FINOS_UpdateInputValueWireModGlobally( LiftScalarInput, FINOSDATA_InputWireModTable, "FinOS_LiftForceScalarValue_Wiremod", "IgnoreRealScalarValue" ) + + end end -- Update globally - self:TriggerOutput( AAP_str, AAP, AM_str, AM, AI_str, AI, LFN_str, LFN, DFN_str, DFN, WE, WE_str, WFA, WFA_str, SCALAR_str, SCALAR, SKMH_str, SKMH, SMPH_str, SMPH, MPS_str, MPS, BT_str, BT ) + self:TriggerOutput( AAP_str, AAP, AM_str, AM, AI_str, AI, LFN_str, LFN, DFN_str, DFN, WE, WE_str, WFA, WFA_str, SCALAR_str, SCALAR, KNOTS_str, KNOTS, SKMH_str, SKMH, SMPH_str, SMPH, MPS_str, MPS, BT_str, BT ) self:NextThink( CurTime() + 0.03 ) return true diff --git a/lua/weapons/fin_os/hooks/cl_hooks.lua b/lua/weapons/fin_os/hooks/cl_hooks.lua index 2dd71d9..7b8c3af 100644 --- a/lua/weapons/fin_os/hooks/cl_hooks.lua +++ b/lua/weapons/fin_os/hooks/cl_hooks.lua @@ -143,7 +143,7 @@ hook.Add( "HUDPaint", "fin_os:fin_display_settings", function() draw.DrawText( - "Air Attack Angle: " .. pitchAttackAngle .. "˚ | " .. pitchAttackAngle_FLAP .. "˚", + "Angle of Attack: " .. pitchAttackAngle .. "˚ | " .. pitchAttackAngle_FLAP .. "˚", textType, ( backgroundPosX + 20 ), ( backgroundPosY + 20 ), @@ -413,7 +413,7 @@ hook.Add( "HUDPaint", "fin_os:fin_display_settings", function() draw.DrawText( - "Air Attack Angle: " .. pitchAttackAngle.. "˚ (important)", + "Angle of Attack: " .. pitchAttackAngle.. "˚ (important)", "HudSelectionText", ( backgroundPosX + 20 ), ( backgroundPosY + 20 ), @@ -556,7 +556,7 @@ hook.Add( "HUDPaint", "fin_os:fin_display_settings", function() draw.DrawText( - "AAA: " .. pitchAttackAngle.. "˚ | " .. pitchAttackAngle_FLAP .. "˚", + "AOA: " .. pitchAttackAngle.. "˚ | " .. pitchAttackAngle_FLAP .. "˚", "DermaDefaultBold", ( backgroundPosX + 10 ), ( backgroundPosY + 8 ), diff --git a/lua/weapons/fin_os/init.lua b/lua/weapons/fin_os/init.lua index b2f3bb0..1a87664 100644 --- a/lua/weapons/fin_os/init.lua +++ b/lua/weapons/fin_os/init.lua @@ -27,6 +27,7 @@ AddCSLuaFile( "reload.lua" ) -- /////////////////////////////////////////////////////////////////////////////// -- CONSOLE VARIABLES +-- Server CreateConVar( "finos_maxfin_os_ent", 20, @@ -63,6 +64,7 @@ CreateConVar( ) +-- Client CreateClientConVar( "finos_cl_enableHoverRingBall_fin", "1", true, false ) CreateClientConVar( "finos_cl_enableHoverRingBall_flap", "1", true, false ) CreateClientConVar( "finos_cl_enableAlignAngleHelpers", "1", true, false ) @@ -76,6 +78,9 @@ CreateClientConVar( "finos_cl_gridColorG", "146", true, false ) --[[ INT ]] CreateClientConVar( "finos_cl_gridColorB", "241", true, false ) --[[ INT ]] -- WIND +-- Server +CreateConVar( "finos_wind_disableAllServerLimits", 0, bit.bor( FCVAR_PROTECTED, FCVAR_ARCHIVE ), "Disables all wind limits set by server." ) + CreateConVar( "finos_wind_maxForcePerSquareMeterAreaAllowed", 6000, bit.bor( FCVAR_PROTECTED, FCVAR_ARCHIVE ), "Max Force Per. Square Meter For Area Allowed." ) CreateConVar( "finos_wind_minWindScaleAllowed", 0, bit.bor( FCVAR_PROTECTED, FCVAR_ARCHIVE ), "Min. Wind Scale Allowed." ) CreateConVar( "finos_wind_maxWindScaleAllowed", 1, bit.bor( FCVAR_PROTECTED, FCVAR_ARCHIVE ), "Max. Wind Scale Allowed." ) @@ -83,6 +88,7 @@ CreateConVar( "finos_wind_minWildWindScaleAllowed", 0.1, bit.bor( FCVAR_PROTECTE CreateConVar( "finos_wind_maxWildWindScaleAllowed", 6, bit.bor( FCVAR_PROTECTED, FCVAR_ARCHIVE ), "Max. Wild Wind Scale Allowed." ) CreateConVar( "finos_wind_maxActivateThermalWindScaleAllowed", 200, bit.bor( FCVAR_PROTECTED, FCVAR_ARCHIVE ), "Max. Thermal Lift Wind Scale Allowed." ) +-- Client CreateClientConVar( "finos_cl_wind_enableWind", "0", true, false ) CreateClientConVar( "finos_cl_wind_forcePerSquareMeterArea", "300", true, false ) --[[ FLOAT ]] CreateClientConVar( "finos_cl_wind_minWindScale", "0.4", true, false ) --[[ FLOAT ]] diff --git a/lua/weapons/fin_os/shared.lua b/lua/weapons/fin_os/shared.lua index 1aea98b..e63af78 100644 --- a/lua/weapons/fin_os/shared.lua +++ b/lua/weapons/fin_os/shared.lua @@ -381,21 +381,27 @@ if SERVER then local function r( id, value, limitValue, compare ) - FINOS_AlertPlayer( "**[WIND] The " .. string.upper( id ) .. " SETTING was overwritten to: " .. math.Round( limitValue, 2 ) .. "! Because: " .. math.Round( value, 2 ) .. " " .. compare .. " " .. math.Round( limitValue, 2 ) .. ". Can be adjusted by admin.", pl ) - FINOS_SendNotification( "[WIND] The " .. string.upper( id ) .. " SETTING was overwritten to: " .. math.Round( limitValue, 2 ) .. "! Because: " .. math.Round( value, 2 ) .. " " .. compare .. " " .. math.Round( limitValue, 2 ) .. ". Can be adjusted by admin", FIN_OS_NOTIFY_ERROR, pl, 6 ) + FINOS_AlertPlayer( "**[WIND] The " .. string.upper( id ) .. " SETTING was overwritten to: " .. math.Round( limitValue, 2 ) .. "! Because: " .. math.Round( value, 2 ) .. " " .. compare .. " " .. math.Round( limitValue, 2 ) .. ". Can be adjusted/disabled by admin.", pl ) + FINOS_SendNotification( "[WIND] The " .. string.upper( id ) .. " SETTING was overwritten to: " .. math.Round( limitValue, 2 ) .. "! Because: " .. math.Round( value, 2 ) .. " " .. compare .. " " .. math.Round( limitValue, 2 ) .. ". Can be adjusted/disabled by admin", FIN_OS_NOTIFY_ERROR, pl, 6 ) + + if pl and ( pl:IsAdmin() or pl:IsSuperAdmin() ) then FINOS_SendNotification( "You can disable all wind limits with ConVar: finos_wind_disableAllServerLimits", FIN_OS_NOTIFY_HINT, pl, 7.5 ) end end - -- Prevent Player setting invalid settings ( let server decide the min/max amount ) - if math.abs( ForcePerSquareMeterArea ) > math.abs( MaxForcePerSquareMeterAreaAllowed ) then r( "Wind Force [Max]", ForcePerSquareMeterArea, MaxForcePerSquareMeterAreaAllowed, ">" ) ForcePerSquareMeterArea = MaxForcePerSquareMeterAreaAllowed end + if GetConVar( "finos_wind_disableAllServerLimits" ):GetInt() == 0 then + + -- Prevent Player setting invalid settings ( let server decide the min/max amount ) + if math.abs( ForcePerSquareMeterArea ) > math.abs( MaxForcePerSquareMeterAreaAllowed ) then r( "Wind Force [Max]", ForcePerSquareMeterArea, MaxForcePerSquareMeterAreaAllowed, ">" ) ForcePerSquareMeterArea = MaxForcePerSquareMeterAreaAllowed end - if math.abs( MinWindScale ) < math.abs( MinWindScaleAllowed ) then r( "Wind [Min]", MinWindScale, MinWindScaleAllowed, "<" ) MinWindScale = MinWindScaleAllowed end - if math.abs( MaxWindScale ) > math.abs( MaxWindScaleAllowed ) then r( "Wind [Max]", MaxWindScale, MaxWindScaleAllowed, ">" ) MaxWindScale = MaxWindScaleAllowed end + if math.abs( MinWindScale ) < math.abs( MinWindScaleAllowed ) then r( "Wind [Min]", MinWindScale, MinWindScaleAllowed, "<" ) MinWindScale = MinWindScaleAllowed end + if math.abs( MaxWindScale ) > math.abs( MaxWindScaleAllowed ) then r( "Wind [Max]", MaxWindScale, MaxWindScaleAllowed, ">" ) MaxWindScale = MaxWindScaleAllowed end - if math.abs( MinWildWindScale ) < math.abs( MinWildWindScaleAllowed ) then r( "Wild [Min]", MinWildWindScale, MinWildWindScaleAllowed, "<" ) MinWildWindScale = MinWildWindScaleAllowed end - if math.abs( MaxWildWindScale ) > math.abs( MaxWildWindScaleAllowed ) then r( "Wild [Max]", MaxWildWindScale, MaxWildWindScaleAllowed, ">" ) MaxWildWindScale = MaxWildWindScaleAllowed end + if math.abs( MinWildWindScale ) < math.abs( MinWildWindScaleAllowed ) then r( "Wild [Min]", MinWildWindScale, MinWildWindScaleAllowed, "<" ) MinWildWindScale = MinWildWindScaleAllowed end + if math.abs( MaxWildWindScale ) > math.abs( MaxWildWindScaleAllowed ) then r( "Wild [Max]", MaxWildWindScale, MaxWildWindScaleAllowed, ">" ) MaxWildWindScale = MaxWildWindScaleAllowed end - if math.abs( MaxThermalLiftWindScale ) > math.abs( MaxActivateThermalWindScaleAllowed ) then r( "Thermal [Max]", MaxThermalLiftWindScale, MaxActivateThermalWindScaleAllowed, ">" ) MaxThermalLiftWindScale = MaxActivateThermalWindScaleAllowed end + if math.abs( MaxThermalLiftWindScale ) > math.abs( MaxActivateThermalWindScaleAllowed ) then r( "Thermal [Max]", MaxThermalLiftWindScale, MaxActivateThermalWindScaleAllowed, ">" ) MaxThermalLiftWindScale = MaxActivateThermalWindScaleAllowed end + + end -- Apply to Entity ( store ) FINOS_AddDataToEntFinTable( Entity, "fin_os__EntWindProperties", { diff --git a/lua/wire/stools/finos_fin.lua b/lua/wire/stools/finos_fin.lua index 9bf179a..7721600 100644 --- a/lua/wire/stools/finos_fin.lua +++ b/lua/wire/stools/finos_fin.lua @@ -8,18 +8,19 @@ if WireToolSetup then language.Add( "tool.wire_finos_fin.name", "FIN OS Tool - Fin Controller (Wire)" ) language.Add( "tool.wire_finos_fin.desc", "Spawns a Fin Controller for use with the wire system." ) - language.Add( "Tool.wire_finos_fin.out_AAP", "Output Attack Angle" ) - language.Add( "Tool.wire_finos_fin.out_AM", "Output Area (meters)" ) - language.Add( "Tool.wire_finos_fin.out_AI", "Output Area (inches)" ) - language.Add( "Tool.wire_finos_fin.out_LFN", "Output Lift Force" ) - language.Add( "Tool.wire_finos_fin.out_DFN", "Output Drag Force" ) - language.Add( "Tool.wire_finos_fin.out_WE", "Output Wind Enabled" ) - language.Add( "Tool.wire_finos_fin.out_WFA", "Output Wind Force Applied" ) - language.Add( "Tool.wire_finos_fin.out_SCALAR", "Output Scalar" ) - language.Add( "Tool.wire_finos_fin.out_SKMH", "Output Speed (kph)" ) - language.Add( "Tool.wire_finos_fin.out_SMPH", "Output Speed (mph)" ) - language.Add( "Tool.wire_finos_fin.out_MPS", "Output Speed (mps)" ) - language.Add( "Tool.wire_finos_fin.out_BT", "Output if Being Tracked" ) + language.Add( "Tool.wire_finos_fin.out_AAP", "Output Angle of Attack (PITCH)" ) + language.Add( "Tool.wire_finos_fin.out_AM", "Output Area [METERS]" ) + language.Add( "Tool.wire_finos_fin.out_AI", "Output Area [INCHES]" ) + language.Add( "Tool.wire_finos_fin.out_LFN", "Output Lift Force" ) + language.Add( "Tool.wire_finos_fin.out_DFN", "Output Drag Force" ) + language.Add( "Tool.wire_finos_fin.out_WE", "Output Wind Enabled" ) + language.Add( "Tool.wire_finos_fin.out_WFA", "Output Wind Force Applied" ) + language.Add( "Tool.wire_finos_fin.out_SCALAR", "Output Scalar" ) + language.Add( "Tool.wire_finos_fin.out_KNOTS", "Output Speed [KNOTS]" ) + language.Add( "Tool.wire_finos_fin.out_SKMH", "Output Speed [KPH]" ) + language.Add( "Tool.wire_finos_fin.out_SMPH", "Output Speed [MPH]" ) + language.Add( "Tool.wire_finos_fin.out_MPS", "Output Speed [MPS]" ) + language.Add( "Tool.wire_finos_fin.out_BT", "Output if Being Tracked" ) TOOL.Information = { { name = "left", text = "Create/Update " .. TOOL.Name } } @@ -40,6 +41,7 @@ if WireToolSetup then self:GetClientNumber( "out_WE" ) ~= 0, self:GetClientNumber( "out_WFA" ) ~= 0, self:GetClientNumber( "out_SCALAR" ) ~= 0, + self:GetClientNumber( "out_KNOTS" ) ~= 0, self:GetClientNumber( "out_SKMH" ) ~= 0, self:GetClientNumber( "out_SMPH" ) ~= 0, self:GetClientNumber( "out_MPS" ) ~= 0, @@ -58,11 +60,12 @@ if WireToolSetup then out_WFA = 1, out_SCALAR = 1, out_AM = 1, - out_AI = 0, + out_AI = 1, + out_KNOTS = 1, out_SKMH = 1, - out_SMPH = 0, - out_MPS = 0, - out_BT = 0 + out_SMPH = 1, + out_MPS = 1, + out_BT = 1 } cleanup.Register( "wire_finos_fin" ) @@ -79,6 +82,7 @@ if WireToolSetup then panel:CheckBox( "#Tool.wire_finos_fin.out_WE", "wire_finos_fin_out_WE" ) panel:CheckBox( "#Tool.wire_finos_fin.out_WFA", "wire_finos_fin_out_WFA" ) panel:CheckBox( "#Tool.wire_finos_fin.out_SCALAR", "wire_finos_fin_out_SCALAR" ) + panel:CheckBox( "#Tool.wire_finos_fin.out_KNOTS", "wire_finos_fin_out_KNOTS" ) panel:CheckBox( "#Tool.wire_finos_fin.out_SKMH", "wire_finos_fin_out_SKMH" ) panel:CheckBox( "#Tool.wire_finos_fin.out_SMPH", "wire_finos_fin_out_SMPH" ) panel:CheckBox( "#Tool.wire_finos_fin.out_MPS", "wire_finos_fin_out_MPS" )