-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e99f9c9
commit a52a8dc
Showing
17 changed files
with
87 additions
and
19 deletions.
There are no files selected for viewing
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
43 changes: 43 additions & 0 deletions
43
ResearchReinvented/Source/HarmonyPatches/Prototypes/Toils_Recipe_DoRecipeWork_Patches.cs
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,43 @@ | ||
using HarmonyLib; | ||
using PeteTimesSix.ResearchReinvented.Defs; | ||
using PeteTimesSix.ResearchReinvented.Managers; | ||
using PeteTimesSix.ResearchReinvented.Rimworld.MiscData; | ||
using RimWorld; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Verse; | ||
using Verse.AI; | ||
|
||
namespace PeteTimesSix.ResearchReinvented.HarmonyPatches.Prototypes | ||
{ | ||
[HarmonyPatch(typeof(Toils_Recipe), nameof(Toils_Recipe.DoRecipeWork))] | ||
public static class Toils_Recipe_DoRecipeWork_Patches | ||
{ | ||
[HarmonyPostfix] | ||
public static void Toils_Recipe_DoRecipeWork_Postfix(Toil __result) | ||
{ | ||
__result.tickAction += () => | ||
{ | ||
//find tooling opportunity and do research | ||
var toil = __result; | ||
var actor = toil.actor; | ||
var bench = toil.actor.CurJob.GetTarget(TargetIndex.A).Thing; | ||
if (bench != null) | ||
{ | ||
var opportunity = ResearchOpportunityManager.Instance.GetCurrentlyAvailableOpportunities() | ||
.Where(o => o.def.handledBy.HasFlag(HandlingMode.Special_Tooling) && o.requirement.MetBy(bench)) | ||
.FirstOrDefault(); | ||
if(opportunity != null) | ||
{ | ||
float num = actor.GetStatValue(StatDefOf.ResearchSpeed, true); | ||
num *= FieldResearchHelper.GetFieldResearchSpeedFactor(actor, opportunity.project); | ||
opportunity.ResearchTickPerformed(num, actor, null); | ||
} | ||
} | ||
}; | ||
} | ||
} | ||
} |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
8 changes: 0 additions & 8 deletions
8
ResearchReinvented/v1.4/Defs/Opportunities/ResearchOpportunityTypes_Analysis.xml
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
15 changes: 15 additions & 0 deletions
15
ResearchReinvented/v1.4/Defs/Opportunities/ResearchOpportunityTypes_Tooling.xml
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,15 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<Defs> | ||
|
||
<PeteTimesSix.ResearchReinvented.Defs.ResearchOpportunityTypeDef ParentName="ResearchOpportunityBase"> | ||
<defName>AnalyseProductionFacility</defName> | ||
<handledBy>Special_Tooling</handledBy> | ||
<jobPickerClass>PeteTimesSix.ResearchReinvented.OpportunityJobPickers.JobPicker_NoJob</jobPickerClass> | ||
<header_Direct>technique exploration</header_Direct> | ||
<shortDesc_Direct>Practice with differing tools and methodologies while working at {0}.</shortDesc_Direct> | ||
<category_Direct>Tooling</category_Direct> | ||
<hintIcons Inherit="false"> | ||
<li>UI/hintIcons/wrench</li> | ||
</hintIcons> | ||
</PeteTimesSix.ResearchReinvented.Defs.ResearchOpportunityTypeDef> | ||
</Defs> |
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
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