diff --git a/FreeAmmoAndGrenades/FreeAmmoAndGrenades.csproj b/FreeAmmoAndGrenades/FreeAmmoAndGrenades.csproj
index df94c12..1091d19 100644
--- a/FreeAmmoAndGrenades/FreeAmmoAndGrenades.csproj
+++ b/FreeAmmoAndGrenades/FreeAmmoAndGrenades.csproj
@@ -56,6 +56,7 @@
+
diff --git a/FreeAmmoAndGrenades/FreeAmmoAndGrenadesDefs.cs b/FreeAmmoAndGrenades/FreeAmmoAndGrenadesDefs.cs
index faea477..19ff7de 100644
--- a/FreeAmmoAndGrenades/FreeAmmoAndGrenadesDefs.cs
+++ b/FreeAmmoAndGrenades/FreeAmmoAndGrenadesDefs.cs
@@ -14,12 +14,13 @@ public static void Change_AmmoAndGrenades(ModMain Main)
SharedData shared = GameUtl.GameComponent();
GameTagDef GrenadeTag = (GameTagDef)Repo.GetDef("318dd3ff-28f0-1bb4-98bc-39164b7292b6"); // GrenadeItem_TagDef
GameTagDef AmmoTag = shared.SharedGameTags.AmmoTag;
+
// loop over all item defs in the repo
int Count = 0;
Main.Logger.LogInfo($"Free Ammo and Grenades: Beginning updating items");
foreach (ItemDef ItemDef in Repo.GetAllDefs())
{
- // All hand thrown grenades (only these weapon defs ends with "Grenade_WeaponDef" <- checked by tag)
+ // All hand thrown grenades
if (ItemDef.Tags.Contains(GrenadeTag) && Main.Config.GrenadesAreFree)
{
//Main.Logger.LogInfo(System.String.Concat($"Applying Grenade Discount to: ", ItemDef.name));
@@ -42,6 +43,20 @@ public static void Change_AmmoAndGrenades(ModMain Main)
ItemDef.ManufactureOricalcum = 0;
ItemDef.ManufactureProteanMutane = 0;
}
+ else if ((ItemDef.name.EndsWith("FieldRepairKit_EquipmentDef") ||
+ ItemDef.name.EndsWith("Medkit_EquipmentDef") ||
+ ItemDef.name.EndsWith("Stimpack_EquipmentDef") ||
+ ItemDef.name.EndsWith("VirophageMedkit_EquipmentDef")) && Main.Config.MedkitsAreFree)
+ {
+ //Main.Logger.LogInfo(System.String.Concat($"Applying Medkit Discount to: ", ItemDef.name));
+ Count++;
+ ItemDef.ManufactureMaterials = 0;
+ ItemDef.ManufactureTech = 0;
+ ItemDef.ManufactureMutagen = 0;
+ ItemDef.ManufactureLivingCrystals = 0;
+ ItemDef.ManufactureOricalcum = 0;
+ ItemDef.ManufactureProteanMutane = 0;
+ }
//else
//{
//Main.Logger.LogInfo(System.String.Concat($"Skipping item: ", ItemDef.name));
diff --git a/FreeAmmoAndGrenades/FreeAmmoandGrenadesConfig.cs b/FreeAmmoAndGrenades/FreeAmmoandGrenadesConfig.cs
index 2c3e512..75dcc96 100644
--- a/FreeAmmoAndGrenades/FreeAmmoandGrenadesConfig.cs
+++ b/FreeAmmoAndGrenades/FreeAmmoandGrenadesConfig.cs
@@ -9,5 +9,8 @@ public class Configuration : ModConfig
[ConfigField(text: "Grenades are free to manufacture and provide no scrap", description: "Please be sure to restart the game after changing these settings, to reload the mod")]
public bool GrenadesAreFree = true;
+
+ [ConfigField(text: "Medkits and Stimpacks are free to manufacture and provide no scrap", description: "Please be sure to restart the game after changing these settings, to reload the mod")]
+ public bool MedkitsAreFree = true;
}
}
\ No newline at end of file
diff --git a/FreeAmmoAndGrenades/FreeAmmoandGrenadesGeoscape.cs b/FreeAmmoAndGrenades/FreeAmmoandGrenadesGeoscape.cs
new file mode 100644
index 0000000..ea924e6
--- /dev/null
+++ b/FreeAmmoAndGrenades/FreeAmmoandGrenadesGeoscape.cs
@@ -0,0 +1,29 @@
+using PhoenixPoint.Modding;
+using System;
+
+namespace FreeAmmoAndGrenades
+{
+ public class Geoscape : ModGeoscape
+ {
+ private static bool runFlag = true;
+ ///
+ /// Called when Geoscape starts.
+ ///
+ public override void Init()
+ {
+ if (runFlag) // run only once per game load
+ {
+ runFlag = false;
+ try
+ {
+ FreeAmmoAndGrenadesDefs.Change_AmmoAndGrenades((ModMain)base.Main);
+ }
+ catch (Exception e)
+ {
+ Main.Logger.LogInfo(e.Message);
+ }
+ }
+ base.Init();
+ }
+ }
+}
\ No newline at end of file
diff --git a/FreeAmmoAndGrenades/FreeAmmoandGrenadesMain.cs b/FreeAmmoAndGrenades/FreeAmmoandGrenadesMain.cs
index 893ad4f..03b203e 100644
--- a/FreeAmmoAndGrenades/FreeAmmoandGrenadesMain.cs
+++ b/FreeAmmoAndGrenades/FreeAmmoandGrenadesMain.cs
@@ -1,5 +1,4 @@
using HarmonyLib;
-
using System;
namespace FreeAmmoAndGrenades
{
@@ -17,14 +16,13 @@ public class ModMain : PhoenixPoint.Modding.ModMain
public new Harmony HarmonyInstance => (Harmony)base.HarmonyInstance;
- //public new Geoscape GeoscapeMod => (Geoscape)base.GeoscapeMod;
+ public new Geoscape GeoscapeMod => (Geoscape)base.GeoscapeMod;
public override void OnModEnabled()
{
try
{
Main = this;
- FreeAmmoAndGrenadesDefs.Change_AmmoAndGrenades(Main);
HarmonyInstance.PatchAll();
}
catch (Exception e)
@@ -38,5 +36,5 @@ public override void OnModDisabled()
HarmonyInstance.UnpatchAll();
Main = null;
}
- }
+ }
}
\ No newline at end of file