Skip to content

Commit

Permalink
fixed power not working
Browse files Browse the repository at this point in the history
  • Loading branch information
rheirman committed Nov 12, 2018
1 parent f3301f2 commit 8023fbb
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
Binary file modified Assemblies/WhatTheHack.dll
Binary file not shown.
6 changes: 6 additions & 0 deletions Defs/ThingDefs/Buildings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,12 @@
<glowRadius>5</glowRadius>
<glowColor>(138,73,73,0)</glowColor>
</li>
<li Class="CompProperties_Power">
<compClass>CompPowerTrader</compClass>
<shortCircuitInRain>false</shortCircuitInRain>
<basePowerConsumption>200</basePowerConsumption>
<transmitsPower>true</transmitsPower>
</li>
</comps>
<placeWorkers>
<li>PlaceWorker_NotUnderRoof</li>
Expand Down
15 changes: 10 additions & 5 deletions Source/WhatTheHack/Buildings/Building_MechanoidBeacon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ public IEnumerable<Gizmo> StartupGizmos()
bool isDisabled = false;
string disabledReason = "";
bool rogueAIAvailable = false;

if (GetComp<CompHibernatable_MechanoidBeacon>().coolDownTicks > 0)
{
isDisabled = true;
disabledReason = "WTH_CompHibernatable_MechanoidBeacon_Cooldown".Translate(((GetComp<CompHibernatable_MechanoidBeacon>().coolDownTicks / (float)GenDate.TicksPerDay)).ToStringDecimalIfSmall());
}
foreach (ThingWithComps thing in this.Map.listerThings.AllThings.OfType<ThingWithComps>())
{
if (thing.def == WTH_DefOf.WTH_RogueAI)
Expand All @@ -51,16 +57,15 @@ public IEnumerable<Gizmo> StartupGizmos()

}
}
if (GetComp<CompHibernatable_MechanoidBeacon>().coolDownTicks > 0)
if (!rogueAIAvailable)
{
isDisabled = true;
disabledReason = "WTH_CompHibernatable_MechanoidBeacon_Cooldown".Translate(((GetComp<CompHibernatable_MechanoidBeacon>().coolDownTicks / (float)GenDate.TicksPerDay)).ToStringDecimalIfSmall());

disabledReason = "WTH_Reason_NoRogueAI".Translate();
}
if (!rogueAIAvailable)
if (!GetComp<CompPowerTrader>().PowerOn)
{
isDisabled = true;
disabledReason = "WTH_Reason_NoRogueAI".Translate();
disabledReason = "WTH_Reason_NoPower".Translate();
}


Expand Down

0 comments on commit 8023fbb

Please sign in to comment.