Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Thief minor antagonist #21520

Merged
merged 92 commits into from
Dec 24, 2023
Merged
Show file tree
Hide file tree
Changes from 89 commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
9215874
start working
TheShuEd Nov 6, 2023
2ddafa8
add right-click thief antagins
TheShuEd Nov 6, 2023
867744b
add meh thief greeting audio
TheShuEd Nov 6, 2023
48fa146
add thief subgamemode to Traitors gamemode
TheShuEd Nov 6, 2023
9fc3b3c
add late join thief (not tested yet)
TheShuEd Nov 6, 2023
f641f78
add pacifism
TheShuEd Nov 6, 2023
21d8992
add Steal tasks to thief
TheShuEd Nov 7, 2023
b6d163e
fix crash thief+traitor on person
TheShuEd Nov 7, 2023
8439118
add new condition: collection steal
TheShuEd Nov 7, 2023
2ef00b3
add tracking of succes collection objective
TheShuEd Nov 7, 2023
f605f50
add stamp collection target
TheShuEd Nov 7, 2023
98b2726
finalize first 2 group objective
TheShuEd Nov 7, 2023
133e323
start merging stealing objective systems
TheShuEd Nov 7, 2023
e335638
merging
TheShuEd Nov 7, 2023
767884f
finish merging. Now traitor steal objective work better
TheShuEd Nov 7, 2023
e4ce28b
we don't check the items of pullable sentient entity
TheShuEd Nov 7, 2023
077f378
clear naming, enable thief signle item objective start
TheShuEd Nov 7, 2023
cd8e9e1
objective pack add
TheShuEd Nov 7, 2023
bb91275
finish with steal item objectives
TheShuEd Nov 7, 2023
3fede6a
Merge branch 'master' into thief
TheShuEd Nov 7, 2023
0afa736
convert string to ProtoId<>
TheShuEd Nov 7, 2023
e47b3db
Merge branch 'thief' of https://github.com/TheShuEd/ed-station-14 int…
TheShuEd Nov 7, 2023
77e83cb
Merge branch 'space-wizards:master' into thief
TheShuEd Nov 7, 2023
dd344a4
Merge branch 'thief' of https://github.com/TheShuEd/ed-station-14 int…
TheShuEd Nov 7, 2023
a99549f
some clean up
TheShuEd Nov 7, 2023
eea519a
add thieves to revolution game mode
TheShuEd Nov 8, 2023
bffd82c
Update Resources/Locale/en-US/game-ticking/game-presets/preset-thief.ftl
TheShuEd Nov 8, 2023
0806933
Update Resources/Locale/en-US/game-ticking/game-presets/preset-thief.ftl
TheShuEd Nov 8, 2023
19786b7
update pacifism: fix crashing, monkey-thief without pacified
TheShuEd Nov 8, 2023
a85cd59
adaptive animal briefing, cleaning locales
TheShuEd Nov 8, 2023
7cbb1e3
add structure steal objectives
TheShuEd Nov 8, 2023
f3189b5
remove RCD target
TheShuEd Nov 8, 2023
f5a0775
add thiefs to manifest, but bug with traitor duplications
TheShuEd Nov 8, 2023
5466f17
add escape objective
TheShuEd Nov 8, 2023
3c5e4e6
add chat briefing
TheShuEd Nov 8, 2023
43b0392
setup animal objective group system
TheShuEd Nov 8, 2023
2416107
add animal steal objectives
TheShuEd Nov 8, 2023
539df97
add animal objectives notroleconditions
TheShuEd Nov 8, 2023
3c56a49
add morty
TheShuEd Nov 8, 2023
cf12222
now thief mode has a chance of not launching Now there are a random n…
TheShuEd Nov 8, 2023
d5576fe
6 hours of trying to fix duplicate tasks. Failure
TheShuEd Nov 10, 2023
3db4a45
added thief pinpointer (buggy)
TheShuEd Nov 10, 2023
a07f4d7
start thief backpack UI work
TheShuEd Nov 10, 2023
04f5619
revert pinpointer for scope reason
TheShuEd Nov 10, 2023
c8b106f
UI continue work
TheShuEd Nov 11, 2023
1877a69
add thief starter kits content
TheShuEd Nov 12, 2023
f36224d
remove ERP kit :trollface:
TheShuEd Nov 12, 2023
c2640e5
finally! giving starting items to thief. Now it playable, but still n…
TheShuEd Nov 12, 2023
941bfb2
clean up
TheShuEd Nov 12, 2023
9c0242c
fix
TheShuEd Nov 12, 2023
ba79c24
fox
TheShuEd Nov 12, 2023
401b708
Merge branch 'space-wizards:master' into thief
TheShuEd Nov 12, 2023
0e58cb7
Merge branch 'space-wizards:master' into thief
TheShuEd Nov 13, 2023
b6de848
add merged items into thief
TheShuEd Nov 13, 2023
acd0ddc
fix YES antag menu
TheShuEd Nov 13, 2023
2e23c03
objection tweaks
TheShuEd Nov 13, 2023
629e0e6
remove hearts objective, working on spawning things from toolbox
TheShuEd Nov 13, 2023
0a78122
smug
TheShuEd Nov 13, 2023
304d805
fixes
TheShuEd Nov 13, 2023
97fc469
add race specifier objective condition LAMPS
TheShuEd Nov 14, 2023
1cfd700
meh
TheShuEd Nov 14, 2023
f35aa38
Merge branch 'space-wizards:master' into thief
TheShuEd Nov 15, 2023
57098ed
fix fix fix
TheShuEd Nov 15, 2023
3fb5c59
the alive
TheShuEd Nov 15, 2023
216afee
Adding stamps
TheShuEd Nov 15, 2023
1eb5f3d
Update backpack.ftl
TheShuEd Nov 15, 2023
0d358c8
Revert1
TheShuEd Nov 16, 2023
5e96c80
Revert ftl
TheShuEd Nov 16, 2023
bba7cd6
add voice mask to communicator kit
TheShuEd Nov 16, 2023
86bd107
Update Resources/Locale/en-US/administration/antag.ftl
TheShuEd Nov 20, 2023
90ea913
Update Resources/Locale/en-US/game-ticking/game-presets/preset-thief.ftl
TheShuEd Nov 20, 2023
e8180ce
Update Resources/Locale/en-US/thief/backpack.ftl
TheShuEd Nov 20, 2023
aff8d4e
Update Resources/Locale/en-US/objectives/conditions/steal.ftl
TheShuEd Nov 20, 2023
7f61359
Update Resources/Locale/en-US/thief/backpack.ftl
TheShuEd Nov 20, 2023
a58bbea
Update Resources/Locale/en-US/thief/backpack.ftl
TheShuEd Nov 20, 2023
063bb32
Update Resources/Locale/en-US/thief/backpack.ftl
TheShuEd Nov 20, 2023
d2c0a5e
Update Resources/Locale/en-US/thief/backpack.ftl
TheShuEd Nov 20, 2023
08907da
Update Resources/Locale/en-US/prototypes/roles/antags.ftl
TheShuEd Nov 20, 2023
b20d8f3
Update Resources/Locale/en-US/thief/backpack.ftl
TheShuEd Nov 20, 2023
1da4a64
Merge branch 'space-wizards:master' into thief
TheShuEd Nov 24, 2023
0799ce9
Merge branch 'master' into thief
TheShuEd Nov 27, 2023
e2cccd3
Merge branch 'space-wizards:master' into thief
TheShuEd Nov 29, 2023
96baf7a
update
TheShuEd Nov 29, 2023
6c1438b
Merge branch 'space-wizards:master' into thief
TheShuEd Nov 30, 2023
73383c5
Merge branch 'master' into thief
TheShuEd Dec 7, 2023
8c11138
Merge branch 'master' into thief
TheShuEd Dec 11, 2023
7a4387b
fix
TheShuEd Dec 11, 2023
b7b8c7c
more reusable function, add documentation
TheShuEd Dec 11, 2023
798cc4f
fix doc
TheShuEd Dec 11, 2023
24c9248
faint fixes
TheShuEd Dec 11, 2023
828db9c
Merge branch 'master' into thief
TheShuEd Dec 13, 2023
500427b
Merge branch 'master' into thief
TheShuEd Dec 19, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions Content.Client/Thief/ThiefBackpackBoundUserInterface.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using Content.Shared.Thief;
using JetBrains.Annotations;
using Robust.Client.GameObjects;

