Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion About/About.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,6 @@ In theory there is no real limit to the number of manager jobs that can be creat
<url>https://github.com/fluffy-mods/ColonyManager</url>
<supportedVersions>
<li>1.4</li>
<li>1.5</li>
</supportedVersions>
</ModMetaData>
</ModMetaData>
2 changes: 1 addition & 1 deletion Source/Core/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ public override void ExposeData()
Scribe_Values.Look( ref _defaultUpdateIntervalTicks_Scribe, "defaultUpdateInterval", GenDate.TicksPerDay );
}
}
}
}
8 changes: 6 additions & 2 deletions Source/Helpers/Livestock/Utilities_Livestock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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<Hediff_Pregnant>()?.Visible ?? false;
#endif
}

private static bool _milkable(this Pawn pawn)
Expand All @@ -420,4 +424,4 @@ private static bool _shearable(this Pawn pawn)
return (bool)active;
}
}
}
}
20 changes: 19 additions & 1 deletion Source/Helpers/Mining/Dialog_MiningDebugOptions.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -121,5 +138,6 @@ protected override void DoListingItems()
}, false
);
}
#endif
}
}
}
44 changes: 26 additions & 18 deletions Source/ManagerJobs/ManagerJob_Livestock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ public void DoFollowSettings(ref bool actionTaken)
}
}

// default
// default
else
{
if (Masters != MasterMode.Default) SetMaster(animal, Masters, Master, ref actionTaken);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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<CompMilkable>() != null &&
p.GetComp<CompMilkable>().TicksTillHarvestable() < UpdateInterval.ticks)
p.GetComp<CompMilkable>() != null &&
p.GetComp<CompMilkable>().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<CompShearable>() != null &&
p.GetComp<CompShearable>().TicksTillHarvestable() < UpdateInterval.ticks)
p.GetComp<CompShearable>() != null &&
p.GetComp<CompShearable>().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)
Expand Down Expand Up @@ -774,4 +782,4 @@ private void SetWantedRecursive(TrainableDef td, bool wanted)
}
}
}
}
}
9 changes: 8 additions & 1 deletion Source/ManagerTabs/ManagerTab_Hunting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -436,4 +443,4 @@ public void Refresh()
_selected?.RefreshAllowedAnimals();
}
}
}
}
12 changes: 11 additions & 1 deletion Source/Things/Building_ManagerStation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -159,4 +169,4 @@ public class Building_ManagerStation : Building_WorkTable
{
// just to give different versions a common interface.
}
}
}