Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ BETA ] Mobility Update v2.12.7-beta #396

Open
wants to merge 59 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
3cafdd7
Updating Dev branch mobility
Tyunge Mar 24, 2024
b62cdb7
Update to dev branch
Tyunge Mar 24, 2024
d99865b
Convert to dev branch
Tyunge Mar 24, 2024
4f738df
Clear whitespaces
Tyunge Mar 24, 2024
43ad315
Lint style update
Tyunge Mar 24, 2024
4545e92
Add new engine class to mass ratio check
Tyunge Mar 24, 2024
9176d99
Update idle throttle and engine feedback
Tyunge Mar 24, 2024
8d0b24b
Chat Error Update. RPM Matching
Tyunge Mar 27, 2024
d5944d0
Update torque feedback
Tyunge Mar 27, 2024
11a1579
Make dual clutch work with new system
Tyunge Mar 27, 2024
1e6ccbb
Limit input torque to rating
Tyunge Mar 27, 2024
9242c67
Fixed Outputs not displaying
Tyunge Mar 27, 2024
ad04724
Implement flywheel feedback
Tyunge Mar 27, 2024
c474dd5
Limit feedback torque, boost wheel torque
Tyunge Mar 27, 2024
f041c6e
Power loss fix.
Tyunge Mar 28, 2024
7bcca8f
negative rpm fix
Tyunge Mar 28, 2024
5ed7afe
Apply deltatime check to engine rpm
Tyunge Mar 29, 2024
c19198b
Fix timing issue
Tyunge Mar 29, 2024
b821a46
Merge branch 'ACF-Team:master' into master
Tyunge Apr 2, 2024
1dd1424
Ratio convert tool
Tyunge Apr 4, 2024
7f04757
Merge branch 'master' of https://github.com/Tyunge/ACF-3
Tyunge Apr 4, 2024
957d212
Satisfy Lint
Tyunge Apr 4, 2024
71ed9a2
Move mobility update setting
Tyunge Apr 5, 2024
177c450
Merge branch 'ACF-Team:master' into master
Tyunge Apr 5, 2024
0bbb366
Update acf_keshove.lua
Tyunge Apr 5, 2024
090b9c3
Merge branch 'master' of https://github.com/Tyunge/ACF-3
Tyunge Apr 5, 2024
c50516f
Satisfy Lint
Tyunge Apr 5, 2024
fc5ebc3
Gearbox Logic Update + More
Tyunge Apr 13, 2024
12a42e8
Lint
Tyunge Apr 13, 2024
ba2d93c
Remove unused variable
Tyunge Apr 13, 2024
c279e00
Merge branch 'ACF-Team:master' into master
Tyunge Apr 13, 2024
7d21d06
Merge branch 'ACF-Team:master' into master
Tyunge Apr 14, 2024
1e2aa12
Update engine sounds
Tyunge Apr 14, 2024
e3d1e64
Order of operation bugs
Tyunge Apr 16, 2024
a085ee4
Fix Stepping effect of engine rpm
Tyunge Apr 16, 2024
1e6769a
Satisfy Lint
Tyunge Apr 16, 2024
0d57110
Torque transfer
Tyunge Apr 17, 2024
3a88013
Satisfy Lint
Tyunge Apr 17, 2024
05e9388
100% clutch engagement
Tyunge Apr 17, 2024
d2e1d53
Clamp Engine Loaded Torque
Tyunge Apr 17, 2024
3739027
Check Valid phys first
Tyunge Apr 17, 2024
4844ca6
Satisy Lint
Tyunge Apr 17, 2024
3917945
Engine speed accuracy improvements
Tyunge Apr 22, 2024
13af5db
Cut torque past rpm limit
Tyunge Apr 25, 2024
68dad2e
Added CVT gearbox. Dual Clutch improvements
Tyunge Apr 29, 2024
3830907
Lint
Tyunge Apr 29, 2024
64b7c39
>:(
Tyunge Apr 29, 2024
a7459cf
Merge remote-tracking branch 'upstream/dev'
Tyunge Apr 29, 2024
e1c6d54
Update Electric Motors
Tyunge Apr 29, 2024
2c5b33c
Update Turbine Engines. Include Flywheel Torque
Tyunge Apr 29, 2024
d652f05
flywheel mass update
Tyunge May 5, 2024
373705c
Major Update to Engine Physics
Tyunge May 21, 2024
0fd8747
Satisfy Lint
Tyunge May 21, 2024
d0ee509
Satisfy Lint
Tyunge May 21, 2024
505d04f
Timer update
Tyunge May 21, 2024
394337d
Merge branch 'ACF-Team:master' into master
Tyunge Jun 3, 2024
00d67b9
Low gear oscillation fix
Tyunge Jun 3, 2024
3c97baa
Merge branch 'master' of https://github.com/Tyunge/ACF-3
Tyunge Jun 3, 2024
4b56afd
Remove double if statement
Tyunge Jun 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lua/acf/contraption/contraption_sv.lua
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ function Contraption.CalcMassRatio(Ent, Tally)
if Tally then
local Class = K:GetClass()

if Class == "acf_engine" then
if Class == "acf_engine" or Class == "acf_engine_update" then
Power = Power + K.PeakPower * 1.34
elseif Class == "acf_fueltank" then
Fuel = Fuel + K.Capacity
Expand Down Expand Up @@ -180,7 +180,7 @@ function Contraption.CalcMassRatio(Ent, Tally)
if Tally then
local Class = K:GetClass()

if Class == "acf_engine" then
if Class == "acf_engine" or Class == "acf_engine_update" then
Power = Power + K.PeakPower * 1.34
elseif Class == "acf_fueltank" then
Fuel = Fuel + K.Capacity
Expand Down
1 change: 1 addition & 0 deletions lua/acf/core/globals.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ do -- ACF global vars
ACF.MinimumArmor = 1 -- Minimum possible armor that can be given to an entity
ACF.MaximumArmor = 5000 -- Maximum possible armor that can be given to an entity
ACF.KillIconColor = Color(200, 200, 48)
ACF.MobilityUpdate = true -- Enable beta test of the new mobility system

ACF.GunsCanFire = true
ACF.GunsCanSmoke = true
Expand Down
147 changes: 136 additions & 11 deletions lua/acf/core/utilities/util_cl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,21 @@ do -- Default gearbox menus
Base:AddLabel("The dual clutch allows you to apply power and brake each side independently.")
end

ACF.SetClientData("PrimaryClass","acf_gearbox")

if Data.ClassID ~= "DoubleDiff" then
local MobilityUpdate = Base:AddCheckBox("[BETA] Enables new mobility logic")
MobilityUpdate:SetClientData("MobilityUpdate", "OnChange")
MobilityUpdate:DefineSetter(function(Panel, _, _, Value)
Panel:SetValue(Value)
if Value then
ACF.SetClientData("PrimaryClass","acf_gearbox_update")
else
ACF.SetClientData("PrimaryClass","acf_gearbox")
end
return Value
end)
end
-----------------------------------

local GearBase = Menu:AddCollapsible("Gear Settings")
Expand All @@ -117,7 +132,7 @@ do -- Default gearbox menus

ACF.SetClientData(Variable, Default)

local Control = GearBase:AddSlider("Gear " .. I, -1, 1, 2)
local Control = GearBase:AddSlider("Gear " .. I, -10, 10, 3)
Control:SetClientData(Variable, "OnValueChanged")
Control:DefineSetter(function(Panel, _, _, Value)
Value = math.Round(Value, 2)
Expand All @@ -136,7 +151,7 @@ do -- Default gearbox menus

ACF.SetClientData("FinalDrive", ValuesData.FinalDrive)

local FinalDrive = GearBase:AddSlider("Final Drive", -1, 1, 2)
local FinalDrive = GearBase:AddSlider("Final Drive", -10, 10, 3)
FinalDrive:SetClientData("FinalDrive", "OnValueChanged")
FinalDrive:DefineSetter(function(Panel, _, _, Value)
Value = math.Round(Value, 2)
Expand All @@ -147,6 +162,46 @@ do -- Default gearbox menus

return Value
end)

local RatioConverter = GearBase:AddButton("Convert Ratios")
function RatioConverter:DoClickInternal()
if ValuesData.FinalDrive ~= 0 then
local FinalDrive = 1 / ValuesData.FinalDrive
ValuesData.FinalDrive = FinalDrive
ACF.SetClientData("FinalDrive", ValuesData.FinalDrive)
end

for I = 1, Gears.Max do
local Variable = "Gear" .. I
if ValuesData[Variable] ~= 0 then
local Ratio = 1 / ValuesData[Variable]
ValuesData[Variable] = Ratio
ACF.SetClientData(Variable, Ratio)
end

end
end

local PasteCopiedData = GearBase:AddButton("Paste Copied Ratios")
function PasteCopiedData:DoClickInternal()
if ACF.GetClientString("CopiedGearboxData","No Data") == "No Data" then return end
local CopiedData = util.JSONToTable(ACF.GetClientString("CopiedGearboxData","No Data"))
table.SortByMember(CopiedData, "Key", true)

local Ratios = CopiedData[3]["Value"]
local FinalDrive = CopiedData[1]["Value"]

for I = 1, Gears.Max do
if Ratios[I] ~= nil then
local Variable = "Gear" .. I
ValuesData[Variable] = Ratios[I]
ACF.SetClientData(Variable, ValuesData[Variable])
end
end

ValuesData["FinalDrive"] = FinalDrive
ACF.SetClientData("FinalDrive",ValuesData["FinalDrive"])
end
end
end

Expand All @@ -155,9 +210,9 @@ do -- Default gearbox menus
{
Name = "Gear 2",
Variable = "Gear2",
Min = -1,
Max = 1,
Decimals = 2,
Min = -10,
Max = 10,
Decimals = 3,
Default = -0.1,
},
{
Expand All @@ -172,16 +227,16 @@ do -- Default gearbox menus
Name = "Max Target RPM",
Variable = "MaxRPM",
Min = 101,
Max = 10000,
Max = 12000,
Decimals = 0,
Default = 5000,
},
{
Name = "Final Drive",
Variable = "FinalDrive",
Min = -1,
Max = 1,
Decimals = 2,
Min = -10,
Max = 10,
Decimals = 3,
Default = 1,
},
}
Expand All @@ -190,13 +245,28 @@ do -- Default gearbox menus
local Text = "Mass : %s\nTorque Rating : %s n/m - %s fl-lb\n"
local Mass = ACF.GetProperMass(Data.Mass)
local Torque = math.floor(Data.MaxTorque * 0.73)

local Gears = Class.Gears
Base:AddLabel(Text:format(Mass, Data.MaxTorque, Torque))

if Data.DualClutch then
Base:AddLabel("The dual clutch allows you to apply power and brake each side independently.")
end

ACF.SetClientData("PrimaryClass","acf_gearbox")

local MobilityUpdate = Base:AddCheckBox("[BETA] Enables new mobility logic")
MobilityUpdate:SetClientData("MobilityUpdate", "OnChange")
MobilityUpdate:DefineSetter(function(Panel, _, _, Value)
Panel:SetValue(Value)
if Value then
ACF.SetClientData("PrimaryClass","acf_gearbox_update")
else
ACF.SetClientData("PrimaryClass","acf_gearbox")
end
return Value
end)

Base:AddLabel("With the mobility update enabled \"Max Target RPM\" is unused.")
-----------------------------------

local GearBase = Menu:AddCollapsible("Gear Settings")
Expand All @@ -205,7 +275,7 @@ do -- Default gearbox menus

local ValuesData = Values[Class.ID]

ACF.SetClientData("Gear1", 0.01)
ACF.SetClientData("Gear1", 0.001)

for _, GearData in ipairs(CVTData) do
local Variable = GearData.Variable
Expand All @@ -231,6 +301,39 @@ do -- Default gearbox menus
return Value
end)
end