namespace Content.Client.Thief;

[UsedImplicitly]
public sealed class ThiefBackpackBoundUserInterface : BoundUserInterface
{
private ThiefBackpackMenu? _window;

public ThiefBackpackBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) { }

protected override void Open()
{
base.Open();

_window = new ThiefBackpackMenu(this);
_window.OnClose += Close;
_window.OpenCentered();
}

protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (!disposing)
return;

_window?.Dispose();
_window = null;
}

protected override void UpdateState(BoundUserInterfaceState state)
{
base.UpdateState(state);

if (state is not ThiefBackpackBoundUserInterfaceState current)
return;

_window?.UpdateState(current);
}

public void SendChangeSelected(int setNumber)
{
SendMessage(new ThiefBackpackChangeSetMessage(setNumber));
}

public void SendApprove()
{
SendMessage(new ThiefBackpackApproveMessage());
}
}
39 changes: 39 additions & 0 deletions Content.Client/Thief/ThiefBackpackMenu.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<controls:FancyWindow xmlns="https://spacestation14.io"
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
Title="{Loc 'thief-backpack-window-title'}"
MinSize="700 700">
<BoxContainer Orientation="Vertical" HorizontalExpand="True" VerticalExpand="True">
<!-- First Informational panel -->
<Label Text="{Loc 'thief-backpack-window-description'}" Margin="5 5"/>
<controls:HLine Color="#404040" Thickness="2" Margin="0 5"/>
<Label Name="SelectedSets" Text="{Loc 'thief-backpack-window-selected'}" Margin="5 5"/>

