CarCalculator: Difference between revisions

From Automation Game Wiki
No edit summary
No edit summary
Line 16: Line 16:
* CarCalculator.[[EngineCalculator]] --- The EngineCalculator Instance for this Car
* CarCalculator.[[EngineCalculator]] --- The EngineCalculator Instance for this Car
** CarCalculator.EngineCalculator.EngineInfo --- The same instance of the EngineInfo table that is also stored in CarInfo.TrimInfo
** CarCalculator.EngineCalculator.EngineInfo --- The same instance of the EngineInfo table that is also stored in CarInfo.TrimInfo
== Useful functions ==
*[[CarCalculator:GetCarParameters()]]
*[[CarCalculator:GetBrakingForces()]]
*[[CarCalculator:CalculateDynamicCG(speed,mode)]]
*[[CarCalculator:GetTotalEffectiveArea(AeroMode)]]
*[[CarCalculator:GetFrontTyreParameters()]]
*[[CarCalculator:GetRearTyreParameters()]]


== Part Choices ==
== Part Choices ==


The Part choices, each corresponding to a list selection in Automation's designers. Is a table containing the various data attributes Automation uses in its calculations. The main field you may care about is the Part Name/Identifier. To then make choices or selections for the product you are writing an exporter for.
The Part choices, each corresponding to a list selection in Automation's designers. Is a table containing the various data attributes Automation uses in its calculations. The main field you may care about is the Part Name/Identifier. To then make choices or selections for the product you are writing an exporter for.

Revision as of 18:37, 4 November 2021

Overview

CarCalculator is an embarrassment of poor design decisions and technical debt. But that is what you can end up with after a project of 10 years.

The CarCalculator passed into DoExport is an 'instance' of CCarCalculator. A Lua table behaving like a traditional class object of OOP Languages.

CarCalculator is comprised of a series of nested tables:

  • CarCalculator.CarInfo --- The root table of information
  • CarCalculator.EngineCalculator --- The EngineCalculator Instance for this Car
    • CarCalculator.EngineCalculator.EngineInfo --- The same instance of the EngineInfo table that is also stored in CarInfo.TrimInfo

Useful functions

Part Choices

The Part choices, each corresponding to a list selection in Automation's designers. Is a table containing the various data attributes Automation uses in its calculations. The main field you may care about is the Part Name/Identifier. To then make choices or selections for the product you are writing an exporter for.