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
Binary file modified 1.3/Assemblies/WhatTheHack.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion 1.3/Source/WhatTheHack/Jobs/Depricated/JobDriver_Ability.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ private Pawn TargetPawn
}
}

public override IEnumerable<Toil> MakeNewToils()
protected override IEnumerable<Toil> MakeNewToils()
{
if(TargetA != null)
{
Expand Down
2 changes: 1 addition & 1 deletion 1.3/Source/WhatTheHack/Jobs/JobDriver_CarryToHackingTable.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public override bool TryMakePreToilReservations(bool errorOnFailed)
return this.pawn.Reserve(this.Takee, this.job, 1, -1, null) && this.pawn.Reserve(this.HackingTable, this.job, 1, -1, null);
}

public override IEnumerable<Toil> MakeNewToils()
protected override IEnumerable<Toil> MakeNewToils()
{
this.FailOnDestroyedOrNull(TargetIndex.A);
this.FailOnDestroyedOrNull(TargetIndex.B);
Expand Down
7 changes: 4 additions & 3 deletions 1.3/Source/WhatTheHack/Jobs/JobDriver_ClearHackingTable.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,16 @@ public override bool TryMakePreToilReservations(bool errorOnFailed)
return this.pawn.Reserve(this.Takee, this.job, 1, -1, null) && this.pawn.Reserve(this.HackingTable, this.job, 1, -1, null);
}

public override IEnumerable<Toil> MakeNewToils()
protected override IEnumerable<Toil> MakeNewToils()
{
this.FailOnDestroyedOrNull(TargetIndex.A);
this.FailOnDestroyedOrNull(TargetIndex.B);
this.FailOnAggroMentalState(TargetIndex.A);
yield return Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.OnCell).FailOnDestroyedNullOrForbidden(TargetIndex.A).FailOnDespawnedNullOrForbidden(TargetIndex.B).FailOn(() => !this.pawn.CanReach(this.Takee, PathEndMode.OnCell, Danger.Deadly, false, false, TraverseMode.ByPawn)).FailOnSomeonePhysicallyInteracting(TargetIndex.A);
Toil toil = new Toil();
toil.defaultCompleteMode = ToilCompleteMode.Instant;
toil.initAction = new Action(delegate {
toil.initAction = new Action(delegate
{
Takee.jobs.EndCurrentJob(JobCondition.InterruptForced);
Takee.health.surgeryBills.Clear();
});
Expand All @@ -53,7 +54,7 @@ public override IEnumerable<Toil> MakeNewToils()
{
initAction = delegate
{
this.pawn.carryTracker.TryDropCarriedThing(pawn.Position, ThingPlaceMode.Direct, out Thing thing, null);
this.pawn.carryTracker.TryDropCarriedThing(pawn.Position, ThingPlaceMode.Direct, out Thing thing, null);
},
defaultCompleteMode = ToilCompleteMode.Instant
};
Expand Down
2 changes: 1 addition & 1 deletion 1.3/Source/WhatTheHack/Jobs/JobDriver_ControlMechanoid.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ private Pawn Mech
return pawn.RemoteControlLink();
}
}
public override IEnumerable<Toil> MakeNewToils()
protected override IEnumerable<Toil> MakeNewToils()
{
Toil toil = new Toil();
toil.defaultCompleteMode = ToilCompleteMode.Never;
Expand Down
2 changes: 1 addition & 1 deletion 1.3/Source/WhatTheHack/Jobs/JobDriver_ControlMechanoid_GoTo.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ private Pawn Mech
return pawn.RemoteControlLink();
}
}
public override IEnumerable<Toil> MakeNewToils()
protected override IEnumerable<Toil> MakeNewToils()
{
Toil gotoCell = Toils_Goto.GotoCell(TargetIndex.A, PathEndMode.OnCell);
gotoCell.FailOn(() => pawn.UnableToControl() || this.Mech.DestroyedOrNull() || this.Mech.Downed);
Expand Down
2 changes: 1 addition & 1 deletion 1.3/Source/WhatTheHack/Jobs/JobDriver_HackRogueAI.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public override bool TryMakePreToilReservations(bool errorOnFailed)
return true;
}

public override IEnumerable<Toil> MakeNewToils()
protected override IEnumerable<Toil> MakeNewToils()
{
this.FailOnDespawnedNullOrForbidden(TargetIndex.A);
this.FailOn(() => RogueAI.goingRogue == false);
Expand Down
2 changes: 1 addition & 1 deletion 1.3/Source/WhatTheHack/Jobs/JobDriver_MechanoidAbility.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ private Pawn TargetPawn
}
}

