8 [
Serialize(
"",
IsPropertySaveable.Yes, description:
"Identifier of the faction to set as the location's primary faction (optional).")]
9 public Identifier
Faction {
get;
set; }
11 [
Serialize(
"",
IsPropertySaveable.Yes, description:
"Identifier of the faction to set as the location's secondary faction (optional).")]
14 [
Serialize(
"",
IsPropertySaveable.Yes, description:
"Identifier of the location type to set as the location's new type (optional)")]
15 public Identifier
Type {
get;
set; }
17 [
Serialize(
"",
IsPropertySaveable.Yes, description:
"New name to give to the location (optional). Can either be the name as-is, or a tag referring to a line in a text file.")]
18 public Identifier
Name {
get;
set; }
20 private bool isFinished;
35 public override void Update(
float deltaTime)
37 if (isFinished) {
return; }
41 var location = campaign.Map.CurrentLocation;
46 var faction = campaign.Factions.Find(f => f.Prefab.Identifier ==
Faction);
49 DebugConsole.ThrowError($
"Error in ModifyLocationAction ({ParentEvent.Prefab.Identifier}): could not find a faction with the identifier \"{Faction}\".",
54 location.Faction = faction;
59 var secondaryFaction = campaign.Factions.Find(f => f.Prefab.Identifier ==
SecondaryFaction);
60 if (secondaryFaction ==
null)
62 DebugConsole.ThrowError($
"Error in ModifyLocationAction ({ParentEvent.Prefab.Identifier}): could not find a faction with the identifier \"{SecondaryFaction}\".",
67 location.SecondaryFaction = secondaryFaction;
73 if (locationType ==
null)
75 DebugConsole.ThrowError($
"Error in ModifyLocationAction ({ParentEvent.Prefab.Identifier}): could not find a location type with the identifier \"{Type}\".",
78 else if (!location.LocationTypeChangesBlocked)
80 location.ChangeType(campaign, locationType);
85 location.ForceName(
Name);
94 return $
"{ToolBox.GetDebugSymbol(isFinished)} {nameof(ModifyLocationAction)}";
readonly ScriptedEvent ParentEvent
static GameSession?? GameSession
static readonly PrefabCollection< LocationType > Prefabs
Modifies the current location in some way (e.g. adjusting the faction, type of name).
ModifyLocationAction(ScriptedEvent parentEvent, ContentXElement element)
override bool IsFinished(ref string goTo)
Has the action finished.
Identifier SecondaryFaction
override string ToDebugString()
Rich test to display in debugdraw
override void Update(float deltaTime)
ContentPackage? ContentPackage