Skip to content

Commit

Permalink
resharper reorganize, dump evasion on airlift pickup/drop off, make e…
Browse files Browse the repository at this point in the history
…vasion match carrier immediately, and hopefully stop players from being able to indirect tab-target mounted BA
  • Loading branch information
ajkroeg committed Jul 11, 2023
1 parent 770a81b commit 862bd52
Show file tree
Hide file tree
Showing 22 changed files with 7,943 additions and 7,743 deletions.
717 changes: 359 additions & 358 deletions StrategicOperations/StrategicOperations/Framework/AI_Utils.cs

Large diffs are not rendered by default.

877 changes: 445 additions & 432 deletions StrategicOperations/StrategicOperations/Framework/AirliftUtils.cs

Large diffs are not rendered by default.

1,973 changes: 996 additions & 977 deletions StrategicOperations/StrategicOperations/Framework/BattleArmorUtils.cs

Large diffs are not rendered by default.

1,597 changes: 807 additions & 790 deletions StrategicOperations/StrategicOperations/Framework/Classes.cs

Large diffs are not rendered by default.

68 changes: 35 additions & 33 deletions StrategicOperations/StrategicOperations/Framework/DropPodSpawn.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,52 @@ public static void Postfix(CombatHUD __instance, CombatGameState Combat)

