Move hardcoded PlayerActorTypes to shared const variables

This commit is contained in:
abcdefg30
2020-05-24 19:25:06 +02:00
committed by reaperrr
parent e4c5700baf
commit 9c0075b233

View File

@@ -36,6 +36,9 @@ namespace OpenRA
public class Player : IScriptBindable, IScriptNotifyBind, ILuaTableBinding, ILuaEqualityBinding, ILuaToStringBinding public class Player : IScriptBindable, IScriptNotifyBind, ILuaTableBinding, ILuaEqualityBinding, ILuaToStringBinding
{ {
public const string PlayerActorType = "Player";
public const string EditorPlayerActorType = "EditorPlayer";
struct StanceColors struct StanceColors
{ {
public Color Self; public Color Self;
@@ -163,7 +166,7 @@ namespace OpenRA
if (!Spectating) if (!Spectating)
PlayerMask = new LongBitSet<PlayerBitMask>(InternalName); PlayerMask = new LongBitSet<PlayerBitMask>(InternalName);
var playerActorType = world.Type == WorldType.Editor ? "EditorPlayer" : "Player"; var playerActorType = world.Type == WorldType.Editor ? EditorPlayerActorType : PlayerActorType;
PlayerActor = world.CreateActor(playerActorType, new TypeDictionary { new OwnerInit(this) }); PlayerActor = world.CreateActor(playerActorType, new TypeDictionary { new OwnerInit(this) });
Shroud = PlayerActor.Trait<Shroud>(); Shroud = PlayerActor.Trait<Shroud>();
FrozenActorLayer = PlayerActor.TraitOrDefault<FrozenActorLayer>(); FrozenActorLayer = PlayerActor.TraitOrDefault<FrozenActorLayer>();