Skip to content

Commit

Permalink
disable mech when arrive at world map + small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rheirman committed May 8, 2019
1 parent 9ed4e38 commit 2572cc3
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
Binary file modified Assemblies/WhatTheHack.dll
Binary file not shown.
1 change: 1 addition & 0 deletions Source/WhatTheHack/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ public static bool CanStartWorkNow(this Pawn pawn)
Need_Power powerNeed = pawn.needs.TryGetNeed<Need_Power>();
if(pawn.Downed ||
pawn.ShouldRecharge() ||
pawn.ShouldBeMaintained() ||
(pawn.OnBaseMechanoidPlatform() && powerNeed.CurLevelPercentage <= powerNeed.canStartWorkThreshold) ||
pawn.OnHackingTable())
{
Expand Down
7 changes: 7 additions & 0 deletions Source/WhatTheHack/Harmony/GenSpawn.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Text;
using Verse;
using WhatTheHack.Comps;
using WhatTheHack.Storage;

namespace WhatTheHack.Harmony
{
Expand Down Expand Up @@ -40,6 +41,12 @@ static void Postfix(ref Thing newThing, bool respawningAfterLoad)
{
LessonAutoActivator.TeachOpportunity(WTH_DefOf.WTH_Modification, OpportunityType.Important);
}
//disable mechs on map arrival
if (!respawningAfterLoad && newThing is Pawn pawn && pawn.IsHacked() && pawn.Faction == Faction.OfPlayer && Base.Instance.GetExtendedDataStorage() is ExtendedDataStorage store)
{
ExtendedPawnData extendedPawnData = store.GetExtendedDataFor(pawn);
extendedPawnData.isActive = false;
}
}

//Only initialize the refeulcomp of mechanoids that have a repairmodule.
Expand Down
4 changes: 4 additions & 0 deletions Source/WhatTheHack/Harmony/Pawn_Draftcontroller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ private static void DisableCommandIfMechanoidPowerLow(Pawn_DraftController __ins
{
toggleCommand.Disable("WTH_Reason_PowerLow".Translate());
}
if (__instance.pawn.ShouldBeMaintained())
{
toggleCommand.Disable("WTH_Reason_MaintenanceLow".Translate());
}
}
}

Expand Down

0 comments on commit 2572cc3

Please sign in to comment.