diff --git a/lua/acf/client/cl_acfmenu_gui.lua b/lua/acf/client/cl_acfmenu_gui.lua index 82e5eef23..f9af3536e 100644 --- a/lua/acf/client/cl_acfmenu_gui.lua +++ b/lua/acf/client/cl_acfmenu_gui.lua @@ -189,8 +189,9 @@ function PANEL:Init( ) local Mobility = HomeNode:AddNode( "Mobility" , "icon16/car.png" ) --Mobility folder local Engines = Mobility:AddNode( "Engines" , ItemIcon ) - local Gearboxes = Mobility:AddNode( "Gearboxes" , ItemIcon ) - local FuelTanks = Mobility:AddNode( "Fuel Tanks" , ItemIcon ) + local Gearboxes = Mobility:AddNode( "Gearboxes" , "icon16/cog.png" ) + local FuelTanks = Mobility:AddNode( "Fuel Tanks" , "icon16/cog.png" ) + local Radiators = Mobility:AddNode( "Radiators" , "icon16/cog.png" ) local EngineCatNodes = {} --Stores all Engine Cats Nodes (V12, V8, I4, etc) local GearboxCatNodes = {} --Stores all Gearbox Cats Nodes (CVT, Transfer, etc) @@ -273,6 +274,19 @@ function PANEL:Init( ) break end + + -------------------- Radiator folder -------------------- + + --Creates the only button to access to radiator config menu. + for _, RadiatorData in pairs(FinalContainer["Radiators"]) do + + function Radiators:DoClick() + RunConsoleCommand( "acfmenu_type", RadiatorData.type ) + acfmenupanel:UpdateDisplay( RadiatorData ) + end + + break + end end do --[[================================================== diff --git a/lua/acf/server/sv_heat.lua b/lua/acf/server/sv_heat.lua index 344829a19..c10cdcdf0 100644 --- a/lua/acf/server/sv_heat.lua +++ b/lua/acf/server/sv_heat.lua @@ -280,3 +280,78 @@ function ACE_HeatFromEngine( Engine , Radiator ) --radiator?!? woooo end ]]-- +--ACE.AmbientTemp + +--The following functions require any entity involved to: +--Have a specific heat defined +--Have a thermal transfer coefficient defined +--Surface area + +function ACE_GetThermalMass(Ent) + + local Mass = Ent.ThermalMass or -1 + + if Mass == -1 then + local Phys = Ent:GetPhysicsObject() + if Phys:IsValid() then + Mass = Phys:GetMass() + Ent.ThermalMass = Mass + else + Mass = 1000 + end + end + + return Mass +end + +function ACE_AddThermalEnergy(Ent, KJ) --Used to add or remove thermal energy + + local SpecificHeat = Ent.ACESpecificHeat or 0.9211 --Uses specific heat of aluminum if unavailable + local Mass = ACE_GetThermalMass(Ent) + + local DeltaTemp = KJ / SpecificHeat / Mass + + Ent.Heat = (Ent.Heat or ACE.AmbientTemp) + DeltaTemp +end + +function ACE_EqualizeThermalEnergy(Ent1, Ent2) --Instantly balances the thermal energy of 2 objects. Useful for radiators or things one doesn't care for heat transfer rates with. + + local SpecificHeat1 = Ent1.ACESpecificHeat or 0.9211 --Uses specific heat of aluminum if unavailable + local SpecificHeat2 = Ent2.ACESpecificHeat or 0.9211 + + local TMass1 = ACE_GetThermalMass(Ent1) + local TMass2 = ACE_GetThermalMass(Ent2) + local TotalMass = TMass1 + TMass2 + + local Ratio1 = TMass1/TotalMass + local Ratio2 = TMass2/TotalMass + + local AvgSpecificHeat = SpecificHeat1 * Ratio1 + SpecificHeat2 * Ratio2 + + --I LOVE KELVIN AND HAVING TO RECONVERT EVERYTHING 4 TIMES!!!!!!!! :) + + local ThermalEnergy1 = Ent1.Heat * SpecificHeat1 * TMass1 + local ThermalEnergy2 = Ent2.Heat * SpecificHeat2 * TMass2 + local TotalEnergy = ThermalEnergy1 + ThermalEnergy2 + + local FinalTemp = TotalEnergy / AvgSpecificHeat / TotalMass + + Ent1.Heat = FinalTemp + Ent2.Heat = FinalTemp +end + +function ACE_AtmosphericHeatDissipation(Ent, CoolingMultiplier, DeltaTime) --Could be optimized by breaking into more functions. The rate doesn't need to be calculated every iteration riiiiiiiigt? + local ThermalTransferCoefficient = Ent.AtmosphericCoefficient or 5 --5 W / M^2 * K, the thermal transfer coefficient of aluminum to air + local SurfaceArea = Ent.ThermalSurfaceArea --Area in meters squared + + local TempDif = ACE.AmbientTemp - Ent.Heat + + local TransferRate = ThermalTransferCoefficient * SurfaceArea * TempDif * CoolingMultiplier + + --print(TransferRate * DeltaTime * ACF.ThermalTimeScale) + --print(TransferRate * ACF.ThermalTimeScale / DeltaTime / ACF.ThermalTimeScale) --1 Second cooling + ACE_AddThermalEnergy(Ent, TransferRate * DeltaTime * ACF.ThermalTimeScale) +end + + +--AtmosphericHeatExchange with speed-- \ No newline at end of file diff --git a/lua/acf/shared/ammocrates/ammocrates.lua b/lua/acf/shared/ammocrates/ammocrates.lua index ec8e0f367..2af83e893 100644 --- a/lua/acf/shared/ammocrates/ammocrates.lua +++ b/lua/acf/shared/ammocrates/ammocrates.lua @@ -276,3 +276,28 @@ ACE_DefineModelData("Cone",{ return volume end }) + +--Radiator. DefaultSize has issues with 3d vectors. Using external scaling for now. + ACE_DefineModelData("Radiator",{ + + Shape = "Radiator", + Model = "models/radiators/radiator_med.mdl", --Note: The model can be used as ID if needed. + physMaterial = "metal", + DefaultSize = 1, --Maybe later make scalable models support 3d hitboxes? Until then cope with it. + CustomMesh = { --Its a box anyways + { + Vector(17.8875, 2.25, 11.25), + Vector(17.8875, -2.25, 11.25), + Vector(-17.8875, 2.25, 11.25), + Vector(-17.8875, -2.25, 11.25), + Vector(17.8875, 2.25, -11.25), + Vector(17.8875, -2.25, -11.25), + Vector(-17.8875, 2.25, -11.25), + Vector(-17.8875, -2.25, -11.25) + }, + }, + volumefunction = function( L, W, H ) + local volume = L * W * H + return volume + end + }) \ No newline at end of file diff --git a/lua/acf/shared/engines/ace_engine_properties.lua b/lua/acf/shared/engines/ace_engine_properties.lua index cc6e198cc..bc529634e 100644 --- a/lua/acf/shared/engines/ace_engine_properties.lua +++ b/lua/acf/shared/engines/ace_engine_properties.lua @@ -4,40 +4,158 @@ ACF.FuelDensity = { --kg/liter Petrol = 0.745, Electric = 1.35 -- li-ion --WAS 3.1 } +ACF.FuelPowerDensity = { --KJ/liter + Diesel = 38.6, + Petrol = 33.6, + Electric = 1 --TODO: Find conversion units. Fine for now. Electric doesn't generate too much heat to be of concern. +} + + + +ACF.PerFuelRelativeEfficiency = { --Efficiency multipliers when using various fuels + Diesel = 1.375, --42% more fuel efficicient but slightly less(1.02x) kg efficient for a unit of fuel. + Petrol = 1, + Electric = 1 --TODO: Find conversion units. Fine for now. Electric doesn't generate too much heat to be of concern. +} + +--Power density of fuel. They're close enough so we'll use the density of gasoline to give engines the benefit of the doubt. +--This way we score efficiency more on the type of engine and less so fuel which will be seperated. Especially as we're scoring their efficiency as a type. +--local BasePetrol = 1/13 --13kWh per kg gasoline. or ~0.077 kg per kw hr +--local BaseDiesel = 1/12.6 --12.6kWh per kg Diesel. Or ~0.079 kg per kw hr + +local BaseFuel = 1/13 --13kWh per kg or ~0.077 kg per kw hr. The fuel density of gasoline. Diesel is 12.6kWh per kg or ~0.079 kg per kw hr. + +ACF.Efficiency = { --how efficient various engine types are, Final units are in kg/kWhr + GenericPetrol = (BaseFuel / 0.35), --Divide by % efficiency. Was 38%. Needs to be kept for other legacy engines. + GenericDiesel = (BaseFuel / 0.5), --Was 49% efficient. Was 38%. Needs to be kept for other legacy engines. + + Single = (BaseFuel / 0.4), --Divide by % efficiency. Was 38% + I2 = (BaseFuel / 0.395), --Divide by % efficiency. Was 38% + I3 = (BaseFuel / 0.39), --Divide by % efficiency. Was 38% + I4 = (BaseFuel / 0.385), --Divide by % efficiency. Was 38% + I5 = (BaseFuel / 0.38), --Divide by % efficiency. Was 38% + I6 = (BaseFuel / 0.375), --Divide by % efficiency. Was 38% + + B4 = (BaseFuel / 0.365), --Divide by % efficiency. Was 38% + B6 = (BaseFuel / 0.36), --Divide by % efficiency. Was 38% -ACF.Efficiency = { --how efficient various engine types are, higher is worse - GenericPetrol = 0.203, --kg per kw hr - GenericDiesel = 0.162, --up to 0.274 - Turbine = 0.25, -- previously 0.231 - Wankel = 0.223, - Radial = 0.267, -- 0.38 to 0.53 - Electric = 0.6 --percent efficiency converting chemical kw into mechanical kw WAS 0.85 + V2 = (BaseFuel / 0.35), --Divide by % efficiency. Was 38% + V4 = (BaseFuel / 0.345), --Divide by % efficiency. Was 38% + V6 = (BaseFuel / 0.34), --Divide by % efficiency. Was 38% + V8 = (BaseFuel / 0.335), --Divide by % efficiency. Was 38% + V10 = (BaseFuel / 0.33), --Divide by % efficiency. Was 38% + V12 = (BaseFuel / 0.325), --Divide by % efficiency. Was 38% + + Turbine = (BaseFuel / 0.35), --Was 32% efficient. Somewhere between a turboshaft and turbofan. + --Turbofan = (BaseFuel / 0.4), --Was 32% efficient. + GroundTurbine = (BaseFuel / 0.3), --Was 32% efficient. + Wankel = (BaseFuel / 0.25), --Was 34%. Almost on par with regular petrol. Get. Outta. Here. + Radial = (BaseFuel / 0.28), --Was 30% efficient. + + Racing = (BaseFuel / 0.2), --Racing duty engines meant for absurd speeds. Inefficient but power dense as hell. + + Electric = 0.85 --percent efficiency converting chemical kw into mechanical kw WAS 0.85 } ACF.TorqueScale = { --how fast damage drops torque, lower loses more % torque GenericPetrol = 0.25, - GenericDiesel = 0.35, - Turbine = 0.2, + GenericDiesel = 0.5, + + Single = 0.25, + I2 = 0.25, + I3 = 0.275, + I4 = 0.3, + I5 = 0.325, + I6 = 0.35, + + B4 = 0.3, + B6 = 0.325, + + V2 = 0.25, + V4 = 0.275, + V6 = 0.3, + V8 = 0.3, + V10 = 0.325, + V12 = 0.35, + + Turbine = 0.15, + GroundTurbine = 0.2, Wankel = 0.2, Radial = 0.3, - Electric = 0.3 --WAS 0.5 + + Racing = 0.1, + + Electric = 0.2 } ACF.EngineHPMult = { --health multiplier for engines - GenericPetrol = 0.2, - GenericDiesel = 0.5, - Turbine = 0.125, - Wankel = 0.125, - Radial = 0.3, - Electric = 0.75 + + GenericPetrol = 0.15, + GenericDiesel = 0.2, + + Single = 0.1, + I2 = 0.1, + I3 = 0.125, + I4 = 0.15, + I5 = 0.175, + I6 = 0.2, + + B4 = 0.125, + B6 = 0.15, + + V2 = 0.1, + V4 = 0.1, + V6 = 0.125, + V8 = 0.15, + V10 = 0.175, + V12 = 0.2, + + Turbine = 0.05, + GroundTurbine = 0.05, + Wankel = 0.1, + Radial = 0.2, + + Racing = 0.1, + + Electric = 0.1 +} + + +ACF.PerFuelTorqueCurveMul = { --Efficiency multipliers when using various fuels + Diesel = {1,1.64,1.43,1.12,0.9,0.89,0.93}, + Petrol = {1,1,1,1,1,1,1}, + Electric = {1,1,1,1,1,1,1} } --Use this to help design torque curves https://gist.github.com/CheezusChrust/7ccce5f5196d3adc95ab9573009f735a ACF.GenericTorqueCurves = { --Default curves for engines that don't have one defined + GenericPetrol = {0.3, 0.55, 0.7, 0.85, 1, 0.9, 0.7}, - GenericDiesel = {0.3, 0.9, 0.97, 1, 0.95, 0.9, 0.8, 0.65}, - Turbine = {0.8, 1, 0.9, 0.8, 0.6, 0.4, 0.2, 0.1}, + GenericDiesel = {0.3, 0.55, 0.7, 0.85, 1, 0.9, 0.7}, --Needed for legacy and extra engines. It's set the same as petrol because the diesel engines are modified to a diesel torque curve by the fueltype curve. True values = {0.3, 0.97, 1, 0.95, 0.9, 0.8, 0.65} + + Single = {0.4, 0.65, 0.96, 1.0, 0.93, 0.8, 0.71}, + I2 = {0.4, 0.65, 0.96, 1.0, 0.93, 0.8, 0.71}, --Inlines are similar to V-Block engines except with excellent low end torque and a generally more stable powerband. Made up for by being less energy dense. + I3 = {0.4, 0.62, 0.88, 1.0, 0.95, 0.82, 0.73}, + I4 = {0.4, 0.52, 0.74, 0.95, 1.0, 0.85, 0.75}, + I5 = {0.4, 0.49, 0.65, 0.82, 1, 0.92, 0.7}, + I6 = {0.4, 0.48, 0.6, 0.76, 0.95, 1.0, 0.875}, + + B4 = {0.3, 0.48, 0.76, 1, 0.94, 0.74, 0.67}, --Boxer types have a wide torquey band with a narrow peak they produce peak power at. + B6 = {0.35, 0.49, 0.67, 0.87, 1, 0.85, 0.73}, + + V2 = {0.3, 0.65, 0.95, 1.0, 0.91, 0.8, 0.68}, + V4 = {0.3, 0.65, 0.95, 1.0, 0.91, 0.8, 0.68}, --Excellent low end torque and torque over a wide range. But the least peak HP + V6 = {0.35, 0.6, 0.84, 1.0, 0.95, 0.81, 0.7}, --Good torque over a wide range but less high range power + V8 = {0.35, 0.52, 0.72, 0.92, 1.0, 0.85, 0.72}, --Good torque at the upper mid range and a relatively wide range. Results in good horsepower. + V10 = {0.35, 0.49, 0.65, 0.82, 1, 0.92, 0.66}, --A wide but narrower torque band than the V8. Geared slightly more towards peak horsepower. + V12 = {0.3, 0.4, 0.55, 0.72, 0.9, 1.0, 0.875}, --Trades instantaneous torque for higher RPM torque. Best for peak horsepower in the upper range. + + Turbine = {1, 0.9, 0.8, 0.6, 0.4, 0.2, 0.1}, + GroundTurbine = {1, 0.59, 0.58, 0.65, 0.72, 0.66, 0.57}, --Turbine with internal reduction gearing producing instantaneous torque. Reduced from true values because of the fueltype curve. True Values = {1, 0.97, 0.84, 0.73, 0.65, 0.59, 0.529} Wankel = {0.35, 0.7, 0.85, 0.95, 1, 0.9, 0.7}, - Radial = {0.6, 0.75, 0.85, 0.95, 0.98, 0.6}, + Radial = {0.4, 0.5, 0.65, 0.75, 0.95, 1, 0.5}, + + Racing = {0.3, 0.4, 0.55, 0.72, 0.9, 1.0, 0.875}, --Significantly power dense engines designed for peak power output at the cost of longevity. + Electric = {1, 0.99, 0.95, 0.6, 0.2} } diff --git a/lua/acf/shared/engines/b4.lua b/lua/acf/shared/engines/b4.lua index 2a0e342a8..054dd74f3 100644 --- a/lua/acf/shared/engines/b4.lua +++ b/lua/acf/shared/engines/b4.lua @@ -3,34 +3,62 @@ ACF_DefineEngine( "1.4-B4", { name = "1.4L Flat 4 Petrol", - desc = "Small air cooled flat four, most commonly found in nazi insects", + desc = "Small air cooled flat four, most commonly found in nazi insects.", model = "models/engines/b4small.mdl", sound = "acf_engines/b4_petrolsmall.wav", category = "B4", fuel = "Petrol", - enginetype = "GenericPetrol", - weight = 60, - torque = 158, + enginetype = "B4", + weight = 30, + torque = 148, flywheelmass = 0.06, idlerpm = 600, - limitrpm = 4500, - acepoints = 119 + limitrpm = 6500 +} ) + +ACF_DefineEngine( "1.7-B4", { + name = "1.7L Flat 4 Multifuel", + desc = "Torquey mini boxer. Useful in a small buggy.", + model = "models/engines/b4small.mdl", + sound = "acf_engines/b4_petrolsmall.wav", + category = "B4", + fuel = "Multifuel", + enginetype = "B4", + weight = 40, + torque = 208, + flywheelmass = 0.2, + idlerpm = 600, + limitrpm = 4000 } ) ACF_DefineEngine( "2.1-B4", { name = "2.1L Flat 4 Petrol", desc = "Tuned up flat four, probably find this in things that go fast in a desert.", - model = "models/engines/b4small.mdl", + model = "models/engines/b4med.mdl", sound = "acf_engines/b4_petrolmedium.wav", category = "B4", fuel = "Petrol", - enginetype = "GenericPetrol", - weight = 125, - torque = 270, + enginetype = "B4", + weight = 63, + torque = 450, flywheelmass = 0.15, idlerpm = 700, - limitrpm = 5000, - acepoints = 226 + limitrpm = 5000 +} ) + +ACF_DefineEngine( "2.4-B4", { + name = "2.4L Flat 4 Multifuel", + desc = "Small heavy duty multifuel. Heavy, but grunts hard.", + model = "models/engines/b4med.mdl", + sound = "acf_extra/vehiclefx/engines/coh/ba11.wav", + category = "B4", + fuel = "Multifuel", + enginetype = "B4", + weight = 67, + torque = 772, + flywheelmass = 0.4, + idlerpm = 550, + limitrpm = 2800 } ) ACF_DefineEngine( "3.2-B4", { @@ -40,31 +68,15 @@ ACF_DefineEngine( "3.2-B4", { sound = "acf_engines/b4_petrollarge.wav", category = "B4", fuel = "Petrol", - enginetype = "GenericPetrol", - weight = 210, - torque = 378, + enginetype = "B4", + weight = 105, + torque = 450, flywheelmass = 0.15, idlerpm = 900, - limitrpm = 6500, - acepoints = 412 -} ) - -ACF_DefineEngine( "2.4-B4", { - name = "2.4L Flat 4 Multifuel", - desc = "Tiny military-grade multifuel. Heavy, but grunts hard.", - model = "models/engines/b4small.mdl", - sound = "acf_extra/vehiclefx/engines/coh/ba11.wav", - category = "B4", - fuel = "Multifuel", - enginetype = "GenericDiesel", - weight = 135, - torque = 372, - flywheelmass = 0.4, - idlerpm = 550, - limitrpm = 2800, - acepoints = 193 + limitrpm = 6500 } ) +--[[ -- These aren't boxer 4s. They're 3 cylinder(effectively 6 cylinder) opposing piston engines using a B6 model. Dramatically overperforming for their size. Don't even know where to begin to clean this up. ACF_DefineEngine( "7.4-B4", { name = "7.4L Flat 4 Multifuel", desc = "3TD-3. Compact flat APC engine, with good power reserve, but with comparably high consumption. Used in BTR-4s.", @@ -72,13 +84,12 @@ ACF_DefineEngine( "7.4-B4", { sound = "acf_extra/vehiclefx/engines/gnomefather/t71.wav", category = "B4", fuel = "Multifuel", - enginetype = "GenericDiesel", + enginetype = "B4", weight = 800, torque = 2678, flywheelmass = 4.3, idlerpm = 600, - limitrpm = 2800, - acepoints = 1398 + limitrpm = 2800 } ) ACF_DefineEngine( "8.2-B4", { @@ -88,13 +99,12 @@ ACF_DefineEngine( "8.2-B4", { sound = "acf_extra/vehiclefx/engines/gnomefather/t71.wav", category = "B4", fuel = "Multifuel", - enginetype = "GenericDiesel", + enginetype = "B4", weight = 800, torque = 2790, flywheelmass = 4.3, idlerpm = 600, - limitrpm = 2800, - acepoints = 1457 + limitrpm = 2800 } ) ACF_DefineEngine( "14.3-B4", { @@ -104,11 +114,11 @@ ACF_DefineEngine( "14.3-B4", { sound = "acf_extra/vehiclefx/engines/gnomefather/t71.wav", category = "B4", fuel = "Multifuel", - enginetype = "GenericDiesel", + enginetype = "B4", weight = 1620, torque = 4204, flywheelmass = 6.8, idlerpm = 400, - limitrpm = 2600, - acepoints = 2013 + limitrpm = 2600 } ) +]]-- \ No newline at end of file diff --git a/lua/acf/shared/engines/b6.lua b/lua/acf/shared/engines/b6.lua index 0016fb729..71d067248 100644 --- a/lua/acf/shared/engines/b6.lua +++ b/lua/acf/shared/engines/b6.lua @@ -8,13 +8,12 @@ ACF_DefineEngine( "2.8-B6", { sound = "acf_engines/b6_petrolsmall.wav", category = "B6", fuel = "Petrol", - enginetype = "GenericPetrol", - weight = 100, + enginetype = "B6", + weight = 50, torque = 204, flywheelmass = 0.08, idlerpm = 750, - limitrpm = 7250, - acepoints = 247 + limitrpm = 7250 } ) ACF_DefineEngine( "5.0-B6", { @@ -24,13 +23,27 @@ ACF_DefineEngine( "5.0-B6", { sound = "acf_engines/b6_petrolmedium.wav", category = "B6", fuel = "Petrol", - enginetype = "GenericPetrol", - weight = 240, + enginetype = "B6", + weight = 120, torque = 495, flywheelmass = 0.11, idlerpm = 900, - limitrpm = 6800, - acepoints = 564 + limitrpm = 6800 +} ) + +ACF_DefineEngine( "5.4-B6", { + name = "5.4L Flat 6 Multifuel", + desc = "Military-grade multifuel boxer engine. Although heavy, it is compact, durable, and has excellent performance under adverse conditions.", + model = "models/engines/b6med.mdl", + sound = "acf_engines/v8_diesel.wav", + category = "B6", + fuel = "Multifuel", + enginetype = "B6", + weight = 170, + torque = 825, + flywheelmass = 0.65, + idlerpm = 500, + limitrpm = 3500 } ) ACF_DefineEngine( "8.3-B6", { @@ -40,13 +53,12 @@ ACF_DefineEngine( "8.3-B6", { sound = "acf_engines/v8_diesel.wav", category = "B6", fuel = "Multifuel", - enginetype = "GenericDiesel", - weight = 480, + enginetype = "B6", + weight = 240, torque = 848, flywheelmass = 0.65, idlerpm = 500, - limitrpm = 4200, - acepoints = 677 + limitrpm = 4200 } ) ACF_DefineEngine( "10.0-B6", { @@ -56,29 +68,12 @@ ACF_DefineEngine( "10.0-B6", { sound = "acf_engines/b6_petrollarge.wav", category = "B6", fuel = "Petrol", - enginetype = "GenericPetrol", - weight = 650, + enginetype = "B6", + weight = 325, torque = 1575, flywheelmass = 1, idlerpm = 620, - limitrpm = 4500, - acepoints = 1429 -} ) - -ACF_DefineEngine( "5.4-B6", { - name = "5.4L Flat 6 Multifuel", - desc = "Military-grade multifuel boxer engine. Although heavy, it is compact, durable, and has excellent performance under adverse conditions.", - model = "models/engines/b6med.mdl", - sound = "acf_engines/v8_diesel.wav", - category = "B6", - fuel = "Multifuel", - enginetype = "GenericDiesel", - weight = 380, - torque = 825, - flywheelmass = 0.65, - idlerpm = 500, - limitrpm = 3500, - acepoints = 531 + limitrpm = 4500 } ) ACF_DefineEngine( "15.8-B6", { @@ -88,75 +83,55 @@ ACF_DefineEngine( "15.8-B6", { sound = "acf_engines/b6_petrollarge.wav", category = "B6", fuel = "Petrol", - enginetype = "GenericPetrol", - weight = 725, - torque = 1650, + enginetype = "B6", + weight = 363, + torque = 1900, flywheelmass = 1, idlerpm = 620, - limitrpm = 4900, - acepoints = 1354 -} ) - -ACF_DefineEngine( "13.6-B6", { - name = "13.6L Flat 6 Multifuel", - desc = "5TDF. Compact flat tank engine, with great power reserve, but with comparably high consumption. T-64 classic.", - model = "models/engines/b6med.mdl", - sound = "acf_extra/vehiclefx/engines/gnomefather/t64.wav", - category = "B6", - fuel = "Multifuel", - enginetype = "GenericDiesel", - weight = 1040, - torque = 3320, - flywheelmass = 6, - idlerpm = 600, - limitrpm = 2800, - acepoints = 1734 + limitrpm = 4900 } ) ACF_DefineEngine( "20.7-B6", { name = "20.7L Flat 6 Multifuel", - desc = "6TD-1. Not so large flat tank engine, with great power reserve, but with comparably high consumption.", - model = "models/engines/b6med.mdl", + desc = "A compact and torquey boxer engine with great power and torque.", + model = "models/engines/b6large.mdl", sound = "acf_extra/vehiclefx/engines/gnomefather/t64.wav", category = "B6", fuel = "Multifuel", - enginetype = "GenericDiesel", - weight = 1180, - torque = 3908, + enginetype = "B6", + weight = 570, + torque = 3378, flywheelmass = 6.4, idlerpm = 600, - limitrpm = 2800, - acepoints = 2041 + limitrpm = 2800 } ) ACF_DefineEngine( "22.9-B6", { name = "22.9L Flat 6 Multifuel", - desc = "6TD-2E. Large flat tank engine, with big power reserve, but with comparably high consumption", + desc = "Compact monster of a boxer with a fantastic power output and excellent torque for the form.", model = "models/engines/b6xlarge.mdl", sound = "acf_extra/vehiclefx/engines/gnomefather/t64.wav", category = "B6", fuel = "Multifuel", - enginetype = "GenericDiesel", - weight = 1180, - torque = 5512, + enginetype = "B6", + weight = 570, + torque = 6344, flywheelmass = 6.4, idlerpm = 600, - limitrpm = 2600, - acepoints = 2684 + limitrpm = 2600 } ) ACF_DefineEngine( "25.9-B6", { name = "25.9L Flat 6 Multifuel", - desc = "6TD-3, designed by Kharkiv. Large flat tank engine, with really big power reserve, but with monstrous consumption", + desc = "Extremely powerful monster of a mega-boxer engine with enough torque to move a city block.", model = "models/engines/b6huge.mdl", --We really need a huge model for this sound = "acf_extra/vehiclefx/engines/gnomefather/t64.wav", category = "B6", fuel = "Multifuel", - enginetype = "GenericDiesel", - weight = 1220, - torque = 5997, + enginetype = "B6", + weight = 610, + torque = 11997, flywheelmass = 6.6, idlerpm = 600, - limitrpm = 2800, - acepoints = 3132 + limitrpm = 2800 } ) diff --git a/lua/acf/shared/engines/i2.lua b/lua/acf/shared/engines/i2.lua index 3d7021f87..1f577ed9f 100644 --- a/lua/acf/shared/engines/i2.lua +++ b/lua/acf/shared/engines/i2.lua @@ -8,16 +8,28 @@ ACF_DefineEngine( "0.8L-I2", { sound = "acf_engines/i4_diesel2.wav", category = "I2", fuel = "Diesel", - enginetype = "GenericDiesel", - weight = 45, + enginetype = "I2", + weight = 23, torque = 158, flywheelmass = 0.12, idlerpm = 500, - limitrpm = 2950, - acepoints = 87 + limitrpm = 2950 } ) - +ACF_DefineEngine( "0.6L-I2", { + name = "0.6L I2 Petrol", + desc = "Tiny motorbike engine for tearing through dirt.", + model = "models/engines/inline2s.mdl", + sound = "acf_engines/i4_diesel2.wav", + category = "I2", + fuel = "Petrol", + enginetype = "I2", + weight = 15, + torque = 85, + flywheelmass = 0.04, + idlerpm = 500, + limitrpm = 6050 +} ) ACF_DefineEngine( "10.0-I2", { name = "10.0L I2 Diesel", @@ -26,11 +38,10 @@ ACF_DefineEngine( "10.0-I2", { sound = "acf_engines/vtwin_large.wav", category = "I2", fuel = "Diesel", - enginetype = "GenericDiesel", - weight = 800, + enginetype = "I2", + weight = 400, torque = 3000, flywheelmass = 7, idlerpm = 350, - limitrpm = 1200, - acepoints = 685 + limitrpm = 1200 } ) diff --git a/lua/acf/shared/engines/i3.lua b/lua/acf/shared/engines/i3.lua index d6d84d73e..3ed0ac891 100644 --- a/lua/acf/shared/engines/i3.lua +++ b/lua/acf/shared/engines/i3.lua @@ -10,13 +10,12 @@ ACF_DefineEngine( "1.2-I3", { sound = "acf_engines/i4_petrolsmall2.wav", category = "I3", fuel = "Petrol", - enginetype = "GenericPetrol", - weight = 40, + enginetype = "I3", + weight = 20, torque = 142, flywheelmass = 0.05, idlerpm = 1100, - limitrpm = 6000, - acepoints = 144 + limitrpm = 6000 } ) ACF_DefineEngine( "3.4-I3", { @@ -26,13 +25,12 @@ ACF_DefineEngine( "3.4-I3", { sound = "acf_engines/i4_petrolmedium2.wav", category = "I3", fuel = "Petrol", - enginetype = "GenericPetrol", - weight = 170, + enginetype = "I3", + weight = 85, torque = 292, flywheelmass = 0.2, idlerpm = 900, - limitrpm = 6800, - acepoints = 333 + limitrpm = 6800 } ) ACF_DefineEngine( "13.5-I3", { @@ -42,13 +40,12 @@ ACF_DefineEngine( "13.5-I3", { sound = "acf_engines/i4_petrollarge.wav", category = "I3", fuel = "Petrol", - enginetype = "GenericPetrol", - weight = 500, + enginetype = "I3", + weight = 250, torque = 1072, flywheelmass = 3.7, idlerpm = 500, - limitrpm = 3900, - acepoints = 701 + limitrpm = 3900 } ) -- Diesel @@ -60,13 +57,12 @@ ACF_DefineEngine( "1.1-I3", { sound = "acf_engines/i4_diesel2.wav", category = "I3", fuel = "Diesel", - enginetype = "GenericDiesel", - weight = 65, + enginetype = "I3", + weight = 32, torque = 225, flywheelmass = 0.2, idlerpm = 550, - limitrpm = 3000, - acepoints = 126 + limitrpm = 3000 } ) ACF_DefineEngine( "2.8-I3", { @@ -76,13 +72,12 @@ ACF_DefineEngine( "2.8-I3", { sound = "acf_engines/i4_dieselmedium.wav", category = "I3", fuel = "Diesel", - enginetype = "GenericDiesel", - weight = 200, + enginetype = "I3", + weight = 100, torque = 435, flywheelmass = 1, idlerpm = 600, - limitrpm = 3800, - acepoints = 305 + limitrpm = 3800 } ) ACF_DefineEngine( "11.0-I3", { @@ -92,11 +87,10 @@ ACF_DefineEngine( "11.0-I3", { sound = "acf_engines/i4_diesellarge.wav", category = "I3", fuel = "Diesel", - enginetype = "GenericDiesel", - weight = 650, + enginetype = "I3", + weight = 325, torque = 1800, flywheelmass = 5, idlerpm = 550, - limitrpm = 2000, - acepoints = 682 + limitrpm = 2000 } ) diff --git a/lua/acf/shared/engines/i4.lua b/lua/acf/shared/engines/i4.lua index c09e2183c..5e13ca4d9 100644 --- a/lua/acf/shared/engines/i4.lua +++ b/lua/acf/shared/engines/i4.lua @@ -10,13 +10,12 @@ ACF_DefineEngine( "1.5-I4", { sound = "acf_engines/i4_petrolsmall2.wav", category = "I4", fuel = "Petrol", - enginetype = "GenericPetrol", - weight = 50, + enginetype = "I4", + weight = 67, torque = 135, flywheelmass = 0.06, idlerpm = 900, - limitrpm = 7500, - acepoints = 170 + limitrpm = 7500 } ) ACF_DefineEngine( "3.7-I4", { @@ -26,13 +25,12 @@ ACF_DefineEngine( "3.7-I4", { sound = "acf_engines/i4_petrolmedium2.wav", category = "I4", fuel = "Petrol", - enginetype = "GenericPetrol", - weight = 200, + enginetype = "I4", + weight = 100, torque = 360, flywheelmass = 0.2, idlerpm = 900, - limitrpm = 6500, - acepoints = 394 + limitrpm = 6500 } ) ACF_DefineEngine( "16.0-I4", { @@ -42,13 +40,12 @@ ACF_DefineEngine( "16.0-I4", { sound = "acf_engines/i4_petrollarge.wav", category = "I4", fuel = "Petrol", - enginetype = "GenericPetrol", - weight = 600, + enginetype = "I4", + weight = 300, torque = 1275, flywheelmass = 4, idlerpm = 500, - limitrpm = 3500, - acepoints = 750 + limitrpm = 3500 } ) -- Diesel @@ -60,13 +57,12 @@ ACF_DefineEngine( "1.6-I4", { sound = "acf_engines/i4_diesel2.wav", category = "I4", fuel = "Diesel", - enginetype = "GenericDiesel", - weight = 90, + enginetype = "I4", + weight = 45, torque = 225, flywheelmass = 0.2, idlerpm = 650, - limitrpm = 5000, - acepoints = 207 + limitrpm = 5000 } ) ACF_DefineEngine( "3.1-I4", { @@ -76,13 +72,12 @@ ACF_DefineEngine( "3.1-I4", { sound = "acf_engines/i4_dieselmedium.wav", category = "I4", fuel = "Diesel", - enginetype = "GenericDiesel", - weight = 250, + enginetype = "I4", + weight = 125, torque = 480, flywheelmass = 1, idlerpm = 500, - limitrpm = 4000, - acepoints = 352 + limitrpm = 4000 } ) ACF_DefineEngine( "15.0-I4", { @@ -92,11 +87,10 @@ ACF_DefineEngine( "15.0-I4", { sound = "acf_engines/i4_diesellarge.wav", category = "I4", fuel = "Diesel", - enginetype = "GenericDiesel", - weight = 800, + enginetype = "I4", + weight = 400, torque = 2100, flywheelmass = 5, idlerpm = 450, - limitrpm = 2100, - acepoints = 822 + limitrpm = 2100 } ) diff --git a/lua/acf/shared/engines/i5.lua b/lua/acf/shared/engines/i5.lua index c741c07ad..b82fbb5e3 100644 --- a/lua/acf/shared/engines/i5.lua +++ b/lua/acf/shared/engines/i5.lua @@ -10,13 +10,12 @@ ACF_DefineEngine( "2.3-I5", { sound = "acf_engines/i5_petrolsmall.wav", category = "I5", fuel = "Petrol", - enginetype = "GenericPetrol", - weight = 100, + enginetype = "I5", + weight = 50, torque = 188, flywheelmass = 0.12, idlerpm = 900, - limitrpm = 7000, - acepoints = 219 + limitrpm = 7000 } ) ACF_DefineEngine( "3.9-I5", { @@ -26,13 +25,12 @@ ACF_DefineEngine( "3.9-I5", { sound = "acf_engines/i5_petrolmedium.wav", category = "I5", fuel = "Petrol", - enginetype = "GenericPetrol", - weight = 250, + enginetype = "I5", + weight = 125, torque = 412, flywheelmass = 0.25, idlerpm = 700, - limitrpm = 6500, - acepoints = 447 + limitrpm = 6500 } ) -- Diesel @@ -44,13 +42,12 @@ ACF_DefineEngine( "2.9-I5", { sound = "acf_engines/i5_dieselsmall2.wav", category = "I5", fuel = "Diesel", - enginetype = "GenericDiesel", - weight = 130, + enginetype = "I5", + weight = 65, torque = 270, flywheelmass = 0.5, idlerpm = 500, - limitrpm = 4200, - acepoints = 207 + limitrpm = 4200 } ) ACF_DefineEngine( "4.1-I5", { @@ -60,11 +57,10 @@ ACF_DefineEngine( "4.1-I5", { sound = "acf_engines/i5_dieselmedium.wav", category = "I5", fuel = "Diesel", - enginetype = "GenericDiesel", - weight = 400, + enginetype = "I5", + weight = 200, torque = 660, flywheelmass = 1.5, idlerpm = 650, - limitrpm = 3800, - acepoints = 464 + limitrpm = 3800 } ) diff --git a/lua/acf/shared/engines/i6.lua b/lua/acf/shared/engines/i6.lua index efcebbd47..e5a0072c3 100644 --- a/lua/acf/shared/engines/i6.lua +++ b/lua/acf/shared/engines/i6.lua @@ -10,13 +10,12 @@ ACF_DefineEngine( "2.2-I6", { sound = "acf_engines/l6_petrolsmall2.wav", category = "I6", fuel = "Petrol", - enginetype = "GenericPetrol", - weight = 120, + enginetype = "I6", + weight = 60, torque = 195, flywheelmass = 0.1, idlerpm = 800, - limitrpm = 7200, - acepoints = 235 + limitrpm = 7200 } ) ACF_DefineEngine( "4.8-I6", { @@ -26,13 +25,12 @@ ACF_DefineEngine( "4.8-I6", { sound = "acf_engines/l6_petrolmedium.wav", category = "I6", fuel = "Petrol", - enginetype = "GenericPetrol", - weight = 300, + enginetype = "I6", + weight = 150, torque = 540, flywheelmass = 0.2, idlerpm = 900, - limitrpm = 5500, - acepoints = 501 + limitrpm = 5500 } ) ACF_DefineEngine( "17.2-I6", { @@ -42,13 +40,12 @@ ACF_DefineEngine( "17.2-I6", { sound = "acf_engines/l6_petrollarge2.wav", category = "I6", fuel = "Petrol", - enginetype = "GenericPetrol", - weight = 850, + enginetype = "I6", + weight = 425, torque = 1440, flywheelmass = 2.5, idlerpm = 800, - limitrpm = 4250, - acepoints = 1039 + limitrpm = 4250 } ) -- Diesel @@ -60,13 +57,12 @@ ACF_DefineEngine( "3.0-I6", { sound = "acf_engines/l6_dieselsmall.wav", category = "I6", fuel = "Diesel", - enginetype = "GenericDiesel", - weight = 150, + enginetype = "I6", + weight = 75, torque = 300, flywheelmass = 0.5, idlerpm = 650, - limitrpm = 4500, - acepoints = 249 + limitrpm = 4500 } ) ACF_DefineEngine( "6.5-I6", { @@ -76,13 +72,12 @@ ACF_DefineEngine( "6.5-I6", { sound = "acf_engines/l6_dieselmedium4.wav", category = "I6", fuel = "Diesel", - enginetype = "GenericDiesel", - weight = 450, + enginetype = "I6", + weight = 225, torque = 780, flywheelmass = 1.5, idlerpm = 600, - limitrpm = 4000, - acepoints = 573 + limitrpm = 4000 } ) ACF_DefineEngine( "20.0-I6", { @@ -92,11 +87,10 @@ ACF_DefineEngine( "20.0-I6", { sound = "acf_engines/l6_diesellarge2.wav", category = "I6", fuel = "Diesel", - enginetype = "GenericDiesel", - weight = 1200, + enginetype = "I6", + weight = 600, torque = 2550, flywheelmass = 8, idlerpm = 400, - limitrpm = 2600, - acepoints = 1222 + limitrpm = 2600 } ) diff --git a/lua/acf/shared/engines/radial.lua b/lua/acf/shared/engines/radial.lua index 767a97736..4c4eb8be1 100644 --- a/lua/acf/shared/engines/radial.lua +++ b/lua/acf/shared/engines/radial.lua @@ -9,12 +9,11 @@ ACF_DefineEngine( "3.8-R7", { category = "Radial", fuel = "Petrol", enginetype = "Radial", - weight = 105, + weight = 53, torque = 582, flywheelmass = 0.22, idlerpm = 700, - limitrpm = 4800, - acepoints = 394 + limitrpm = 4800 } ) ACF_DefineEngine( "11.0-R7", { @@ -25,12 +24,11 @@ ACF_DefineEngine( "11.0-R7", { category = "Radial", fuel = "Petrol", enginetype = "Radial", - weight = 190, + weight = 95, torque = 1050, flywheelmass = 0.45, idlerpm = 600, - limitrpm = 4400, - acepoints = 652 + limitrpm = 4400 } ) ACF_DefineEngine( "24.0-R7", { @@ -41,12 +39,11 @@ ACF_DefineEngine( "24.0-R7", { category = "Radial", fuel = "Petrol", enginetype = "Radial", - weight = 475, + weight = 238, torque = 3027, flywheelmass = 3.4, idlerpm = 750, - limitrpm = 3500, - acepoints = 1526 + limitrpm = 3500 } ) @@ -58,10 +55,9 @@ ACF_DefineEngine( "8.0-R7", { category = "Radial", fuel = "Multifuel", enginetype = "GenericDiesel", - weight = 225, + weight = 112, torque = 1500, flywheelmass = 1.0, idlerpm = 400, - limitrpm = 2800, - acepoints = 618 + limitrpm = 2800 } ) diff --git a/lua/acf/shared/engines/rotary.lua b/lua/acf/shared/engines/rotary.lua index b2f99950e..4d3791be1 100644 --- a/lua/acf/shared/engines/rotary.lua +++ b/lua/acf/shared/engines/rotary.lua @@ -9,12 +9,11 @@ ACF_DefineEngine( "900cc-R", { category = "Rotary", fuel = "Petrol", enginetype = "Wankel", - weight = 50, + weight = 35, torque = 117, flywheelmass = 0.06, - idlerpm = 950, - limitrpm = 9200, - acepoints = 179 + idlerpm = 1200, + limitrpm = 9500 } ) ACF_DefineEngine( "1.3L-R", { @@ -25,12 +24,11 @@ ACF_DefineEngine( "1.3L-R", { category = "Rotary", fuel = "Petrol", enginetype = "Wankel", - weight = 140, + weight = 43, torque = 186, flywheelmass = 0.06, - idlerpm = 950, - limitrpm = 9000, - acepoints = 280 + idlerpm = 1200, + limitrpm = 9450 } ) ACF_DefineEngine( "2.0L-R", { @@ -41,10 +39,24 @@ ACF_DefineEngine( "2.0L-R", { category = "Rotary", fuel = "Petrol", enginetype = "Wankel", - weight = 200, + weight = 54, torque = 282, flywheelmass = 0.1, - idlerpm = 950, - limitrpm = 9500, - acepoints = 447 + idlerpm = 1200, + limitrpm = 9430 } ) + +ACF_DefineEngine( "2.6L-Wankel", { + name = "2.6L Rotary", + desc = "4 rotor racing Wankel, high revving and high strung.", + model = "models/engines/wankel_4_med.mdl", + sound = "acf_engines/wankel_large.wav", + category = "Rotary", + fuel = "Petrol", + enginetype = "Wankel", + weight = 76, + torque = 460, + flywheelmass = 0.11, + idlerpm = 1200, + limitrpm = 9330 +} ) \ No newline at end of file diff --git a/lua/acf/shared/engines/single.lua b/lua/acf/shared/engines/single.lua index bada78604..5a0df68b9 100644 --- a/lua/acf/shared/engines/single.lua +++ b/lua/acf/shared/engines/single.lua @@ -8,13 +8,12 @@ ACF_DefineEngine( "0.25-I1", { sound = "acf_engines/i1_small.wav", category = "Single", fuel = "Petrol", - enginetype = "GenericPetrol", - weight = 15, + enginetype = "Single", + weight = 8, torque = 30, flywheelmass = 0.005, idlerpm = 1200, - limitrpm = 7500, - acepoints = 37 + limitrpm = 7500 } ) ACF_DefineEngine( "0.5-I1", { @@ -24,13 +23,12 @@ ACF_DefineEngine( "0.5-I1", { sound = "acf_engines/i1_medium.wav", category = "Single", fuel = "Petrol", - enginetype = "GenericPetrol", - weight = 20, + enginetype = "Single", + weight = 10, torque = 60, flywheelmass = 0.005, idlerpm = 900, - limitrpm = 8000, - acepoints = 79 + limitrpm = 8000 } ) ACF_DefineEngine( "1.3-I1", { @@ -40,11 +38,10 @@ ACF_DefineEngine( "1.3-I1", { sound = "acf_engines/i1_large.wav", category = "Single", fuel = "Petrol", - enginetype = "GenericPetrol", - weight = 50, + enginetype = "Single", + weight = 25, torque = 135, flywheelmass = 0.1, idlerpm = 600, - limitrpm = 6700, - acepoints = 151 + limitrpm = 6700 } ) diff --git a/lua/acf/shared/engines/special.lua b/lua/acf/shared/engines/special.lua index 967f42144..dbfc0ec0f 100644 --- a/lua/acf/shared/engines/special.lua +++ b/lua/acf/shared/engines/special.lua @@ -8,13 +8,12 @@ ACF_DefineEngine( "0.9L-I2", { sound = "acf_extra/vehiclefx/engines/ponyengine.wav", category = "Special", fuel = "Petrol", - enginetype = "GenericPetrol", - weight = 60, + enginetype = "I2", + weight = 15, torque = 174, flywheelmass = 0.085, idlerpm = 750, - limitrpm = 6000, - acepoints = 219 + limitrpm = 6000 } ) ACF_DefineEngine( "1.0L-I4", { @@ -25,13 +24,12 @@ ACF_DefineEngine( "1.0L-I4", { pitch = 75, category = "Special", fuel = "Petrol", - enginetype = "GenericPetrol", - weight = 78, + enginetype = "I4", + weight = 20, torque = 102, flywheelmass = 0.031, idlerpm = 1200, - limitrpm = 12000, - acepoints = 254 + limitrpm = 12000 } ) ACF_DefineEngine( "1.8L-V4", { @@ -41,29 +39,27 @@ ACF_DefineEngine( "1.8L-V4", { sound = "acf_extra/vehiclefx/engines/l4/elan_onlow.WAV", category = "Special", fuel = "Petrol", - enginetype = "GenericPetrol", - weight = 92, + enginetype = "V4", + weight = 70, torque = 186.8, flywheelmass = 0.04, idlerpm = 900, - limitrpm = 7500, - acepoints = 294 + limitrpm = 7500 } ) ACF_DefineEngine( "1.9L-I4", { name = "1.9L I4 Petrol", - desc = "Supercharged racing 4 cylinder, most of the power in the high revs.", + desc = "Racing 4 cylinder, most of the power in the high revs.", model = "models/engines/inline4s.mdl", sound = "acf_engines/i4_special.wav", category = "Special", fuel = "Petrol", - enginetype = "GenericPetrol", - weight = 150, + enginetype = "I4", + weight = 60, torque = 264, flywheelmass = 0.06, idlerpm = 950, - limitrpm = 9000, - acepoints = 496 + limitrpm = 9000 } ) ACF_DefineEngine( "2.4L-V6", { @@ -73,29 +69,12 @@ ACF_DefineEngine( "2.4L-V6", { sound = "acf_extra/vehiclefx/engines/l6/capri_onmid.WAV", category = "Special", fuel = "Petrol", - enginetype = "GenericPetrol", - weight = 134, + enginetype = "V6", + weight = 234, torque = 258, flywheelmass = 0.075, idlerpm = 950, - limitrpm = 8000, - acepoints = 431 -} ) - -ACF_DefineEngine( "2.6L-Wankel", { - name = "2.6L Rotary", - desc = "4 rotor racing Wankel, high revving and high strung.", - model = "models/engines/wankel_4_med.mdl", - sound = "acf_engines/wankel_large.wav", - category = "Special", - fuel = "Petrol", - enginetype = "Wankel", - weight = 260, - torque = 375, - flywheelmass = 0.11, - idlerpm = 1200, - limitrpm = 9500, - acepoints = 745 + limitrpm = 8000 } ) ACF_DefineEngine( "2.9-V8", { @@ -105,30 +84,12 @@ ACF_DefineEngine( "2.9-V8", { sound = "acf_engines/v8_special.wav", category = "Special", fuel = "Petrol", - enginetype = "GenericPetrol", - weight = 180, + enginetype = "V8", + weight = 140, torque = 300, flywheelmass = 0.075, idlerpm = 1000, - limitrpm = 10000, - acepoints = 500 -} ) - -ACF_DefineEngine( "3.0-V12", { - name = "3.0L V12 Petrol", - desc = "A purpose-built racing v12, not known for longevity.", - model = "models/engines/v12s.mdl", - sound = "acf_extra/vehiclefx/engines/v12/gtb4_onmid.WAV", - pitch = 85, - category = "Special", - fuel = "Petrol", - enginetype = "GenericPetrol", - weight = 175, - torque = 372, - flywheelmass = 0.1, - idlerpm = 1200, - limitrpm = 12500, - acepoints = 969 + limitrpm = 10000 } ) ACF_DefineEngine( "3.8-I6", { @@ -138,43 +99,86 @@ ACF_DefineEngine( "3.8-I6", { sound = "acf_engines/l6_special.wav", category = "Special", fuel = "Petrol", - enginetype = "GenericPetrol", - weight = 180, + enginetype = "I6", + weight = 130, torque = 336, flywheelmass = 0.1, idlerpm = 1100, - limitrpm = 9000, - acepoints = 634 + limitrpm = 9000 +} ) + +ACF_DefineEngine( "7.2-V8", { + name = "7.2L V8 Petrol", + desc = "Very high revving, glorious v8 of ear rapetasticalness.", + model = "models/engines/v8m.mdl", + sound = "acf_engines/v8_special2.wav", + category = "Special", + fuel = "Petrol", + enginetype = "V8", + weight = 160, + torque = 510, + flywheelmass = 0.15, + idlerpm = 1000, + limitrpm = 8500 } ) ACF_DefineEngine( "5.3-V10", { name = "5.3L V10 Special", - desc = "Extreme performance v10", + desc = "De-limited V10 of ridiculous revving goodness. Born to race. Expect to overheat and explode.", model = "models/engines/v10sml.mdl", sound = "acf_engines/v10_special.wav", category = "Special", fuel = "Petrol", - enginetype = "GenericPetrol", - weight = 300, + enginetype = "Racing", + weight = 135, torque = 480, - flywheelmass = 0.15, + flywheelmass = 0.2, idlerpm = 1100, - limitrpm = 9000, - acepoints = 904 + limitrpm = 12000 } ) -ACF_DefineEngine( "7.2-V8", { - name = "7.2L V8 Petrol", - desc = "Very high revving, glorious v8 of ear rapetasticalness.", - model = "models/engines/v8m.mdl", - sound = "acf_engines/v8_special2.wav", +ACF_DefineEngine( "2.4-V10", { + name = "2.4L V10 Petrol", + desc = "High revving F1-grade racing engine. You will combust into flames without cooling.", + model = "models/engines/v10sml.mdl", + sound = "acf_engines/v10_special.wav", category = "Special", fuel = "Petrol", - enginetype = "GenericPetrol", - weight = 400, - torque = 510, - flywheelmass = 0.15, + enginetype = "Racing", + weight = 106, + torque = 260, + flywheelmass = 0.05, idlerpm = 1000, - limitrpm = 8500, - acepoints = 906 + limitrpm = 19100 } ) + +ACF_DefineEngine( "3.0-V12", { + name = "3.0L V12 Petrol", + desc = "A purpose-built racing v12. An energy-dense fuel guzzling monster with little hope for longevity rumored to be as hot as the sun.", + model = "models/engines/v12s.mdl", + sound = "acf_extra/vehiclefx/engines/v12/gtb4_onmid.WAV", + pitch = 85, + category = "Special", + fuel = "Petrol", + enginetype = "Racing", + weight = 120, + torque = 350, + flywheelmass = 0.1, + idlerpm = 1000, + limitrpm = 15000 +} ) + +ACF_DefineEngine( "25.0-V12", { + name = "25.0L V12 Petrol", + desc = "Aero-grade V-12 bored out by a racing nutjob. Has an absurd RPM despite its massive bore. Don't get cooked by the ludicrous heat output.", + model = "models/engines/v12l.mdl", + sound = "acf_engines/v12_petrollarge.wav", + category = "Special", + fuel = "Petrol", + enginetype = "Racing", + weight = 600, + torque = 1650, + flywheelmass = 3, + idlerpm = 500, + limitrpm = 5000 +} ) \ No newline at end of file diff --git a/lua/acf/shared/engines/turbine.lua b/lua/acf/shared/engines/turbine.lua index 8d05b7996..2e8ab608c 100644 --- a/lua/acf/shared/engines/turbine.lua +++ b/lua/acf/shared/engines/turbine.lua @@ -9,7 +9,7 @@ ACF_DefineEngine( "Turbine-Small-Trans", { category = "Turbine", fuel = "Multifuel", enginetype = "Turbine", - weight = 160, + weight = 80, torque = 660, flywheelmass = 2.3, idlerpm = 1400, @@ -28,7 +28,7 @@ ACF_DefineEngine( "Turbine-Medium-Trans", { category = "Turbine", fuel = "Multifuel", enginetype = "Turbine", - weight = 320, + weight = 160, torque = 975, flywheelmass = 3.4, idlerpm = 1800, @@ -47,7 +47,7 @@ ACF_DefineEngine( "Turbine-Large-Trans", { category = "Turbine", fuel = "Multifuel", enginetype = "Turbine", - weight = 880, + weight = 440, torque = 2388, flywheelmass = 8.4, idlerpm = 2000, @@ -66,7 +66,7 @@ ACF_DefineEngine( "Turbine-Small", { category = "Turbine", fuel = "Multifuel", enginetype = "Turbine", - weight = 200, + weight = 100, torque = 825, flywheelmass = 2.9, idlerpm = 1400, @@ -84,7 +84,7 @@ ACF_DefineEngine( "Turbine-Medium", { category = "Turbine", fuel = "Multifuel", enginetype = "Turbine", - weight = 400, + weight = 200, torque = 1220, flywheelmass = 4.3, idlerpm = 1800, @@ -102,7 +102,7 @@ ACF_DefineEngine( "Turbine-Large", { category = "Turbine", fuel = "Multifuel", enginetype = "Turbine", - weight = 1100, + weight = 550, torque = 2985, flywheelmass = 10.5, idlerpm = 2000, @@ -121,8 +121,8 @@ ACF_DefineEngine( "Turbine-Ground-Small", { sound = "acf_engines/turbine_small.wav", category = "Turbine", fuel = "Multifuel", - enginetype = "Turbine", - weight = 350, + enginetype = "GroundTurbine", + weight = 175, torque = 1200, flywheelmass = 14.3, idlerpm = 700, @@ -139,8 +139,8 @@ ACF_DefineEngine( "Turbine-Ground-Medium", { sound = "acf_engines/turbine_medium.wav", category = "Turbine", fuel = "Multifuel", - enginetype = "Turbine", --This is done to give proper fuel consumption and make the turbines not instant-torque from idle - weight = 600, + enginetype = "GroundTurbine", --This is done to give proper fuel consumption and make the turbines not instant-torque from idle + weight = 300, torque = 1800, flywheelmass = 29.6, idlerpm = 600, @@ -158,8 +158,8 @@ ACF_DefineEngine( "Turbine-Ground-Large", { sound = "acf_engines/turbine_large.wav", category = "Turbine", fuel = "Multifuel", - enginetype = "Turbine", - weight = 1650, + enginetype = "GroundTurbine", + weight = 825, torque = 6000, flywheelmass = 75, idlerpm = 500, @@ -179,8 +179,8 @@ ACF_DefineEngine( "Turbine-Small-Ground-Trans", { sound = "acf_engines/turbine_small.wav", category = "Turbine", fuel = "Multifuel", - enginetype = "Turbine", - weight = 280, + enginetype = "GroundTurbine", + weight = 140, torque = 900, flywheelmass = 11.4, idlerpm = 700, @@ -198,8 +198,8 @@ ACF_DefineEngine( "Turbine-Medium-Ground-Trans", { sound = "acf_engines/turbine_medium.wav", category = "Turbine", fuel = "Multifuel", - enginetype = "Turbine", - weight = 480, + enginetype = "GroundTurbine", + weight = 240, torque = 1350, flywheelmass = 23.7, idlerpm = 600, @@ -218,8 +218,8 @@ ACF_DefineEngine( "Turbine-Large-Ground-Trans", { sound = "acf_engines/turbine_large.wav", category = "Turbine", fuel = "Multifuel", - enginetype = "Turbine", - weight = 1320, + enginetype = "GroundTurbine", + weight = 655, torque = 4500, flywheelmass = 60, idlerpm = 500, @@ -231,30 +231,6 @@ ACF_DefineEngine( "Turbine-Large-Ground-Trans", { acepoints = 3620 } ) - - - -ACF_DefineEngine( "(+)Turbine-Small-SuperAero", { - name = "(+)Turboshaft, Small", - desc = "Gaghr Aerobine, notorious for being used in littlebirds. Experimental.", - model = "models/engines/gasturbine_s.mdl", - sound = "acf_engines/turbine_small.wav", - category = "Turbine", - fuel = "Multifuel", - enginetype = "Turbine", - weight = 72, - torque = 525, - flywheelmass = 0.5, - idlerpm = 1000, - limitrpm = 14000, - iselec = true, - pitch = 70, - flywheeloverride = 12000, - acepoints = 635 -} ) - - - ACF_DefineEngine( "AGT 1500 Large Turbine", { name = "AGT 1500 Large Turbine", desc = "The gas turbine used in the M1 Abrams. Low output RPM due to an internal reduction gearbox. Plenty of low end torque and a wide powerband.", @@ -262,10 +238,9 @@ ACF_DefineEngine( "AGT 1500 Large Turbine", { sound = "acf_extra/vehiclefx/engines/abrams.wav", category = "Turbine", fuel = "Multifuel", - enginetype = "Turbine", - weight = 2500, + enginetype = "GroundTurbine", + weight = 1250, torque = 6780, - torquecurve = {1, 0.82, 0.65, 0.529}, flywheelmass = 10.5, idlerpm = 300, limitrpm = 3000, diff --git a/lua/acf/shared/engines/v10.lua b/lua/acf/shared/engines/v10.lua index 7d9709b31..015a8ea8b 100644 --- a/lua/acf/shared/engines/v10.lua +++ b/lua/acf/shared/engines/v10.lua @@ -7,7 +7,7 @@ ACF_DefineEngine( "4.3-V10", { sound = "acf_engines/v10_petrolsmall.wav", category = "V10", fuel = "Petrol", - enginetype = "GenericPetrol", + enginetype = "V10", weight = 160, torque = 432, flywheelmass = 0.2, @@ -23,7 +23,7 @@ ACF_DefineEngine( "8.0-V10", { sound = "acf_engines/v10_petrolmedium.wav", category = "V10", fuel = "Petrol", - enginetype = "GenericPetrol", + enginetype = "V10", weight = 300, torque = 735, flywheelmass = 0.5, @@ -39,7 +39,7 @@ ACF_DefineEngine( "22.0-V10", { sound = "acf_engines/v10_diesellarge.wav", category = "V10", fuel = "Multifuel", - enginetype = "GenericDiesel", + enginetype = "V10", weight = 1600, torque = 3908, flywheelmass = 5, @@ -54,7 +54,7 @@ ACF_DefineEngine( "23.0-V10", { sound = "acf_engines/v10_petrolmedium.wav", category = "V10", fuel = "Petrol", - enginetype = "GenericPetrol", + enginetype = "V10", weight = 2110, torque = 1800, flywheelmass = 0.45, diff --git a/lua/acf/shared/engines/v2.lua b/lua/acf/shared/engines/v2.lua index 9f7b57711..9dfbbfeed 100644 --- a/lua/acf/shared/engines/v2.lua +++ b/lua/acf/shared/engines/v2.lua @@ -8,7 +8,7 @@ ACF_DefineEngine( "0.6-V2", { sound = "acf_engines/vtwin_small.wav", category = "V-Twin", fuel = "Petrol", - enginetype = "GenericPetrol", + enginetype = "V2", weight = 30, torque = 75, flywheelmass = 0.01, @@ -24,7 +24,7 @@ ACF_DefineEngine( "1.2-V2", { sound = "acf_engines/vtwin_medium.wav", category = "V-Twin", fuel = "Petrol", - enginetype = "GenericPetrol", + enginetype = "V2", weight = 50, torque = 128, flywheelmass = 0.02, @@ -40,7 +40,7 @@ ACF_DefineEngine( "2.4-V2", { sound = "acf_engines/vtwin_large.wav", category = "V-Twin", fuel = "Petrol", - enginetype = "GenericPetrol", + enginetype = "V2", weight = 100, torque = 240, flywheelmass = 0.075, diff --git a/lua/acf/shared/engines/v4.lua b/lua/acf/shared/engines/v4.lua index ab572ab9f..42561f732 100644 --- a/lua/acf/shared/engines/v4.lua +++ b/lua/acf/shared/engines/v4.lua @@ -10,7 +10,7 @@ ACF_DefineEngine( "1.9L-V4", { sound = "acf_engines/i4_diesel2.wav", category = "V4", fuel = "Diesel", - enginetype = "GenericDiesel", + enginetype = "V4", weight = 110, torque = 248, flywheelmass = 0.3, @@ -26,7 +26,7 @@ ACF_DefineEngine( "3.3L-V4", { sound = "acf_engines/i4_dieselmedium.wav", category = "V4", fuel = "Diesel", - enginetype = "GenericDiesel", + enginetype = "V4", weight = 275, torque = 720, flywheelmass = 1.05, diff --git a/lua/acf/shared/engines/v6.lua b/lua/acf/shared/engines/v6.lua index 1a8017810..b8c4510ff 100644 --- a/lua/acf/shared/engines/v6.lua +++ b/lua/acf/shared/engines/v6.lua @@ -5,7 +5,7 @@ ACF_DefineEngine( "3.6-V6", { sound = "acf_engines/v6_petrolsmall.wav", category = "V6", fuel = "Petrol", - enginetype = "GenericPetrol", + enginetype = "V6", weight = 190, torque = 380, flywheelmass = 0.25, @@ -21,7 +21,7 @@ ACF_DefineEngine( "6.2-V6", { sound = "acf_engines/v6_petrolmedium.wav", category = "V6", fuel = "Petrol", - enginetype = "GenericPetrol", + enginetype = "V6", weight = 360, torque = 708, flywheelmass = 0.45, @@ -37,7 +37,7 @@ ACF_DefineEngine( "5.2-V6", { sound = "acf_engines/i5_dieselmedium.wav", category = "V6", fuel = "Multifuel", - enginetype = "GenericDiesel", + enginetype = "V6", weight = 520, torque = 728, flywheelmass = 0.8, @@ -53,7 +53,7 @@ ACF_DefineEngine( "12.0-V6", { sound = "acf_engines/v6_petrollarge.wav", category = "V6", fuel = "Petrol", - enginetype = "GenericPetrol", + enginetype = "V6", weight = 675, torque = 2168, flywheelmass = 4, @@ -69,7 +69,7 @@ ACF_DefineEngine( "15.0-V6", { sound = "acf_engines/v6_diesellarge.wav", category = "V6", fuel = "Multifuel", - enginetype = "GenericDiesel", + enginetype = "V6", weight = 900, torque = 2650, flywheelmass = 6.4, diff --git a/lua/acf/shared/engines/v8.lua b/lua/acf/shared/engines/v8.lua index f1830ea21..d1f0745d0 100644 --- a/lua/acf/shared/engines/v8.lua +++ b/lua/acf/shared/engines/v8.lua @@ -10,7 +10,7 @@ ACF_DefineEngine( "5.7-V8", { sound = "acf_engines/v8_petrolsmall.wav", category = "V8", fuel = "Petrol", - enginetype = "GenericPetrol", + enginetype = "V8", weight = 260, torque = 480, flywheelmass = 0.15, @@ -26,7 +26,7 @@ ACF_DefineEngine( "9.0-V8", { sound = "acf_engines/v8_petrolmedium.wav", category = "V8", fuel = "Petrol", - enginetype = "GenericPetrol", + enginetype = "V8", weight = 400, torque = 690, flywheelmass = 0.25, @@ -42,7 +42,7 @@ ACF_DefineEngine( "18.0-V8", { sound = "acf_engines/v8_petrollarge.wav", category = "V8", fuel = "Petrol", - enginetype = "GenericPetrol", + enginetype = "V8", weight = 850, torque = 2187, flywheelmass = 2.8, @@ -60,7 +60,7 @@ ACF_DefineEngine( "4.5-V8", { sound = "acf_engines/v8_dieselsmall.wav", category = "V8", fuel = "Diesel", - enginetype = "GenericDiesel", + enginetype = "V8", weight = 320, torque = 622, flywheelmass = 0.75, @@ -76,7 +76,7 @@ ACF_DefineEngine( "7.8-V8", { sound = "acf_engines/v8_dieselmedium2.wav", category = "V8", fuel = "Diesel", - enginetype = "GenericDiesel", + enginetype = "V8", weight = 520, torque = 1050, flywheelmass = 1.6, @@ -92,7 +92,7 @@ ACF_DefineEngine( "19.0-V8", { sound = "acf_engines/v8_diesellarge.wav", category = "V8", fuel = "Diesel", - enginetype = "GenericDiesel", + enginetype = "V8", weight = 1200, torque = 3450, flywheelmass = 4.5, diff --git a/lua/acf/shared/fueltanks/basic.lua b/lua/acf/shared/fueltanks/basic.lua index fc6af1b6c..3f05284f1 100644 --- a/lua/acf/shared/fueltanks/basic.lua +++ b/lua/acf/shared/fueltanks/basic.lua @@ -368,3 +368,12 @@ ACF_DefineFuelTankSize( "Gas_Pump", { nolinks = true, notitle = true } ) + + + + +--definition for the fuel tank that shows on menu +ACF_DefineRadiator( "Basic_Radiator", { + name = "Radiator", + desc = "Basic Radiator for cooling engines" +} ) \ No newline at end of file diff --git a/lua/acf/shared/sh_ace_functions.lua b/lua/acf/shared/sh_ace_functions.lua index 94eebdf85..0681fe9a3 100644 --- a/lua/acf/shared/sh_ace_functions.lua +++ b/lua/acf/shared/sh_ace_functions.lua @@ -50,19 +50,52 @@ function ACF_CalcCurve(Points, Pos) (3 * P1 - P0 - 3 * P2 + P3) * T ^ 3) end +function applyEngineFuelModifierToCurve(EngineCurve, FuelCurve) --BEWARE OF FEEDING THE ORIGINAL TABLES INTO THE FUNCTION THIS FUNCTION IS DESTRUCTIVE. Maybe I should just use returns instead but inefficiency. + local MaxValue = 0 + for Key in pairs(EngineCurve) do + local CurveValue = EngineCurve[Key] + local Mult = FuelCurve[Key] + + CurveValue = 1 - (1 - CurveValue * Mult) + + EngineCurve[Key] = CurveValue + + if CurveValue > MaxValue then MaxValue = CurveValue end + end + + local NormMul = 1/MaxValue --Used to normalize the new torque curve for the engine. + + + for Key in pairs(EngineCurve) do + local CurveValue = EngineCurve[Key] + + CurveValue = math.Clamp(CurveValue * NormMul,0,1) + + EngineCurve[Key] = CurveValue + end +end + --Calculates the performance characteristics of an engine, given a torque curve, max torque (in nm), idle, and redline rpm -function ACF_CalcEnginePerformanceData(curve, maxTq, idle, redline) +function ACF_CalcEnginePerformanceData(curve, maxTq, idle, redline, fueltype) local peakTq = 0 local peakTqRPM local peakPower = 0 local powerTable = {} --Power at each point on the curve for use in powerband calc local res = 32 --Iterations for use in calculating the curve, higher is more accurate + local ModifiedCurve = table.Copy(curve) --We love accidentally modifying the original engine torque which modifies the torque for all engines :))))))))) + local Fuel = fueltype or "Petrol" + if Fuel == "Multifuel" then + Fuel = "Diesel" + end + --local Fuel = "Petrol" + applyEngineFuelModifierToCurve(ModifiedCurve, ACF.PerFuelTorqueCurveMul[Fuel]) + --Calculate peak torque/power RPM for i = 0, res do local rpm = i / res * redline local perc = math.Remap(rpm, idle, redline, 0, 1) - local curTq = ACF_CalcCurve(curve, perc) + local curTq = ACF_CalcCurve(ModifiedCurve, perc) local power = maxTq * curTq * rpm / 9548.8 powerTable[i] = power diff --git a/lua/acf/shared/sh_ace_loader.lua b/lua/acf/shared/sh_ace_loader.lua index 6404f30b9..2e5049455 100644 --- a/lua/acf/shared/sh_ace_loader.lua +++ b/lua/acf/shared/sh_ace_loader.lua @@ -19,6 +19,7 @@ local LegacyAmmoTable = {} local EngineTable = {} local GearboxTable = {} local FuelTankTable = {} +local RadiatorTable = {} local FuelTankSizeTable = {} local MuzzleFlashTable = {} @@ -53,6 +54,10 @@ local fueltank_base = { ent = "acf_fueltank", type = "FuelTanks" } +local radiator_base = { + ent = "ace_radiator", + type = "Radiators" +} local rack_base = { ent = "acf_rack", type = "Racks" @@ -100,6 +105,9 @@ if CLIENT then fueltank_base.guicreate = function( _, tbl ) ACFFuelTankGUICreate( tbl ) end or nil fueltank_base.guiupdate = function( _, tbl ) ACFFuelTankGUIUpdate( tbl ) end or nil + radiator_base.guicreate = function( _, tbl ) ACFRadiatorGUICreate( tbl ) end or nil + radiator_base.guiupdate = function( _, tbl ) ACFRadiatorGUIUpdate( tbl ) end or nil + radar_base.guicreate = function( _, Table ) ACFRadarGUICreate( Table ) end radar_base.guiupdate = function() return end @@ -202,7 +210,7 @@ end --Engine definition function ACF_DefineEngine( id, data ) if (data.year or 0) < ACF.Year then - local engineData = ACF_CalcEnginePerformanceData(data.torquecurve or ACF.GenericTorqueCurves[data.enginetype], data.torque, data.idlerpm, data.limitrpm) + local engineData = ACF_CalcEnginePerformanceData(data.torquecurve or ACF.GenericTorqueCurves[data.enginetype], data.torque, data.idlerpm, data.limitrpm, data.fuel) data.peaktqrpm = engineData.peakTqRPM data.peakpower = engineData.peakPower @@ -241,6 +249,14 @@ function ACF_DefineFuelTankSize( id, data ) FuelTankSizeTable[ id ] = data end +-- fueltank definition +function ACF_DefineRadiator( id, data ) + data.id = id + table.Inherit( data, radiator_base ) + RadiatorTable[ id ] = data + MobilityTable[ id ] = data +end + -- Radar definition function ACF_DefineRadar( id, data ) data.id = id @@ -380,6 +396,7 @@ do "gearboxes", "guidances", "fueltanks", + "radiators", "fuses", "sounds", "tools", @@ -412,6 +429,7 @@ ACF.Weapons.Racks = RackTable ACF.Weapons.Engines = EngineTable ACF.Weapons.Gearboxes = GearboxTable ACF.Weapons.FuelTanks = FuelTankTable +ACF.Weapons.Radiators = RadiatorTable ACF.Weapons.FuelTanksSize = FuelTankSizeTable ACF.Weapons.Radars = Radars ACF.Weapons.Tools = Tools diff --git a/lua/autorun/acf_globals.lua b/lua/autorun/acf_globals.lua index 0ad75c570..432f5b61d 100644 --- a/lua/autorun/acf_globals.lua +++ b/lua/autorun/acf_globals.lua @@ -48,15 +48,18 @@ ACF.DebrisLifeTime = 30 ACF.LiIonED = 0.27 -- li-ion energy density: kw hours / liter --BEFORE to balance: 0.458 ACF.CuIToLiter = 0.0163871 -- cubic inches to liters -ACF.DriverTorqueBoost = 1.25 -- torque multiplier from having a driver -ACF.FuelRate = 10 -- multiplier for fuel usage, 1.0 is approx real world -ACF.ElecRate = 4 -- multiplier for electrics --BEFORE to balance: 0.458 -ACF.TankVolumeMul = 1 -- multiplier for fuel tank capacity, 1.0 is approx real world +ACF.DriverTorqueBoost = 1.25 -- torque multiplier from having a driver +ACF.FuelRate = 10 -- multiplier for fuel usage, 1.0 is approx real world +ACF.ThermalTimeScale = 60 --Multiplies the timescale of anything heat related. This way engines don't take dozens of minutes to overheat. +ACF.RadiatorEff = 0.125 --Multiplier for radiator cooling effectiveness +ACF.RadiatorHeatCap = 0.2 --Multiplier for radiator specific heat cap. Makes radiators more or less effective at storing energy +ACF.ElecRate = 3 -- multiplier for electrics --BEFORE to balance: 0.458 +ACF.TankVolumeMul = 1 -- multiplier for fuel tank capacity, 1.0 is approx real world ---------------------------------- Ammo Crate config ---------------------------------- ACF.CrateMaximumSize = 250 -ACF.CrateMinimumSize = 5 +ACF.CrateMinimumSize = 1 ACF.RefillDistance = 400 -- Distance in which ammo crate starts refilling. ACF.RefillSpeed = 250 -- (ACF.RefillSpeed / RoundMass) / Distance diff --git a/lua/entities/ace_radiator/cl_init.lua b/lua/entities/ace_radiator/cl_init.lua new file mode 100644 index 000000000..09dc666b8 --- /dev/null +++ b/lua/entities/ace_radiator/cl_init.lua @@ -0,0 +1,188 @@ + +include("shared.lua") + +CreateClientConVar("ACF_FuelInfoWhileSeated", 0, true, false) + +-- copied from base_wire_entity: DoNormalDraw's notip arg isn't accessible from ENT:Draw defined there. +function ENT:Draw() + + local lply = LocalPlayer() + local hideBubble = not GetConVar("ACF_FuelInfoWhileSeated"):GetBool() and IsValid(lply) and lply:InVehicle() + + self.BaseClass.DoNormalDraw(self, false, hideBubble) + Wire_Render(self) + + if self.GetBeamLength and (not self.GetShowBeam or self:GetShowBeam()) then + -- Every SENT that has GetBeamLength should draw a tracer. Some of them have the GetShowBeam boolean + Wire_DrawTracerBeam( self, 1, self.GetBeamHighlight and self:GetBeamHighlight() or false ) + end + +end + +do + + local Wall = 0.75 -- wall thickness in inches + + local function CreateIdForCrate() + + local X = math.Round( acfmenupanel.RadiatorPanelConfig["Crate_Length"], 1 ) + local Y = math.Round( acfmenupanel.RadiatorPanelConfig["Crate_Width"], 1 ) + local Z = math.Round( acfmenupanel.RadiatorPanelConfig["Crate_Height"], 1) + + local Id = X .. ":" .. Y .. ":" .. Z + + ACFRadiatorGUIUpdate( Table ) + acfmenupanel.RadiatorData["Id"] = Id + RunConsoleCommand( "acfmenu_data1", Id ) + + end + + function ACFRadiatorGUICreate( Table ) + if not acfmenupanel.CustomDisplay then return end + + local MainPanel = acfmenupanel.CustomDisplay + + if not acfmenupanel.RadiatorData then + acfmenupanel.RadiatorData = {} + acfmenupanel.RadiatorData.Id = "10:10:10" + end + + if not acfmenupanel.RadiatorPanelConfig then + + acfmenupanel.RadiatorPanelConfig = {} + acfmenupanel.RadiatorPanelConfig["Crate_Length"] = 1 + acfmenupanel.RadiatorPanelConfig["Crate_Width"] = 10 + acfmenupanel.RadiatorPanelConfig["Crate_Height"] = 10 + acfmenupanel.RadiatorPanelConfig["Crate_Shape"] = "Radiator" + + end + + acfmenupanel:CPanelText("Name", Table.name, "DermaDefaultBold") + acfmenupanel:CPanelText("Desc", Table.desc) + + --------------- NEW CONFIG --------------- + do + + local CrateNewCat = vgui.Create( "DCollapsibleCategory" ) -- Create a collapsible category + acfmenupanel.CustomDisplay:AddItem(CrateNewCat) + CrateNewCat:SetLabel( "Radiator Config" ) -- Set the name ( label ) + CrateNewCat:SetPos( 25, 50 ) -- Set position + CrateNewCat:SetSize( 250, 100 ) -- Set size + CrateNewCat:SetExpanded( acfmenupanel.RadiatorPanelConfig["ExpandedCatNew"] ) + + function CrateNewCat:OnToggle( bool ) + acfmenupanel.RadiatorPanelConfig["ExpandedCatNew"] = bool + end + + local CrateNewPanel = vgui.Create( "DPanelList" ) + CrateNewPanel:SetSpacing( 10 ) + CrateNewPanel:EnableHorizontal( false ) + CrateNewPanel:EnableVerticalScrollbar( true ) + CrateNewPanel:SetPaintBackground( false ) + CrateNewPanel:AddItem(LengthSlider) + CrateNewCat:SetContents( CrateNewPanel ) + + local MinCrateSize = ACF.CrateMinimumSize or 1 + local MaxCrateSize = ACF.CrateMaximumSize + + acfmenupanel:CPanelText("Crate_desc_new", "\nAdjust the dimensions for the radiator. In inches.", nil, CrateNewPanel) + + -- X Slider + local LengthSlider = vgui.Create( "DNumSlider" ) + LengthSlider:SetText( "Length" ) + LengthSlider:SetDark( true ) + LengthSlider:SetMin( MinCrateSize ) + LengthSlider:SetMax( MaxCrateSize ) + LengthSlider:SetValue( acfmenupanel.RadiatorPanelConfig["Crate_Length"] or 10 ) + LengthSlider:SetDecimals( 1 ) + + function LengthSlider:OnValueChanged( value ) + acfmenupanel.RadiatorPanelConfig["Crate_Length"] = value + CreateIdForCrate() + end + CrateNewPanel:AddItem(LengthSlider) + + -- Y Slider + local WidthSlider = vgui.Create( "DNumSlider" ) + WidthSlider:SetText( "Width" ) + WidthSlider:SetDark( true ) + WidthSlider:SetMin( MinCrateSize ) + WidthSlider:SetMax( MaxCrateSize ) + WidthSlider:SetValue( acfmenupanel.RadiatorPanelConfig["Crate_Width"] or 10 ) + WidthSlider:SetDecimals( 1 ) + + function WidthSlider:OnValueChanged( value ) + acfmenupanel.RadiatorPanelConfig["Crate_Width"] = value + CreateIdForCrate() + end + CrateNewPanel:AddItem(WidthSlider) + + -- Z Slider + local HeightSlider = vgui.Create( "DNumSlider" ) + HeightSlider:SetText( "Height" ) + HeightSlider:SetDark( true ) + HeightSlider:SetMin( MinCrateSize ) + HeightSlider:SetMax( MaxCrateSize ) + HeightSlider:SetValue( acfmenupanel.RadiatorPanelConfig["Crate_Height"] or 10 ) + HeightSlider:SetDecimals( 1 ) + + function HeightSlider:OnValueChanged( value ) + acfmenupanel.RadiatorPanelConfig["Crate_Height"] = value + CreateIdForCrate() + end + CrateNewPanel:AddItem(HeightSlider) + + end + + ----------- The rest below ----------- + + ACFRadiatorGUIUpdate( Table ) + + MainPanel:PerformLayout() + + end + + function ACFRadiatorGUIUpdate( _ ) + + if not acfmenupanel.CustomDisplay then return end + + local Length = acfmenupanel.RadiatorPanelConfig["Crate_Length"] + local Width = acfmenupanel.RadiatorPanelConfig["Crate_Width"] + local Height = acfmenupanel.RadiatorPanelConfig["Crate_Height"] + local Shape = "Box" --Box + + local ModelData = ACE.ModelData[Shape] + + local CrateVolume = ModelData.volumefunction( Length, Width, Height) + local ContentVolume = math.max(ModelData.volumefunction( Length, Width - (Wall * 2), Height - (Wall * 2)) * 0.7,0) --Assume 2/3rds volume radiator fins, 1/3rd water + + local Capacity = ContentVolume * ACF.CuIToLiter * ACF.TankVolumeMul * 0.4774 -- internal volume available for fuel in liters, with magic realism number + local EmptyMass = (CrateVolume - ContentVolume) * 16.387 * ( 2.6 / 1000 ) -- total wall volume * cu in to cc * density of aluminum (kg/cc) + local Mass = EmptyMass + Capacity --* 1 Conversion Ommited -- weight of tank + weight of contained water. Water is 1kg/Liter + + local FinsPerInch = 15 + local FinPackRatio = 0.5 --Ratio of volume fins to volume air in radiator + + local FinHeight = (1/FinsPerInch) * FinPackRatio --Air/Fin ratio. + + local finSize = Length * Width * 2 + Width * FinHeight * 2 --Surface area of one fin(Top and bottom) + + local FinCount = Height / FinsPerInch + + local TotalSurfaceArea = finSize * FinCount / 1550 + + local AirflowRestrictiveness = 1-(1-(1/Length))^2 --Airflow ratio of the radiator. Difficulty air flowing through it will have cooling anything. + + acfmenupanel:CPanelText("Mass", "Full mass: " .. math.Round(Mass,1) .. " kg, Empty mass: " .. math.Round(EmptyMass,1) .. " kg") + acfmenupanel:CPanelText("Cap", "Capacity: " .. math.Round(Capacity,1) .. " liters / " .. math.Round(Capacity * 0.264172,1) .. " gallons") + + acfmenupanel:CPanelText("RestrictedFlow", "Airflow restriction: " .. math.Round(AirflowRestrictiveness * 100,1) .. "%") + + acfmenupanel:CPanelText("Area", "Total Fin Surface Area: " .. math.Round(TotalSurfaceArea,1) .. " m^2") + local specificHeat = (EmptyMass * 0.9211 + Capacity * 4.184) / Mass + local KJTo100C = Mass * specificHeat * 100 * ACF.RadiatorHeatCap --Heat capacity of the radiator. Joules needed to raise the radiator to 100C. + acfmenupanel:CPanelText("ThermalStorage", "" .. math.Round(KJTo100C,1) .. " kilojoules needed to raise the radiator to 100C") + + + end +end \ No newline at end of file diff --git a/lua/entities/ace_radiator/init.lua b/lua/entities/ace_radiator/init.lua new file mode 100644 index 000000000..8e89895d4 --- /dev/null +++ b/lua/entities/ace_radiator/init.lua @@ -0,0 +1,576 @@ +AddCSLuaFile("shared.lua") +AddCSLuaFile("cl_init.lua") + +include("shared.lua") + +--don't forget: +--armored tanks + +do + + local RadiatorWireDescs = { + --Inputs + ["ActiveCooling"] = "Active uses engine power to cool the radiator. Pushes an additional 20mph of airflow through the radiator.", + + --Outputs + ["Coolant"] = "Returns the current coolant level.", + ["Capacity"] = "Returns the max capacity of the radiator.", + ["Leaking"] = "Is the radiator leaking?", + ["Temperature"] = "How hot is the radiator" + } + + function ENT:Initialize() + + self.CanUpdate = true + + self.Size = 0 --outer dimensions + self.Volume = 0 --total internal volume in cubic inches + self.Capacity = 0 --max coolant capacity in liters + self.EmptyMass = 0 --mass of tank only + + self.ThermalSurfaceArea = 1 --total surface area of the radiator fins + self.AirflowRestrictiveness = 1 --Ratio for airflow passing through the radiator. + + self.NextMassUpdate = 0 + self.NextGUIUpdate = 0 + self.Id = nil --model id + self.Active = false + self.FanRunning = 0 + self.NextLegalCheck = ACF.CurTime + math.random(ACF.Legal.Min, ACF.Legal.Max) -- give any spawning issues time to iron themselves out + self.Legal = true + self.LegalIssues = "" + + self.RadiatorEfficacy = 1 + self.ActiveTorqueDemand = 1 + + self.FanSpeed = 0 + + self.Sound = nil + self.SoundPath = "acf_extra/ACE/miscellaneous/fans/BuzzingCoolingFan.wav" + self.SoundPitch = 100 + + self.RadiatorStats = "" --Used to cache radiator stats. No reason to recalculate these constantly. + self.Heat = ACE.AmbientTemp + + self.Inputs = Wire_CreateInputs( self, { "ActiveCooling (" .. RadiatorWireDescs["ActiveCooling"] .. ")" } ) + self.Outputs = WireLib.CreateSpecialOutputs( self, + { "Temperature (" .. RadiatorWireDescs["Temperature"] .. ")", "Coolant (" .. RadiatorWireDescs["Coolant"] .. ")", "Capacity (" .. RadiatorWireDescs["Capacity"] .. ")", "Leaking (" .. RadiatorWireDescs["Leaking"] .. ")", "FanRunning", "Entity" }, + { "NORMAL", "NORMAL", "NORMAL", "NORMAL", "NORMAL", "ENTITY" } + ) + Wire_TriggerOutput( self, "Leaking", 0 ) + Wire_TriggerOutput( self, "Entity", self ) + + self.Master = {} --engines linked to this tank + + self.LastThink = 0 + + self.NextFanLogic = 0 + self.NextHeatLogic = 0 + self.LastThink2 = 0 --Used for the core heat logic running less frequently + self.NextThink = ACF.CurTime + 1 + + end + +end + +function ENT:ACF_Activate( Recalc ) + + self.ACF = self.ACF or {} + + local PhysObj = self:GetPhysicsObject() + if not self.ACF.Area then + self.ACF.Area = PhysObj:GetSurfaceArea() * 6.45 + end + if not self.ACF.Volume then + self.ACF.Volume = PhysObj:GetVolume() * 1 + end + + local Armour = self.EmptyMass * 1000 / self.ACF.Area / 0.78 --So we get the equivalent thickness of that prop in mm if all it's weight was a steel plate + local Health = self.ACF.Volume / ACF.Threshold --Setting the threshold of the prop Area gone + + local Percent = 1 + if Recalc and self.ACF.Health and self.ACF.MaxHealth then + Percent = self.ACF.Health / self.ACF.MaxHealth + end + + self.ACF.Health = Health * Percent + self.ACF.MaxHealth = Health + self.ACF.Armour = Armour * (0.5 + Percent / 2) + self.ACF.MaxArmour = Armour + self.ACF.Type = nil + self.ACF.Mass = self.Mass + self.ACF.Density = (PhysObj:GetMass() * 1000) / self.ACF.Volume + self.ACF.Type = "Prop" + + self.ACF.Material = not isstring(self.ACF.Material) and ACE.BackCompMat[self.ACF.Material] or self.ACF.Material or "RHA" + + --Forces an update of mass + self.LastMass = 1 + self:UpdateRadiatorMass() + +end + +do + + -- Checks if the provided string vector matches the desired format. + -- Define a pattern to match the format + local pattern = "^%d+%.?%d*:%d+%.?%d*:%d+%.?%d*$" + local function IsValidStringScale( Id ) + if not isstring( Id ) then return false end + if not string.match(Id, pattern) then return false end + return true + end + + -- Converts an already verified string vector into a valid vector scale. + local function ParseToVector( ScaleId ) + if not isstring(ScaleId) then return end + + local Result = string.Explode( ":", ScaleId ) + + local X = tonumber(Result[1]) + local Y = tonumber(Result[2]) + local Z = tonumber(Result[3]) + + return Vector(X, Y, Z) + end + + -- Clamps the already converted scale so its within the size limits, defined on globals. + local function ClampScale( Scale ) + if not isvector( Scale ) then return end + + local MinSize = ACF.CrateMinimumSize + local MaxSize = ACF.CrateMaximumSize + + Scale.x = math.Clamp( math.Round(Scale.x, 1), MinSize, MaxSize) + Scale.y = math.Clamp( math.Round(Scale.y, 1), MinSize, MaxSize) + Scale.z = math.Clamp( math.Round(Scale.z, 1), MinSize, MaxSize) + + return Scale + end + + -- Tries to convert a scale id, having a string format, to a vector scale. If its already a vector, skip the process. + local function ConvertStringScale( ScaleId ) + if isvector( ScaleId ) then return ScaleId end + if not IsValidStringScale( ScaleId ) then return end + + local Scale = ParseToVector( ScaleId ) + Scale = ClampScale( Vector(Scale.y, Scale.x, Scale.z) ) + + return Scale + end + + function MakeACE_Radiator(Owner, Pos, Angle, Id, Data1) + + if IsValid(Owner) and not Owner:CheckLimit("_acf_misc") then return false end + + local Tank = ents.Create("ace_radiator") + if IsValid(Tank) then + + local Model + local Dimensions + + Tank:CPPISetOwner(Owner) + Tank:SetAngles(Angle) + Tank:SetPos(Pos) + Tank:Spawn() + + local Scale = ConvertStringScale(Data1) + + if isvector(Scale) then + + local ModelData = ACE.ModelData["Radiator"] + + Data1 = Scale + Model = ModelData.Model + Weight = (Scale.x * Scale.y * Scale.z) / 200 + Dimensions = Scale + + local DefaultSize = ModelData.DefaultSize + local Mesh = ModelData.CustomMesh + local PhysMaterial = ModelData.physMaterial + --Width is X + --Thickness is y + --Height is Z + local RadScale = Vector(1/35.775, 1/4.5, 1/22.5) + --local EntityScale = Vector(Scale.x / DefaultSize, Scale.y / DefaultSize, Scale.z / DefaultSize) --Defaultsize does not support 3d vectors. + local EntityScale = Vector(Scale.x, Scale.y, Scale.z) * RadScale + + + Tank.ScaleData = { + Mesh = Mesh, + Scale = EntityScale, + Size = DefaultSize, + Material = PhysMaterial, + } + + --Tank:SetMaterial("phoenix_storms/gear") + Tank:SetModel( Model ) --Sending the model to client + Tank:PhysicsInit( SOLID_VPHYSICS ) + Tank:SetMoveType( MOVETYPE_VPHYSICS ) + Tank:SetSolid( SOLID_VPHYSICS ) + + Tank.IsScalable = true + Tank:ACE_SetScale( Tank.ScaleData ) + + end + + Tank.Id = Id + Tank.SizeId = Data1 + Tank.Shape = "Radiator" + Tank.Model = Model + Tank.Dimensions = Dimensions + + Tank.LastMass = 1 + Tank:UpdateRadiator(Id, Data1) + + Owner:AddCount( "_acf_misc", Tank ) + Owner:AddCleanup( "acfmenu", Tank ) + + --table.insert(ACF.FuelTanks, Tank) + + return Tank + end + + return Tank + end +end + +list.Set( "ACFCvars", "ace_radiator", {"id", "data1"} ) +duplicator.RegisterEntityClass("ace_radiator", MakeACE_Radiator, "Pos", "Angle", "Id", "SizeId") + + +local Wall = 0.75 -- wall thickness in inches + +function ENT:UpdateRadiator(_, _) + + local electric = "ups" + local gas = "ups" + local pct = 1 --how full is the tank? + self.Leaking = 0 + + + local ModelData = ACE.ModelData[self.Shape] + local Volumefunc = ModelData.volumefunction + + local Dimensions = self.Dimensions + + --We love rotated models. + --Width is X + --Thickness is y + --Height is Z + + local Length = Dimensions.y + local Width = Dimensions.x + local Height = Dimensions.z + + local Volume = Volumefunc( Length, Width, Height) + local IVolume = math.max(Volumefunc( Length, Width - (Wall * 2), Height - (Wall * 2)) * 0.7,0) --Assume 2/3rds volume radiator fins, 1/3rd water (roughly 0.7x) + + self.Volume = IVolume-- total volume of tank (cu in), reduced by wall thickness + self.Capacity = IVolume * ACF.CuIToLiter * ACF.TankVolumeMul * 0.4774 --internal volume available for coolant in liters, with magic realism number + self.EmptyMass = (Volume - IVolume) * 16.387 * ( 2.6 / 1000 ) -- total wall volume * cu in to cc * density of aluminum (kg/cc) + self.Coolant = pct * self.Capacity + self.Mass = self.EmptyMass + self.Coolant --* 1 Conversion Ommited -- weight of tank + weight of contained water. Water is 1kg/Liter + + self:UpdateRadiatorMass() + + --Calculates the average specific heat of the object + self.ACESpecificHeat = (self.EmptyMass * 0.9211 + self.Coolant * 4.184) / self.Mass * ACF.RadiatorHeatCap --0.9211 is the specific heat of aluminum in kj/kg * k, and 4.184 is the specific heat of water in kj/kg * k + + + local x = math.Round(Length, 1) / 10 + local y = math.Round(Width, 1) / 10 + local z = math.Round(Height, 1) / 10 + + self.ActiveTorqueDemand = self.Volume / 61.02 * 60 --Convert to liters. Then multiply by the amount of Joules per second it'll take to actively cool the engine per liter of radiator volume. + + --print("Horsepower required to use active cooling: " .. self.ActiveTorqueDemand / 1.3410220896 / 1000) + + + local FinsPerInch = 15 + local FinPackRatio = 0.5 --Ratio of volume fins to volume air in radiator + + local FinHeight = (1/FinsPerInch) * FinPackRatio --Air/Fin ratio. + + local finSize = Length * Width * 2 + Width * FinHeight * 2 --Surface area of one fin(Top and bottom) + + local FinCount = Height / FinsPerInch + + self.ThermalSurfaceArea = finSize * FinCount / 1550 --Converts from square inches to square meters + + self.AirflowRestrictiveness = 1-(1-(1/Length))^2 --Airflow ratio of the radiator. Difficulty air flowing through it will have cooling anything. + + --Infotext moved from the overlay update. No need to recalculate this. + + local text = "\nTotal Surface Area: " .. math.Round(self.ThermalSurfaceArea,2) .. "m^2" + text = text .. "\nAirflow Restriction: " .. math.Round((1-self.AirflowRestrictiveness)*100,1) .. "%\n" + local HeatCapacity = self.ACESpecificHeat * self.Mass + text = text .. "\nThermal Storage: " .. math.Round(HeatCapacity,1) .. " kJ/Deg C\n" + + local OldHeat = self.Heat + --Bit of a hacked together way to measure the thermal dissipation rate at a given temp. + self.Heat = 100 + ACE_AtmosphericHeatDissipation(self, self.AirflowRestrictiveness * ACF.RadiatorEff, 1) + local Dissipation = (100 - self.Heat) * HeatCapacity / ACF.ThermalTimeScale --Gets the heat difference in Deg/C and multiplies it by the Heat capacity of the radiator to determine the KJ dissipated + text = text .. "\nStationary Cooling:\n" .. math.Round(Dissipation,2) .. " kJ / second @ 100 Deg C.\n" + + text = text .. "\nw/ Active:\n" .. math.Round(Dissipation*3,2) .. " kJ / second @ 100 Deg C." + text = text .. "\nusing " .. math.Round(self.ActiveTorqueDemand / 1.3410220896 / 1000,2) .. "hp when needed\n" + + self.ActiveTorqueDemand = self.Volume / 61.02 * 30 + + self.Heat = OldHeat + + self.RadiatorStats = text + + + + + local dims = x .. "x" .. y .. "x" .. z + + local rad = " " .. dims .. " Radiator" + + self:SetNWString( "WireName", rad ) + + Wire_TriggerOutput( self, "Capacity", math.Round(self.Capacity,2) ) + self:UpdateOverlayText() + +end + +function ENT:UpdateOverlayText() + + + local Stats + + if self.FanRunning > 0 then + Stats = "Cooling Actively - Fan using engine power" + else + Stats = "Cooling Passively" + end + + local text = "- " .. Stats .. " -\n" + + --Slot in infotext + + text = text .. self.RadiatorStats + + text = text .. "\nTemp: " .. math.Round(self.Heat) .. " °C / " .. math.Round((self.Heat * (9 / 5)) + 32) .. " °F\n" + + text = text .. "\nCurrent Coolant Remaining:" + text = text .. "\n- " .. math.Round( self.Coolant, 1 ) .. " / " .. math.Round( self.Capacity, 1 ) .. " liters" + text = text .. "\n- " .. math.Round( self.Coolant * 0.264172, 1 ) .. " / " .. math.Round( self.Capacity * 0.264172, 1 ) .. " gallons" + + if self.Leaking > 0 then + text = text .. "\n- Leaking: " .. math.Round(self.Leaking, 1) .. " liters per second" + end + + + if not self.Legal then + text = text .. "\nNot legal, disabled for " .. math.ceil(self.NextLegalCheck - ACF.CurTime) .. "s\nIssues: " .. self.LegalIssues + end + + self:SetOverlayText( text ) + +end + +function ENT:UpdateRadiatorMass() + + self.Mass = self.EmptyMass + self.Coolant -- * 1 --Water weighs 1kg/L + + --reduce superflous engine calls, update fuel tank mass every 5 kgs change or every 10s-15s + if math.abs(self.LastMass - self.Mass) > 5 or ACF.CurTime > self.NextMassUpdate then + self.LastMass = self.Mass + self.NextMassUpdate = ACF.CurTime + math.Rand(10, 15) + local phys = self:GetPhysicsObject() + if (phys:IsValid()) then + phys:SetMass( self.Mass ) + end + end + + self:UpdateOverlayText() + +end + +function ENT:Update( ArgsTable ) + + local Feedback = "" + + self:UpdateRadiator(ArgsTable[4], ArgsTable[5]) --Id, SizeId, FuelType + + return true, "Radiator successfully updated." .. Feedback +end + +function ENT:TriggerInput( iname, value ) + + if (iname == "ActiveCooling") then + if value > 0 then + self.Active = true + else + self.Active = false + end + end + +end + +function ENT:Think() + + --Rapid Logic. Runs on tick. Used to not stall out the engines by pulling large chunks of power from the flywheel. + local CT = ACF.CurTime + local DeltaTime = CT - self.LastThink + + local ECount = #self.Master + local PerEngineTorqueDemand = self.ActiveTorqueDemand / ECount * DeltaTime + local DriveFactor = 0 --Active fan drive factor. Ability for engines to meet fan's torque demands. + local RPMPulled = 1--Actual RPM Pulled from the crankshaft. + local RPMDemand = 1--Requested RPM pulled from the crankshaft. Used to see if we meet energy demands. + + for Key in pairs(self.Master) do + local Ent = self.Master[Key] + if IsValid( Ent ) then + --Active cooling. Saps a certain amount of power from the engine to drive the cooling fans + --Activates only if needed to keep the radiator below the coolant overheating temperature. + if self.Active then -- and self.Heat > 21 + RPMDemand = PerEngineTorqueDemand / Ent.Inertia + local NewRPM = math.max(Ent.FlyRPM - RPMDemand, Ent.IdleRPM) + RPMPulled = Ent.FlyRPM - NewRPM + Ent.FlyRPM = NewRPM + + --DriveFactor = math.min(DriveFactor,math.min(RPMPulled/RPMDemand,1)) --Penalized severely if one of the engines is unable to satisfy the torque demand. + self.FanRunning = 1 + else + self.FanRunning = 0 + end + end + end + + + + if CT > self.NextFanLogic then + + if self.FanRunning == 1 then --The Fan is running + + + if self.FanSpeed > 0 then --Fan is ramping up + self.FanSpeed = math.min(self.FanSpeed + 0.03,1) + if self.Sound then + self.Sound:ChangePitch( self.SoundPitch * self.FanSpeed ) + end + elseif self.FanSpeed == 0 then --Fan just started + --stupid workaround for the engine sound. THANK YOU garry + filter = RecipientFilter(true) + filter:AddAllPlayers() + + if self.SoundPath ~= "" then + self.Sound = CreateSound(self, self.SoundPath , filter) + local Horsepower = self.ActiveTorqueDemand / 1.3410220896 / 1000 + + local DB = 40 + Horsepower * 10 + self.Sound:SetSoundLevel( DB ) --Has to be adjusted before being played sadly. No dynamic DB levels. + self.Sound:PlayEx(1.0,0) + end + + self.FanSpeed = self.FanSpeed + 0.01 + end + + else --The cooling fan is no longer running + + if self.FanSpeed > 0 then --Fan is slowing down + self.FanSpeed = math.max(self.FanSpeed - 0.03,0) + if self.Sound then + self.Sound:ChangePitch( self.SoundPitch * self.FanSpeed ) + end + elseif self.FanSpeed == 0 then --Fan has stopped + if self.Sound then + self.Sound:Stop() + end + self.Sound = nil + end + + end + + + + + --Maybe later once a workaround is found + --local sequence = self:LookupSequence("idle") + --self:ResetSequence(sequence) + --self:SetPlaybackRate(0) + + self.NextFanLogic = CT + 0.05 + end + + if CT > self.NextHeatLogic then + local DeltaTime2 = CT - self.LastThink2 + + --Obligatory legality Check + if CT > self.NextLegalCheck then + --local minmass = math.floor(self.Mass-6) -- water is light, may as well save complexity and just check it's above empty mass + self.Legal, self.LegalIssues = ACF_CheckLegal(self, self.Model, math.Round(self.EmptyMass,2), nil, true, true) -- mass-6, as mass update is granular to 5 kg + self.NextLegalCheck = ACF.Legal.NextCheck(self.legal) + --make sure it's not made spherical + if self.EntityMods and self.EntityMods.MakeSphericalCollisions then self.Coolant = 0 end + self:UpdateOverlayText() + end + + --Update the UI + self:UpdateOverlayText() + + --Exchange heat with all linked linked engines. + for Key in pairs(self.Master) do + local Ent = self.Master[Key] + if IsValid( Ent ) then + ACE_EqualizeThermalEnergy(self, Ent) + end + end + + --Do the actual radiator dissipation logic + local Speed = math.min(ACF_GetPhysicalParent(self):GetVelocity():Length() / 17.6,141) --Speed in MPH. Capped to 141mph or ~12x cooling. + + if self.Heat > 90 then --Tries to keep the loop at the ideal combustion temperature (~90C-104C). Otherwise uses slower dissipation rate. + --Calculate the drive factor if applicable. I/E if we meet power demand. This running slowly doesn't really matter. Mostly it's to make sure underpowered engines don't run huge radiators. + if not self.FanRunning then + DriveFactor = 0 + else + DriveFactor = math.min(1,math.min(RPMPulled/RPMDemand,1)) --Penalized severely if one of the engines is unable to satisfy the torque demand. + Speed = Speed + 64 * DriveFactor * self.FanSpeed --Add the radiator cooling fan speed. Enough for 3x base cooling when active. + --print(Speed) + end + + local CoolingMult = 1 * 2^(Speed/40) --The cooling of radiators doubles every 40mph of speed + ACE_AtmosphericHeatDissipation(self, CoolingMult * self.AirflowRestrictiveness * ACF.RadiatorEff, DeltaTime2) + else + local CoolingMult = 0.1 * 2^(Speed/40) --The cooling of radiators doubles every 40mph of speed + ACE_AtmosphericHeatDissipation(self, CoolingMult * self.AirflowRestrictiveness * ACF.RadiatorEff, DeltaTime2) + end + + Wire_TriggerOutput( self, "Temperature", self.Heat ) + Wire_TriggerOutput( self, "FanRunning", self.FanRunning ) + + self.LastThink2 = CT --Used for heat deltatime + self.NextHeatLogic = CT + 0.25 --Executes heat logic every 0.5 seconds. + end + + + + self.LastThink = CT + + self:NextThink( CT ) + return true + +end + +function ENT:OnRemove() + + for Key in pairs(self.Master) do + if IsValid( self.Master[Key] ) then + self.Master[Key]:Unlink( self ) + end + end + +end + +function ENT:OnRemove() + if self.Sound then + self.Sound:Stop() + end +end \ No newline at end of file diff --git a/lua/entities/ace_radiator/shared.lua b/lua/entities/ace_radiator/shared.lua new file mode 100644 index 000000000..0d0f8d86a --- /dev/null +++ b/lua/entities/ace_radiator/shared.lua @@ -0,0 +1,4 @@ +DEFINE_BASECLASS( "ace_scalability" ) + +ENT.PrintName = "ACE Radiator" +ENT.WireDebugName = "ACE Radiator" diff --git a/lua/entities/acf_engine/cl_init.lua b/lua/entities/acf_engine/cl_init.lua index 1f25d6121..46155b81d 100644 --- a/lua/entities/acf_engine/cl_init.lua +++ b/lua/entities/acf_engine/cl_init.lua @@ -57,16 +57,25 @@ function ACE_EngineGUI_Update( Table ) acfmenupanel:CPanelText("FuelType", "\nFuel Type: " .. Table.fuel) if Table.fuel == "Electric" then - local cons = ACF.ElecRate * peakkw / ACF.Efficiency[Table.enginetype] + local engineEfficiency = ACF.Efficiency[Table.enginetype] * (1 + (peakkw * 1.34/2000)*0.1) + local cons = ACF.ElecRate * peakkw / engineEfficiency acfmenupanel:CPanelText("FuelCons", "Peak energy use: " .. math.Round(cons,1) .. " kW / " .. math.Round(0.06 * cons,1) .. " MJ/min") elseif Table.fuel == "Multifuel" then - local petrolcons = ACF.FuelRate * ACF.Efficiency[Table.enginetype] * peakkw / (60 * ACF.FuelDensity.Petrol) - local dieselcons = ACF.FuelRate * ACF.Efficiency[Table.enginetype] * peakkw / (60 * ACF.FuelDensity.Diesel) + local engineEfficiency = ACF.Efficiency[Table.enginetype] * (1 + (peakkw * 1.34/2000)*0.1) + local petrolcons = ACF.FuelRate * engineEfficiency * peakkw / (60 * ACF.FuelDensity.Petrol) * ACF.PerFuelRelativeEfficiency.Petrol + local dieselcons = ACF.FuelRate * engineEfficiency * peakkw / (60 * ACF.FuelDensity.Diesel) * ACF.PerFuelRelativeEfficiency.Diesel + local HeatPerLiterUsedPetrol = engineEfficiency * ACF.FuelPowerDensity["Petrol"] * 0.4 * 1000 / 60 / ACF.FuelRate --Heat generated per liter burned. Assume 60% heat lost to the air as exhaust. + local HeatPerLiterUsedDiesel = engineEfficiency * ACF.FuelPowerDensity["Diesel"] * 0.4 * 1000 / 60 / ACF.FuelRate --Heat generated per liter burned. Assume 60% heat lost to the air as exhaust. acfmenupanel:CPanelText("FuelConsP", "Petrol Use at " .. math.Round(peakkwrpm) .. " rpm: " .. math.Round(petrolcons,2) .. " liters/min / " .. math.Round(0.264 * petrolcons,2) .. " gallons/min") + acfmenupanel:CPanelText("EngHeatP", "Producing ".. math.Round(petrolcons * HeatPerLiterUsedPetrol,2) .. "kJ / Second of heat") acfmenupanel:CPanelText("FuelConsD", "Diesel Use at " .. math.Round(peakkwrpm) .. " rpm: " .. math.Round(dieselcons,2) .. " liters/min / " .. math.Round(0.264 * dieselcons,2) .. " gallons/min") + acfmenupanel:CPanelText("EngHeatD", "Producing ".. math.Round(dieselcons * HeatPerLiterUsedDiesel,2) .. "kJ / Second of heat") else - local fuelcons = ACF.FuelRate * ACF.Efficiency[Table.enginetype] * peakkw / (60 * ACF.FuelDensity[Table.fuel]) + local engineEfficiency = ACF.Efficiency[Table.enginetype] * (1 + (peakkw * 1.34/2000)*0.1) + local fuelcons = ACF.FuelRate * engineEfficiency * peakkw / (60 * ACF.FuelDensity[Table.fuel]) * ACF.PerFuelRelativeEfficiency[Table.fuel] acfmenupanel:CPanelText("FuelCons", Table.fuel .. " Use at " .. math.Round(peakkwrpm) .. " rpm: " .. math.Round(fuelcons,2) .. " liters/min / " .. math.Round(0.264 * fuelcons,2) .. " gallons/min") + local HeatPerLiterUsed = engineEfficiency * ACF.FuelPowerDensity[Table.fuel] * 0.4 * 1000 / 60 / ACF.FuelRate --Heat generated per liter burned. Assume 60% heat lost to the air as exhaust. + acfmenupanel:CPanelText("EngHeat", "Producing ".. math.Round(fuelcons * HeatPerLiterUsed,2) .. "kJ / Second of heat") end acfmenupanel.CustomDisplay:PerformLayout() diff --git a/lua/entities/acf_engine/init.lua b/lua/entities/acf_engine/init.lua index 85a4b28ff..dc87a1275 100644 --- a/lua/entities/acf_engine/init.lua +++ b/lua/entities/acf_engine/init.lua @@ -29,6 +29,7 @@ do self.IsMaster = true self.GearLink = {} -- a "Link" has these components: Ent, Rope, RopeLen, ReqTq self.FuelLink = {} + self.RadLink = {} self.OTWarnings = {} --Used to remember all the one time warnings. self.NextUpdate = 0 @@ -37,7 +38,6 @@ do self.FuelTank = 0 self.Heat = ACE.AmbientTemp self.TotalFuel = 0 - self.Efficiency = 1-(ACF.Efficiency[self.EngineType] or ACF.Efficiency["GenericPetrol"]) -- Energy not transformed into kinetic energy and instead into thermal self.Legal = true self.CanUpdate = true self.RequiresDriver = false @@ -52,6 +52,12 @@ do self.CanUseSeatDriver = false self.SeatDriverEnt = nil + self.HeatGeneration = 0 --Heat generated per second + + self.LastFuel = nil + + self.ThermalSurfaceArea = 0.1 --In m^2 + self.LastDamageTime = CurTime() self.Inputs = Wire_CreateInputs( self, { "Active", "Throttle (" .. EngineWireDescs["Throttle"] .. ")" } ) --use fuel input? @@ -81,6 +87,7 @@ do ["AVDS-1790-1500"] = "27.0-V12" } + function MakeACF_Engine(Owner, Pos, Angle, Id) if not Owner:CheckLimit("_acf_misc") then return false end @@ -117,7 +124,10 @@ do Engine.IsTrans = Lookup.istrans -- driveshaft outputs to the side Engine.FuelType = Lookup.fuel or "Petrol" Engine.EngineType = Lookup.enginetype or "GenericPetrol" - Engine.TorqueCurve = Lookup.torquecurve or ACF.GenericTorqueCurves[Engine.EngineType] + Engine.Efficiency = 1-(ACF.Efficiency[Engine.EngineType] or ACF.Efficiency["GenericPetrol"]) * (1 + (Engine.peakkw * 1.34/2000)*0.1) -- Energy not transformed into kinetic energy and instead into thermal + Engine.EfficiencyMod = Engine.Efficiency + Engine.TorqueCurve = Lookup.torquecurve or ACF.GenericTorqueCurves[Engine.EngineType] + Engine.ModTorqueCurve = table.Copy(Engine.TorqueCurve) Engine.RequiresDriver = false Engine.SoundPath = Lookup.sound Engine.DefaultSound = Engine.SoundPath @@ -127,27 +137,35 @@ do Engine.TorqueMult = 1 Engine.FuelTank = 0 Engine.Heat = ACE.AmbientTemp - + Engine.ThermalSurfaceArea = Lookup.CoolingArea or 0.1 local FuelCostMul = { Petrol = 1.0, - Diesel = 1.2, --Due to generally higher torques - Multifuel = 1.2, --Due to generally higher torques + Diesel = 1.25, --Due to generally higher torques + Multifuel = 1.25, --Due to generally higher torques Electric = 0.8 --Due to odd power outputs } + local PtsPerHP = 2.33 / 1.5 --Added 1.5 mul from torque boost antics for any engines without a defined hp cost. - local FallBackCost = (Engine.peakkw / 0.7457) * PtsPerHP * (FuelCostMul[Engine.FuelType] or 1) + local EngineHorsepower = Engine.peakkw / 0.7457 --Converts KW to HP, 74.57 / 100 + + local FallBackCost = EngineHorsepower * PtsPerHP * (FuelCostMul[Engine.FuelType] or 1) Engine.ACEPoints = math.ceil((Lookup.acepoints or FallBackCost or 0.404) * ACE.EnginePointCostMultiplier) Engine.TorqueScale = ACF.TorqueScale[Engine.EngineType] - if Engine.peakkw > (74.57 / 100 * ACF.LargeEngineThreshold) and ACF.LargeEnginesRequireDrivers ~= 0 then --If the engine has more than 100 hp it requires a driver. + Engine.MaxDB = 70 + 60 * (EngineHorsepower / 2400) --Base volume of 70DB. Plus 60 * The ratio of the engine hp to 2400. + + if EngineHorsepower > ACF.LargeEngineThreshold and ACF.LargeEnginesRequireDrivers ~= 0 then --If the engine has more than 100 hp it requires a driver. Engine.RequiresDriver = true Engine.CanUseSeatDriver = true end + --calculate base fuel usage if Engine.EngineType == "Electric" then Engine.FuelUse = ACF.ElecRate / (ACF.Efficiency[Engine.EngineType] * 60 * 60) --elecs use current power output, not max + + Engine.MaxDB = Engine.MaxDB * 0.15 --Electrics generate hardly any sound by themselves. else Engine.FuelUse = ACF.FuelRate * ACF.Efficiency[Engine.EngineType] * Engine.peakkw / (60 * 60) end @@ -414,8 +432,9 @@ function ENT:TriggerInput( iname, value ) filter:AddAllPlayers() self.Sound = CreateSound(self, self.SoundPath , filter) + self.Sound:SetSoundLevel( self.MaxDB ) --Has to be adjusted before being played sadly. No dynamic DB levels. self.Sound:PlayEx(0.5,100) - + --print("Engine DB: " .. SoundStrength * self.MaxDB) end self:ACFInit() else @@ -551,7 +570,6 @@ function ENT:Think() self.NextUpdate = ACF.CurTime + 1 end - self.Heat = ACE_HeatFromEngine( self ) Wire_TriggerOutput(self, "EngineHeat", self.Heat) if ACF.CurTime > self.NextUpdate then @@ -687,6 +705,26 @@ function ENT:CalcRPM() if IsValid(Tank) then local Consumption + if Tank.FuelType != self.LastFuel then --Fueltype changed. Recalculate fuel specific modifiers. + + self.ModTorqueCurve = table.Copy(self.TorqueCurve) --Resets the variable to the base before modifying it for fueltype. + --print("Before:") + --PrintTable(self.ModTorqueCurve) + + applyEngineFuelModifierToCurve(self.ModTorqueCurve, ACF.PerFuelTorqueCurveMul[Tank.FuelType]) + + --print("After:") + --PrintTable(self.ModTorqueCurve) + + + self.EfficiencyMod = self.Efficiency / ACF.PerFuelRelativeEfficiency[Tank.FuelType] --Applies efficiency modifer for different fueltypes on top of the per engine effiency. + + --Cache FuelPowerDensity -- Is it worth another variable? + --Cache FuelEfficiency + + self.LastFuel = Tank.FuelType + end + if self.FuelType == "Electric" then Consumption = (self.Torque * self.FlyRPM / 9548.8) * self.FuelUse * DeltaTime else @@ -695,6 +733,16 @@ function ENT:CalcRPM() end Tank.Fuel = math.max(Tank.Fuel - Consumption,0) + + self.HeatGeneration = Consumption * (1 - self.EfficiencyMod) * ACF.FuelPowerDensity[Tank.FuelType] * 0.4 * 1000 / ACF.FuelRate / DeltaTime --Assume 60% heat lost to air as exhaust hence 0.4 + --print("Kj/S " .. self.HeatGeneration) + + if self.HeatGeneration > 0 then --Avoids nan inputs from dividing by deltatime. + ACE_AddThermalEnergy(self, self.HeatGeneration * ACF.ThermalTimeScale * DeltaTime) --Have to convert it back to deltatime as the above indicates KJ/S of heat generation used on the display. + end + + + FuelBoost = ACF.TorqueBoost self.HasFuel = true Wire_TriggerOutput(self, "Fuel Use", math.Round(60 * Consumption / DeltaTime,3)) else @@ -707,6 +755,11 @@ function ENT:CalcRPM() self.HasFuel = false end + --Could stuff this in a spot executed less frequently + local Speed = math.min(ACF_GetPhysicalParent(self):GetVelocity():Length() / 17.6,141) --Speed in MPH. Capped to 141mph or ~12x cooling. + local CoolingMult = 1 * 2^(Speed/40) --The cooling of radiators doubles every 40mph of speed + ACE_AtmosphericHeatDissipation(self, CoolingMult, DeltaTime) + ACE_DoContraptionLegalCheck(self) if self.RequiresDriver and not (self.HasDriver or self.HasSeatDriver) then @@ -725,7 +778,7 @@ function ENT:CalcRPM() -- Calculate the current torque from flywheel RPM. local perc = math.Remap(self.FlyRPM, self.IdleRPM, self.LimitRPM, 0, 1) - self.Torque = self.Throttle * ACF_CalcCurve(self.TorqueCurve, perc) * self.PeakTorque * (self.FlyRPM < self.LimitRPM and 1 or 0) + self.Torque = self.Throttle * ACF_CalcCurve(self.ModTorqueCurve, perc) * self.PeakTorque * (self.FlyRPM < self.LimitRPM and 1 or 0) -- Let's accelerate the flywheel based on that torque. -- Calculate drag @@ -762,10 +815,6 @@ function ENT:CalcRPM() end self.FlyRPM = self.FlyRPM - math.min( TorqueDiff, TotalReqTq ) / self.Inertia - - -- Heat Temperature calculation. Below is the damage caused by rpm if damaged. - self.Heat = ACE_HeatFromEngine( self ) - local HealthRatio = self.ACF.Health / self.ACF.MaxHealth if HealthRatio < 0.995 then if HealthRatio > 0.025 then @@ -787,7 +836,6 @@ function ENT:CalcRPM() end end - -- 743.2 Estimate for engine material, 35% weight steel, 65% weight aluminum -- Then we calc a smoothed RPM value for the sound effects. For some reason this thing exists. table.remove( self.RPM, 10 ) table.insert( self.RPM, 1, self.FlyRPM ) @@ -805,7 +853,11 @@ function ENT:CalcRPM() if self.Sound then self.Sound:ChangePitch( math.min( 20 + (SmoothRPM * (self.SoundPitch / 100)) / 50, 255 ), 0 ) - self.Sound:ChangeVolume( 0.25 + (0.1 + 0.9 * ((SmoothRPM / self.LimitRPM) ^ 1.5)) * self.Throttle / 1.5, 0 ) + local SoundStrength = 0.25 + (0.1 + 0.9 * ((SmoothRPM / self.LimitRPM) ^ 1.5)) * self.Throttle / 1.5 + + self.Sound:ChangeVolume( SoundStrength, 0 ) + --self.Sound:SetSoundLevel( SoundStrength * self.MaxDB, 0 ) --Will not work after being played. + end return RPM @@ -897,12 +949,14 @@ do local AllowedEnts = { acf_gearbox = true, acf_fueltank = true, + ace_radiator = true, ace_crewseat_driver = true, } function ENT:Link( Target ) if not IsValid( Target ) or not AllowedEnts[Target:GetClass()] then + print(Target:GetClass()) return false, "You can only link gearboxes, fueltanks or crewseats!" end @@ -914,6 +968,10 @@ do if Target:GetClass() == "acf_fueltank" then return self:LinkFuel( Target ) end + -- Radiator links + if Target:GetClass() == "ace_radiator" then + return self:LinkRadiator( Target ) + end -- Crew links if Target:GetClass() == "ace_crewseat_driver" then return self:LinkCrew( Target ) @@ -923,7 +981,7 @@ do function ENT:Unlink( Target ) if not IsValid( Target ) or not AllowedEnts[Target:GetClass()] then - return false, "You can only unlink gearboxes, fueltanks or crewseats!" + return false, "You can only unlink gearboxes, fueltanks, radiators, or crewseats!" end -- Gear links @@ -934,6 +992,10 @@ do if Target:GetClass() == "acf_fueltank" then return self:UnlinkFuel( Target ) end + -- Radiator links + if Target:GetClass() == "ace_radiator" then + return self:UnlinkRadiator( Target ) + end -- Crew links if Target:GetClass() == "ace_crewseat_driver" then return self:UnlinkCrew( Target ) @@ -1054,7 +1116,7 @@ do end if self:GetPos():Distance( Target:GetPos() ) > FuelLinkDistBase then - return false, "Fuel tank is too far away." + return false, "The fuel tank is too far away." end table.insert( self.FuelLink, Target ) @@ -1076,6 +1138,36 @@ do end end +function ENT:LinkRadiator( Target ) + + for _, Value in pairs(self.RadLink) do + if Value == Target then + return false, "That radiator is already linked to this engine!" + end + end + + if self:GetPos():Distance( Target:GetPos() ) > FuelLinkDistBase then + return false, "The radiator is too far away." + end + + table.insert( self.RadLink, Target ) + table.insert( Target.Master, self ) + + return true, "Link successful!" +end + +function ENT:UnlinkRadiator( Target ) + + for Key, Value in pairs( self.RadLink ) do + if Value == Target then + table.remove( self.RadLink, Key ) + return true, "Unlink successful!" + end + end + + return false, "That radiator is not linked to this engine!" +end + -------------------------- Duplicator related stuff -------------------------- do function ENT:PreEntityCopy() @@ -1113,6 +1205,23 @@ do if fuel_info.entities then duplicator.StoreEntityModifier( self, "FuelLink", fuel_info ) end + + --fuel tank link saving + local rad_info = {} + local rad_entids = {} + for _, Value in pairs(self.RadLink) do --First clean the table of any invalid entities + if not Value:IsValid() then + table.remove(self.RadLink, Value) + end + end + for _, Value in pairs(self.RadLink) do --Then save it + table.insert(rad_entids, Value:EntIndex()) + end + + rad_info.entities = rad_entids + if rad_info.entities then + duplicator.StoreEntityModifier( self, "RadLink", rad_info ) + end --driver seat link saving for _, Value in pairs(self.CrewLink) do --First clean the table of any invalid entities @@ -1164,6 +1273,19 @@ do end Ent.EntityMods.FuelLink = nil end + --radiator link Pasting + if Ent.EntityMods and Ent.EntityMods.RadLink and Ent.EntityMods.RadLink.entities then + local RadLink = Ent.EntityMods.RadLink + if RadLink.entities and next(RadLink.entities) then + for _,ID in pairs(RadLink.entities) do + local Linked = CreatedEntities[ ID ] + if IsValid( Linked ) then + self:Link( Linked ) + end + end + end + Ent.EntityMods.RadLink = nil + end --ace_crewseat_gunner if Ent.EntityMods and Ent.EntityMods.CrewLink and Ent.EntityMods.CrewLink.entities then local CrewLink = Ent.EntityMods.CrewLink diff --git a/lua/weapons/gmod_tool/stools/acfsound.lua b/lua/weapons/gmod_tool/stools/acfsound.lua index ef103cfe2..e25f1b7d1 100644 --- a/lua/weapons/gmod_tool/stools/acfsound.lua +++ b/lua/weapons/gmod_tool/stools/acfsound.lua @@ -79,6 +79,28 @@ ACF.SoundToolSupport = { end }, + ace_radiator = { + + GetSound = function(ent) return { Sound = ent.SoundPath, Pitch = ent.SoundPitch or 100 } end, + + SetSound = function(ent, soundData) + ent.SoundPath = soundData.Sound + ent.SoundPitch = soundData.Pitch + end, + + ResetSound = function(ent) + + local pitch = 100 + local sound = "acf_extra/ACE/miscellaneous/fans/HighPitchCoolingFan.wav" + + local soundData = { Sound = sound, Pitch = pitch } + + local setSound = ACF.SoundToolSupport["ace_radiator"].SetSound + setSound( ent, soundData ) + end + }, + + acf_rack = { GetSound = function(ent) return { Sound = ent.Sound, Pitch = ent.SoundPitch or 100 } end, diff --git a/materials/models/radiators/Radiator.vmt b/materials/models/radiators/Radiator.vmt new file mode 100644 index 000000000..ae1dec85b --- /dev/null +++ b/materials/models/radiators/Radiator.vmt @@ -0,0 +1,6 @@ +"VertexLitGeneric" +{ + "$baseTexture" "models/radiators/Radiator" + "$bumpmap" "models/radiators/Radiator_normal" + "$model" "1" +} diff --git a/materials/models/radiators/Radiator.vtf b/materials/models/radiators/Radiator.vtf new file mode 100644 index 000000000..1266c3f48 Binary files /dev/null and b/materials/models/radiators/Radiator.vtf differ diff --git a/materials/models/radiators/Radiator_frame.vmt b/materials/models/radiators/Radiator_frame.vmt new file mode 100644 index 000000000..92bc17f63 --- /dev/null +++ b/materials/models/radiators/Radiator_frame.vmt @@ -0,0 +1,7 @@ +"VertexLitGeneric" +{ + "$baseTexture" "models\radiators/Radiator" + "$bumpmap" "models/radiators/Radiator_normal" + "$model" "1" + "$alphatest" "1" +} diff --git a/materials/models/radiators/Radiator_normal.vtf b/materials/models/radiators/Radiator_normal.vtf new file mode 100644 index 000000000..b1e409659 Binary files /dev/null and b/materials/models/radiators/Radiator_normal.vtf differ diff --git a/models/radiators/Radiator_big.dx80.vtx b/models/radiators/Radiator_big.dx80.vtx new file mode 100644 index 000000000..2bd6f90ec Binary files /dev/null and b/models/radiators/Radiator_big.dx80.vtx differ diff --git a/models/radiators/Radiator_big.dx90.vtx b/models/radiators/Radiator_big.dx90.vtx new file mode 100644 index 000000000..61bb99e3e Binary files /dev/null and b/models/radiators/Radiator_big.dx90.vtx differ diff --git a/models/radiators/Radiator_big.mdl b/models/radiators/Radiator_big.mdl new file mode 100644 index 000000000..51ea801bc Binary files /dev/null and b/models/radiators/Radiator_big.mdl differ diff --git a/models/radiators/Radiator_big.phy b/models/radiators/Radiator_big.phy new file mode 100644 index 000000000..d65b0e225 Binary files /dev/null and b/models/radiators/Radiator_big.phy differ diff --git a/models/radiators/Radiator_big.sw.vtx b/models/radiators/Radiator_big.sw.vtx new file mode 100644 index 000000000..8bbad73e3 Binary files /dev/null and b/models/radiators/Radiator_big.sw.vtx differ diff --git a/models/radiators/Radiator_big.vvd b/models/radiators/Radiator_big.vvd new file mode 100644 index 000000000..e1c686135 Binary files /dev/null and b/models/radiators/Radiator_big.vvd differ diff --git a/models/radiators/Radiator_med.dx80.vtx b/models/radiators/Radiator_med.dx80.vtx new file mode 100644 index 000000000..3fe34ea67 Binary files /dev/null and b/models/radiators/Radiator_med.dx80.vtx differ diff --git a/models/radiators/Radiator_med.dx90.vtx b/models/radiators/Radiator_med.dx90.vtx new file mode 100644 index 000000000..c9cf3c885 Binary files /dev/null and b/models/radiators/Radiator_med.dx90.vtx differ diff --git a/models/radiators/Radiator_med.mdl b/models/radiators/Radiator_med.mdl new file mode 100644 index 000000000..a750d6db3 Binary files /dev/null and b/models/radiators/Radiator_med.mdl differ diff --git a/models/radiators/Radiator_med.phy b/models/radiators/Radiator_med.phy new file mode 100644 index 000000000..9b2ddf9ad Binary files /dev/null and b/models/radiators/Radiator_med.phy differ diff --git a/models/radiators/Radiator_med.sw.vtx b/models/radiators/Radiator_med.sw.vtx new file mode 100644 index 000000000..3e6136536 Binary files /dev/null and b/models/radiators/Radiator_med.sw.vtx differ diff --git a/models/radiators/Radiator_med.vvd b/models/radiators/Radiator_med.vvd new file mode 100644 index 000000000..588785011 Binary files /dev/null and b/models/radiators/Radiator_med.vvd differ diff --git a/models/radiators/Radiator_small.dx80.vtx b/models/radiators/Radiator_small.dx80.vtx new file mode 100644 index 000000000..dcf31b619 Binary files /dev/null and b/models/radiators/Radiator_small.dx80.vtx differ diff --git a/models/radiators/Radiator_small.dx90.vtx b/models/radiators/Radiator_small.dx90.vtx new file mode 100644 index 000000000..401894b03 Binary files /dev/null and b/models/radiators/Radiator_small.dx90.vtx differ diff --git a/models/radiators/Radiator_small.mdl b/models/radiators/Radiator_small.mdl new file mode 100644 index 000000000..934323ce4 Binary files /dev/null and b/models/radiators/Radiator_small.mdl differ diff --git a/models/radiators/Radiator_small.phy b/models/radiators/Radiator_small.phy new file mode 100644 index 000000000..9d4916336 Binary files /dev/null and b/models/radiators/Radiator_small.phy differ diff --git a/models/radiators/Radiator_small.sw.vtx b/models/radiators/Radiator_small.sw.vtx new file mode 100644 index 000000000..16e403255 Binary files /dev/null and b/models/radiators/Radiator_small.sw.vtx differ diff --git a/models/radiators/Radiator_small.vvd b/models/radiators/Radiator_small.vvd new file mode 100644 index 000000000..9b3a92d0a Binary files /dev/null and b/models/radiators/Radiator_small.vvd differ diff --git a/sound/acf_extra/ACE/miscellaneous/fans/BuzzingCoolingFan.wav b/sound/acf_extra/ACE/miscellaneous/fans/BuzzingCoolingFan.wav new file mode 100644 index 000000000..9e380d4be Binary files /dev/null and b/sound/acf_extra/ACE/miscellaneous/fans/BuzzingCoolingFan.wav differ diff --git a/sound/acf_extra/ACE/miscellaneous/fans/BuzzingCoolingFan_Startup.wav b/sound/acf_extra/ACE/miscellaneous/fans/BuzzingCoolingFan_Startup.wav new file mode 100644 index 000000000..df6325e04 Binary files /dev/null and b/sound/acf_extra/ACE/miscellaneous/fans/BuzzingCoolingFan_Startup.wav differ diff --git a/sound/acf_extra/ACE/miscellaneous/fans/HighPitchCoolingFan.wav b/sound/acf_extra/ACE/miscellaneous/fans/HighPitchCoolingFan.wav new file mode 100644 index 000000000..a6866cfcc Binary files /dev/null and b/sound/acf_extra/ACE/miscellaneous/fans/HighPitchCoolingFan.wav differ diff --git a/sound/acf_extra/ACE/miscellaneous/fans/QuietCoolingFan.wav b/sound/acf_extra/ACE/miscellaneous/fans/QuietCoolingFan.wav new file mode 100644 index 000000000..fc345c146 Binary files /dev/null and b/sound/acf_extra/ACE/miscellaneous/fans/QuietCoolingFan.wav differ diff --git a/sound/acf_extra/ACE/miscellaneous/fans/QuietCoolingFan_Startup.wav b/sound/acf_extra/ACE/miscellaneous/fans/QuietCoolingFan_Startup.wav new file mode 100644 index 000000000..03d19641c Binary files /dev/null and b/sound/acf_extra/ACE/miscellaneous/fans/QuietCoolingFan_Startup.wav differ diff --git a/sound/acf_extra/ACE/miscellaneous/fans/RattlyCoolingFan.wav b/sound/acf_extra/ACE/miscellaneous/fans/RattlyCoolingFan.wav new file mode 100644 index 000000000..7ded215af Binary files /dev/null and b/sound/acf_extra/ACE/miscellaneous/fans/RattlyCoolingFan.wav differ diff --git a/sound/acf_extra/ACE/miscellaneous/fans/RattlyCoolingFan_Startup.wav b/sound/acf_extra/ACE/miscellaneous/fans/RattlyCoolingFan_Startup.wav new file mode 100644 index 000000000..72e3cddfe Binary files /dev/null and b/sound/acf_extra/ACE/miscellaneous/fans/RattlyCoolingFan_Startup.wav differ