Fix IDE0032
This commit is contained in:
committed by
Pavel Penev
parent
e64c0a35c5
commit
98c4eaca83
@@ -94,20 +94,18 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
readonly Actor self;
|
||||
readonly bool checkTerrainType;
|
||||
|
||||
DeployState deployState;
|
||||
INotifyDeployTriggered[] notify;
|
||||
int deployedToken = Actor.InvalidConditionToken;
|
||||
int undeployedToken = Actor.InvalidConditionToken;
|
||||
|
||||
public DeployState DeployState => deployState;
|
||||
public DeployState DeployState { get; private set; }
|
||||
|
||||
public GrantConditionOnDeploy(ActorInitializer init, GrantConditionOnDeployInfo info)
|
||||
: base(info)
|
||||
{
|
||||
self = init.Self;
|
||||
checkTerrainType = info.AllowedTerrainTypes.Count > 0;
|
||||
deployState = init.GetValue<DeployStateInit, DeployState>(DeployState.Undeployed);
|
||||
DeployState = init.GetValue<DeployStateInit, DeployState>(DeployState.Undeployed);
|
||||
}
|
||||
|
||||
protected override void Created(Actor self)
|
||||
@@ -115,14 +113,14 @@ namespace OpenRA.Mods.Common.Traits
|
||||
notify = self.TraitsImplementing<INotifyDeployTriggered>().ToArray();
|
||||
base.Created(self);
|
||||
|
||||
if (Info.Facing.HasValue && deployState != DeployState.Undeployed)
|
||||
if (Info.Facing.HasValue && DeployState != DeployState.Undeployed)
|
||||
{
|
||||
var facing = self.TraitOrDefault<IFacing>();
|
||||
if (facing != null)
|
||||
facing.Facing = Info.Facing.Value;
|
||||
}
|
||||
|
||||
switch (deployState)
|
||||
switch (DeployState)
|
||||
{
|
||||
case DeployState.Undeployed:
|
||||
OnUndeployCompleted();
|
||||
@@ -153,10 +151,10 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
bool IDelayCarryallPickup.TryLockForPickup(Actor self, Actor carrier)
|
||||
{
|
||||
if (!Info.UndeployOnPickup || deployState == DeployState.Undeployed || IsTraitDisabled)
|
||||
if (!Info.UndeployOnPickup || DeployState == DeployState.Undeployed || IsTraitDisabled)
|
||||
return true;
|
||||
|
||||
if (deployState == DeployState.Deployed && !IsTraitPaused)
|
||||
if (DeployState == DeployState.Deployed && !IsTraitPaused)
|
||||
Undeploy();
|
||||
|
||||
return false;
|
||||
@@ -208,7 +206,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (IsTraitPaused || IsTraitDisabled)
|
||||
return false;
|
||||
|
||||
return IsValidTerrain(self.Location) || (deployState == DeployState.Deployed);
|
||||
return IsValidTerrain(self.Location) || (DeployState == DeployState.Deployed);
|
||||
}
|
||||
|
||||
public bool IsValidTerrain(CPos location)
|
||||
@@ -253,7 +251,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
void Deploy(bool init)
|
||||
{
|
||||
// Something went wrong, most likely due to deploy order spam and the fact that this is a delayed action.
|
||||
if (!init && deployState != DeployState.Undeployed)
|
||||
if (!init && DeployState != DeployState.Undeployed)
|
||||
return;
|
||||
|
||||
if (!IsValidTerrain(self.Location))
|
||||
@@ -280,7 +278,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
void Undeploy(bool init)
|
||||
{
|
||||
// Something went wrong, most likely due to deploy order spam and the fact that this is a delayed action.
|
||||
if (!init && deployState != DeployState.Deployed)
|
||||
if (!init && DeployState != DeployState.Deployed)
|
||||
return;
|
||||
|
||||
if (Info.UndeploySounds != null && Info.UndeploySounds.Length > 0)
|
||||
@@ -303,7 +301,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (undeployedToken != Actor.InvalidConditionToken)
|
||||
undeployedToken = self.RevokeCondition(undeployedToken);
|
||||
|
||||
deployState = DeployState.Deploying;
|
||||
DeployState = DeployState.Deploying;
|
||||
}
|
||||
|
||||
void OnDeployCompleted()
|
||||
@@ -311,7 +309,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (deployedToken == Actor.InvalidConditionToken)
|
||||
deployedToken = self.GrantCondition(Info.DeployedCondition);
|
||||
|
||||
deployState = DeployState.Deployed;
|
||||
DeployState = DeployState.Deployed;
|
||||
}
|
||||
|
||||
void OnUndeployStarted()
|
||||
@@ -319,7 +317,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (deployedToken != Actor.InvalidConditionToken)
|
||||
deployedToken = self.RevokeCondition(deployedToken);
|
||||
|
||||
deployState = DeployState.Deploying;
|
||||
DeployState = DeployState.Deploying;
|
||||
}
|
||||
|
||||
void OnUndeployCompleted()
|
||||
@@ -327,7 +325,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (undeployedToken == Actor.InvalidConditionToken)
|
||||
undeployedToken = self.GrantCondition(Info.UndeployedCondition);
|
||||
|
||||
deployState = DeployState.Undeployed;
|
||||
DeployState = DeployState.Undeployed;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user