diff --git a/About/About.xml b/About/About.xml index fc4f5669..f4066508 100644 --- a/About/About.xml +++ b/About/About.xml @@ -54,5 +54,6 @@ In theory there is no real limit to the number of manager jobs that can be creat https://github.com/fluffy-mods/ColonyManager
  • 1.4
  • +
  • 1.5
  • - \ No newline at end of file + diff --git a/Source/Core/Settings.cs b/Source/Core/Settings.cs index 500f2b36..2467364c 100644 --- a/Source/Core/Settings.cs +++ b/Source/Core/Settings.cs @@ -56,4 +56,4 @@ public override void ExposeData() Scribe_Values.Look( ref _defaultUpdateIntervalTicks_Scribe, "defaultUpdateInterval", GenDate.TicksPerDay ); } } -} \ No newline at end of file +} diff --git a/Source/Helpers/Livestock/Utilities_Livestock.cs b/Source/Helpers/Livestock/Utilities_Livestock.cs index f8004f18..13a94c38 100644 --- a/Source/Helpers/Livestock/Utilities_Livestock.cs +++ b/Source/Helpers/Livestock/Utilities_Livestock.cs @@ -158,7 +158,7 @@ public static MasterMode GetMasterMode(this Pawn pawn) if (pawn.workSettings.WorkIsActive(WorkTypeDefOf.Handling)) mode = mode | MasterMode.Trainers; - if (pawn.equipment.Primary?.def.IsMeleeWeapon ?? true) // no weapon = melee + if (pawn.equipment.Primary?.def.IsMeleeWeapon ?? true) // no weapon = melee mode = mode | MasterMode.Melee; if (pawn.equipment.Primary?.def.IsRangedWeapon ?? false) @@ -401,7 +401,11 @@ public static int TicksTillHarvestable(this CompHasGatherableBodyResource comp) public static bool VisiblyPregnant(this Pawn pawn) { + #if RIMWORLD12 || RIMWORLD13 + return false; + #else return pawn?.health.hediffSet.GetFirstHediff()?.Visible ?? false; + #endif } private static bool _milkable(this Pawn pawn) @@ -420,4 +424,4 @@ private static bool _shearable(this Pawn pawn) return (bool)active; } } -} \ No newline at end of file +} diff --git a/Source/Helpers/Mining/Dialog_MiningDebugOptions.cs b/Source/Helpers/Mining/Dialog_MiningDebugOptions.cs index 46bacec3..864b0899 100644 --- a/Source/Helpers/Mining/Dialog_MiningDebugOptions.cs +++ b/Source/Helpers/Mining/Dialog_MiningDebugOptions.cs @@ -1,7 +1,11 @@ // Dialog_MiningDebugOptions.cs // Copyright Karel Kroeze, 2018-2020 +using System; using System.Linq; +#if RIMWORLD15 +using LudeonTK; +#endif using RimWorld; using UnityEngine; using Verse; @@ -17,6 +21,19 @@ public Dialog_MiningDebugOptions( ManagerJob_Mining job ) this.job = job; } + #if RIMWORLD12 + protected void DebugToolMap(string label, Action toolAction, bool highlight) + { + DebugToolMap_NewTmp(label, toolAction, highlight); + } + + protected bool DebugAction(string label, Action action, bool highlight) + { + return DebugAction_NewTmp(label, action, highlight); + } + #endif + +#if !RIMWORLD15 protected override void DoListingItems() { DebugToolMap( "IsValidMiningTarget", delegate @@ -121,5 +138,6 @@ protected override void DoListingItems() }, false ); } +#endif } -} \ No newline at end of file +} diff --git a/Source/ManagerJobs/ManagerJob_Livestock.cs b/Source/ManagerJobs/ManagerJob_Livestock.cs index 3bb259f7..b2d62544 100644 --- a/Source/ManagerJobs/ManagerJob_Livestock.cs +++ b/Source/ManagerJobs/ManagerJob_Livestock.cs @@ -262,7 +262,7 @@ public void DoFollowSettings(ref bool actionTaken) } } - // default + // default else { if (Masters != MasterMode.Default) SetMaster(animal, Masters, Master, ref actionTaken); @@ -373,7 +373,7 @@ public Pawn GetMaster(Pawn animal, MasterMode mode) if (options.NullOrEmpty()) return null; - // if we currently have a master, our current master is a valid option, + // if we currently have a master, our current master is a valid option, // and all the options have roughly equal amounts of pets following them, we don't need to take action if (master != null && options.Contains(master) && RoughlyEquallyDistributed(options)) return master; @@ -506,54 +506,62 @@ private void DoAreaRestrictions(ref bool actionTaken) for (var i = 0; i < Utilities_Livestock.AgeSexArray.Length; i++) foreach (var p in Trigger.pawnKind.GetTame(manager, Utilities_Livestock.AgeSexArray[i])) + { + #if RIMWORLD15 + Area restrictedArea = p.playerSettings.AreaRestrictionInPawnCurrentMap; + #else + Area restrictedArea = p.playerSettings.AreaRestriction; + #endif + // slaughter if (SendToSlaughterArea && - manager.map.designationManager.DesignationOn(p, DesignationDefOf.Slaughter) != null) + manager.map.designationManager.DesignationOn(p, DesignationDefOf.Slaughter) != null) { - actionTaken = p.playerSettings.AreaRestriction != SlaughterArea; - p.playerSettings.AreaRestriction = SlaughterArea; + actionTaken = restrictedArea != SlaughterArea; + restrictedArea = SlaughterArea; } // milking else if (SendToMilkingArea && - p.GetComp() != null && - p.GetComp().TicksTillHarvestable() < UpdateInterval.ticks) + p.GetComp() != null && + p.GetComp().TicksTillHarvestable() < UpdateInterval.ticks) { - if (p.playerSettings.AreaRestriction != MilkArea) + if (restrictedArea != MilkArea) { actionTaken = true; - p.playerSettings.AreaRestriction = MilkArea; + restrictedArea = MilkArea; } } // shearing else if (SendToShearingArea && - p.GetComp() != null && - p.GetComp().TicksTillHarvestable() < UpdateInterval.ticks) + p.GetComp() != null && + p.GetComp().TicksTillHarvestable() < UpdateInterval.ticks) { - if (p.playerSettings.AreaRestriction != ShearArea) + if (restrictedArea != ShearArea) { actionTaken = true; - p.playerSettings.AreaRestriction = ShearArea; + restrictedArea = ShearArea; } } // training else if (SendToTrainingArea && p.training.NextTrainableToTrain() != null) { - if (p.playerSettings.AreaRestriction != TrainingArea) + if (restrictedArea != TrainingArea) { actionTaken = true; - p.playerSettings.AreaRestriction = TrainingArea; + restrictedArea = TrainingArea; } } // all - else if (RestrictToArea && p.playerSettings.AreaRestriction != RestrictArea[i]) + else if (RestrictToArea && restrictedArea != RestrictArea[i]) { actionTaken = true; - p.playerSettings.AreaRestriction = RestrictArea[i]; + restrictedArea = RestrictArea[i]; } + } } private void DoButcherJobs(ref bool actionTaken) @@ -774,4 +782,4 @@ private void SetWantedRecursive(TrainableDef td, bool wanted) } } } -} \ No newline at end of file +} diff --git a/Source/ManagerTabs/ManagerTab_Hunting.cs b/Source/ManagerTabs/ManagerTab_Hunting.cs index c1afe6b5..861bbf39 100644 --- a/Source/ManagerTabs/ManagerTab_Hunting.cs +++ b/Source/ManagerTabs/ManagerTab_Hunting.cs @@ -354,10 +354,17 @@ public float DrawAnimalShortcuts(Vector2 pos, float width) // exploding animals rowRect.y += ListEntryHeight; + #if RIMWORLD15 + var exploding = animals + .Where(a => a.RaceProps.deathAction.workerClass == typeof(DeathActionWorker_SmallExplosion) + || a.RaceProps.deathAction.workerClass == typeof(DeathActionWorker_BigExplosion)) + .ToList(); + #else var exploding = animals .Where(a => a.RaceProps.deathActionWorkerClass == typeof(DeathActionWorker_SmallExplosion) || a.RaceProps.deathActionWorkerClass == typeof(DeathActionWorker_BigExplosion)) .ToList(); + #endif Utilities.DrawToggle(rowRect, "FM.Hunting.Exploding".Translate().Italic(), "FM.Hunting.Exploding.Tip".Translate(), @@ -436,4 +443,4 @@ public void Refresh() _selected?.RefreshAllowedAnimals(); } } -} \ No newline at end of file +} diff --git a/Source/Things/Building_ManagerStation.cs b/Source/Things/Building_ManagerStation.cs index 0ed90e5a..60e31662 100644 --- a/Source/Things/Building_ManagerStation.cs +++ b/Source/Things/Building_ManagerStation.cs @@ -144,11 +144,21 @@ public override void Tick() if ( _glowDirty ) { // Update glow grid + #if RIMWORLD15 + Map.glowGrid.DirtyCache(Position); + Map.mapDrawer.MapMeshDirty(Position, MapMeshFlagDefOf.GroundGlow); + #else Map.glowGrid.MarkGlowGridDirty( Position ); + #endif // the following two should not be necesarry, but for some reason do seem to be. + #if RIMWORLD15 + Map.mapDrawer.MapMeshDirty( Position, MapMeshFlagDefOf.GroundGlow ); + Map.mapDrawer.MapMeshDirty( Position, MapMeshFlagDefOf.Things ); + #else Map.mapDrawer.MapMeshDirty( Position, MapMeshFlag.GroundGlow ); Map.mapDrawer.MapMeshDirty( Position, MapMeshFlag.Things ); + #endif _glowDirty = false; } @@ -159,4 +169,4 @@ public class Building_ManagerStation : Building_WorkTable { // just to give different versions a common interface. } -} \ No newline at end of file +}