From 7fd4d523091ef24428b19bf47d3f8f1d3c14a648 Mon Sep 17 00:00:00 2001 From: KemGus Date: Sun, 8 Oct 2023 01:37:35 +0300 Subject: [PATCH] New E2/SF functions + SA accuracy buff(again) --- lua/acf/shared/guns/semiauto.lua | 2 +- lua/autorun/acf_globals.lua | 9 +++++---- .../core/custom/acffunctions.lua | 10 ++++++++++ .../core/custom/cl_acfdescriptions.lua | 3 ++- lua/starfall/libs_sv/acf.lua | 18 ++++++++++++++++++ 5 files changed, 36 insertions(+), 6 deletions(-) diff --git a/lua/acf/shared/guns/semiauto.lua b/lua/acf/shared/guns/semiauto.lua index b52096f6..a1f37a22 100644 --- a/lua/acf/shared/guns/semiauto.lua +++ b/lua/acf/shared/guns/semiauto.lua @@ -1,7 +1,7 @@ --define the class ACF_defineGunClass("SA", { type = "Gun", - spread = 0.131, + spread = 0.11, name = "Semiautomatic Cannon", desc = ACFTranslation.GunClasses[12], muzzleflash = "30mm_muzzleflash_noscale", diff --git a/lua/autorun/acf_globals.lua b/lua/autorun/acf_globals.lua index 021cca6b..97356686 100644 --- a/lua/autorun/acf_globals.lua +++ b/lua/autorun/acf_globals.lua @@ -476,19 +476,20 @@ if CLIENT then else local curveFactor = 2.5 local reset_timer = 60 - + ACF.Wind = Vector() timer.Create("ACE_Wind", reset_timer, 0, function() local smokeDir = Vector(math.Rand(-1, 1), math.Rand(-1, 1), 0):GetNormalized() - local wind = (math.random() ^ curveFactor) * smokeDir * GetConVar("acf_wind"):GetFloat() + ACF.Wind = (math.random() ^ curveFactor) * smokeDir * GetConVar("acf_wind"):GetFloat() net.Start("ACE_Wind") - net.WriteFloat(wind.x) - net.WriteFloat(wind.y) + net.WriteFloat(ACF.Wind.x) + net.WriteFloat(ACF.Wind.y) net.Broadcast() end) end + cleanup.Register( "aceexplosives" ) AddCSLuaFile("autorun/acf_missile/folder.lua") diff --git a/lua/entities/gmod_wire_expression2/core/custom/acffunctions.lua b/lua/entities/gmod_wire_expression2/core/custom/acffunctions.lua index 23d0735e..53633f14 100644 --- a/lua/entities/gmod_wire_expression2/core/custom/acffunctions.lua +++ b/lua/entities/gmod_wire_expression2/core/custom/acffunctions.lua @@ -330,6 +330,16 @@ do e2function number acfCurVersion() return ACF.Version end + + --returns global variable about air effectiveness against heat + e2function number acfHEATAirGapFactor() + return ACF.HEATAirGapFactor + end + + --returns acfWindVector + e2function vector acfWindVector() + return ACF.Wind + end end -- [ Engine Functions ] -- diff --git a/lua/entities/gmod_wire_expression2/core/custom/cl_acfdescriptions.lua b/lua/entities/gmod_wire_expression2/core/custom/cl_acfdescriptions.lua index 7237a29c..675e373a 100644 --- a/lua/entities/gmod_wire_expression2/core/custom/cl_acfdescriptions.lua +++ b/lua/entities/gmod_wire_expression2/core/custom/cl_acfdescriptions.lua @@ -22,7 +22,8 @@ E2Helper.Descriptions["acfDragDiv"] = "Returns current ACF drag divisor." E2Helper.Descriptions["acfHeat"] = "Returns heat of an ACF entity." E2Helper.Descriptions["acfVersion"] = "Returns latest git version of ACE." E2Helper.Descriptions["acfCurVersion"] = "Returns current version of ACE." - +E2Helper.Descriptions["acfHEATAirGapFactor"] = "% velocity loss for every meter traveled. 0.2x means HEAT loses 20% of its energy every 2m traveled. 1m is about typical for the sideskirt spaced armor of most tanks." +E2Helper.Descriptions["acfWindVector()"] = "Returns acf wind direction(vector)" --engine E2Helper.Descriptions["acfMaxTorque"] = "Returns the maximum torque (in N/m) of an ACF engine." E2Helper.Descriptions["acfMaxPower"] = "Returns the maximum power (in kW) of an ACF engine." diff --git a/lua/starfall/libs_sv/acf.lua b/lua/starfall/libs_sv/acf.lua index 4f5fef76..0699f4a7 100644 --- a/lua/starfall/libs_sv/acf.lua +++ b/lua/starfall/libs_sv/acf.lua @@ -828,6 +828,24 @@ function acf_library.getCurrentVersion() return version end +--- returns % velocity loss for every meter traveled. 0.2x means HEAT loses 20% of its energy every 2m traveled. 1m is about typical for the sideskirt spaced armor of most tanks. +-- @server +-- @return number +function acf_library.getHEATAirGapFactor() + local airgapfactor = ACF.HEATAirGapFactor + + return airgapfactor +end + +--- Returns acf wind direction(vector) +-- @server +-- @return vector +function acf_library.getWindVector() + local windVector = ACF.Wind + + return windVector +end + ---------------------------------------- -- Entity Methods