-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Users may now set a custom value in the menu for repair threshold. If the building's HP as a percentage is above this threshold, pawns will not repair it. E.g. wooden wall with 100/140 HP has ~71% HP and will only be repaired if the threshold is >71.
- Loading branch information
1 parent
17ac709
commit 65b3a0b
Showing
8 changed files
with
32 additions
and
4 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using RimWorld; | ||
using Verse; | ||
|
||
namespace RWP | ||
{ | ||
public class WorkGiver_RepairCustom : WorkGiver_Repair | ||
{ | ||
public static int RepairThreshold = 100; | ||
|
||
public override bool HasJobOnThing(Pawn pawn, Thing t) | ||
{ | ||
int hitPointPercentage = 100 * t.HitPoints / t.MaxHitPoints; | ||
|
||
return base.HasJobOnThing(pawn, t) && hitPointPercentage < RepairThreshold; | ||
} | ||
} | ||
} |