<!-- Second sets panel -->
<PanelContainer Margin="5 5">
<PanelContainer.PanelOverride>
<gfx:StyleBoxFlat BackgroundColor="#050505" />
</PanelContainer.PanelOverride>
<ScrollContainer
HScrollEnabled="False"
MinSize="0 600"
SizeFlagsStretchRatio="2"
VerticalExpand="True">
<BoxContainer Name="SetsGrid" Orientation="Vertical" MinSize="460 200">
<!-- Sets is filled by code -->

</BoxContainer>
</ScrollContainer>
</PanelContainer>

<!-- Third approve button panel -->
<PanelContainer Margin="10">
<Button Name="ApproveButton"
Text="{Loc 'thief-backpack-window-approve-button'}"
Margin="0 5"
Access="Public"
HorizontalAlignment ="Right"
StyleClasses="OpenRight"/>
</PanelContainer>
</BoxContainer>
</controls:FancyWindow>
56 changes: 56 additions & 0 deletions Content.Client/Thief/ThiefBackpackMenu.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
using Content.Client.UserInterface.Controls;
using Content.Shared.Thief;
using Robust.Client.AutoGenerated;
using Robust.Client.GameObjects;
using Robust.Client.UserInterface.XAML;

namespace Content.Client.Thief;

[GenerateTypedNameReferences]
public sealed partial class ThiefBackpackMenu : FancyWindow
{
[Dependency] private readonly IEntitySystemManager _sysMan = default!;
private readonly SpriteSystem _spriteSystem;

private readonly ThiefBackpackBoundUserInterface _owner;

public ThiefBackpackMenu(ThiefBackpackBoundUserInterface owner)
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
_spriteSystem = _sysMan.GetEntitySystem<SpriteSystem>();

_owner = owner;

ApproveButton.OnButtonDown += (args) =>
{
_owner.SendApprove();
};
}

