Fix player-only option in ModuleWingManager

This commit is contained in:
2025-02-25 09:46:59 +01:00
parent acdc4d2a78
commit e4700847df

View File

@@ -37,13 +37,11 @@ namespace TerraTech {
}
private static void ConfigureAerofoil(MultipliedObject<ModuleWing.Aerofoil> obj) {
obj.AddField(
new FieldConfiguration<float, float>("flapAngleRangeActual", angleRangeMultiplier, ShouldApply));
obj.AddField(
new FieldConfiguration<float, float>("flapAngleRangeVisual", angleRangeMultiplier, ShouldApply));
obj.AddField(new FieldConfiguration<float, float>("flapAngleRangeActual", angleRangeMultiplier));
obj.AddField(new FieldConfiguration<float, float>("flapAngleRangeVisual", angleRangeMultiplier));
obj.AddField(new FieldConfiguration<float, float>("flapTurnSpeed", turnSpeedMultiplier, ShouldApply));
obj.AddField(new FieldConfiguration<float, float>("liftStrength", liftStrengthMultiplier, ShouldApply));
obj.AddField(new FieldConfiguration<float, float>("flapTurnSpeed", turnSpeedMultiplier));
obj.AddField(new FieldConfiguration<float, float>("liftStrength", liftStrengthMultiplier));
}
private static readonly Func<object, bool> ShouldApply = obj => {
@@ -55,6 +53,8 @@ namespace TerraTech {
[HarmonyPrefix]
[HarmonyPatch(typeof(ModuleWing), "OnAttached")]
static void PostfixCreate(ModuleWing __instance) {
if (playerOnly.Value && !CykUtil.IsPlayerTank(__instance))
return;
for (int i = 0; i < __instance.m_Aerofoils.Length; i++) {
var aerofoil = __instance.m_Aerofoils[i];
manager.OnObjectAttached(aerofoil);
@@ -64,6 +64,8 @@ namespace TerraTech {
[HarmonyPrefix]
[HarmonyPatch(typeof(ModuleWing), "OnDetaching")]
static void PostfixDestroy(ModuleWing __instance) {
if (playerOnly.Value && !CykUtil.IsPlayerTank(__instance))
return;
for (int i = 0; i < __instance.m_Aerofoils.Length; i++) {
var aerofoil = __instance.m_Aerofoils[i];
manager.OnObjectDetached(aerofoil);