fish-station/Content.Server/GameTicking/Rules/ThiefRuleSystem.cs
Vigers Ray 3cf56cd5b3 Merge remote-tracking branch 'space-wizards/master'
# Conflicts:
#	Content.Server/Access/Systems/AgentIDCardSystem.cs
#	Content.Server/GameTicking/Rules/ChangelingRuleSystem.cs
#	Content.Server/GameTicking/Rules/ThiefRuleSystem.cs
#	Content.Server/Medical/SuitSensors/SuitSensorSystem.cs
#	Content.Server/Zombies/ZombieSystem.cs
#	Content.Shared/Clothing/EntitySystems/SharedChameleonClothingSystem.cs
#	Content.Shared/Standing/StandingStateComponent.cs
#	Content.Shared/Standing/StandingStateSystem.cs
#	Content.Shared/Stunnable/SharedStunSystem.Knockdown.cs
#	Content.Shared/Stunnable/SharedStunSystem.cs
#	Resources/Locale/en-US/_strings/game-ticking/game-presets/preset-changeling.ftl
#	Resources/Locale/en-US/_strings/ghost/observer-role.ftl
#	Resources/Locale/en-US/_strings/robotics/borg_modules.ftl
#	Resources/Prototypes/Entities/Clothing/Ears/specific.yml
#	Resources/Prototypes/Entities/Clothing/Eyes/specific.yml
#	Resources/Prototypes/Entities/Clothing/Hands/specific.yml
#	Resources/Prototypes/Entities/Clothing/Head/specific.yml
#	Resources/Prototypes/Entities/Clothing/Neck/specific.yml
#	Resources/Prototypes/Entities/Clothing/OuterClothing/specific.yml
#	Resources/Prototypes/Entities/Clothing/Shoes/specific.yml
#	Resources/Prototypes/Entities/Clothing/Uniforms/specific.yml
#	Resources/Prototypes/Entities/Mobs/NPCs/animals.yml
#	Resources/Prototypes/Entities/Objects/Materials/Sheets/glass.yml
#	Resources/Prototypes/Entities/Objects/Materials/Sheets/metal.yml
#	Resources/Prototypes/Entities/Objects/Materials/Sheets/other.yml
#	Resources/Prototypes/Entities/Objects/Materials/parts.yml
#	Resources/Prototypes/Entities/Objects/Specific/Robotics/borg_modules.yml
2025-08-13 14:13:30 +03:00

57 lines
1.9 KiB
C#

using Content.Server.Antag;
using Content.Server.GameTicking.Rules.Components;
using Content.Server.Roles;
using Content.Shared.Humanoid;
using Content.Shared.Roles.Components;
using Content.Shared.NPC.Systems;
namespace Content.Server.GameTicking.Rules;
public sealed class ThiefRuleSystem : GameRuleSystem<ThiefRuleComponent>
{
[Dependency] private readonly AntagSelectionSystem _antag = default!;
[Dependency] private readonly NpcFactionSystem _npcFaction = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<ThiefRuleComponent, AfterAntagEntitySelectedEvent>(AfterAntagSelected);
SubscribeLocalEvent<ThiefRoleComponent, GetBriefingEvent>(OnGetBriefing);
}
// Greeting upon thief activation
private void AfterAntagSelected(Entity<ThiefRuleComponent> mindId, ref AfterAntagEntitySelectedEvent args)
{
var ent = args.EntityUid;
_antag.SendBriefing(ent, MakeBriefing(ent), null, null);
Log.Debug($"MakeThief {ToPrettyString(ent)} - Change faction");
_npcFaction.RemoveFaction(ent, mindId.Comp.NanoTrasenFaction, false);
_npcFaction.AddFaction(ent, mindId.Comp.SyndicateFaction);
}
// Character screen briefing
private void OnGetBriefing(Entity<ThiefRoleComponent> role, ref GetBriefingEvent args)
{
var ent = args.Mind.Comp.OwnedEntity;
if (ent is null)
return;
args.Append(MakeBriefing(ent.Value));
}
private string MakeBriefing(EntityUid ent)
{
var isHuman = HasComp<HumanoidAppearanceComponent>(ent);
var briefing = isHuman
? Loc.GetString("thief-role-greeting-human")
: Loc.GetString("thief-role-greeting-animal");
if (isHuman)
briefing += "\n \n" + Loc.GetString("thief-role-greeting-equipment") + "\n";
return briefing;
}
}