Added briefings to character menu & the traitor briefing (codewords) (#5971)
This commit is contained in:
@@ -35,7 +35,7 @@ public class CharacterInfoSystem : EntitySystem
|
|||||||
if (!EntityManager.TryGetComponent(msg.EntityUid, out CharacterInfoComponent characterInfoComponent))
|
if (!EntityManager.TryGetComponent(msg.EntityUid, out CharacterInfoComponent characterInfoComponent))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
UpdateUI(characterInfoComponent, msg.JobTitle, msg.Objectives);
|
UpdateUI(characterInfoComponent, msg.JobTitle, msg.Objectives, msg.Briefing);
|
||||||
if (EntityManager.TryGetComponent(msg.EntityUid, out ISpriteComponent? spriteComponent))
|
if (EntityManager.TryGetComponent(msg.EntityUid, out ISpriteComponent? spriteComponent))
|
||||||
{
|
{
|
||||||
characterInfoComponent.Control.SpriteView.Sprite = spriteComponent;
|
characterInfoComponent.Control.SpriteView.Sprite = spriteComponent;
|
||||||
@@ -46,7 +46,7 @@ public class CharacterInfoSystem : EntitySystem
|
|||||||
characterInfoComponent.Control.NameLabel.Text = metadata.EntityName;
|
characterInfoComponent.Control.NameLabel.Text = metadata.EntityName;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateUI(CharacterInfoComponent comp, string jobTitle, Dictionary<string, List<ConditionInfo>> objectives)
|
private void UpdateUI(CharacterInfoComponent comp, string jobTitle, Dictionary<string, List<ConditionInfo>> objectives, string briefing)
|
||||||
{
|
{
|
||||||
comp.Control.SubText.Text = jobTitle;
|
comp.Control.SubText.Text = jobTitle;
|
||||||
|
|
||||||
@@ -93,6 +93,18 @@ public class CharacterInfoSystem : EntitySystem
|
|||||||
);
|
);
|
||||||
vbox.AddChild(hbox);
|
vbox.AddChild(hbox);
|
||||||
}
|
}
|
||||||
|
var briefinghBox = new BoxContainer
|
||||||
|
{
|
||||||
|
Orientation = BoxContainer.LayoutOrientation.Horizontal
|
||||||
|
};
|
||||||
|
|
||||||
|
briefinghBox.AddChild(new Label
|
||||||
|
{
|
||||||
|
Text = briefing,
|
||||||
|
Modulate = Color.Yellow
|
||||||
|
});
|
||||||
|
|
||||||
|
vbox.AddChild(briefinghBox);
|
||||||
comp.Control.ObjectivesContainer.AddChild(vbox);
|
comp.Control.ObjectivesContainer.AddChild(vbox);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ public class CharacterInfoSystem : EntitySystem
|
|||||||
|
|
||||||
var conditions = new Dictionary<string, List<ConditionInfo>>();
|
var conditions = new Dictionary<string, List<ConditionInfo>>();
|
||||||
var jobTitle = "No Profession";
|
var jobTitle = "No Profession";
|
||||||
|
var briefing = "!!ERROR: No Briefing!!"; //should never show on the UI unless there's a bug
|
||||||
if (EntityManager.TryGetComponent(entity, out MindComponent? mindComponent) && mindComponent.Mind != null)
|
if (EntityManager.TryGetComponent(entity, out MindComponent? mindComponent) && mindComponent.Mind != null)
|
||||||
{
|
{
|
||||||
var mind = mindComponent.Mind;
|
var mind = mindComponent.Mind;
|
||||||
@@ -51,9 +52,12 @@ public class CharacterInfoSystem : EntitySystem
|
|||||||
jobTitle = role.Name;
|
jobTitle = role.Name;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get briefing
|
||||||
|
briefing = mind.Briefing;
|
||||||
}
|
}
|
||||||
|
|
||||||
RaiseNetworkEvent(new CharacterInfoEvent(entity, jobTitle, conditions),
|
RaiseNetworkEvent(new CharacterInfoEvent(entity, jobTitle, conditions, briefing),
|
||||||
Filter.SinglePlayer(args.SenderSession));
|
Filter.SinglePlayer(args.SenderSession));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -186,6 +186,9 @@ public class TraitorRuleSystem : GameRuleSystem
|
|||||||
if (traitor.Mind.TryAddObjective(objective))
|
if (traitor.Mind.TryAddObjective(objective))
|
||||||
difficulty += objective.Difficulty;
|
difficulty += objective.Difficulty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//give traitors their codewords to keep in their character info menu
|
||||||
|
traitor.Mind.Briefing = Loc.GetString("traitor-role-codewords", ("codewords", string.Join(", ",codewords)));
|
||||||
}
|
}
|
||||||
|
|
||||||
SoundSystem.Play(Filter.Empty().AddWhere(s => ((IPlayerSession)s).Data.ContentData()?.Mind?.HasRole<TraitorRole>() ?? false), _addedSound.GetSound(), AudioParams.Default);
|
SoundSystem.Play(Filter.Empty().AddWhere(s => ((IPlayerSession)s).Data.ContentData()?.Mind?.HasRole<TraitorRole>() ?? false), _addedSound.GetSound(), AudioParams.Default);
|
||||||
|
|||||||
@@ -36,6 +36,8 @@ namespace Content.Server.Mind
|
|||||||
|
|
||||||
private readonly List<Objective> _objectives = new();
|
private readonly List<Objective> _objectives = new();
|
||||||
|
|
||||||
|
public string Briefing = String.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates the new mind.
|
/// Creates the new mind.
|
||||||
/// Note: the Mind is NOT initially attached!
|
/// Note: the Mind is NOT initially attached!
|
||||||
|
|||||||
@@ -23,11 +23,13 @@ public class CharacterInfoEvent : EntityEventArgs
|
|||||||
public readonly EntityUid EntityUid;
|
public readonly EntityUid EntityUid;
|
||||||
public readonly string JobTitle;
|
public readonly string JobTitle;
|
||||||
public readonly Dictionary<string, List<ConditionInfo>> Objectives;
|
public readonly Dictionary<string, List<ConditionInfo>> Objectives;
|
||||||
|
public readonly string Briefing;
|
||||||
|
|
||||||
public CharacterInfoEvent(EntityUid entityUid, string jobTitle, Dictionary<string, List<ConditionInfo>> objectives)
|
public CharacterInfoEvent(EntityUid entityUid, string jobTitle, Dictionary<string, List<ConditionInfo>> objectives, string briefing)
|
||||||
{
|
{
|
||||||
EntityUid = entityUid;
|
EntityUid = entityUid;
|
||||||
JobTitle = jobTitle;
|
JobTitle = jobTitle;
|
||||||
Objectives = objectives;
|
Objectives = objectives;
|
||||||
|
Briefing = briefing;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user