Rewrite ActorInit queries.
This commit is contained in:
@@ -74,7 +74,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
var init = actor.Init<DeployStateInit>();
|
||||
if (init != null)
|
||||
return init.Value(world) == DeployState.Deployed;
|
||||
return init.Value == DeployState.Deployed;
|
||||
|
||||
return false;
|
||||
},
|
||||
@@ -111,8 +111,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
checkTerrainType = info.AllowedTerrainTypes.Count > 0;
|
||||
canTurn = self.Info.HasTraitInfo<IFacingInfo>();
|
||||
move = self.TraitOrDefault<IMove>();
|
||||
if (init.Contains<DeployStateInit>())
|
||||
deployState = init.Get<DeployStateInit, DeployState>();
|
||||
deployState = init.GetValue<DeployStateInit, DeployState>(info, DeployState.Undeployed);
|
||||
}
|
||||
|
||||
protected override void Created(Actor self)
|
||||
@@ -344,6 +343,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
readonly DeployState value = DeployState.Deployed;
|
||||
public DeployStateInit() { }
|
||||
public DeployStateInit(DeployState init) { value = init; }
|
||||
public DeployState Value(World world) { return value; }
|
||||
public DeployState Value { get { return value; } }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public GrantConditionOnFaction(ActorInitializer init, GrantConditionOnFactionInfo info)
|
||||
: base(info)
|
||||
{
|
||||
faction = init.Contains<FactionInit>() ? init.Get<FactionInit, string>() : init.Self.Owner.Faction.InternalName;
|
||||
faction = init.GetValue<FactionInit, string>(info, init.Self.Owner.Faction.InternalName);
|
||||
}
|
||||
|
||||
public void OnOwnerChanged(Actor self, Player oldOwner, Player newOwner)
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public GrantConditionOnLineBuildDirection(ActorInitializer init, GrantConditionOnLineBuildDirectionInfo info)
|
||||
{
|
||||
this.info = info;
|
||||
direction = init.Get<LineBuildDirectionInit>().Value(init.World);
|
||||
direction = init.GetValue<LineBuildDirectionInit, LineBuildDirection>(info);
|
||||
}
|
||||
|
||||
void INotifyCreated.Created(Actor self)
|
||||
|
||||
Reference in New Issue
Block a user