Skip to content

Commit

Permalink
Fix actors not yet in the world improperly updating power state
Browse files Browse the repository at this point in the history
  • Loading branch information
abcdefg30 authored and reaperrr committed Aug 14, 2020
1 parent a751f07 commit a847f3e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion OpenRA.Mods.Common/Traits/Power/Player/PowerManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,11 @@ void INotifyCreated.Created(Actor self)

public void UpdateActor(Actor a)
{
// old is 0 if a is not in powerDrain
// Do not add power from actors that are not in the world
if (!a.IsInWorld)
return;

// Old is 0 if a is not in powerDrain
int old;
powerDrain.TryGetValue(a, out old);

Expand All @@ -98,6 +102,10 @@ public void UpdateActor(Actor a)

public void RemoveActor(Actor a)
{
// Do not remove power from actors that are still in the world
if (a.IsInWorld)
return;

int amount;
if (!powerDrain.TryGetValue(a, out amount))
return;
Expand Down

0 comments on commit a847f3e

Please sign in to comment.