public override IEnumerable<Toil> MakeNewToils()
protected override IEnumerable<Toil> MakeNewToils()
{
if(TargetA != null && job.def.GetModExtension<DefModExtension_Ability>() is DefModExtension_Ability modExt)
{
Expand Down
Empty file.
2 changes: 1 addition & 1 deletion 1.3/Source/WhatTheHack/Jobs/JobDriver_Mechanoid_Rest.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public override bool TryMakePreToilReservations(bool errorOnFailed)
return result;
}

public override IEnumerable<Toil> MakeNewToils()
protected override IEnumerable<Toil> MakeNewToils()
{
//this.AddFinishAction(new Action(delegate { Log.Message("finish action called for job!"); }));
this.FailOnDespawnedOrNull(TargetIndex.A);
Expand Down
2 changes: 1 addition & 1 deletion 1.3/Source/WhatTheHack/Jobs/JobDriver_PerformMaintenance.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public override bool TryMakePreToilReservations(bool errorOnFailed)
}
return false;
}
public override IEnumerable<Toil> MakeNewToils()
protected override IEnumerable<Toil> MakeNewToils()
{
this.FailOnAggroMentalState(TargetIndex.A);
this.FailOnDespawnedNullOrForbidden(TargetIndex.A);
Expand Down
2 changes: 1 addition & 1 deletion 1.3/Source/WhatTheHack/Jobs/JobGiver_ControlMechanoid.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace WhatTheHack.Jobs
{
class JobGiver_ControlMechanoid : ThinkNode_JobGiver
{
public override Job TryGiveJob(Pawn pawn)
protected override Job TryGiveJob(Pawn pawn)
{
if(pawn.RemoteControlLink() != null && Utilities.QuickDistance(pawn.Position, pawn.RemoteControlLink().Position) <= Utilities.GetRemoteControlRadius(pawn) - 5f)
{
Expand Down
2 changes: 1 addition & 1 deletion 1.3/Source/WhatTheHack/Jobs/JobGiver_ControlMechanoid_Follow.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ private int FollowJobExpireInterval
}
}

public override Job TryGiveJob(Pawn pawn)
protected override Job TryGiveJob(Pawn pawn)
{
Pawn followee = pawn.RemoteControlLink();
if (followee == null)
Expand Down
2 changes: 1 addition & 1 deletion 1.3/Source/WhatTheHack/Jobs/JobGiver_Mechanoid_Ability.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class JobGiver_Mechanoid_Ability : ThinkNode_JobGiver
{
float powerDrain = 40f; //Should store this globally.
float fuelConsumption = 5f; //Should store this globally.
public override Job TryGiveJob(Pawn pawn)
protected override Job TryGiveJob(Pawn pawn)
{
if(pawn.health.hediffSet.HasHediff(WTH_DefOf.WTH_SelfDestruct) && pawn.health.summaryHealth.SummaryHealthPercent < 0.5f)
{
Expand Down
2 changes: 1 addition & 1 deletion 1.3/Source/WhatTheHack/Jobs/JobGiver_Mechanoid_Rest.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace WhatTheHack.Jobs
{
class JobGiver_Mechanoid_Rest : ThinkNode_JobGiver
{
public override Job TryGiveJob(Pawn pawn)
protected override Job TryGiveJob(Pawn pawn)
{
Job job = null;
if (pawn.IsActivated() && (pawn.ShouldRecharge() || pawn.ShouldBeMaintained()))
Expand Down
Empty file modified 1.3/Source/WhatTheHack/Jobs/JobGiver_Work_Mechanoid.cs
100644 → 100755
Empty file.
Empty file modified 1.3/Source/WhatTheHack/Jobs/WorkGiver_HackRogueAI.cs
100644 → 100755
Empty file.
Empty file modified 1.3/Source/WhatTheHack/Jobs/WorkGiver_HaulMechanoid.cs
100644 → 100755
Empty file.
Empty file modified 1.3/Source/WhatTheHack/Jobs/WorkGiver_PerformMaintenance.cs
100644 → 100755
Empty file.
Empty file.
2 changes: 2 additions & 0 deletions 1.3/Source/WhatTheHack/Recipes/Recipe_ModifyMechanoid_UninstallModule.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,14 @@ private static void Cleanup(Pawn pawn, HediffDef removedHediff)
{
pawnData.workTypes.RemoveAll((WorkTypeDef def) => ext.workTypes.Contains(def));
}
/* Disableled because after this part of code runs -> mechanoid will never do hunting (actualy this part breaks a lot of things)
if (!pawn.health.hediffSet.hediffs.Exists((Hediff h) => h.def.HasModExtension<DefModExtension_Hediff_WorkModule>()))
{
pawnData.workTypes = null;
pawn.skills = null;
pawn.workSettings = null;
}
*/
if(removedHediff == WTH_DefOf.WTH_RepairModule)
{
Base.RemoveComps(pawn);
Expand Down
8 changes: 6 additions & 2 deletions 1.3/Source/WhatTheHack/Recipes/Recipe_ModifyMechanoid_WorkModule.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,14 @@ class Recipe_ModifyMechanoid_WorkModule : Recipe_ModifyMechanoid
protected override void PostSuccessfulApply(Pawn pawn, BodyPartRecord part, Pawn billDoer, List<Thing> ingredients, Bill bill)
{
base.PostSuccessfulApply(pawn, part, billDoer, ingredients, bill);
ExtendedPawnData pawnData = Base.Instance.GetExtendedDataStorage().GetExtendedDataFor(pawn);
if (pawn.skills == null || pawn.workSettings == null || Base.Instance.GetExtendedDataStorage().GetExtendedDataFor(pawn).workTypes == null)
{
//for people who became victums of NullReferenceException bug (reinitialize ALL mechanoid skills and worktypes)
Utilities.InitWorkTypesAndSkills(pawn, Base.Instance.GetExtendedDataStorage().GetExtendedDataFor(pawn));
}
if (bill.recipe.addsHediff.GetModExtension<DefModExtension_Hediff_WorkModule>() is DefModExtension_Hediff_WorkModule modExt)
{

ExtendedPawnData pawnData = Base.Instance.GetExtendedDataStorage().GetExtendedDataFor(pawn);
foreach (WorkTypeDef workType in modExt.workTypes)
{
pawnData.workTypes.Add(workType);
Expand Down