From b80f7d353ce1c5f52ba9088ab66604e312cdf1fa Mon Sep 17 00:00:00 2001 From: Sn1p3rr3c0n Date: Fri, 29 Jul 2022 18:30:56 +0200 Subject: [PATCH 1/5] Plasteel Refin: Reduced Chemfuel cost by 50% and slightly reduced the Workammount --- Defs/RecipeDefs/Recipes_Plasteel.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Defs/RecipeDefs/Recipes_Plasteel.xml b/Defs/RecipeDefs/Recipes_Plasteel.xml index f8cbc3696..b95204d41 100644 --- a/Defs/RecipeDefs/Recipes_Plasteel.xml +++ b/Defs/RecipeDefs/Recipes_Plasteel.xml @@ -11,7 +11,7 @@ GeneralLaborSpeed Smelt Recipe_Machining - 30000 + 24000 0.75 UnfinishedComponent @@ -29,7 +29,7 @@
  • Chemfuel
  • - 100 + 50
    From a4c42eef190d1d5b1faa2e9e2245fdb9b3adf363 Mon Sep 17 00:00:00 2001 From: Sn1p3rr3c0n Date: Fri, 29 Jul 2022 18:34:45 +0200 Subject: [PATCH 2/5] nerfed the ammount of items gained per bill --- .../AutoMachineTool/Building_MIner.cs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/Source/ProjectRimFactory/AutoMachineTool/Building_MIner.cs b/Source/ProjectRimFactory/AutoMachineTool/Building_MIner.cs index bd9b4f21d..209ae501a 100644 --- a/Source/ProjectRimFactory/AutoMachineTool/Building_MIner.cs +++ b/Source/ProjectRimFactory/AutoMachineTool/Building_MIner.cs @@ -198,6 +198,21 @@ public string GetDescription(ThingDef def) [StaticConstructorOnStartup] public static class RecipeRegister { + private static readonly float maxValuePerBill = 23f; + /// + /// Retuns a appropriate yield for a minable Thing + /// based on a "maxValuePerBill" Variable and the default yield + /// + /// Minable Building + /// yield ammount + private static int GetMinableYieldForMinerBill(ThingDef def) + { + var yield = def.building.mineableYield; + var valuePerUnit = def.building.mineableThing.BaseMarketValue; + int count = Mathf.CeilToInt(maxValuePerBill / valuePerUnit); + return Mathf.Min(yield, count); + } + static RecipeRegister() { var minerDef = DefDatabase.GetNamedSilentFail("PRF_BillTypeMiner_I"); @@ -207,7 +222,7 @@ static RecipeRegister() var mineables = DefDatabase.AllDefs .Where(d => d.mineable && d.building != null && d.building.mineableThing != null && d.building.mineableYield > 0) .Where(d => d.building.isResourceRock || d.building.isNaturalRock) - .Select(d => new ThingDefCountClass(d.building.mineableThing, d.building.mineableYield)) + .Select(d => new ThingDefCountClass(d.building.mineableThing, GetMinableYieldForMinerBill(d))) // Create recipes for exluded items - for now - so players who had those recipes // don't get errors are save game load. // Once people have had this change for a while (Nov 2020?), can uncomment this line From f2e81b8b7b6a21750e4426c6014e76006cb58a23 Mon Sep 17 00:00:00 2001 From: Sn1p3rr3c0n Date: Tue, 16 Aug 2022 09:25:47 +0200 Subject: [PATCH 3/5] #593 increased workammount added special rule for silver --- .../AutoMachineTool/Building_MIner.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Source/ProjectRimFactory/AutoMachineTool/Building_MIner.cs b/Source/ProjectRimFactory/AutoMachineTool/Building_MIner.cs index 209ae501a..02fdd1b10 100644 --- a/Source/ProjectRimFactory/AutoMachineTool/Building_MIner.cs +++ b/Source/ProjectRimFactory/AutoMachineTool/Building_MIner.cs @@ -210,6 +210,7 @@ private static int GetMinableYieldForMinerBill(ThingDef def) var yield = def.building.mineableYield; var valuePerUnit = def.building.mineableThing.BaseMarketValue; int count = Mathf.CeilToInt(maxValuePerBill / valuePerUnit); + if (def.defName == "MineableSilver") count = 5; return Mathf.Min(yield, count); } @@ -268,6 +269,19 @@ static RecipeRegister() //minerDef.recipes = recipeDefs; } } + private static float calculateWorkAmmount(ThingDefCountClass defCount) + { + var isRare = defCount.thingDef.BaseMarketValue >= 6; + var work = Mathf.Max(10000f, StatDefOf.MarketValue.Worker.GetValue(StatRequest.For(defCount.thingDef, null)) * defCount.count * 1000); + //Maybe make this a fuction at a later point + //As in factor per maket value + if (isRare) + { + work *= 5; + } + if (defCount.thingDef.defName == "MineableSilver") work *= 8; + return work; + } private static RecipeDef CreateMiningRecipe(ThingDefCountClass defCount, EffecterDef effecter) { @@ -276,7 +290,7 @@ private static RecipeDef CreateMiningRecipe(ThingDefCountClass defCount, Effecte r.label = "PRF.AutoMachineTool.AutoMiner.MineOre".Translate(defCount.thingDef.label); r.jobString = "PRF.AutoMachineTool.AutoMiner.MineOre".Translate(defCount.thingDef.label); - r.workAmount = Mathf.Max(10000f, StatDefOf.MarketValue.Worker.GetValue(StatRequest.For(defCount.thingDef, null)) * defCount.count * 1000); + r.workAmount = calculateWorkAmmount(defCount); r.workSpeedStat = StatDefOf.WorkToMake; r.efficiencyStat = StatDefOf.WorkToMake; From b49345acc47d13e507a908f19c6045912af0e80f Mon Sep 17 00:00:00 2001 From: Sn1p3rr3c0n Date: Wed, 17 Aug 2022 10:59:08 +0200 Subject: [PATCH 4/5] #593 no mining in space --- .../AutoMachineTool/Building_MIner.cs | 9 ++++++++- Source/ProjectRimFactory/Common/PRFMapComponent.cs | 9 +++++++++ .../Common/ProjectRimFactory_ModComponent.cs | 11 +++++++++-- .../ProjectRimFactory/Industry/Building_DeepQuarry.cs | 4 +++- 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/Source/ProjectRimFactory/AutoMachineTool/Building_MIner.cs b/Source/ProjectRimFactory/AutoMachineTool/Building_MIner.cs index 02fdd1b10..386aa4a7a 100644 --- a/Source/ProjectRimFactory/AutoMachineTool/Building_MIner.cs +++ b/Source/ProjectRimFactory/AutoMachineTool/Building_MIner.cs @@ -26,6 +26,8 @@ public class Building_Miner : Building_BaseMachine, IBillGiver, public IEnumerable AllRecipes => this.def.AllRecipes; + private bool inSpace = false; + public IEnumerable GetAllRecipes() { return this.AllRecipes; @@ -153,7 +155,7 @@ protected bool EffectTick() public override void SpawnSetup(Map map, bool respawningAfterLoad) { base.SpawnSetup(map, respawningAfterLoad); - + inSpace = Common.HarmonyPatches.PatchStorageUtil.GetPRFMapComponent(map).IsSpace; if (this.GetComp() != null) { this.GetComp().Glows = false; @@ -193,6 +195,11 @@ public string GetDescription(ThingDef def) HelpText += "\r\n"; return HelpText; } + + protected override bool IsActive() + { + return base.IsActive() && !inSpace; + } } [StaticConstructorOnStartup] diff --git a/Source/ProjectRimFactory/Common/PRFMapComponent.cs b/Source/ProjectRimFactory/Common/PRFMapComponent.cs index 4468c3f32..33234c76b 100644 --- a/Source/ProjectRimFactory/Common/PRFMapComponent.cs +++ b/Source/ProjectRimFactory/Common/PRFMapComponent.cs @@ -19,6 +19,9 @@ public class PRFMapComponent : MapComponent private Dictionary> ForbidPawnOutputItemLocations = new Dictionary>(); + private bool spaceTested = false; + public bool IsSpace = false; + public void RegisterIHideItemPos(IntVec3 pos, HarmonyPatches.IHideItem hideItem) { if(hideItemLocations.ContainsKey(pos)) @@ -97,6 +100,12 @@ public override void MapComponentTick() { base.MapComponentTick(); this.tickers.ForEach(t => t.Tick()); + + if(!spaceTested && ProjectRimFactory_ModComponent.ModSupport_SOS2) + { + spaceTested = true; + IsSpace = (bool)ProjectRimFactory_ModComponent.ModSupport_SOS2_IsSpace.Invoke(null, new object[] { this.map }); + } } public void AddTicker(ITicker ticker) diff --git a/Source/ProjectRimFactory/Common/ProjectRimFactory_ModComponent.cs b/Source/ProjectRimFactory/Common/ProjectRimFactory_ModComponent.cs index a4f101aef..a51550672 100644 --- a/Source/ProjectRimFactory/Common/ProjectRimFactory_ModComponent.cs +++ b/Source/ProjectRimFactory/Common/ProjectRimFactory_ModComponent.cs @@ -41,7 +41,10 @@ public ProjectRimFactory_ModComponent(ModContentPack content) : base(content) public static System.Reflection.MethodInfo ModSupport_ReserchPal_ResetLayout = null; public static bool ModSupport_ReserchPal = false; - + + public static System.Reflection.MethodInfo ModSupport_SOS2_IsSpace = null; + public static bool ModSupport_SOS2 = false; + private void LoadModSupport() { if (ModLister.HasActiveModWithName("[KV] RimFridge")) @@ -151,7 +154,11 @@ private void LoadModSupport() Log.Error("PRF Could not find savestoragesettings.kv.rw assembly"); } } - + if (ModLister.HasActiveModWithName("Save Our Ship 2")) + { + ModSupport_SOS2 = true; + ModSupport_SOS2_IsSpace = AccessTools.Method("RimworldMod.AccessExtensions:IsSpace"); + } } diff --git a/Source/ProjectRimFactory/Industry/Building_DeepQuarry.cs b/Source/ProjectRimFactory/Industry/Building_DeepQuarry.cs index 3348f1245..d7aef1ad5 100644 --- a/Source/ProjectRimFactory/Industry/Building_DeepQuarry.cs +++ b/Source/ProjectRimFactory/Industry/Building_DeepQuarry.cs @@ -29,12 +29,14 @@ public class Building_DeepQuarry : Building , IXMLThingDescription public CompPowerTrader power; public CompRefuelable fuel; public int ProducedChunksTotal = 0; + private bool inSpace = false; public override void SpawnSetup(Map map, bool respawningAfterLoad) { base.SpawnSetup(map, respawningAfterLoad); flick = GetComp(); power = GetComp(); fuel = GetComp(); + inSpace = Common.HarmonyPatches.PatchStorageUtil.GetPRFMapComponent(map).IsSpace; } public static IEnumerable PossibleRockDefCandidates @@ -78,7 +80,7 @@ private void HandelTick(int numTicks, bool consumeFuelWhileRunning) !fuel.Props.consumeFuelOnlyWhenUsed) { fuel.ConsumeFuel(fuel.Props.fuelConsumptionRate / 6000 * numTicks); }*/ - + if (inSpace) return; if (flick == null || flick.SwitchIsOn) // Either no switch or turned on { if (power == null || power.PowerOn) // Either does not use power or has power From 6e162bc5600e131c561c285d10fc5efc2a9a0ba2 Mon Sep 17 00:00:00 2001 From: Sn1p3rr3c0n Date: Wed, 17 Aug 2022 13:27:25 +0200 Subject: [PATCH 5/5] #593 added initial techprints --- .../ResearchProjects_Assemblers.xml | 16 ++++++++++++++++ .../ResearchProjects_Batteries.xml | 8 ++++++++ .../ResearchProjects_Drones.xml | 8 ++++++++ .../ResearchProjects_Industrial.xml | 8 ++++++++ .../ResearchProjectDefs/ResearchProjects_SAL.xml | 8 ++++++++ .../ResearchProjects_Storage.xml | 16 ++++++++++++++++ 6 files changed, 64 insertions(+) diff --git a/Defs/ResearchProjectDefs/ResearchProjects_Assemblers.xml b/Defs/ResearchProjectDefs/ResearchProjects_Assemblers.xml index c774bca13..b0fb1879e 100644 --- a/Defs/ResearchProjectDefs/ResearchProjects_Assemblers.xml +++ b/Defs/ResearchProjectDefs/ResearchProjects_Assemblers.xml @@ -115,6 +115,14 @@
  • PRF_UniversalAutocrafting
  • 9 + + 1 + 1 + 3000 + +
  • Outlander
  • +
  • Empire
  • +
    @@ -132,5 +140,13 @@
  • PRF_SelfCorrectingAssemblers
  • 10 + + 2 + 1 + 4000 + +
  • Outlander
  • +
  • Empire
  • +
    \ No newline at end of file diff --git a/Defs/ResearchProjectDefs/ResearchProjects_Batteries.xml b/Defs/ResearchProjectDefs/ResearchProjects_Batteries.xml index ddd9b6d35..a441ad0ff 100644 --- a/Defs/ResearchProjectDefs/ResearchProjects_Batteries.xml +++ b/Defs/ResearchProjectDefs/ResearchProjects_Batteries.xml @@ -52,6 +52,14 @@
  • PRF_CoreTierIII
  • 9 + + 1 + 1 + 3000 + +
  • Outlander
  • +
  • Empire
  • +
    diff --git a/Defs/ResearchProjectDefs/ResearchProjects_Drones.xml b/Defs/ResearchProjectDefs/ResearchProjects_Drones.xml index ce02a32af..a2e81f559 100644 --- a/Defs/ResearchProjectDefs/ResearchProjects_Drones.xml +++ b/Defs/ResearchProjectDefs/ResearchProjects_Drones.xml @@ -57,6 +57,14 @@ 10 About: Drone are now lv 20 You have upgraded your drones with advanced AI cores, this will let them do their tasks better than most humans will do. \n This will set any drones base level to 20. \n Unless other settings for specific dronestation is specified. + + 1 + 1 + 3000 + +
  • Outlander
  • +
  • Empire
  • +
    diff --git a/Defs/ResearchProjectDefs/ResearchProjects_Industrial.xml b/Defs/ResearchProjectDefs/ResearchProjects_Industrial.xml index b28a2eb81..fde8b5031 100644 --- a/Defs/ResearchProjectDefs/ResearchProjects_Industrial.xml +++ b/Defs/ResearchProjectDefs/ResearchProjects_Industrial.xml @@ -55,6 +55,14 @@ 9 Build two more advanced forms of miners. One will only produce resources with no stone, and one allows you to target-mine specific resources. Neither of the tier 3 miners will draw infestations thanks to the advanced technology they use to dampen vibrations. + + 1 + 1 + 3000 + +
  • Outlander
  • +
  • Empire
  • +
    \ No newline at end of file diff --git a/Defs/ResearchProjectDefs/ResearchProjects_SAL.xml b/Defs/ResearchProjectDefs/ResearchProjects_SAL.xml index cb79b13bd..967fff275 100644 --- a/Defs/ResearchProjectDefs/ResearchProjects_SAL.xml +++ b/Defs/ResearchProjectDefs/ResearchProjects_SAL.xml @@ -162,6 +162,14 @@ 12 4.3 + + 2 + 1 + 6000 + +
  • Outlander
  • +
  • Empire
  • +
    diff --git a/Defs/ResearchProjectDefs/ResearchProjects_Storage.xml b/Defs/ResearchProjectDefs/ResearchProjects_Storage.xml index eb6114615..f443c3800 100644 --- a/Defs/ResearchProjectDefs/ResearchProjects_Storage.xml +++ b/Defs/ResearchProjectDefs/ResearchProjects_Storage.xml @@ -50,6 +50,14 @@
  • MultiAnalyzer
  • PRF_ResearchTerminal
  • + + 1 + 1 + 3000 + +
  • Outlander
  • +
  • Empire
  • +
    @@ -67,5 +75,13 @@
  • MultiAnalyzer
  • PRF_ResearchTerminal
  • + + 1 + 1 + 3000 + +
  • Outlander
  • +
  • Empire
  • +