RigsofRods
Soft-body Physics Simulation
|
A land vehicle engine + transmission. More...
#include <Engine.h>
Public Types | |
enum | autoswitch { REAR, NEUTRAL, DRIVE, TWO, ONE, MANUALMODE } |
enum | turbomode { OLD, NEW } |
Public Member Functions | |
Engine (float min_rpm, float max_rpm, float torque, float reverse_gear, float neutral_gear, std::vector< float > gears, float dratio, ActorPtr actor) | |
~Engine () | |
void | SetEngineOptions (float einertia, char etype, float eclutch, float ctime, float stime, float pstime, float irpm, float srpm, float maximix, float minimix, float ebraking) |
void | SetTurboOptions (int type, float tinertiaFactor, int nturbos, float param1, float param2, float param3, float param4, float param5, float param6, float param7, float param8, float param9, float param10, float param11) |
Definition; keyword 'engine' | |
float | getGearRatio (int pos) |
-1=R, 0=N, 1... ('engine' attrs #5[R],#6[N],#7[1]...) More... | |
int | getNumGears () const |
int | getNumGearsRanges () const |
Definition, Keyword 'engoption' | |
bool | isElectric () const |
bool | hasAir () const |
bool | hasTurbo () const |
float | getBrakingTorque () const |
Definition, Keyword 'torquecurve' | |
TorqueCurve * | getTorqueCurve () |
General state getters | |
float | getAcc () |
float | getClutch () const |
float | getCrankFactor () |
float | getRPM () |
float | getSmoke () |
float | getTorque () |
float | getTurboPSI () |
SimGearboxMode | getAutoMode () |
int | getGear () |
int | getGearRange () |
bool | isRunning () |
float | getCurEngineTorque () |
float | getInputShaftRPM () |
float | getDriveRatio () |
float | getEnginePower () |
float | getEnginePower (float rpm) |
float | getTurboPower () |
float | getIdleMixture () |
float | getPrimeMixture () |
int | getAutoShift () |
float | getAccToHoldRPM () |
estimate required throttle input to hold the current rpm More... | |
Shifting diagnostic | |
float | getPostShiftClock () |
float | getShiftClock () |
bool | isPostShifting () |
bool | isShifting () |
int | getShifTargetGear () |
float | getAutoShiftBehavior () |
int | getUpshiftDelayCounter () |
int | getKickdownDelayCounter () |
General state changes | |
void | pushNetworkState (float engine_rpm, float acc, float clutch, int gear, bool running, bool contact, char auto_mode, char auto_select=-1) |
void | setAcc (float val) |
void | autoSetAcc (float val) |
void | setClutch (float clutch) |
void | setRPM (float rpm) |
void | setWheelSpin (float rpm) |
void | setAutoMode (SimGearboxMode mode) |
void | setPrime (bool p) |
void | setHydroPump (float work) |
void | setManualClutch (float val) |
void | setTCaseRatio (float ratio) |
Set current transfer case gear (reduction) ratio. More... | |
void | toggleContact () |
Ignition. More... | |
void | offStart () |
Quick start of vehicle engine. More... | |
void | startEngine () |
Quick engine start. Plays sounds. More... | |
void | stopEngine () |
stall engine More... | |
Shifting | |
void | toggleAutoMode () |
void | autoShiftDown () |
void | autoShiftSet (int mode) |
void | autoShiftUp () |
void | setGear (int v) |
low level gear changing (bypasses shifting logic) More... | |
void | setGearRange (int v) |
low level gear changing (bypasses shifting logic) More... | |
void | shift (int val) |
Changes gear by a relative offset. Plays sounds. More... | |
void | shiftTo (int val) |
Changes gear to given value. Plays sounds. More... | |
Updates | |
void | updateShifts () |
Changes gears. Plays sounds. More... | |
void | UpdateEngine (float dt, int doUpdate) |
void | UpdateEngineAudio () |
void | UpdateInputEvents (float dt) |
Public Member Functions inherited from RefCountingObject< Engine > | |
RefCountingObject () | |
virtual | ~RefCountingObject () |
void | AddRef () |
void | Release () |
Private Attributes | |
ActorPtr | m_actor |
float | m_ref_wheel_revolutions |
Gears; estimated wheel revolutions based on current vehicle speed along the longi. axis. More... | |
float | m_cur_wheel_revolutions |
Gears; measured wheel revolutions. More... | |
int | m_cur_gear |
Gears; Current gear {-1 = reverse, 0 = neutral, 1...21 = forward}. More... | |
int | m_cur_gear_range |
Gears. More... | |
int | m_num_gears |
Num. forward gears. More... | |
std::vector< float > | m_gear_ratios |
[R|N|1|...] ('engine' attrs #4[global],#5[R],#6[N],#7[1]...) More... | |
float | m_clutch_force |
('engoption' attr #3) More... | |
float | m_clutch_time |
Time (in seconds) the clutch takes to apply ('engoption' attr #5) More... | |
float | m_cur_clutch |
float | m_cur_clutch_torque |
bool | m_engine_is_electric |
Engine attribute. More... | |
bool | m_engine_has_air |
Engine attribute. More... | |
bool | m_engine_has_turbo |
Engine attribute. More... | |
int | m_engine_turbo_mode |
Engine attribute. More... | |
bool | m_engine_is_running |
Engine state. More... | |
char | m_engine_type |
't' = truck (default), 'c' = car ('engoption' attr #2) More... | |
float | m_braking_torque |
Engine attribute. More... | |
float | m_cur_acc |
Engine. More... | |
float | m_cur_engine_rpm |
Engine. More... | |
float | m_cur_engine_torque |
Engine. More... | |
float | m_diff_ratio |
Global gear ratio ('engine' attr #4) More... | |
float | m_tcase_ratio |
Engine. More... | |
float | m_engine_torque |
Torque in N/m ('engine' attr #3) More... | |
float | m_hydropump_state |
Engine. More... | |
float | m_min_idle_mixture |
Minimum throttle to maintain the idle RPM ('engoption' attr #10) More... | |
float | m_max_idle_mixture |
Maximum throttle to maintain the idle RPM ('engoption' attr #9) More... | |
float | m_engine_inertia |
('engoption' attr #1) More... | |
float | m_engine_max_rpm |
Shift up RPM ('engine' attr #2) More... | |
float | m_engine_shiftup_rpm |
Shift down RPM ('engine' attr #1) More... | |
float | m_engine_idle_rpm |
('engoption' attr #8) More... | |
float | m_engine_stall_rpm |
('engoption' attr #7) More... | |
bool | m_engine_is_priming |
Engine. More... | |
TorqueCurve * | m_torque_curve |
float | m_air_pressure |
bool | m_contact |
Ignition switch is in ON/RUN position. More... | |
bool | m_starter |
Ignition switch is in START position. More... | |
float | m_post_shift_time |
Time (in seconds) until full torque is transferred ('engoption' attr #6) More... | |
float | m_post_shift_clock |
float | m_shift_time |
Time (in seconds) that it takes to shift ('engoption' attr #4) More... | |
float | m_shift_clock |
int | m_post_shifting |
int | m_shifting |
int | m_shift_val |
SimGearboxMode | m_auto_mode |
autoswitch | m_autoselect |
float | m_auto_cur_acc |
float | m_full_rpm_range |
float | m_one_third_rpm_range |
float | m_half_rpm_range |
float | m_shift_behaviour |
int | m_upshift_delay_counter |
int | m_kickdown_delay_counter |
std::deque< float > | m_rpms |
std::deque< float > | m_accs |
std::deque< float > | m_brakes |
int | m_turbo_ver |
float | m_cur_turbo_rpm [MAXTURBO] |
float | m_turbo_inertia_factor |
int | m_num_turbos |
int | m_max_turbo_rpm |
float | m_engine_addi_torque [MAXTURBO] |
float | m_turbo_engine_rpm_operation |
bool | m_turbo_has_bov |
float | m_turbo_bov_rpm [MAXTURBO] |
int | m_min_bov_psi |
bool | m_turbo_has_wastegate |
float | m_min_wastegate_psi |
bool | m_turbo_flutters |
float | m_turbo_wg_threshold_p |
float | m_turbo_wg_threshold_n |
bool | m_turbo_has_antilag |
float | m_antilag_min_rpm |
float | m_antilag_rand_chance |
float | m_antilag_power_factor |
Friends | |
class | ActorSpawner |
class | Actor |
Additional Inherited Members | |
Static Public Member Functions inherited from RefCountingObject< Engine > | |
static void | RegisterRefCountingObject (AS_NAMESPACE_QUALIFIER asIScriptEngine *engine, const char *name) |
Data Fields inherited from RefCountingObject< Engine > | |
int | m_refcount |
std::mutex | m_refcount_mtx |
Engine::Engine | ( | float | min_rpm, |
float | max_rpm, | ||
float | torque, | ||
float | reverse_gear, | ||
float | neutral_gear, | ||
std::vector< float > | gears, | ||
float | dratio, | ||
ActorPtr | actor | ||
) |
Definition at line 37 of file Engine.cpp.
Engine::~Engine | ( | ) |
Definition at line 121 of file Engine.cpp.
void Engine::autoSetAcc | ( | float | val | ) |
Definition at line 1075 of file Engine.cpp.
void Engine::autoShiftDown | ( | ) |
Definition at line 1171 of file Engine.cpp.
void Engine::autoShiftSet | ( | int | mode | ) |
Definition at line 1154 of file Engine.cpp.
void Engine::autoShiftUp | ( | ) |
Definition at line 1162 of file Engine.cpp.
float Engine::getAcc | ( | ) |
float Engine::getAccToHoldRPM | ( | ) |
estimate required throttle input to hold the current rpm
Definition at line 1069 of file Engine.cpp.
RoR::SimGearboxMode Engine::getAutoMode | ( | ) |
int Engine::getAutoShift | ( | ) |
|
inline |
float Engine::getCrankFactor | ( | ) |
|
inline |
float Engine::getEnginePower | ( | float | rpm | ) |
int Engine::getGear | ( | ) |
int Engine::getGearRange | ( | ) |
float Engine::getGearRatio | ( | int | pos | ) |
-1=R, 0=N, 1... ('engine' attrs #5[R],#6[N],#7[1]...)
Definition at line 956 of file Engine.cpp.
float Engine::getIdleMixture | ( | ) |
|
inline |
|
inline |
float Engine::getPrimeMixture | ( | ) |
Definition at line 1239 of file Engine.cpp.
|
inline |
float Engine::getSmoke | ( | ) |
Definition at line 903 of file Engine.cpp.
float Engine::getTorque | ( | ) |
|
inline |
float Engine::getTurboPower | ( | ) |
Definition at line 1195 of file Engine.cpp.
float Engine::getTurboPSI | ( | ) |
|
inline |
|
inline |
void Engine::offStart | ( | ) |
Quick start of vehicle engine.
Definition at line 1013 of file Engine.cpp.
void Engine::pushNetworkState | ( | float | engine_rpm, |
float | acc, | ||
float | clutch, | ||
int | gear, | ||
bool | running, | ||
bool | contact, | ||
char | auto_mode, | ||
char | auto_select = -1 |
||
) |
void Engine::setAcc | ( | float | val | ) |
void Engine::setAutoMode | ( | RoR::SimGearboxMode | mode | ) |
|
inline |
void Engine::SetEngineOptions | ( | float | einertia, |
char | etype, | ||
float | eclutch, | ||
float | ctime, | ||
float | stime, | ||
float | pstime, | ||
float | irpm, | ||
float | srpm, | ||
float | maximix, | ||
float | minimix, | ||
float | ebraking | ||
) |
void Engine::setGear | ( | int | v | ) |
low level gear changing (bypasses shifting logic)
Definition at line 1044 of file Engine.cpp.
void Engine::setGearRange | ( | int | v | ) |
low level gear changing (bypasses shifting logic)
Definition at line 1054 of file Engine.cpp.
void Engine::setHydroPump | ( | float | work | ) |
Definition at line 928 of file Engine.cpp.
void Engine::setManualClutch | ( | float | val | ) |
void Engine::setPrime | ( | bool | p | ) |
Definition at line 923 of file Engine.cpp.
void Engine::setRPM | ( | float | rpm | ) |
void Engine::setTCaseRatio | ( | float | ratio | ) |
Set current transfer case gear (reduction) ratio.
Definition at line 938 of file Engine.cpp.
void Engine::SetTurboOptions | ( | int | type, |
float | tinertiaFactor, | ||
int | nturbos, | ||
float | param1, | ||
float | param2, | ||
float | param3, | ||
float | param4, | ||
float | param5, | ||
float | param6, | ||
float | param7, | ||
float | param8, | ||
float | param9, | ||
float | param10, | ||
float | param11 | ||
) |
void Engine::setWheelSpin | ( | float | rpm | ) |
void Engine::shift | ( | int | val | ) |
Changes gear by a relative offset. Plays sounds.
Definition at line 1084 of file Engine.cpp.
void Engine::shiftTo | ( | int | val | ) |
Changes gear to given value. Plays sounds.
Definition at line 1108 of file Engine.cpp.
void Engine::startEngine | ( | ) |
Quick engine start. Plays sounds.
Definition at line 995 of file Engine.cpp.
void Engine::stopEngine | ( | ) |
stall engine
Definition at line 1059 of file Engine.cpp.
void Engine::toggleAutoMode | ( | ) |
void Engine::toggleContact | ( | ) |
void Engine::UpdateEngine | ( | float | dt, |
int | doUpdate | ||
) |
void Engine::UpdateEngineAudio | ( | ) |
Definition at line 790 of file Engine.cpp.
void Engine::UpdateInputEvents | ( | float | dt | ) |
Definition at line 1260 of file Engine.cpp.
void Engine::updateShifts | ( | ) |
Changes gears. Plays sounds.
Definition at line 1113 of file Engine.cpp.
|
friend |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |