From cef7dd2b766fbd4090509779c0c0723e1155bb5f Mon Sep 17 00:00:00 2001 From: denadan Date: Sun, 9 Dec 2018 09:30:48 +0300 Subject: [PATCH] omnitech --- mod.json | 11 +++++++---- source/CCLight/Registry.cs | 18 +++++++++++++----- source/Control.cs | 2 +- source/CustomComponentSettings.cs | 3 +++ ...ameState_CreateComponentInstallWorkOrder.cs | 17 +++++++++++++++++ 5 files changed, 41 insertions(+), 10 deletions(-) diff --git a/mod.json b/mod.json index 3da17f1..26cdf77 100644 --- a/mod.json +++ b/mod.json @@ -23,15 +23,18 @@ "G": 180, "B": 180, "A": 10 - }, - "DefaultFlagOverlayCColor": { + }, + "DefaultFlagOverlayCColor": { "R": 180, "G": 255, "B": 180, "A": 10 - }, + }, - "TestEnableAllTags": false + "TestEnableAllTags": false, + "OmniTechFlag" = "cc_omnitech", + "OmniTechCostBySize" = false, + "OmniTechInstallCost" = 1 }, "Manifest": [ ] diff --git a/source/CCLight/Registry.cs b/source/CCLight/Registry.cs index 28c949f..4577e6f 100644 --- a/source/CCLight/Registry.cs +++ b/source/CCLight/Registry.cs @@ -94,9 +94,10 @@ internal static void ProcessCustomFactories(object target, Dictionary ColorTagsDictionary; public bool TestEnableAllTags = false; + public string OmniTechFlag = "cc_omnitech"; + public bool OmniTechCostBySize = false; + public int OmniTechInstallCost = 1; public void Complete() { diff --git a/source/Fixes/SimGameState_CreateComponentInstallWorkOrder.cs b/source/Fixes/SimGameState_CreateComponentInstallWorkOrder.cs index c63c942..d22a9b0 100644 --- a/source/Fixes/SimGameState_CreateComponentInstallWorkOrder.cs +++ b/source/Fixes/SimGameState_CreateComponentInstallWorkOrder.cs @@ -13,6 +13,7 @@ public static void FixCost( MechComponentRef mechComponent, ChassisLocations newLocation, ChassisLocations previousLocation, + string mechSimGameUID, WorkOrderEntry_InstallComponent __result) { #if CCDEBUG @@ -44,6 +45,22 @@ public static void FixCost( return; } + MechDef mechByID = __instance.GetMechByID(mechSimGameUID); +#if CCDEBUG + if (mechByID == null) + Control.Logger.LogDebug("-- no mech found!"); +#endif + if (mechByID != null && mechByID.Chassis.ChassisTags.Contains(Control.Settings.OmniTechFlag)) + { +#if CCDEBUG + if (mechByID == null) + Control.Logger.LogDebug("-- mech is omni!"); +#endif + + tr.Value = (Control.Settings.OmniTechCostBySize ? mechComponent.Def.InventorySize / 2 : 1) * Control.Settings.OmniTechInstallCost; + } + + if (tr.Value == 0) tr.Value = 1; }