local RatioConverter = GearBase:AddButton("Convert Ratios")
function RatioConverter:DoClickInternal()
if ValuesData.FinalDrive ~= 0 then
local FinalDrive = 1 / ValuesData.FinalDrive
ValuesData.FinalDrive = FinalDrive
ACF.SetClientData("FinalDrive", ValuesData.FinalDrive)
end
local Gear2 = 1 / ValuesData.Gear2
ValuesData.Gear2 = Gear2
ACF.SetClientData("Gear2",Gear2)
end

local PasteCopiedData = GearBase:AddButton("Paste Copied Ratios")
function PasteCopiedData:DoClickInternal()
if ACF.GetClientString("CopiedGearboxData","No Data") == "No Data" then return end
local CopiedData = util.JSONToTable(ACF.GetClientString("CopiedGearboxData","No Data"))
table.SortByMember(CopiedData, "Key", true)

local Ratios = CopiedData[3]["Value"]
local FinalDrive = CopiedData[1]["Value"]

for I = 1, Gears.Max do
if Ratios[I] ~= nil then
local Variable = "Gear" .. I
ValuesData[Variable] = Ratios[I]
ACF.SetClientData(Variable, ValuesData[Variable])
end
end

ValuesData["FinalDrive"] = FinalDrive
ACF.SetClientData("FinalDrive",ValuesData["FinalDrive"])
end
end
end

