Skip to content

Commit

Permalink
rough vehicle classifications
Browse files Browse the repository at this point in the history
  • Loading branch information
jackhumbert committed Feb 23, 2023
1 parent 7a3eca7 commit 8f032bc
Show file tree
Hide file tree
Showing 5 changed files with 154 additions and 88 deletions.
119 changes: 76 additions & 43 deletions build/r6/scripts/let_there_be_flight/let_there_be_flight.packed.reds
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Let There Be Flight
// (C) 2022 Jack Humbert
// https://github.com/jackhumbert/let_there_be_flight
// This file was automatically generated on 2023-02-23 17:04:25.9728444
// This file was automatically generated on 2023-02-23 19:25:25.6515460

// FlightAudio.reds

Expand Down Expand Up @@ -1489,7 +1489,10 @@ public native class FlightComponent extends GameComponent {
enum FlightVehicleType {
Streetkid = 0,
Nomad = 1,
Corpo = 2
Corpo = 2,
Poor = 3,
Suburban = 4,
Urban = 5
}

public abstract native class IFlightConfiguration extends IScriptable {
Expand All @@ -1508,21 +1511,27 @@ public abstract native class IFlightConfiguration extends IScriptable {
public let type: FlightVehicleType = FlightVehicleType.Corpo;

public func OnSetup(vehicle: ref<VehicleObject>) {
// switch (vehicle.currentAppearance) {
// case n"thorton_galena_nomad_player_01":
// this.type = FlightVehicleType.Nomad;
// break;
// case n"chevalier_emperor__basic_police":
// this.type = FlightVehicleType.Corpo;
// break;
// case n"quadra_type66__basic_poor_03":
// case n"arch_nemesis_basic_jackie":
// case n"mahir_supron__basic_urban_02":
// case n"thorton_galena__basic_player_01":
// default:
// this.type = FlightVehicleType.Streetkid;
// break;
// }
let name = NameToString(vehicle.GetCurrentAppearanceName());
if StrFindFirst(name, "nomad") > -1 {
this.type = FlightVehicleType.Nomad;
}

if StrFindFirst(name, "tyger") > -1
|| StrFindFirst(name, "6th_street") > -1
|| StrFindFirst(name, "animals") > -1
|| StrFindFirst(name, "valentinos") > -1 {
this.type = FlightVehicleType.Streetkid;
}

if StrFindFirst(name, "poor") > -1 {
this.type = FlightVehicleType.Poor;
}
if StrFindFirst(name, "urban") > -1 {
this.type = FlightVehicleType.Urban;
}
if StrFindFirst(name, "suburban") > -1 {
this.type = FlightVehicleType.Suburban;
}
}
}

Expand Down Expand Up @@ -1563,6 +1572,11 @@ public class CarFlightConfiguration extends IFlightConfiguration {
ArrayPush(this.thrusters, new FlightThrusterFR().Create(vehicle, CreateNomadThruster()));
ArrayPush(this.thrusters, new FlightThrusterBL().Create(vehicle, CreateNomadThruster()));
ArrayPush(this.thrusters, new FlightThrusterBR().Create(vehicle, CreateNomadThruster()));

this.thrusters[0].hasRetroThruster = false;
this.thrusters[1].hasRetroThruster = false;
this.thrusters[2].hasRetroThruster = false;
this.thrusters[3].hasRetroThruster = false;
}

for thruster in this.thrusters {
Expand Down Expand Up @@ -1593,23 +1607,31 @@ public class BikeFlightConfiguration extends IFlightConfiguration {

this.flightCameraOffset = new Vector3(0.0, 1.0, 0.5);

ArrayPush(this.thrusters, new FlightThrusterFront().Create(vehicle, CreateEmptyThruster()));
ArrayPush(this.thrusters, new FlightThrusterBack().Create(vehicle, CreateEmptyThruster()));
if (Equals(this.type, FlightVehicleType.Corpo)) {
ArrayPush(this.thrusters, new FlightThrusterFront().Create(vehicle, CreateCorpoThruster()));
ArrayPush(this.thrusters, new FlightThrusterBack().Create(vehicle, CreateCorpoThruster()));
} else {
ArrayPush(this.thrusters, new FlightThrusterFront().Create(vehicle, CreateEmptyThruster()));
ArrayPush(this.thrusters, new FlightThrusterBack().Create(vehicle, CreateEmptyThruster()));

let mesh: ref<MeshComponent>;
mesh = CreateNomadThruster();
// mesh.visualScale = new Vector3(1.0, 0.5, 1.0);
// mesh.SetLocalPosition(new Vector4(0.0, 0.0, -0.2, 1.0));
mesh.SetLocalOrientation(new Quaternion(0.0, 0.0, 0.707, -0.707));
mesh.SetParentTransform(this.thrusters[0].meshComponent.name, n"None");
vehicle.AddComponent(mesh);

let mesh: ref<MeshComponent>;
mesh = CreateNomadThruster();
// mesh.visualScale = new Vector3(1.0, 0.5, 1.0);
// mesh.SetLocalPosition(new Vector4(0.0, 0.0, -0.2, 1.0));
mesh.SetLocalOrientation(new Quaternion(0.0, 0.0, 0.707, -0.707));
mesh.SetParentTransform(this.thrusters[0].meshComponent.name, n"None");
vehicle.AddComponent(mesh);
mesh = CreateNomadThruster();
// mesh.visualScale = new Vector3(1.0, 0.5, 1.0);
// mesh.SetLocalPosition(new Vector4(0.0, 0.0, -0.2, 1.0));
mesh.SetLocalOrientation(new Quaternion(0.0, 0.0, -0.707, -0.707));
mesh.SetParentTransform(this.thrusters[1].meshComponent.name, n"None");
vehicle.AddComponent(mesh);

mesh = CreateNomadThruster();
// mesh.visualScale = new Vector3(1.0, 0.5, 1.0);
// mesh.SetLocalPosition(new Vector4(0.0, 0.0, -0.2, 1.0));
mesh.SetLocalOrientation(new Quaternion(0.0, 0.0, -0.707, -0.707));
mesh.SetParentTransform(this.thrusters[1].meshComponent.name, n"None");
vehicle.AddComponent(mesh);
this.thrusters[0].hasRetroThruster = false;
this.thrusters[1].hasRetroThruster = false;
}

for thruster in this.thrusters {
vehicle.AddComponent(thruster.meshComponent);
Expand Down Expand Up @@ -3710,6 +3732,7 @@ public abstract native class IFlightThruster extends IScriptable {
public let mainFx: ref<FxInstance>;
// public let mainThrusterFactor: Float = 0.05;
public let mainThrusterYawFactor: Float = 0.5;
public let hasRetroThruster: Bool = true;
public let retroFx: ref<FxInstance>;
public let retroThrusterFactor: Float = 0.1;
public let force: Vector4;
Expand All @@ -3726,7 +3749,13 @@ public abstract native class IFlightThruster extends IScriptable {
public func OnSetup(fc : ref<FlightComponent>) {
this.flightComponent = fc;
this.mainFxRes = Cast<FxResource>(this.mainResRef);
this.retroFxRes = Cast<FxResource>(this.retroResRef);

if !this.hasRetroThruster {
this.mainThrusterYawFactor = 30.0;
} else {
this.mainThrusterYawFactor = 5.0;
this.retroFxRes = Cast<FxResource>(this.retroResRef);
}

// this.meshComponent = vehicleComponent.FindComponentByName(this.meshName) as MeshComponent;
this.meshComponent.visualScale = new Vector3(0.0, 0.0, 0.0);
Expand Down Expand Up @@ -3836,11 +3865,13 @@ public abstract native class IFlightThruster extends IScriptable {
this.mainFx.AttachToComponent(this.vehicle, entAttachmentTarget.Transform, this.meshComponent.name, wt);
this.meshComponent.Toggle(true);

let wt_retro: WorldTransform;
WorldTransform.SetOrientation(wt_retro, EulerAngles.ToQuat(new EulerAngles(0.0, 0.0, -90.0)));
this.retroFx = GameInstance.GetFxSystem(this.vehicle.GetGame()).SpawnEffect(this.retroFxRes, effectTransform);
// this.retroFx.AttachToSlot(this.component.Getthis.Vehicle(), entAttachmentTarget.Transform, n"Base", wt_retro);
this.retroFx.AttachToComponent(this.vehicle, entAttachmentTarget.Transform, this.meshComponent.name, wt_retro);
if this.hasRetroThruster {
let wt_retro: WorldTransform;
WorldTransform.SetOrientation(wt_retro, EulerAngles.ToQuat(new EulerAngles(0.0, 0.0, -90.0)));
this.retroFx = GameInstance.GetFxSystem(this.vehicle.GetGame()).SpawnEffect(this.retroFxRes, effectTransform);
// this.retroFx.AttachToSlot(this.component.Getthis.Vehicle(), entAttachmentTarget.Transform, n"Base", wt_retro);
this.retroFx.AttachToComponent(this.vehicle, entAttachmentTarget.Transform, this.meshComponent.name, wt_retro);
}

// FlightAudio.Get().StartWithPitch(this.id, "vehicle3_TPP", this.audioPitch);
FlightAudio.Get().StartWithPitch(this.id, "vehicle3_TPP", this.flightComponent.GetPitch());
Expand Down Expand Up @@ -3903,8 +3934,10 @@ public abstract native class IFlightThruster extends IScriptable {

// acc.SetInputFloat(this.GetRadiusName(), this.animRadius);

let retroAmount = this.GetRetroThrusterAmount();
this.retroFx.SetBlackboardValue(n"thruster_amount", retroAmount);
if this.hasRetroThruster {
let retroAmount = this.GetRetroThrusterAmount();
this.retroFx.SetBlackboardValue(n"thruster_amount", retroAmount);
}

this.audioUpdate = this.flightComponent.audioUpdate;
// amount *= 0.5;
Expand Down Expand Up @@ -6449,9 +6482,9 @@ public native func SetBlurDimension(effectName: CName, blurDimension : inkEBlurD

// Entity

@addField(Entity)
@runtimeProperty("offset", "0x50")
public native let currentAppearance: CName;
// @addField(Entity)
// @runtimeProperty("offset", "0x50")
// public native let currentAppearance: CName;

@addField(Entity)
@runtimeProperty("offset", "0x138")
Expand Down
2 changes: 1 addition & 1 deletion build/r6/tweaks/let_there_be_flight.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Let There Be Flight
# (C) 2022 Jack Humbert
# https://github.com/jackhumbert/let_there_be_flight
# This file was automatically generated on 2023-02-23 17:04:27.5158096
# This file was automatically generated on 2023-02-23 19:25:26.5799738

# quickhacks.yaml

Expand Down
88 changes: 55 additions & 33 deletions src/redscript/let_there_be_flight/FlightConfiguration.reds
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
enum FlightVehicleType {
Streetkid = 0,
Nomad = 1,
Corpo = 2
Corpo = 2,
Poor = 3,
Suburban = 4,
Urban = 5
}

public abstract native class IFlightConfiguration extends IScriptable {
Expand All @@ -20,21 +23,27 @@ public abstract native class IFlightConfiguration extends IScriptable {
public let type: FlightVehicleType = FlightVehicleType.Corpo;

public func OnSetup(vehicle: ref<VehicleObject>) {
// switch (vehicle.currentAppearance) {
// case n"thorton_galena_nomad_player_01":
// this.type = FlightVehicleType.Nomad;
// break;
// case n"chevalier_emperor__basic_police":
// this.type = FlightVehicleType.Corpo;
// break;
// case n"quadra_type66__basic_poor_03":
// case n"arch_nemesis_basic_jackie":
// case n"mahir_supron__basic_urban_02":
// case n"thorton_galena__basic_player_01":
// default:
// this.type = FlightVehicleType.Streetkid;
// break;
// }
let name = NameToString(vehicle.GetCurrentAppearanceName());
if StrFindFirst(name, "nomad") > -1 {
this.type = FlightVehicleType.Nomad;
}

if StrFindFirst(name, "tyger") > -1
|| StrFindFirst(name, "6th_street") > -1
|| StrFindFirst(name, "animals") > -1
|| StrFindFirst(name, "valentinos") > -1 {
this.type = FlightVehicleType.Streetkid;
}

if StrFindFirst(name, "poor") > -1 {
this.type = FlightVehicleType.Poor;
}
if StrFindFirst(name, "urban") > -1 {
this.type = FlightVehicleType.Urban;
}
if StrFindFirst(name, "suburban") > -1 {
this.type = FlightVehicleType.Suburban;
}
}
}

Expand Down Expand Up @@ -75,6 +84,11 @@ public class CarFlightConfiguration extends IFlightConfiguration {
ArrayPush(this.thrusters, new FlightThrusterFR().Create(vehicle, CreateNomadThruster()));
ArrayPush(this.thrusters, new FlightThrusterBL().Create(vehicle, CreateNomadThruster()));
ArrayPush(this.thrusters, new FlightThrusterBR().Create(vehicle, CreateNomadThruster()));

this.thrusters[0].hasRetroThruster = false;
this.thrusters[1].hasRetroThruster = false;
this.thrusters[2].hasRetroThruster = false;
this.thrusters[3].hasRetroThruster = false;
}

for thruster in this.thrusters {
Expand Down Expand Up @@ -105,23 +119,31 @@ public class BikeFlightConfiguration extends IFlightConfiguration {

this.flightCameraOffset = new Vector3(0.0, 1.0, 0.5);

ArrayPush(this.thrusters, new FlightThrusterFront().Create(vehicle, CreateEmptyThruster()));
ArrayPush(this.thrusters, new FlightThrusterBack().Create(vehicle, CreateEmptyThruster()));

let mesh: ref<MeshComponent>;
mesh = CreateNomadThruster();
// mesh.visualScale = new Vector3(1.0, 0.5, 1.0);
// mesh.SetLocalPosition(new Vector4(0.0, 0.0, -0.2, 1.0));
mesh.SetLocalOrientation(new Quaternion(0.0, 0.0, 0.707, -0.707));
mesh.SetParentTransform(this.thrusters[0].meshComponent.name, n"None");
vehicle.AddComponent(mesh);

mesh = CreateNomadThruster();
// mesh.visualScale = new Vector3(1.0, 0.5, 1.0);
// mesh.SetLocalPosition(new Vector4(0.0, 0.0, -0.2, 1.0));
mesh.SetLocalOrientation(new Quaternion(0.0, 0.0, -0.707, -0.707));
mesh.SetParentTransform(this.thrusters[1].meshComponent.name, n"None");
vehicle.AddComponent(mesh);
if (Equals(this.type, FlightVehicleType.Corpo)) {
ArrayPush(this.thrusters, new FlightThrusterFront().Create(vehicle, CreateCorpoThruster()));
ArrayPush(this.thrusters, new FlightThrusterBack().Create(vehicle, CreateCorpoThruster()));
} else {
ArrayPush(this.thrusters, new FlightThrusterFront().Create(vehicle, CreateEmptyThruster()));
ArrayPush(this.thrusters, new FlightThrusterBack().Create(vehicle, CreateEmptyThruster()));

let mesh: ref<MeshComponent>;
mesh = CreateNomadThruster();
// mesh.visualScale = new Vector3(1.0, 0.5, 1.0);
// mesh.SetLocalPosition(new Vector4(0.0, 0.0, -0.2, 1.0));
mesh.SetLocalOrientation(new Quaternion(0.0, 0.0, 0.707, -0.707));
mesh.SetParentTransform(this.thrusters[0].meshComponent.name, n"None");
vehicle.AddComponent(mesh);

mesh = CreateNomadThruster();
// mesh.visualScale = new Vector3(1.0, 0.5, 1.0);
// mesh.SetLocalPosition(new Vector4(0.0, 0.0, -0.2, 1.0));
mesh.SetLocalOrientation(new Quaternion(0.0, 0.0, -0.707, -0.707));
mesh.SetParentTransform(this.thrusters[1].meshComponent.name, n"None");
vehicle.AddComponent(mesh);

this.thrusters[0].hasRetroThruster = false;
this.thrusters[1].hasRetroThruster = false;
}

for thruster in this.thrusters {
vehicle.AddComponent(thruster.meshComponent);
Expand Down
27 changes: 19 additions & 8 deletions src/redscript/let_there_be_flight/FlightThruster.reds
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public abstract native class IFlightThruster extends IScriptable {
public let mainFx: ref<FxInstance>;
// public let mainThrusterFactor: Float = 0.05;
public let mainThrusterYawFactor: Float = 0.5;
public let hasRetroThruster: Bool = true;
public let retroFx: ref<FxInstance>;
public let retroThrusterFactor: Float = 0.1;
public let force: Vector4;
Expand All @@ -62,7 +63,13 @@ public abstract native class IFlightThruster extends IScriptable {
public func OnSetup(fc : ref<FlightComponent>) {
this.flightComponent = fc;
this.mainFxRes = Cast<FxResource>(this.mainResRef);
this.retroFxRes = Cast<FxResource>(this.retroResRef);

if !this.hasRetroThruster {
this.mainThrusterYawFactor = 30.0;
} else {
this.mainThrusterYawFactor = 5.0;
this.retroFxRes = Cast<FxResource>(this.retroResRef);
}

// this.meshComponent = vehicleComponent.FindComponentByName(this.meshName) as MeshComponent;
this.meshComponent.visualScale = new Vector3(0.0, 0.0, 0.0);
Expand Down Expand Up @@ -172,11 +179,13 @@ public abstract native class IFlightThruster extends IScriptable {
this.mainFx.AttachToComponent(this.vehicle, entAttachmentTarget.Transform, this.meshComponent.name, wt);
this.meshComponent.Toggle(true);

let wt_retro: WorldTransform;
WorldTransform.SetOrientation(wt_retro, EulerAngles.ToQuat(new EulerAngles(0.0, 0.0, -90.0)));
this.retroFx = GameInstance.GetFxSystem(this.vehicle.GetGame()).SpawnEffect(this.retroFxRes, effectTransform);
// this.retroFx.AttachToSlot(this.component.Getthis.Vehicle(), entAttachmentTarget.Transform, n"Base", wt_retro);
this.retroFx.AttachToComponent(this.vehicle, entAttachmentTarget.Transform, this.meshComponent.name, wt_retro);
if this.hasRetroThruster {
let wt_retro: WorldTransform;
WorldTransform.SetOrientation(wt_retro, EulerAngles.ToQuat(new EulerAngles(0.0, 0.0, -90.0)));
this.retroFx = GameInstance.GetFxSystem(this.vehicle.GetGame()).SpawnEffect(this.retroFxRes, effectTransform);
// this.retroFx.AttachToSlot(this.component.Getthis.Vehicle(), entAttachmentTarget.Transform, n"Base", wt_retro);
this.retroFx.AttachToComponent(this.vehicle, entAttachmentTarget.Transform, this.meshComponent.name, wt_retro);
}

// FlightAudio.Get().StartWithPitch(this.id, "vehicle3_TPP", this.audioPitch);
FlightAudio.Get().StartWithPitch(this.id, "vehicle3_TPP", this.flightComponent.GetPitch());
Expand Down Expand Up @@ -239,8 +248,10 @@ public abstract native class IFlightThruster extends IScriptable {

// acc.SetInputFloat(this.GetRadiusName(), this.animRadius);

let retroAmount = this.GetRetroThrusterAmount();
this.retroFx.SetBlackboardValue(n"thruster_amount", retroAmount);
if this.hasRetroThruster {
let retroAmount = this.GetRetroThrusterAmount();
this.retroFx.SetBlackboardValue(n"thruster_amount", retroAmount);
}

this.audioUpdate = this.flightComponent.audioUpdate;
// amount *= 0.5;
Expand Down
6 changes: 3 additions & 3 deletions src/redscript/let_there_be_flight/_MeshComponent.reds
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Entity

@addField(Entity)
@runtimeProperty("offset", "0x50")
public native let currentAppearance: CName;
// @addField(Entity)
// @runtimeProperty("offset", "0x50")
// public native let currentAppearance: CName;

@addField(Entity)
@runtimeProperty("offset", "0x138")
Expand Down

0 comments on commit 8f032bc

Please sign in to comment.