Refactor antag rule code (#23445)
* Initial Pass, Rev, Thief
* Zombie initial pass
* Rebase, Traitor
* Nukeops, More overloads
* Revert RevolutionaryRuleComponent
* Use TryRoundStartAttempt, Rewrite nukie spawning
* Comments, Add task scheduler to GameRuleSystem
* Zombie initial testing done
* Sort methods, rework GameRuleTask
* Add CCVar, Initial testing continues
* Might as well get rid of the obsolete logging
* Oops, i dont know how to log apparently
* Suggested formatting fixes
* Suggested changes
* Fix merge issues
* Minor optimisation
* Allowed thief to choose other antags
* Review changes
* Spawn items on floor first, then inserting
* minor tweaks
* Shift as much as possible to ProtoId<>
* Remove unneeded
* Add exclusive antag attribute
* Fix merge issues
* Minor formatting fix
* Convert to struct
* Cleanup
* Review cleanup (need to test a lot)
* Some fixes, (mostly) tested
* oop
* Pass tests (for real)
---------
Co-authored-by: Rainfall <rainfey0+git@gmail.com>
Co-authored-by: AJCM <AJCM@tutanota.com>
2024-02-29 06:25:10 +00:00
|
|
|
using Content.Server.Antag;
|
2023-12-24 12:58:28 +03:00
|
|
|
using Content.Server.GameTicking.Rules.Components;
|
|
|
|
|
using Content.Server.Roles;
|
Refactor antag rule code (#23445)
* Initial Pass, Rev, Thief
* Zombie initial pass
* Rebase, Traitor
* Nukeops, More overloads
* Revert RevolutionaryRuleComponent
* Use TryRoundStartAttempt, Rewrite nukie spawning
* Comments, Add task scheduler to GameRuleSystem
* Zombie initial testing done
* Sort methods, rework GameRuleTask
* Add CCVar, Initial testing continues
* Might as well get rid of the obsolete logging
* Oops, i dont know how to log apparently
* Suggested formatting fixes
* Suggested changes
* Fix merge issues
* Minor optimisation
* Allowed thief to choose other antags
* Review changes
* Spawn items on floor first, then inserting
* minor tweaks
* Shift as much as possible to ProtoId<>
* Remove unneeded
* Add exclusive antag attribute
* Fix merge issues
* Minor formatting fix
* Convert to struct
* Cleanup
* Review cleanup (need to test a lot)
* Some fixes, (mostly) tested
* oop
* Pass tests (for real)
---------
Co-authored-by: Rainfall <rainfey0+git@gmail.com>
Co-authored-by: AJCM <AJCM@tutanota.com>
2024-02-29 06:25:10 +00:00
|
|
|
using Content.Shared.Humanoid;
|
2023-12-24 12:58:28 +03:00
|
|
|
|
|
|
|
|
namespace Content.Server.GameTicking.Rules;
|
|
|
|
|
|
|
|
|
|
public sealed class ThiefRuleSystem : GameRuleSystem<ThiefRuleComponent>
|
|
|
|
|
{
|
2024-04-24 21:31:45 -04:00
|
|
|
[Dependency] private readonly AntagSelectionSystem _antag = default!;
|
2023-12-24 12:58:28 +03:00
|
|
|
|
|
|
|
|
public override void Initialize()
|
|
|
|
|
{
|
|
|
|
|
base.Initialize();
|
|
|
|
|
|
2024-04-24 21:31:45 -04:00
|
|
|
SubscribeLocalEvent<ThiefRuleComponent, AfterAntagEntitySelectedEvent>(AfterAntagSelected);
|
2023-12-24 12:58:28 +03:00
|
|
|
|
|
|
|
|
SubscribeLocalEvent<ThiefRoleComponent, GetBriefingEvent>(OnGetBriefing);
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-10 10:48:56 +02:00
|
|
|
// Greeting upon thief activation
|
|
|
|
|
private void AfterAntagSelected(Entity<ThiefRuleComponent> mindId, ref AfterAntagEntitySelectedEvent args)
|
2023-12-24 12:58:28 +03:00
|
|
|
{
|
2024-10-10 10:48:56 +02:00
|
|
|
var ent = args.EntityUid;
|
|
|
|
|
_antag.SendBriefing(ent, MakeBriefing(ent), null, null);
|
Refactor antag rule code (#23445)
* Initial Pass, Rev, Thief
* Zombie initial pass
* Rebase, Traitor
* Nukeops, More overloads
* Revert RevolutionaryRuleComponent
* Use TryRoundStartAttempt, Rewrite nukie spawning
* Comments, Add task scheduler to GameRuleSystem
* Zombie initial testing done
* Sort methods, rework GameRuleTask
* Add CCVar, Initial testing continues
* Might as well get rid of the obsolete logging
* Oops, i dont know how to log apparently
* Suggested formatting fixes
* Suggested changes
* Fix merge issues
* Minor optimisation
* Allowed thief to choose other antags
* Review changes
* Spawn items on floor first, then inserting
* minor tweaks
* Shift as much as possible to ProtoId<>
* Remove unneeded
* Add exclusive antag attribute
* Fix merge issues
* Minor formatting fix
* Convert to struct
* Cleanup
* Review cleanup (need to test a lot)
* Some fixes, (mostly) tested
* oop
* Pass tests (for real)
---------
Co-authored-by: Rainfall <rainfey0+git@gmail.com>
Co-authored-by: AJCM <AJCM@tutanota.com>
2024-02-29 06:25:10 +00:00
|
|
|
}
|
|
|
|
|
|
2024-10-10 10:48:56 +02:00
|
|
|
// Character screen briefing
|
|
|
|
|
private void OnGetBriefing(Entity<ThiefRoleComponent> role, ref GetBriefingEvent args)
|
2023-12-24 12:58:28 +03:00
|
|
|
{
|
2024-10-10 10:48:56 +02:00
|
|
|
var ent = args.Mind.Comp.OwnedEntity;
|
2023-12-24 12:58:28 +03:00
|
|
|
|
2024-10-10 10:48:56 +02:00
|
|
|
if (ent is null)
|
|
|
|
|
return;
|
|
|
|
|
args.Append(MakeBriefing(ent.Value));
|
2023-12-24 12:58:28 +03:00
|
|
|
}
|
|
|
|
|
|
2024-10-10 10:48:56 +02:00
|
|
|
private string MakeBriefing(EntityUid ent)
|
2023-12-24 12:58:28 +03:00
|
|
|
{
|
2024-10-10 10:48:56 +02:00
|
|
|
var isHuman = HasComp<HumanoidAppearanceComponent>(ent);
|
2024-04-24 21:31:45 -04:00
|
|
|
var briefing = isHuman
|
2023-12-24 12:58:28 +03:00
|
|
|
? Loc.GetString("thief-role-greeting-human")
|
|
|
|
|
: Loc.GetString("thief-role-greeting-animal");
|
|
|
|
|
|
2024-10-10 10:48:56 +02:00
|
|
|
if (isHuman)
|
|
|
|
|
briefing += "\n \n" + Loc.GetString("thief-role-greeting-equipment") + "\n";
|
|
|
|
|
|
2023-12-24 12:58:28 +03:00
|
|
|
return briefing;
|
|
|
|
|
}
|
|
|
|
|
}
|