Skip to content

Commit

Permalink
Pokemon Power now works correctly, reduced heat pusher pokemon max heat
Browse files Browse the repository at this point in the history
  • Loading branch information
Gargamiel committed Dec 2, 2021
1 parent b48e515 commit 53e048c
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 43 deletions.
Binary file modified Assemblies/PokeWorld.dll
Binary file not shown.
66 changes: 33 additions & 33 deletions Defs/ThingDefs_Races/Races_Pokemon.xml
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@
<li Class="CompProperties_HeatPusher">
<compClass>PokeWorld.CompPokemonHeatPusher</compClass>
<heatPerSecond>1.40</heatPerSecond>
<heatPushMaxTemperature>32</heatPushMaxTemperature>
<heatPushMaxTemperature>28</heatPushMaxTemperature>
</li>
</comps>
<statBases>
Expand Down Expand Up @@ -775,7 +775,7 @@
<li Class="CompProperties_HeatPusher">
<compClass>PokeWorld.CompPokemonHeatPusher</compClass>
<heatPerSecond>1.84</heatPerSecond>
<heatPushMaxTemperature>32</heatPushMaxTemperature>
<heatPushMaxTemperature>28</heatPushMaxTemperature>
</li>
</comps>
<statBases>
Expand Down Expand Up @@ -955,7 +955,7 @@
<li Class="CompProperties_HeatPusher">
<compClass>PokeWorld.CompPokemonHeatPusher</compClass>
<heatPerSecond>2.43</heatPerSecond>
<heatPushMaxTemperature>32</heatPushMaxTemperature>
<heatPushMaxTemperature>28</heatPushMaxTemperature>
</li>
</comps>
<statBases>
Expand Down Expand Up @@ -5944,7 +5944,7 @@
<li Class="CompProperties_HeatPusher">
<compClass>PokeWorld.CompPokemonHeatPusher</compClass>
<heatPerSecond>1.36</heatPerSecond>
<heatPushMaxTemperature>32</heatPushMaxTemperature>
<heatPushMaxTemperature>28</heatPushMaxTemperature>
</li>
</comps>
<statBases>
Expand Down Expand Up @@ -6092,7 +6092,7 @@
<li Class="CompProperties_HeatPusher">
<compClass>PokeWorld.CompPokemonHeatPusher</compClass>
<heatPerSecond>2.30</heatPerSecond>
<heatPushMaxTemperature>32</heatPushMaxTemperature>
<heatPushMaxTemperature>28</heatPushMaxTemperature>
</li>
</comps>
<statBases>
Expand Down Expand Up @@ -9402,7 +9402,7 @@
<li Class="CompProperties_HeatPusher">
<compClass>PokeWorld.CompPokemonHeatPusher</compClass>
<heatPerSecond>1.59</heatPerSecond>
<heatPushMaxTemperature>32</heatPushMaxTemperature>
<heatPushMaxTemperature>28</heatPushMaxTemperature>
</li>
</comps>
<statBases>
Expand Down Expand Up @@ -9553,7 +9553,7 @@
<li Class="CompProperties_HeatPusher">
<compClass>PokeWorld.CompPokemonHeatPusher</compClass>
<heatPerSecond>2.52</heatPerSecond>
<heatPushMaxTemperature>32</heatPushMaxTemperature>
<heatPushMaxTemperature>28</heatPushMaxTemperature>
</li>
</comps>
<statBases>
Expand Down Expand Up @@ -12417,7 +12417,7 @@
<li Class="CompProperties_HeatPusher">
<compClass>PokeWorld.CompPokemonHeatPusher</compClass>
<heatPerSecond>1.86</heatPerSecond>
<heatPushMaxTemperature>32</heatPushMaxTemperature>
<heatPushMaxTemperature>28</heatPushMaxTemperature>
</li>
</comps>
<statBases>
Expand Down Expand Up @@ -12583,7 +12583,7 @@
<li Class="CompProperties_HeatPusher">
<compClass>PokeWorld.CompPokemonHeatPusher</compClass>
<heatPerSecond>2.27</heatPerSecond>
<heatPushMaxTemperature>32</heatPushMaxTemperature>
<heatPushMaxTemperature>28</heatPushMaxTemperature>
</li>
</comps>
<statBases>
Expand Down Expand Up @@ -20315,7 +20315,7 @@
<li Class="CompProperties_HeatPusher">
<compClass>PokeWorld.CompPokemonHeatPusher</compClass>
<heatPerSecond>2.25</heatPerSecond>
<heatPushMaxTemperature>32</heatPushMaxTemperature>
<heatPushMaxTemperature>28</heatPushMaxTemperature>
</li>
</comps>
<statBases>
Expand Down Expand Up @@ -21911,7 +21911,7 @@
<li Class="CompProperties_HeatPusher">
<compClass>PokeWorld.CompPokemonHeatPusher</compClass>
<heatPerSecond>2.39</heatPerSecond>
<heatPushMaxTemperature>32</heatPushMaxTemperature>
<heatPushMaxTemperature>28</heatPushMaxTemperature>
</li>
</comps>
<statBases>
Expand Down Expand Up @@ -23584,7 +23584,7 @@
<li Class="CompProperties_HeatPusher">
<compClass>PokeWorld.CompPokemonHeatPusher</compClass>
<heatPerSecond>2.64</heatPerSecond>
<heatPushMaxTemperature>32</heatPushMaxTemperature>
<heatPushMaxTemperature>28</heatPushMaxTemperature>
</li>
</comps>
<statBases>
Expand Down Expand Up @@ -25061,7 +25061,7 @@
<li Class="CompProperties_HeatPusher">
<compClass>PokeWorld.CompPokemonHeatPusher</compClass>
<heatPerSecond>1.40</heatPerSecond>
<heatPushMaxTemperature>32</heatPushMaxTemperature>
<heatPushMaxTemperature>28</heatPushMaxTemperature>
</li>
</comps>
<statBases>
Expand Down Expand Up @@ -25247,7 +25247,7 @@
<li Class="CompProperties_HeatPusher">
<compClass>PokeWorld.CompPokemonHeatPusher</compClass>
<heatPerSecond>1.84</heatPerSecond>
<heatPushMaxTemperature>32</heatPushMaxTemperature>
<heatPushMaxTemperature>28</heatPushMaxTemperature>
</li>
</comps>
<statBases>
Expand Down Expand Up @@ -25425,7 +25425,7 @@
<li Class="CompProperties_HeatPusher">
<compClass>PokeWorld.CompPokemonHeatPusher</compClass>
<heatPerSecond>2.43</heatPerSecond>
<heatPushMaxTemperature>32</heatPushMaxTemperature>
<heatPushMaxTemperature>28</heatPushMaxTemperature>
</li>
</comps>
<statBases>
Expand Down Expand Up @@ -35572,7 +35572,7 @@
<li Class="CompProperties_HeatPusher">
<compClass>PokeWorld.CompPokemonHeatPusher</compClass>
<heatPerSecond>1.14</heatPerSecond>
<heatPushMaxTemperature>32</heatPushMaxTemperature>
<heatPushMaxTemperature>28</heatPushMaxTemperature>
</li>
</comps>
<statBases>
Expand Down Expand Up @@ -35744,7 +35744,7 @@
<li Class="CompProperties_HeatPusher">
<compClass>PokeWorld.CompPokemonHeatPusher</compClass>
<heatPerSecond>1.95</heatPerSecond>
<heatPushMaxTemperature>32</heatPushMaxTemperature>
<heatPushMaxTemperature>28</heatPushMaxTemperature>
</li>
</comps>
<statBases>
Expand Down Expand Up @@ -37301,7 +37301,7 @@
<li Class="CompProperties_HeatPusher">
<compClass>PokeWorld.CompPokemonHeatPusher</compClass>
<heatPerSecond>1.50</heatPerSecond>
<heatPushMaxTemperature>32</heatPushMaxTemperature>
<heatPushMaxTemperature>28</heatPushMaxTemperature>
</li>
</comps>
<statBases>
Expand Down Expand Up @@ -37477,7 +37477,7 @@
<li Class="CompProperties_HeatPusher">
<compClass>PokeWorld.CompPokemonHeatPusher</compClass>
<heatPerSecond>2.27</heatPerSecond>
<heatPushMaxTemperature>32</heatPushMaxTemperature>
<heatPushMaxTemperature>28</heatPushMaxTemperature>
</li>
</comps>
<statBases>
Expand Down Expand Up @@ -39250,7 +39250,7 @@
<li Class="CompProperties_HeatPusher">
<compClass>PokeWorld.CompPokemonHeatPusher</compClass>
<heatPerSecond>1.66</heatPerSecond>
<heatPushMaxTemperature>32</heatPushMaxTemperature>
<heatPushMaxTemperature>28</heatPushMaxTemperature>
</li>
</comps>
<statBases>
Expand Down Expand Up @@ -39884,7 +39884,7 @@
<li Class="CompProperties_HeatPusher">
<compClass>PokeWorld.CompPokemonHeatPusher</compClass>
<heatPerSecond>2.64</heatPerSecond>
<heatPushMaxTemperature>32</heatPushMaxTemperature>
<heatPushMaxTemperature>28</heatPushMaxTemperature>
</li>
</comps>
<statBases>
Expand Down Expand Up @@ -40876,7 +40876,7 @@
<li Class="CompProperties_HeatPusher">
<compClass>PokeWorld.CompPokemonHeatPusher</compClass>
<heatPerSecond>3.09</heatPerSecond>
<heatPushMaxTemperature>32</heatPushMaxTemperature>
<heatPushMaxTemperature>28</heatPushMaxTemperature>
</li>
</comps>
<statBases>
Expand Down Expand Up @@ -41700,7 +41700,7 @@
<li Class="CompProperties_HeatPusher">
<compClass>PokeWorld.CompPokemonHeatPusher</compClass>
<heatPerSecond>1.41</heatPerSecond>
<heatPushMaxTemperature>32</heatPushMaxTemperature>
<heatPushMaxTemperature>28</heatPushMaxTemperature>
</li>
</comps>
<statBases>
Expand Down Expand Up @@ -41875,7 +41875,7 @@
<li Class="CompProperties_HeatPusher">
<compClass>PokeWorld.CompPokemonHeatPusher</compClass>
<heatPerSecond>1.84</heatPerSecond>
<heatPushMaxTemperature>32</heatPushMaxTemperature>
<heatPushMaxTemperature>28</heatPushMaxTemperature>
</li>
</comps>
<statBases>
Expand Down Expand Up @@ -42042,7 +42042,7 @@
<li Class="CompProperties_HeatPusher">
<compClass>PokeWorld.CompPokemonHeatPusher</compClass>
<heatPerSecond>2.41</heatPerSecond>
<heatPushMaxTemperature>32</heatPushMaxTemperature>
<heatPushMaxTemperature>28</heatPushMaxTemperature>
</li>
</comps>
<statBases>
Expand Down Expand Up @@ -52385,7 +52385,7 @@
<li Class="CompProperties_HeatPusher">
<compClass>PokeWorld.CompPokemonHeatPusher</compClass>
<heatPerSecond>1.39</heatPerSecond>
<heatPushMaxTemperature>32</heatPushMaxTemperature>
<heatPushMaxTemperature>28</heatPushMaxTemperature>
</li>
</comps>
<statBases>
Expand Down Expand Up @@ -52554,7 +52554,7 @@
<li Class="CompProperties_HeatPusher">
<compClass>PokeWorld.CompPokemonHeatPusher</compClass>
<heatPerSecond>2.09</heatPerSecond>
<heatPushMaxTemperature>32</heatPushMaxTemperature>
<heatPushMaxTemperature>28</heatPushMaxTemperature>
</li>
</comps>
<statBases>
Expand Down Expand Up @@ -52712,7 +52712,7 @@
<li Class="CompProperties_HeatPusher">
<compClass>PokeWorld.CompPokemonHeatPusher</compClass>
<heatPerSecond>2.14</heatPerSecond>
<heatPushMaxTemperature>32</heatPushMaxTemperature>
<heatPushMaxTemperature>28</heatPushMaxTemperature>
</li>
</comps>
<statBases>
Expand Down Expand Up @@ -63587,7 +63587,7 @@
<li Class="CompProperties_HeatPusher">
<compClass>PokeWorld.CompPokemonHeatPusher</compClass>
<heatPerSecond>1.40</heatPerSecond>
<heatPushMaxTemperature>32</heatPushMaxTemperature>
<heatPushMaxTemperature>28</heatPushMaxTemperature>
</li>
</comps>
<statBases>
Expand Down Expand Up @@ -63759,7 +63759,7 @@
<li Class="CompProperties_HeatPusher">
<compClass>PokeWorld.CompPokemonHeatPusher</compClass>
<heatPerSecond>1.84</heatPerSecond>
<heatPushMaxTemperature>32</heatPushMaxTemperature>
<heatPushMaxTemperature>28</heatPushMaxTemperature>
</li>
</comps>
<statBases>
Expand Down Expand Up @@ -63921,7 +63921,7 @@
<li Class="CompProperties_HeatPusher">
<compClass>PokeWorld.CompPokemonHeatPusher</compClass>
<heatPerSecond>2.43</heatPerSecond>
<heatPushMaxTemperature>32</heatPushMaxTemperature>
<heatPushMaxTemperature>28</heatPushMaxTemperature>
</li>
</comps>
<statBases>
Expand Down Expand Up @@ -76170,7 +76170,7 @@
<li Class="CompProperties_HeatPusher">
<compClass>PokeWorld.CompPokemonHeatPusher</compClass>
<heatPerSecond>2.45</heatPerSecond>
<heatPushMaxTemperature>32</heatPushMaxTemperature>
<heatPushMaxTemperature>28</heatPushMaxTemperature>
</li>
</comps>
<statBases>
Expand Down Expand Up @@ -79086,7 +79086,7 @@
<li Class="CompProperties_HeatPusher">
<compClass>PokeWorld.CompPokemonHeatPusher</compClass>
<heatPerSecond>2.73</heatPerSecond>
<heatPushMaxTemperature>32</heatPushMaxTemperature>
<heatPushMaxTemperature>28</heatPushMaxTemperature>
</li>
</comps>
<statBases>
Expand Down
Binary file modified Source/PokeWorld/.vs/PokeWorld/v16/.suo
Binary file not shown.
47 changes: 38 additions & 9 deletions Source/PokeWorld/PokeWorld/CompPokemonPower.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,35 +11,64 @@ namespace PokeWorld
{
public class CompPokemonPower : CompPowerTrader
{
private float maxDistance = 7f;
private float maxDistance = 7.5f;
public override void Initialize(CompProperties props)
{
base.Initialize(props);
PowerOn = true;
}

public override void CompTick()
{
base.CompTick();
if(parent is Pawn pawn && pawn.Spawned && !pawn.Dead && pawn.Faction != null && pawn.Faction.IsPlayer)
{
PowerOutput = (pawn.Starving() ? 1f : -1f) * (Props.basePowerConsumption * Mathf.Sqrt(pawn.TryGetComp<CompPokemon>().levelTracker.level) / 2);
if (PowerNet == null)
if (PowerNet == null && connectParent == null)
{
PowerConnectionMaker.TryConnectToAnyPowerNet(this);
parent.Map.powerNetManager.Notify_ConnectorWantsConnect(this);
}
else if(PowerNet != null)
else if(PowerNet != null && connectParent != null)
{
if (connectParent != null && IntVec3Utility.DistanceTo(parent.Position, connectParent.parent.Position) > maxDistance)
if (IntVec3Utility.DistanceTo(parent.Position, connectParent.parent.Position) > maxDistance + connectParent.parent.def.Size.Magnitude)
{
PowerConnectionMaker.DisconnectFromPowerNet(this);
parent.Map.powerNetManager.Notify_ConnectorDespawned(this);
}
else if(connectParent == null)
}
else if(PowerNet != null && connectParent == null)
{
PowerNet.DeregisterConnector(this);
}
else if (PowerNet == null && connectParent != null)
{
if (connectParent.connectChildren != null)
{
PowerConnectionMaker.DisconnectFromPowerNet(this);
connectParent.connectChildren.Remove(this);
if (connectParent.connectChildren.Count == 0)
{
connectParent.connectChildren = null;
}
}
connectParent = null;
}
}
}
public override void ResetPowerVars()
{
base.ResetPowerVars();
if(parent is Pawn pawn && pawn.Spawned && !pawn.Dead && pawn.Faction != null && pawn.Faction.IsPlayer)
{
PowerOutput = (pawn.Starving() ? 1f : -1f) * (Props.basePowerConsumption * Mathf.Sqrt(pawn.TryGetComp<CompPokemon>().levelTracker.level) / 2);
}
}
public override void SetUpPowerVars()
{
base.SetUpPowerVars();
if (parent is Pawn pawn && pawn.Spawned && !pawn.Dead && pawn.Faction != null && pawn.Faction.IsPlayer)
{
PowerOutput = (pawn.Starving() ? 1f : -1f) * (Props.basePowerConsumption * Mathf.Sqrt(pawn.TryGetComp<CompPokemon>().levelTracker.level) / 2);
}
}
public override string CompInspectStringExtra()
{
if(parent is Pawn pawn && pawn.Spawned && !pawn.Dead && pawn.Faction != null && pawn.Faction.IsPlayer)
Expand All @@ -52,6 +81,6 @@ public override string CompInspectStringExtra()
return text;
}
return null;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ private static void DrawHeader(Rect rect)
Widgets.Label(rect5, "PW_Range".Translate());
Rect rect6 = rect;
rect6.xMin = rect5.xMax + 17f;
rect6.xMax = rect6.xMin + 50f;
rect6.xMax = rect6.xMin + 65f;
Widgets.Label(rect6, "PW_Used".Translate());
Text.Anchor = TextAnchor.UpperLeft;
}
Expand Down
Binary file not shown.
Binary file modified Source/PokeWorld/PokeWorld/obj/Debug/PokeWorld.dll
Binary file not shown.

0 comments on commit 53e048c

Please sign in to comment.