Skip to content

Commit

Permalink
Try fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Roudenn committed Feb 13, 2025
1 parent c33314b commit ae3161e
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 29 deletions.
8 changes: 6 additions & 2 deletions Content.Server/ADT/GameTicking/Rules/HereticRuleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,12 @@ public bool TryMakeHeretic(EntityUid target, HereticRuleComponent rule)

rule.Minds.Add(mindId);

foreach (var objective in rule.Objectives)
_mind.TryAddObjective(mindId, mind, objective);
_role.MindHasRole<HereticRoleComponent>(mindId, out var traitorRole);
if (traitorRole is not null)
{
AddComp<RoleBriefingComponent>(traitorRole.Value.Owner);
Comp<RoleBriefingComponent>(traitorRole.Value.Owner).Briefing = Loc.GetString("heretic-role-greeting-short");
}

return true;
}
Expand Down
39 changes: 18 additions & 21 deletions Content.Server/ADT/Heretic/EntitySystems/GhoulSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,14 @@ public void GhoulifyEntity(Entity<GhoulComponent> ent)
RemComp<TemperatureComponent>(ent);

var hasMind = _mind.TryGetMind(ent, out var mindId, out var mind);
if (hasMind && ent.Comp.BoundHeretic != null)
SendBriefing(ent, mindId, mind);

var hasEretic = ent.Comp.BoundHeretic.HasValue;
_antag.SendBriefing(ent,
hasEretic
? Loc.GetString("heretic-ghoul-greeting", ("ent", Name(ent)))
: Loc.GetString("heretic-ghoul-greeting-noname"),
Color.MediumPurple,
null);

if (TryComp<HumanoidAppearanceComponent>(ent, out var humanoid))
{
Expand Down Expand Up @@ -87,23 +93,6 @@ public void GhoulifyEntity(Entity<GhoulComponent> ent)
_faction.AddFaction((ent, null), "Heretic");
}

private void SendBriefing(Entity<GhoulComponent> ent, EntityUid mindId, MindComponent? mind)
{
var brief = Loc.GetString("heretic-ghoul-greeting-noname");

if (ent.Comp.BoundHeretic != null)
brief = Loc.GetString("heretic-ghoul-greeting", ("ent", Identity.Entity((EntityUid) ent.Comp.BoundHeretic, EntityManager)));
var sound = new SoundPathSpecifier("/Audio/ADT/Heretic/Ambience/Antag/Heretic/heretic_gain.ogg");
_antag.SendBriefing(ent, brief, Color.MediumPurple, sound);

if (!_mind.TryGetRole<GhoulRoleComponent>(ent, out _))
_role.MindAddRole<GhoulRoleComponent>(mindId, new(), mind);

if (!_mind.TryGetRole<RoleBriefingComponent>(ent, out var rolebrief))
_role.MindAddRole(mindId, new RoleBriefingComponent() { Briefing = brief }, mind);
else rolebrief.Briefing += $"\n{brief}";
}

public override void Initialize()
{
base.Initialize();
Expand All @@ -129,8 +118,16 @@ private void OnInit(Entity<GhoulComponent> ent, ref ComponentInit args)
private void OnTakeGhostRole(Entity<GhoulComponent> ent, ref TakeGhostRoleEvent args)
{
var hasMind = _mind.TryGetMind(ent, out var mindId, out var mind);
if (hasMind)
SendBriefing(ent, mindId, mind);
if (!hasMind)
return;

var hasEretic = ent.Comp.BoundHeretic.HasValue;
_antag.SendBriefing(ent,
hasEretic
? Loc.GetString("heretic-ghoul-greeting", ("ent", Name(ent)))
: Loc.GetString("heretic-ghoul-greeting-noname"),
Color.MediumPurple,
null);
}

private void OnTryAttack(Entity<GhoulComponent> ent, ref AttackAttemptEvent args)
Expand Down
3 changes: 3 additions & 0 deletions Content.Server/ADT/Heretic/EntitySystems/HereticSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using Content.Server.Atmos.Components;
using Content.Shared.Damage;
using Content.Server.Heretic.Components;
using Robust.Shared.Prototypes;

namespace Content.Server.Heretic.EntitySystems;

Expand Down Expand Up @@ -76,7 +77,9 @@ private void OnCompInit(Entity<HereticComponent> ent, ref ComponentInit args)
_eye.SetVisibilityMask(ent, eye.VisibilityMask | EldritchInfluenceComponent.LayerMask);

foreach (var knowledge in ent.Comp.BaseKnowledge)
{
_knowledge.AddKnowledge(ent, ent.Comp, knowledge);
}
}

private void OnMagicItemExamine(Entity<HereticMagicItemComponent> ent, ref ExaminedEvent args)
Expand Down
6 changes: 2 additions & 4 deletions Content.Server/ADT/Roles/GhoulRoleComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,5 @@

namespace Content.Server.Roles;

[RegisterComponent, ExclusiveAntagonist]
public sealed partial class GhoulRoleComponent : AntagonistRoleComponent
{
}
[RegisterComponent]
public sealed partial class GhoulRoleComponent : BaseMindRoleComponent;
2 changes: 1 addition & 1 deletion Resources/Prototypes/ADT/Heretic/Objectives/heretic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
issuer: objective-issuer-heretic
- type: RoleRequirement
roles:
components:
mindRoles:
- HereticRole

- type: entity
Expand Down
5 changes: 5 additions & 0 deletions Resources/Prototypes/_Backmen/GameRules/roundstart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -351,3 +351,8 @@
lateJoinAdditional: true
mindRoles:
- Heretic
- type: AntagObjectives
objectives:
- HereticKnowledgeObjective
- HereticSacrificeObjective
- HereticSacrificeHeadObjective
2 changes: 1 addition & 1 deletion Resources/Prototypes/_Backmen/game_presets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@
name: heretic-title
minPlayers: 25
showInVote: true
description: heretic-title
description: heretic-desc
rules:
- HereticGameRule
- BasicRoundstartVariation
Expand Down

0 comments on commit ae3161e

Please sign in to comment.