This commit is contained in:
CGFighter
2021-08-17 12:59:19 +03:00
parent 27ce46c551
commit 41c1be31e5
5 changed files with 15 additions and 17 deletions

View File

Binary file not shown.

View File

@@ -1,6 +1,7 @@
using HarmonyLib; using HarmonyLib;
using System.Reflection; using System.Reflection;
using Verse; using Verse;
using RimWorld;
namespace ResearchWhatever namespace ResearchWhatever
{ {

View File

@@ -61,6 +61,7 @@
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Patches\ResearchManagerPatch.cs" />
<Compile Include="Patches\StaticConstructorOnStartupUtilityPatch.cs" /> <Compile Include="Patches\StaticConstructorOnStartupUtilityPatch.cs" />
<Compile Include="Patches\WorkGiver_ResearcherPatch.cs" /> <Compile Include="Patches\WorkGiver_ResearcherPatch.cs" />
<Compile Include="ResearchWhatever.cs" /> <Compile Include="ResearchWhatever.cs" />

View File

@@ -8,18 +8,8 @@ namespace ResearchWhatever
{ {
public bool Active public bool Active
{ {
get get { return parent?.Faction == Faction.OfPlayer && active; }
{ set { if (value == active) return; active = value; }
return active;
}
set
{
if (value == active)
{
return;
}
this.active = value;
}
} }
public override void PostExposeData() public override void PostExposeData()
@@ -29,16 +19,19 @@ namespace ResearchWhatever
public override IEnumerable<Gizmo> CompGetGizmosExtra() public override IEnumerable<Gizmo> CompGetGizmosExtra()
{ {
if (parent?.Faction != Faction.OfPlayer)
yield break;
//
Command_Toggle command_Toggle = new Command_Toggle(); Command_Toggle command_Toggle = new Command_Toggle();
command_Toggle.hotKey = KeyBindingDefOf.Command_TogglePower; command_Toggle.hotKey = KeyBindingDefOf.Command_TogglePower;
command_Toggle.defaultLabel = "CommandResearchWhateverToggleLabel".Translate(); command_Toggle.defaultLabel = "CommandResearchWhateverToggleLabel".Translate();
command_Toggle.icon = TexCommand.OpenLinkedQuestTex; command_Toggle.icon = TexCommand.OpenLinkedQuestTex;
command_Toggle.isActive = (() => this.Active); command_Toggle.isActive = (() => active);
command_Toggle.toggleAction = delegate () command_Toggle.toggleAction = delegate ()
{ {
this.Active = !this.Active; Active = !active;
}; };
if (this.Active) if (Active)
{ {
command_Toggle.defaultDesc = "CommandResearchWhateverToggleDescActive".Translate(); command_Toggle.defaultDesc = "CommandResearchWhateverToggleDescActive".Translate();
} }

View File

@@ -1,5 +1,8 @@
1.0.1 1.0.2
- did stuff that maybe could help somebody; - option gets disabled if building is not of player faction;
1.0.1
- did stuff that maybe could help somebody... to not have error messages;
1.0.0.1 1.0.0.1
- grammar; - grammar;