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
    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
  • +
    diff --git a/Source/ProjectRimFactory/AutoMachineTool/Building_MIner.cs b/Source/ProjectRimFactory/AutoMachineTool/Building_MIner.cs index bd9b4f21d..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,11 +195,32 @@ public string GetDescription(ThingDef def) HelpText += "\r\n"; return HelpText; } + + protected override bool IsActive() + { + return base.IsActive() && !inSpace; + } } [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); + if (def.defName == "MineableSilver") count = 5; + return Mathf.Min(yield, count); + } + static RecipeRegister() { var minerDef = DefDatabase.GetNamedSilentFail("PRF_BillTypeMiner_I"); @@ -207,7 +230,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 @@ -253,6 +276,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) { @@ -261,7 +297,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; 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