Hello all, I am working on getting my mod Horrors back up and running, however there is one hurdle in the way presently:
Previously I could locate the closest rock to my digger using this code:
However, since the update, I no longer have a 'ThingRequestGroup.Building', it only describes items that are Artificial in nature and such. And the ThingRequestGroup is an enumerated integer that I cannot (Or don't know how to) alter.
So I tried everything I could think of on that approach, failed, and retook arms from another front, namely I looked at the 'JobGiver_Manhunter' code to determine how it targets turrets, the code is as follows (abridged):
But if I use that code to find a target I am running into another problem... It has to be hostile. So I dropped the 'TargetScanFlags.OnlyTargetCombatBuildings' flag in the hopes that it will work, but the class still has a check for hostility...
So I copied the class and created my own version where I merely removed the 'isHostile' check... But no joy.
Anyone have any suggestions regarding a possible way to approach this?
Thank you to anyone willing to read my issue and those whom reply, beforehand.
Previously I could locate the closest rock to my digger using this code:
Code Select
public static Thing ClosestRock(Pawn digger, float rockSearchRadius)
{
Predicate<Thing> validator = delegate(Thing t)
{
Building building = t as Building;
if (t.def.eType != EntityType.Rock)
{
return false;
}
return (building.Position.CanReach(digger.Position, PathMode.Touch, TraverseMode.NoPassDoors, Danger.Some) && RockAttackUtility.IsGoodTrashTargetFor(t, digger));
// return (caccoonBuilding.Position.CanReach(kidnapper.Position, PathMode.OnCell, TraverseMode.NoPassDoors, Danger.Some) && caccoonBuilding.container.Empty && ReservationUtility.CanReserve(kidnapper, caccoonBuilding, ReservationType.Use));
};
return (Building)GenClosest.ClosestThingReachable(digger.Position, ThingRequest.ForGroup(ThingRequestGroup.Building), PathMode.Touch, TraverseParms.For(digger, Danger.Deadly, true), rockSearchRadius, validator, null, -1);
}
}
However, since the update, I no longer have a 'ThingRequestGroup.Building', it only describes items that are Artificial in nature and such. And the ThingRequestGroup is an enumerated integer that I cannot (Or don't know how to) alter.
So I tried everything I could think of on that approach, failed, and retook arms from another front, namely I looked at the 'JobGiver_Manhunter' code to determine how it targets turrets, the code is as follows (abridged):
Code Select
private Thing FindTurretTarget(Pawn pawn)
{
return AttackTargetFinder.BestAttackTarget(pawn, (Thing t) => t is Building, 70f, 0f, TargetScanFlags.NeedLOSToPawns | TargetScanFlags.NeedLOSToNonPawns | TargetScanFlags.NeedReachable | TargetScanFlags.OnlyTargetCombatBuildings, default(IntVec3), 3.40282347E+38f);
}
But if I use that code to find a target I am running into another problem... It has to be hostile. So I dropped the 'TargetScanFlags.OnlyTargetCombatBuildings' flag in the hopes that it will work, but the class still has a check for hostility...
So I copied the class and created my own version where I merely removed the 'isHostile' check... But no joy.
Anyone have any suggestions regarding a possible way to approach this?
Thank you to anyone willing to read my issue and those whom reply, beforehand.