Skip to content

Commit 6b6abbf

Browse files
Adding Animal Farm to the Lambordeere Shuttle (impstation#2912)
* added glorious leader * reparented glorious leader * lambordeere edit * reduce rev chance to 30% * THIS DOENS'T WORK BUT MQ'S GOTTA GO BEDDY BYE * this super doesn't work * i hate life and living * hi grim * got it working! remember to fix the probabilities * updated monkey antagchance * unanchored smuggler's stash * commented out invalid StorageUiKey * Fixing keb shuttle part 1 * Fixing keb shuttle part 1 part 2 * Fixing keb shuttle part 2 * Fixing keb shuttle part 3 * YOU * それ!!!! * The evil is defeated * give headrev monkey the statusicon component * remove the component after antag or not is rolled and applied no mindswap shennanigans re-rolling it * I forgor defaults for RandomAntagChanceComponent --------- Co-authored-by: TheGrimbeeper <thegrimbeeper.11@gmail.com>
1 parent e7fffa4 commit 6b6abbf

File tree

8 files changed

+1989
-16
lines changed

8 files changed

+1989
-16
lines changed

Content.Server/_Impstation/Traitor/Components/RandomAntagChanceComponent.cs

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,26 @@ namespace Content.Server._Impstation.Traitor.Components;
1010
public sealed partial class RandomAntagChanceComponent : Component
1111
{
1212
/// <summary>
13-
/// Sets the antag type to be rolled for.
13+
/// Sets the chance that the antag is rolled
1414
/// </summary>
1515
[DataField]
16-
public EntProtoId Profile = "Traitor";
16+
public float Chance = 0.3f;
1717

1818
/// <summary>
19-
/// Sets the chance that the antag is rolled
19+
/// Sets the antag type to be rolled for.
2020
/// </summary>
21-
[DataField]
22-
public float Chance = 0.5f;
21+
/// <remarks>
22+
/// Value given must be a valid antag gamerule OR MindRolePrototype.
23+
/// </remarks>
24+
[DataField(required: true)]
25+
public EntProtoId AntagRole = "Traitor";
26+
27+
/// <summary>
28+
/// The mind role given if the antag is not rolled.
29+
/// </summary>
30+
/// <remarks>
31+
/// Value given must be a valid antag gamerule OR MindRolePrototype.
32+
/// </remarks>
33+
[DataField(required: true)]
34+
public EntProtoId FallbackRole = "MindRoleGhostRoleNeutral";
2335
}
Lines changed: 59 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1-
using System;
2-
using Content.Server.Antag;
31
using Content.Server._Impstation.Traitor.Components;
2+
using Content.Server.Antag;
3+
using Content.Server.GameTicking.Rules.Components;
4+
using Content.Server.Roles;
5+
using Content.Server.Zombies;
6+
using Content.Shared.Mind;
47
using Content.Shared.Mind.Components;
8+
using Content.Shared.Roles;
59
using Robust.Shared.Player;
610
using Robust.Shared.Prototypes;
11+
using Robust.Shared.Random;
712

813
namespace Content.Server._Impstation.Traitor.Systems;
914

@@ -14,6 +19,10 @@ public sealed class RandomAntagChanceSystem : EntitySystem
1419
{
1520
[Dependency] private readonly AntagSelectionSystem _antag = default!;
1621
[Dependency] private readonly ISharedPlayerManager _player = default!;
22+
[Dependency] private readonly RoleSystem _role = default!;
23+
[Dependency] private readonly ZombieSystem _zombie = default!;
24+
[Dependency] private readonly SharedRoleSystem _roleSystem = default!;
25+
1726

1827
public override void Initialize()
1928
{
@@ -22,15 +31,57 @@ public override void Initialize()
2231
SubscribeLocalEvent<RandomAntagChanceComponent, MindAddedMessage>(OnMindAdded);
2332
}
2433

25-
private void OnMindAdded(EntityUid uid, RandomAntagChanceComponent comp, MindAddedMessage args)
34+
private void OnMindAdded(Entity<RandomAntagChanceComponent> ent, ref MindAddedMessage args)
2635
{
27-
if (!_player.TryGetSessionById(args.Mind.Comp.UserId, out var session))
36+
if (!_player.TryGetSessionByEntity(ent, out var session))
2837
return;
2938

30-
var random = new Random();
31-
if (random.NextDouble() > comp.Chance)
32-
return;
39+
var random = IoCManager.Resolve<IRobustRandom>();
40+
if (random.Prob(ent.Comp.Chance))
41+
{
42+
DoRoles(session, args.Mind, ent.Comp.AntagRole);
43+
}
44+
else
45+
{
46+
DoRoles(session, args.Mind, ent.Comp.FallbackRole);
47+
}
48+
RemCompDeferred<RandomAntagChanceComponent>(ent);
49+
}
3350

34-
_antag.ForceMakeAntag<RandomAntagChanceComponent>(session, comp.Profile);
51+
private void DoRoles(ICommonSession session, Entity<MindComponent> ent, EntProtoId role)
52+
{
53+
// antag code is hell. woe to all ye who enter here
54+
// GOD I WISH THERE WAS A BETTER WAY TO DO THIS
55+
switch (role)
56+
{
57+
case "Traitor":
58+
_antag.ForceMakeAntag<TraitorRuleComponent>(session, role);
59+
return;
60+
case "InitialInfected":
61+
_antag.ForceMakeAntag<ZombieRuleComponent>(session, role);
62+
return;
63+
case "Zombie":
64+
_zombie.ZombifyEntity(ent);
65+
return;
66+
case "LoneOpsSpawn":
67+
_antag.ForceMakeAntag<NukeopsRuleComponent>(session, role);
68+
return;
69+
case "Revolutionary":
70+
_antag.ForceMakeAntag<RevolutionaryRuleComponent>(session, role);
71+
return;
72+
case "Thief":
73+
_antag.ForceMakeAntag<ThiefRuleComponent>(session, role);
74+
return;
75+
case "Changeling":
76+
_antag.ForceMakeAntag<ChangelingRuleComponent>(session, role);
77+
return;
78+
case "Heretic":
79+
_antag.ForceMakeAntag<HereticRuleComponent>(session, role);
80+
return;
81+
default:
82+
// i hate my life
83+
_role.MindAddRole(ent, role);
84+
return;
85+
}
3586
}
3687
}

Resources/Locale/en-US/_Impstation/ghost/roles/ghost-role-component.ftl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,4 +165,12 @@ ghost-role-information-tame-rules = You are a [color=yellow][bold]Free Agent[/bo
165165
You don't remember any of your previous life, and you don't remember anything you learned as a ghost.
166166
167167
ghost-role-information-vrex-name = V-Rex
168-
ghost-role-information-vrex-desc = Not sure how you got here, but you're mad about it! Swing your weight around and express your anger, all while avoiding the dangers of barotrauma.
168+
ghost-role-information-vrex-desc = Not sure how you got here, but you're mad about it! Swing your weight around and express your anger, all while avoiding the dangers of barotrauma.
169+
170+
ghost-role-information-freeagent-teamantagonistchance-rules = You are a [color=yellow][bold]Free Agent[/bold][/color] with a small chance of rolling a [color=red][bold]Team Antagonist[/bold][/color] role. You must still follow escalation, but are not bound to the same restrictions as crew-aligned characters, unless the game tells you that you are an antagonist. [bold]ABANDONING THIS ROLE BECAUSE YOU ARE NOT AN ANTAGONIST WILL RESULT IN A BAN.[/bold]
171+
You are still required to follow rules against excessive destruction. [color=red]Do not seek to sabotage critical infrastructure without proper escalation.[/color]
172+
173+
You don't remember any of your previous life, and you don't remember anything you learned as a ghost.
174+
175+
ghost-role-information-monkey-name-lambordeere = Glorious Leader Monkey
176+
ghost-role-information-monkey-description-lambordeere = You have slain your captor and now seek to reap the rewards of freedom.

0 commit comments

Comments
 (0)