Skip to content

Commit e8018e3

Browse files
authored
Added AI Physics Cheatcode
1 parent d172396 commit e8018e3

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

code/midtown/mmcar/car.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,24 @@ define_dummy_symbol(mmcar_car);
2424
#include "agi/getdlp.h"
2525
#include "data7/timer.h"
2626
#include "mmcity/cullcity.h"
27+
#include "mmcityinfo/state.h"
2728
#include "mmcityinfo/vehlist.h"
2829
#include "mmphysics/joint3dof.h"
2930

3031
#include "playercaraudio.h"
3132
#include "trailer.h"
3233

34+
static mem::cmd_param PARAM_aiphysics {"aiphysics"};
35+
36+
void mmCar::ApplyAiPhysics()
37+
{
38+
if (!Sim.FrontLeft.OnGround && !Sim.FrontRight.OnGround && !Sim.BackLeft.OnGround && !Sim.BackRight.OnGround)
39+
{
40+
Sim.ICS.AngularMomentum *= 0.1f;
41+
CHEATING = true;
42+
}
43+
}
44+
3345
mmCar::mmCar()
3446
{
3547
// FIXME: mmCar is already oversampled by mmPhysicsMGR
@@ -65,6 +77,9 @@ void mmCar::Update()
6577

6678
OverSample.Update();
6779

80+
if (PARAM_aiphysics && MMSTATE.NetworkStatus == 0)
81+
ApplyAiPhysics();
82+
6883
#ifdef ARTS_DEV_BUILD
6984
f32 elapsed = t.Time();
7085
mmCar::UpdateTime += elapsed;

code/midtown/mmcar/car.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ class mmCar final : public mmPhysEntity
145145
// ?DeclareFields@mmCar@@SAXXZ
146146
ARTS_IMPORT static void DeclareFields();
147147

148+
void ApplyAiPhysics();
149+
148150
#ifdef ARTS_DEV_BUILD
149151
// ?PostUpdateTime@mmCar@@2MA
150152
ARTS_IMPORT static f32 PostUpdateTime;

docs/setup.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ For a tutorial on how to use command line arguments, click [here](https://www.bl
3636

3737
| Name | Value | Description |
3838
| ---------- | ----- | --- |
39+
| aiphysics | false | Sets AI-like physics midair
3940
| allcars | false | Unlocks All Cars |
4041
| allrace | false | Unlocks All Races |
4142
| maxcops | 3 | Max cops chasing you at once |

0 commit comments

Comments
 (0)