public void UpdateState(ThiefBackpackBoundUserInterfaceState state)
{
SetsGrid.RemoveAllChildren();
int count = 0;
int selectedNumber = 0;
foreach (var set in state.Sets)
{
var child = new ThiefBackpackSet(set.Value, _spriteSystem);

child.SetButton.OnButtonDown += (args) =>
{
_owner.SendChangeSelected(set.Key);
};

SetsGrid.AddChild(child);

count++;

if (set.Value.Selected)
selectedNumber++;
}

SelectedSets.Text = Loc.GetString("thief-backpack-window-selected", ("selectedCount", selectedNumber), ("maxCount", state.MaxSelectedSets));
ApproveButton.Disabled = selectedNumber == state.MaxSelectedSets ? false : true;
}
}
23 changes: 23 additions & 0 deletions Content.Client/Thief/ThiefBackpackSet.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<Control xmlns="https://spacestation14.io"
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client">
<!-- Name and button -->
<PanelContainer Margin="5 5 0 5">
<PanelContainer.PanelOverride>
<gfx:StyleBoxFlat BackgroundColor="#18211b" />
</PanelContainer.PanelOverride>
<BoxContainer Orientation="Vertical" HorizontalExpand="True">
<GridContainer Margin="5" Columns="2" MinSize="600 0">
<Label Name="SetName" Text="Set" StyleClasses="StatusFieldTitle"></Label>
<Button Margin="0 10" Name="SetButton" Text="Select" StyleClasses="OpenRight" Access="Public" HorizontalAlignment="Right"/>
</GridContainer>
<controls:HLine Color="#404040" Thickness="1" Margin="0 5"/>
<!-- Icon and Description -->
<GridContainer Margin="0 5" Columns="2">
<TextureRect Name="Icon" Margin="10" Stretch="KeepAspectCentered"
VerticalAlignment="Center" HorizontalAlignment="Right" SetSize="64 64"/>
<Label Name="SetDescription" Text="Description"></Label>
</GridContainer>
</BoxContainer>
</PanelContainer>
</Control>
22 changes: 22 additions & 0 deletions Content.Client/Thief/ThiefBackpackSet.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.XAML;
using Content.Shared.Thief;
using Robust.Client.GameObjects;

namespace Content.Client.Thief;

[GenerateTypedNameReferences]
public sealed partial class ThiefBackpackSet : Control
{
public ThiefBackpackSet(ThiefBackpackSetInfo set, SpriteSystem spriteSystem)
{
RobustXamlLoader.Load(this);

Icon.Texture = spriteSystem.Frame0(set.Sprite);
SetName.Text = Loc.GetString(set.Name);
SetDescription.Text = Loc.GetString(set.Description);
SetButton.Text = Loc.GetString(set.Selected ? "thief-backpack-button-deselect" : "thief-backpack-button-select");
SetButton.ModulateSelfOverride = set.Selected ? new Color(40, 84, 35) : new Color(68, 75, 103);
}
}
19 changes: 19 additions & 0 deletions Content.Server/Administration/Systems/AdminVerbSystem.Antags.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Content.Server.GameTicking;
using Content.Server.GameTicking.Rules;
using Content.Server.StationEvents.Events;
using Content.Server.Zombies;
using Content.Shared.Administration;
using Content.Shared.Database;
Expand All @@ -15,6 +16,7 @@ namespace Content.Server.Administration.Systems;
public sealed partial class AdminVerbSystem
{
[Dependency] private readonly ZombieSystem _zombie = default!;
[Dependency] private readonly ThiefRuleSystem _thief = default!;
[Dependency] private readonly TraitorRuleSystem _traitorRule = default!;
[Dependency] private readonly NukeopsRuleSystem _nukeopsRule = default!;
[Dependency] private readonly PiratesRuleSystem _piratesRule = default!;
Expand Down Expand Up @@ -119,5 +121,22 @@ private void AddAntagVerbs(GetVerbsEvent<Verb> args)
Message = Loc.GetString("admin-verb-make-head-rev"),
};
args.Verbs.Add(headRev);

Verb thief = new()
{
Text = Loc.GetString("admin-verb-text-make-thief"),
Category = VerbCategory.Antag,
Icon = new SpriteSpecifier.Rsi(new ResPath("/Textures/Clothing/Hands/Gloves/ihscombat.rsi"), "icon"),
Act = () =>
{
if (!_minds.TryGetSession(targetMindComp.Mind, out var session))
return;

_thief.MakeThief(session);
},
Impact = LogImpact.High,
Message = Loc.GetString("admin-verb-make-thief"),
};
args.Verbs.Add(thief);
}
}
67 changes: 67 additions & 0 deletions Content.Server/Antag/AntagSelectionSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
using Robust.Server.Containers;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;
using Content.Server.Shuttles.Components;