Expand Down Expand Up @@ -297,6 +400,7 @@ do -- Default gearbox menus
Base:AddLabel("The dual clutch allows you to apply power and brake each side independently.")
end

ACF.SetClientData("PrimaryClass","acf_gearbox")
-----------------------------------

local GearBase = Menu:AddCollapsible("Gear Settings")
Expand Down Expand Up @@ -456,6 +560,27 @@ do -- Default gearbox menus
ACF.SetClientData("Shift" .. I, Gear * Multiplier)
end
end

local PasteCopiedData = GearBase:AddButton("Paste Copied Ratios")
function PasteCopiedData:DoClickInternal()
if ACF.GetClientString("CopiedGearboxData","No Data") == "No Data" then return end
local CopiedData = util.JSONToTable(ACF.GetClientString("CopiedGearboxData","No Data"))
table.SortByMember(CopiedData, "Key", true)

local Ratios = CopiedData[3]["Value"]
local FinalDrive = CopiedData[1]["Value"]

for I = 1, Gears.Max do
if Ratios[I] ~= nil then
local Variable = "Gear" .. I
ValuesData[Variable] = Ratios[I]
ACF.SetClientData(Variable, ValuesData[Variable])
end
end

ValuesData["FinalDrive"] = FinalDrive
ACF.SetClientData("FinalDrive",ValuesData["FinalDrive"])
end
end
end
end
Expand Down
8 changes: 8 additions & 0 deletions lua/acf/entities/engines/b4.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ do
Mass = 60,
Torque = 131,
FlywheelMass = 0.06,
FlywheelMassUpdate = 8,
Displacement = 1.4,
RPM = {
Idle = 600,
Limit = 4500,
Expand All @@ -36,6 +38,8 @@ do
Mass = 125,
Torque = 225,
FlywheelMass = 0.15,
FlywheelMassUpdate = 11,
Displacement = 2.1,
RPM = {
Idle = 700,
Limit = 5000,
Expand All @@ -55,6 +59,8 @@ do
Mass = 135,
Torque = 310,
FlywheelMass = 0.4,
FlywheelMassUpdate = 25,
Displacement = 2.4,
RPM = {
Idle = 550,
Limit = 2800,
Expand All @@ -74,6 +80,8 @@ do
Mass = 210,
Torque = 315,
FlywheelMass = 0.15,
FlywheelMassUpdate = 13,
Displacement = 3.2,
RPM = {
Idle = 900,
Limit = 6500
Expand Down
10 changes: 10 additions & 0 deletions lua/acf/entities/engines/b6.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ do
Mass = 100,
Torque = 170,
FlywheelMass = 0.08,
FlywheelMassUpdate = 7,
Displacement = 2.8,
RPM = {
Idle = 750,
Limit = 7250,
Expand All @@ -36,6 +38,8 @@ do
Mass = 240,
Torque = 412,
FlywheelMass = 0.11,
FlywheelMassUpdate = 13,
Displacement = 5.0,
RPM = {
Idle = 900,
Limit = 6800,
Expand All @@ -55,6 +59,8 @@ do
Mass = 480,
Torque = 606,
FlywheelMass = 0.65,
FlywheelMassUpdate = 35,
Displacement = 8.3,
RPM = {
Idle = 500,
Limit = 4200,
Expand All @@ -74,6 +80,8 @@ do
Mass = 725,
Torque = 1375,
FlywheelMass = 1,
FlywheelMassUpdate = 60,
Displacement = 15.8,
RPM = {
Idle = 620,
Limit = 4900,
Expand All @@ -93,6 +101,8 @@ do
Mass = 1600,
Torque = 1995,
FlywheelMass = 3,
FlywheelMassUpdate = 125,
Displacement = 14.5,
RPM = {
Idle = 620,
Limit = 2550,
Expand Down
Loading
Loading