public class DropPodSpawner: MonoBehaviour
{
public AbstractActor Unit { get; set; } = null;
public bool DropProcessing { get; set; } = false;
public EncounterLayerParent Parent { get; set; } = null;
public ParticleSystem DropPodVfxPrefab
//public string SpawnGUID { get; set; }
//public Action OnDropComplete { get; set; }
public CombatGameState Combat;

public Vector3 DropPodPosition;
public Quaternion DropPodRotation;

public GameObject DropPodLandedPrefab
{
get;
set;
}

public GameObject DropPodLandedPrefab
public ParticleSystem DropPodVfxPrefab
{
get;
set;
}

public Vector3 DropPodPosition;
public Quaternion DropPodRotation;
public bool DropProcessing { get; set; } = false;
public Vector3 OffscreenDropPodPosition { get; set; } = Vector3.zero;
//public string SpawnGUID { get; set; }
//public Action OnDropComplete { get; set; }
public CombatGameState Combat;
public EncounterLayerParent Parent { get; set; } = null;
public AbstractActor Unit { get; set; } = null;

public IEnumerator DestroyFlimsyObjects(Vector3 position)
{
Collider[] hits = Physics.OverlapSphere(position, 36f, -5, QueryTriggerInteraction.Ignore);
float impactMagnitude = 3f * Combat.Constants.ResolutionConstants.FlimsyDestructionForceMultiplier;
for (int i = 0; i < hits.Length; ++i)
{
Collider collider = hits[i];
Vector3 normalized = (collider.transform.position - position).normalized;
DestructibleObject component1 = collider.gameObject.GetComponent<DestructibleObject>();
DestructibleUrbanFlimsy component2 = collider.gameObject.GetComponent<DestructibleUrbanFlimsy>();
if (component1 != null && component1.isFlimsy)
{
component1.TakeDamage(position, normalized, impactMagnitude);
component1.Collapse(normalized, impactMagnitude);
}
if ((UnityEngine.Object)component2 != (UnityEngine.Object)null)
component2.PlayDestruction(normalized, impactMagnitude);
if (i % 10 == 0)
yield return (object)null;
}
yield return (object)null;
}

public void LoadDropPodPrefabs(ParticleSystem dropPodVfxPrefab, GameObject dropPodLandedPrefab)
{
Expand Down Expand Up @@ -113,29 +138,6 @@ public void TeleportUnitToSpawnPoint()
this.Unit.GameRep.FadeIn(1f);
this.Unit.OnPlayerVisibilityChanged(VisibilityLevel.LOSFull);
}

public IEnumerator DestroyFlimsyObjects(Vector3 position)
{
Collider[] hits = Physics.OverlapSphere(position, 36f, -5, QueryTriggerInteraction.Ignore);
float impactMagnitude = 3f * Combat.Constants.ResolutionConstants.FlimsyDestructionForceMultiplier;
for (int i = 0; i < hits.Length; ++i)
{
Collider collider = hits[i];
Vector3 normalized = (collider.transform.position - position).normalized;
DestructibleObject component1 = collider.gameObject.GetComponent<DestructibleObject>();
DestructibleUrbanFlimsy component2 = collider.gameObject.GetComponent<DestructibleUrbanFlimsy>();
if (component1 != null && component1.isFlimsy)
{
component1.TakeDamage(position, normalized, impactMagnitude);
component1.Collapse(normalized, impactMagnitude);
}
if ((UnityEngine.Object)component2 != (UnityEngine.Object)null)
component2.PlayDestruction(normalized, impactMagnitude);
if (i % 10 == 0)
yield return (object)null;
}
yield return (object)null;
}
}
}
}
133 changes: 68 additions & 65 deletions StrategicOperations/StrategicOperations/Framework/ModState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,99 +9,101 @@ namespace StrategicOperations.Framework
{
public static class ModState
{
public static List<Color> ProcessedOverlayColors = new List<Color>();
public static Dictionary<string, Color> UsedOverlayColorsByCarrier = new Dictionary<string, Color>();
public static List<Color> UsedOverlayColors = new List<Color>();
public static Color DefaultOverlay = new Color();
public static Color PendingSelectionColor = new Color(0.15f, 0.15f, 0.17f, .5f);
//public static string UnitPendingAirliftInvocation = "";
//public static AbstractActor startUnitFromInvocation = null;
public static LanceLoadoutSlot PendingPairBAUnit = null;

public static Dictionary<string, BAPairingInfo> PairingInfos = new Dictionary<string, BAPairingInfo>();
public static bool ReinitPhaseIcons = false;
public static float CancelChanceForPlayerStrafe = 0f;
public static List<string> TeamsWithResupply = new List<string>();
public static AbstractActor CurrentGarrisonSquadForLOS = null;
public static AbstractActor CurrentGarrisonSquadForLOF = null;
public static List<CustomSpawner> CurrentContractBASpawners = new List<CustomSpawner>();
public static Dictionary<string, bool> GarrisonFriendlyTeam = new Dictionary<string, bool>();
public static float SwarmSuccessChance = 0f;
public static float DeSwarmSuccessChance = 0f;

public static Dictionary<string, Dictionary<string, List<string>>> CachedFactionAssociations = new Dictionary<string, Dictionary<string, List<string>>>();
public static Dictionary<string, Dictionary<string, List<AI_BeaconProxyInfo>>> CachedFactionCommandBeacons = new Dictionary<string, Dictionary<string, List<AI_BeaconProxyInfo>>>(); // key1 is abilityID, key2 is faction name
public static Dictionary<string, AI_CmdInvocation> AiCmds = new Dictionary<string, AI_CmdInvocation>();

public static Dictionary<string, int> CurrentBattleArmorSquads = new Dictionary<string, int>();
public static Dictionary<string, Dictionary<string,int>> CurrentCommandUnits = new Dictionary<string, Dictionary<string, int>>();
public static Dictionary<string, AI_DealWithBAInvocation> AiDealWithBattleArmorCmds = new Dictionary<string, AI_DealWithBAInvocation>();

public static List<ConfigOptions.AI_FactionCommandAbilitySetting> CurrentFactionSettingsList = new List<ConfigOptions.AI_FactionCommandAbilitySetting>();
public static List<AirliftTargetEffect> AirliftEffects = new List<AirliftTargetEffect>();
//public static Dictionary<string, string> PositionLockAirlift = new Dictionary<string, string>(); // key is mounted unit, value is carrier

public static bool IsStrafeAOE = false;
public static Dictionary<string, PendingStrafeWave> PendingStrafeWaves =
new Dictionary<string, PendingStrafeWave>();
public static List<ArmorLocation> MechArmorMountOrder = new List<ArmorLocation>();
public static List<ArmorLocation> MechArmorSwarmOrder = new List<ArmorLocation>();
public static Dictionary<string, AirliftTracker> AirliftTrackers = new Dictionary<string, AirliftTracker>(); //Key is mounted unit, value has carrier

public static List<VehicleChassisLocations> VehicleMountOrder = new List<VehicleChassisLocations>();
public static List<BA_TargetEffect> BA_MountSwarmEffects = new List<BA_TargetEffect>();

public static Dictionary<string, BA_DamageTracker>
BADamageTrackers = new Dictionary<string, BA_DamageTracker>(); // key is GUID of BA squad

public static Dictionary<string, Dictionary<string, List<string>>> CachedFactionAssociations = new Dictionary<string, Dictionary<string, List<string>>>();
public static Dictionary<string, Dictionary<string, List<AI_BeaconProxyInfo>>> CachedFactionCommandBeacons = new Dictionary<string, Dictionary<string, List<AI_BeaconProxyInfo>>>(); // key1 is abilityID, key2 is faction name

//public static Dictionary<string, Vector3> SavedBAScale = new Dictionary<string, Vector3>(); // should always be 1,1,1

public static Dictionary<string, Vector3> CachedUnitCoordinates = new Dictionary<string, Vector3>();
public static Dictionary<string, BA_GarrisonInfo> PositionLockGarrison = new Dictionary<string, BA_GarrisonInfo>(); // key is mounted unit, value is building
public static Dictionary<string, string> PositionLockMount = new Dictionary<string, string>(); // key is mounted unit, value is carrier
public static Dictionary<string, string> PositionLockSwarm = new Dictionary<string, string>(); // key is mounted unit, value is carrier
//public static Dictionary<string, string> PositionLockAirlift = new Dictionary<string, string>(); // key is mounted unit, value is carrier
public static float CancelChanceForPlayerStrafe = 0f;

public static Dictionary<string, AirliftTracker> AirliftTrackers = new Dictionary<string, AirliftTracker>(); //Key is mounted unit, value has carrier
public static List<Ability> CommandAbilities = new List<Ability>();

public static Dictionary<string, int> ResupplyShutdownPhases = new Dictionary<string, int>();
public static List<CmdUseInfo> CommandUses = new List<CmdUseInfo>();

public static List<Ability> CommandAbilities = new List<Ability>();
public static Dictionary<string, int> CurrentBattleArmorSquads = new Dictionary<string, int>();
public static Dictionary<string, Dictionary<string,int>> CurrentCommandUnits = new Dictionary<string, Dictionary<string, int>>();
public static List<CustomSpawner> CurrentContractBASpawners = new List<CustomSpawner>();

public static List<KeyValuePair<string, Action>>
DeferredInvokeSpawns = new List<KeyValuePair<string, Action>>();
public static List<ConfigOptions.AI_FactionCommandAbilitySetting> CurrentFactionSettingsList = new List<ConfigOptions.AI_FactionCommandAbilitySetting>();
public static AbstractActor CurrentGarrisonSquadForLOF = null;
public static AbstractActor CurrentGarrisonSquadForLOS = null;
public static Color DefaultOverlay = new Color();

public static List<KeyValuePair<string, Action>>
DeferredInvokeBattleArmor = new List<KeyValuePair<string, Action>>();
public static string DeferredActorResource = "";
public static bool DeferredBattleArmorSpawnerFromDelegate;

public static Dictionary<string, AbstractActor> DeferredDespawnersFromStrafe =
new Dictionary<string, AbstractActor>();

public static string DeferredActorResource = "";

public static Dictionary<string, CmdInvocationParams> StoredCmdParams =
new Dictionary<string, CmdInvocationParams>();
public static List<KeyValuePair<string, Action>>
DeferredInvokeBattleArmor = new List<KeyValuePair<string, Action>>();

public static CmdInvocationParams PendingPlayerCmdParams = new CmdInvocationParams();
public static List<KeyValuePair<string, Action>>
DeferredInvokeSpawns = new List<KeyValuePair<string, Action>>();

//public static string PopupActorResource = "";
//public static int StrafeWaves;
//public static string PilotOverride = null;
public static bool DeferredSpawnerFromDelegate;
public static bool DeferredBattleArmorSpawnerFromDelegate;
public static bool OutOfRange;

public static Dictionary<string, AI_DealWithBAInvocation> AiDealWithBattleArmorCmds = new Dictionary<string, AI_DealWithBAInvocation>();
public static List<CmdUseStat> DeploymentAssetsStats = new List<CmdUseStat>();

public static Dictionary<string, AI_CmdInvocation> AiCmds = new Dictionary<string, AI_CmdInvocation>();
public static BA_DeswarmMovementInfo DeSwarmMovementInfo = new BA_DeswarmMovementInfo();
public static float DeSwarmSuccessChance = 0f;
public static Dictionary<string, bool> GarrisonFriendlyTeam = new Dictionary<string, bool>();

public static Dictionary<string, StrategicActorTargetInvocation> StrategicActorTargetInvocationCmds = new Dictionary<string, StrategicActorTargetInvocation>();
public static bool IsStrafeAOE = false;
public static List<ArmorLocation> MechArmorMountOrder = new List<ArmorLocation>();
public static List<ArmorLocation> MechArmorSwarmOrder = new List<ArmorLocation>();
public static List<BA_TargetEffect> OnGarrisonCollapseEffects = new List<BA_TargetEffect>();
public static bool OutOfRange;

public static List<CmdUseInfo> CommandUses = new List<CmdUseInfo>();
public static Dictionary<string, BAPairingInfo> PairingInfos = new Dictionary<string, BAPairingInfo>();

public static List<CmdUseStat> DeploymentAssetsStats = new List<CmdUseStat>();
//public static string UnitPendingAirliftInvocation = "";
//public static AbstractActor startUnitFromInvocation = null;
public static LanceLoadoutSlot PendingPairBAUnit = null;

public static List<BA_TargetEffect> BA_MountSwarmEffects = new List<BA_TargetEffect>();
public static List<BA_TargetEffect> OnGarrisonCollapseEffects = new List<BA_TargetEffect>();
public static List<AirliftTargetEffect> AirliftEffects = new List<AirliftTargetEffect>();
public static CmdInvocationParams PendingPlayerCmdParams = new CmdInvocationParams();
public static Color PendingSelectionColor = new Color(0.15f, 0.15f, 0.17f, .5f);

public static BA_DeswarmMovementInfo DeSwarmMovementInfo = new BA_DeswarmMovementInfo();
public static Dictionary<string, PendingStrafeWave> PendingStrafeWaves =
new Dictionary<string, PendingStrafeWave>();

public static List<string> PlayerSpawnGUIDs = new List<string>();
public static Dictionary<string, BA_GarrisonInfo> PositionLockGarrison = new Dictionary<string, BA_GarrisonInfo>(); // key is mounted unit, value is building
public static Dictionary<string, string> PositionLockMount = new Dictionary<string, string>(); // key is mounted unit, value is carrier
public static Dictionary<string, string> PositionLockSwarm = new Dictionary<string, string>(); // key is mounted unit, value is carrier
public static List<Color> ProcessedOverlayColors = new List<Color>();
public static bool ReinitPhaseIcons = false;

public static Dictionary<string, int> ResupplyShutdownPhases = new Dictionary<string, int>();

public static Dictionary<string, CmdInvocationParams> StoredCmdParams =
new Dictionary<string, CmdInvocationParams>();

public static Dictionary<string, StrategicActorTargetInvocation> StrategicActorTargetInvocationCmds = new Dictionary<string, StrategicActorTargetInvocation>();
public static float SwarmSuccessChance = 0f;
public static List<string> TeamsWithResupply = new List<string>();
public static List<Color> UsedOverlayColors = new List<Color>();
public static Dictionary<string, Color> UsedOverlayColorsByCarrier = new Dictionary<string, Color>();

public static List<VehicleChassisLocations> VehicleMountOrder = new List<VehicleChassisLocations>();

public static void Initialize()
{
Expand Down Expand Up @@ -229,21 +231,22 @@ public static void ResetAll()
ReinitPhaseIcons = false;
}

public static void ResetDelegateInfos()
public static void ResetDeferredBASpawners()
{
DeferredSpawnerFromDelegate = false;
DeferredActorResource = "";
//PopupActorResource = "";
//PilotOverride = null;
DeferredInvokeBattleArmor = new List<KeyValuePair<string, Action>>();
}

public static void ResetDeferredSpawners()
{
DeferredInvokeSpawns = new List<KeyValuePair<string, Action>>();
}
public static void ResetDeferredBASpawners()

public static void ResetDelegateInfos()
{
DeferredInvokeBattleArmor = new List<KeyValuePair<string, Action>>();
DeferredSpawnerFromDelegate = false;
DeferredActorResource = "";
//PopupActorResource = "";
//PilotOverride = null;
}
}
}
Loading

0 comments on commit 862bd52

Please sign in to comment.