namespace Content.Server.Antag;

Expand Down Expand Up @@ -149,6 +150,72 @@ public void EligiblePlayers(string antagPrototype,
}
}

/// <summary>
/// The function walks through all players, checking their role and preferences to generate a list of players who can become antagonists.
/// </summary>
/// <param name="candidates">a list of players to check out</param>
/// <param name="antagPreferenceId">antagonist's code id</param>
/// <returns></returns>
public List<ICommonSession> FindPotentialAntags(in Dictionary<ICommonSession, HumanoidCharacterProfile> candidates, string antagPreferenceId)
{
var list = new List<ICommonSession>();
var pendingQuery = GetEntityQuery<PendingClockInComponent>();

foreach (var player in candidates.Keys)
{
// Role prevents antag.
if (!_jobs.CanBeAntag(player))
continue;

// Latejoin
if (player.AttachedEntity != null && pendingQuery.HasComponent(player.AttachedEntity.Value))
continue;

list.Add(player);
}

var prefList = new List<ICommonSession>();

foreach (var player in list)
{
//player preferences to play as this antag
var profile = candidates[player];
if (profile.AntagPreferences.Contains(antagPreferenceId))
{
prefList.Add(player);
}
}
if (prefList.Count == 0)
{
Log.Info($"Insufficient preferred antag:{antagPreferenceId}, picking at random.");
prefList = list;
}
return prefList;
}

/// <summary>
/// selects the specified number of players from the list
/// </summary>
/// <param name="antagCount">how many players to take</param>
/// <param name="prefList">a list of players from which to draw</param>
/// <returns></returns>
public List<ICommonSession> PickAntag(int antagCount, List<ICommonSession> prefList)
{
var results = new List<ICommonSession>(antagCount);
if (prefList.Count == 0)
{
Log.Info("Insufficient ready players to fill up with antags, stopping the selection.");
return results;
}

for (var i = 0; i < antagCount; i++)
{
results.Add(_random.PickAndTake(prefList));
Log.Info("Selected a preferred antag.");
}
return results;
}

/// <summary>
/// Will take a group of entities and check if they are all alive or dead
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
using Robust.Shared.Audio;
using Robust.Shared.Prototypes;
using Content.Shared.Roles;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
using Robust.Shared.Player;
using Content.Shared.Preferences;

namespace Content.Server.GameTicking.Rules.Components;

/// <summary>
/// Stores data for <see cref="ThiefRuleSystem/">.
/// </summary>
[RegisterComponent, Access(typeof(ThiefRuleSystem))]
public sealed partial class ThiefRuleComponent : Component
{
/// <summary>
/// A chance for this mode to be added to the game.
/// </summary>
[DataField]
public float RuleChance = 1f;

[DataField(customTypeSerializer: typeof(PrototypeIdSerializer<AntagPrototype>))]
public string ThiefPrototypeId = "Thief";
TheShuEd marked this conversation as resolved.
Show resolved Hide resolved

public Dictionary<ICommonSession, HumanoidCharacterProfile> StartCandidates = new();

[DataField]
public float MaxObjectiveDifficulty = 2.5f;

[DataField]
public int MaxStealObjectives = 10;

/// <summary>
/// Things that will be given to thieves
/// </summary>
[DataField]
public List<EntProtoId> StarterItems = new List<EntProtoId> { "ToolboxThief", "ClothingHandsChameleonThief" }; //TO DO - replace to chameleon thieving gloves whem merg

/// <summary>
/// All Thiefes created by this rule
/// </summary>
public readonly List<EntityUid> ThiefMinds = new();

TheShuEd marked this conversation as resolved.
Show resolved Hide resolved
/// <summary>
/// Max Thiefs created by rule on roundstart
/// </summary>
[DataField]
public int MaxAllowThief = 3;

/// <summary>
/// Sound played when making the player a thief via antag control or ghost role
/// </summary>
[DataField]
public SoundSpecifier? GreetingSound = new SoundPathSpecifier("/Audio/Misc/thief_greeting.ogg");
}
Loading
Loading