Skip to content

Commit bcc6462

Browse files
authored
Merge branch 'master' into toys!
2 parents 0fe33ea + 0f0ea4c commit bcc6462

File tree

183 files changed

+3011
-2982
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

183 files changed

+3011
-2982
lines changed

.github/workflows/labeler-approve.yml

+2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ on:
77
jobs:
88
remove_label:
99
permissions:
10+
contents: write
1011
pull-requests: write
12+
statuses: write
1113
if: github.event.review.state == 'approved'
1214
runs-on: ubuntu-latest
1315
steps:

Content.Server/DeviceLinking/Systems/DoorSignalControlSystem.cs

+2
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ private void OnStateChanged(EntityUid uid, DoorSignalControlComponent door, Door
9999
_signalSystem.SendSignal(uid, door.OutOpen, false);
100100
}
101101
else if (args.State == DoorState.Open
102+
|| args.State == DoorState.Opening
103+
|| args.State == DoorState.Closing
102104
|| args.State == DoorState.Emagging)
103105
{
104106
// say the door is open whenever it would be letting air pass

Content.Server/GameTicking/Rules/VariationPass/Components/EntitySpawnVariationPassComponent.cs

+9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using Content.Shared.Random;
22
using Content.Shared.Storage;
3+
using Content.Shared.Whitelist;
34
using Robust.Shared.Prototypes;
45

56
namespace Content.Server.GameTicking.Rules.VariationPass.Components;
@@ -24,4 +25,12 @@ public sealed partial class EntitySpawnVariationPassComponent : Component
2425
/// </summary>
2526
[DataField(required: true)]
2627
public List<EntitySpawnEntry> Entities = default!;
28+
29+
// SS220 Fix SM begin
30+
/// <summary>
31+
/// A blacklis of entities that will block spawn of garbage in their vicinity
32+
/// </summary>
33+
[DataField]
34+
public EntityWhitelist? Blacklist = new();
35+
// SS220 Fix SM end
2736
}

Content.Server/GameTicking/Rules/VariationPass/EntitySpawnVariationPassSystem.cs

+19
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
using Content.Server.GameTicking.Rules.VariationPass.Components;
22
using Content.Shared.Storage;
33
using Robust.Shared.Random;
4+
using Content.Shared.Whitelist;
45

56
namespace Content.Server.GameTicking.Rules.VariationPass;
67

78
/// <inheritdoc cref="EntitySpawnVariationPassComponent"/>
89
public sealed class EntitySpawnVariationPassSystem : VariationPassSystem<EntitySpawnVariationPassComponent>
910
{
11+
// SS220 SM garbage fix begin
12+
[Dependency] private readonly EntityLookupSystem _lookupSystem = default!;
13+
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
14+
private const float Range = 3f; // Range to check SM nearby
15+
// SS220 SM garbage fix end
1016
protected override void ApplyVariation(Entity<EntitySpawnVariationPassComponent> ent, ref StationVariationPassEvent args)
1117
{
1218
var totalTiles = Stations.GetTileCount(args.Station);
@@ -19,6 +25,19 @@ protected override void ApplyVariation(Entity<EntitySpawnVariationPassComponent>
1925
if (!TryFindRandomTileOnStation(args.Station, out _, out _, out var coords))
2026
continue;
2127

28+
// SS220 SM garbage fix begin
29+
var listTakedEntites = _lookupSystem.GetEntitiesInRange(coords, Range);
30+
bool isCanSpawn = true;
31+
32+
foreach (var checkedTakedEntities in listTakedEntites)
33+
{
34+
if (_whitelistSystem.IsBlacklistPass(ent.Comp.Blacklist, checkedTakedEntities))
35+
isCanSpawn = false;
36+
}
37+
if (!isCanSpawn)
38+
continue;
39+
// SS220 SM garbage fix end
40+
2241
var ents = EntitySpawnCollection.GetSpawns(ent.Comp.Entities, Random);
2342
foreach (var spawn in ents)
2443
{

Content.Server/Mech/Equipment/EntitySystems/MechGrabberSystem.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,8 @@ private void OnInteract(EntityUid uid, MechGrabberComponent component, UserActiv
139139

140140
if (TryComp<PhysicsComponent>(target, out var physics) && physics.BodyType == BodyType.Static ||
141141
HasComp<WallMountComponent>(target) ||
142-
HasComp<MobStateComponent>(target))
142+
HasComp<MobStateComponent>(target) ||
143+
HasComp<MechComponent>(target)) //SS220 Ripley in ripley fix (AddMechToClothing)
143144
{
144145
return;
145146
}

Content.Server/Mech/Systems/MechEquipmentSystem.cs

+5-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,11 @@ private void OnUsed(EntityUid uid, MechEquipmentComponent component, AfterIntera
3636
if (mechComp.Broken)
3737
return;
3838

39-
if (args.User == mechComp.PilotSlot.ContainedEntity)
40-
return;
39+
//SS220-AddMechToClothing-start
40+
//Why does this check exist if it cannot be called?
41+
// if (args.User == mechComp.PilotSlot.ContainedEntity)
42+
// return;
43+
//SS220-AddMechToClothing-end
4144

4245
if (mechComp.EquipmentContainer.ContainedEntities.Count >= mechComp.MaxEquipmentAmount)
4346
return;

Content.Server/Mech/Systems/MechSystem.cs

+40-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
using Robust.Shared.Containers;
2424
using Robust.Shared.Player;
2525
using Content.Shared.Whitelist;
26+
using Content.Shared.SS220.MechRobot; //SS220-AddMechToClothing
2627

2728
namespace Content.Server.Mech.Systems;
2829

@@ -50,6 +51,7 @@ public override void Initialize()
5051
SubscribeLocalEvent<MechComponent, MapInitEvent>(OnMapInit);
5152
SubscribeLocalEvent<MechComponent, GetVerbsEvent<AlternativeVerb>>(OnAlternativeVerb);
5253
SubscribeLocalEvent<MechComponent, MechOpenUiEvent>(OnOpenUi);
54+
SubscribeLocalEvent<MechComponent, MechClothingOpenUiEvent>(OnOpenClothingUi); //SS220-AddMechToClothing
5355
SubscribeLocalEvent<MechComponent, RemoveBatteryEvent>(OnRemoveBattery);
5456
SubscribeLocalEvent<MechComponent, MechEntryEvent>(OnMechEntry);
5557
SubscribeLocalEvent<MechComponent, MechExitEvent>(OnMechExit);
@@ -163,6 +165,14 @@ private void OnOpenUi(EntityUid uid, MechComponent component, MechOpenUiEvent ar
163165
ToggleMechUi(uid, component);
164166
}
165167

168+
//SS220-AddMechToClothing-start
169+
private void OnOpenClothingUi(Entity<MechComponent> ent, ref MechClothingOpenUiEvent args)
170+
{
171+
args.Handled = true;
172+
ToggleMechClothingUi(ent.Owner, args.Performer, ent.Comp);
173+
}
174+
//SS220-AddMechToClothing-end
175+
166176
private void OnToolUseAttempt(EntityUid uid, MechPilotComponent component, ref ToolUserAttemptUseEvent args)
167177
{
168178
if (args.Target == component.Mech)
@@ -174,6 +184,11 @@ private void OnAlternativeVerb(EntityUid uid, MechComponent component, GetVerbsE
174184
if (!args.CanAccess || !args.CanInteract || component.Broken)
175185
return;
176186

187+
//SS220-AddMechToClothing-start
188+
if (!TryComp<MechRobotComponent>(uid, out var _))
189+
return;
190+
//SS220-AddMechToClothing-end
191+
177192
if (CanInsert(uid, args.User, component))
178193
{
179194
var enterVerb = new AlternativeVerb
@@ -197,8 +212,13 @@ private void OnAlternativeVerb(EntityUid uid, MechComponent component, GetVerbsE
197212
args.Verbs.Add(enterVerb);
198213
args.Verbs.Add(openUiVerb);
199214
}
200-
else if (!IsEmpty(component))
215+
else if (!IsEmpty(component, uid)) //SS220-AddMechToClothing
201216
{
217+
//SS220-AddMechToClothing-start
218+
if (!TryComp<MechRobotComponent>(uid, out var _))
219+
return;
220+
//SS220-AddMechToClothing-end
221+
202222
var ejectVerb = new AlternativeVerb
203223
{
204224
Text = Loc.GetString("mech-verb-exit"),
@@ -229,6 +249,11 @@ private void OnMechEntry(EntityUid uid, MechComponent component, MechEntryEvent
229249
if (args.Cancelled || args.Handled)
230250
return;
231251

252+
//SS220-AddMechToClothing-start
253+
if (!TryComp<MechRobotComponent>(uid, out var _))
254+
return;
255+
//SS220-AddMechToClothing-end
256+
232257
if (_whitelistSystem.IsWhitelistFail(component.PilotWhitelist, args.User))
233258
{
234259
_popup.PopupEntity(Loc.GetString("mech-no-enter", ("item", uid)), args.User);
@@ -280,6 +305,20 @@ private void ToggleMechUi(EntityUid uid, MechComponent? component = null, Entity
280305
UpdateUserInterface(uid, component);
281306
}
282307

308+
//SS220-AddMechToClothing-start
309+
private void ToggleMechClothingUi(EntityUid entOwner, EntityUid argsPerformer, MechComponent? entComp = null)
310+
{
311+
if (!Resolve(entOwner, ref entComp))
312+
return;
313+
314+
if (!TryComp<ActorComponent>(argsPerformer, out var actor))
315+
return;
316+
317+
_ui.TryToggleUi(entOwner, MechUiKey.Key, actor.PlayerSession);
318+
UpdateUserInterface(entOwner, entComp);
319+
}
320+
//SS220-AddMechToClothing-end
321+
283322
private void ReceiveEquipmentUiMesssages<T>(EntityUid uid, MechComponent component, T args) where T : MechEquipmentUiMessage
284323
{
285324
var ev = new MechEquipmentUiMessageRelayEvent(args);

Content.Server/Revenant/EntitySystems/RevenantSystem.Abilities.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
using Robust.Shared.Utility;
3131
using Robust.Shared.Map.Components;
3232
using Content.Shared.Whitelist;
33+
using Content.Server.NPC.HTN;
3334

3435
namespace Content.Server.Revenant.EntitySystems;
3536

@@ -73,7 +74,8 @@ private void OnInteract(EntityUid uid, RevenantComponent component, UserActivate
7374
return;
7475
}
7576

76-
if (!HasComp<MobStateComponent>(target) || !HasComp<HumanoidAppearanceComponent>(target) || HasComp<RevenantComponent>(target))
77+
if (!HasComp<MobStateComponent>(target) || !HasComp<HumanoidAppearanceComponent>(target) || HasComp<RevenantComponent>(target)
78+
|| HasComp<HTNComponent>(target)) // ss220 rev cant harvest NPC
7779
return;
7880

7981
args.Handled = true;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
// © SS220, An EULA/CLA with a hosting restriction, full text: https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/CLA.txt
2+
using System.Linq;
3+
using Content.Server.Administration;
4+
using Content.Server.Antag;
5+
using Content.Server.GameTicking;
6+
using Content.Server.GameTicking.Rules.Components;
7+
using Content.Shared.Administration;
8+
using Content.Shared.GameTicking;
9+
using Content.Shared.IdentityManagement;
10+
using Robust.Server.Player;
11+
using Robust.Shared.Console;
12+
using Robust.Shared.Random;
13+
using Content.Shared.Ghost;
14+
using Content.Server.Administration.Managers;
15+
using Content.Server.Roles;
16+
using Content.Shared.Mind;
17+
using Content.Shared.Mindshield.Components;
18+
using Content.Shared.Preferences;
19+
using Content.Server.Preferences.Managers;
20+
21+
namespace Content.Server.SS220.Commands
22+
{
23+
[AdminCommand(AdminFlags.VarEdit)] // Only for admins
24+
public sealed class MakeAntagCommand : IConsoleCommand
25+
{
26+
[Dependency] private readonly IEntityManager _entityManager = default!;
27+
[Dependency] private readonly IServerPreferencesManager _pref = default!;
28+
29+
public string Command => "makerandomantag";
30+
public string Description => Loc.GetString("command-makerandomantag-description");
31+
public string Help => $"Usage: {Command}";
32+
33+
private readonly List<string> _antagTypes = new() // TODO: When will add a cult add a cultist there
34+
{
35+
"Traitor",
36+
"Thief",
37+
"InitialInfected",
38+
};
39+
40+
public void Execute(IConsoleShell shell, string argStr, string[] args)
41+
{
42+
if (args.Length == 0 || !_antagTypes.Contains(args[0]))
43+
{
44+
shell.WriteLine(Loc.GetString("command-makerandomantag-objective"));
45+
return;
46+
}
47+
48+
var successEntityUid = AdminMakeRandomAntagCommand(args[0]);
49+
50+
if (successEntityUid != null)
51+
{
52+
shell.WriteLine(Loc.GetString("command-makerandomantag-sucess",
53+
("Entityname", Identity.Name(successEntityUid.Value, _entityManager)), ("antag", args[0])));
54+
}
55+
else
56+
shell.WriteLine(Loc.GetString("command-makerandomantag-negative"));
57+
}
58+
59+
private EntityUid? AdminMakeRandomAntagCommand(string defaultRule)
60+
{
61+
var antag = _entityManager.System<AntagSelectionSystem>();
62+
var playerManager = IoCManager.Resolve<IPlayerManager>();
63+
var gameTicker = _entityManager.System<GameTicker>();
64+
var random = IoCManager.Resolve<IRobustRandom>();
65+
var mindSystem = _entityManager.System<SharedMindSystem>();
66+
var roleSystem = _entityManager.System<RoleSystem>();
67+
var banSystem = IoCManager.Resolve<IBanManager>();
68+
69+
var players = playerManager.Sessions
70+
.Where(x => gameTicker.PlayerGameStatuses[x.UserId] == PlayerGameStatus.JoinedGame)
71+
.ToList();
72+
73+
random.Shuffle(players); // Shuffle player list to be more randomly
74+
75+
foreach (var player in players)
76+
{
77+
78+
var pref = (HumanoidCharacterProfile)_pref.GetPreferences(player.UserId).SelectedCharacter;
79+
80+
if (!mindSystem.TryGetMind(player.UserId, out var mindId)) // Is it player or a cow?
81+
continue;
82+
83+
if (banSystem.GetRoleBans(player.UserId) is { } roleBans &&
84+
roleBans.Contains("Job:" + defaultRule)) // Do he have a roleban on THIS antag?
85+
continue;
86+
87+
if (roleSystem.MindIsAntagonist(mindId) ||
88+
_entityManager.HasComponent<GhostComponent>(player.AttachedEntity) ||
89+
_entityManager.HasComponent<MindShieldComponent>(player.AttachedEntity)) // Is he already lucky boy or he is ghost or he is CAPTIAN?
90+
continue;
91+
92+
if (!pref.AntagPreferences.Contains(defaultRule)) // Do he want to be a chosen antag or no?
93+
continue;
94+
95+
switch (defaultRule) // TODO: When will add a cult add a cultist there too. U can add more for fun if u want.
96+
{
97+
case "Traitor":
98+
antag.ForceMakeAntag<TraitorRuleComponent>(player, defaultRule);
99+
break;
100+
case "Thief":
101+
antag.ForceMakeAntag<ThiefRuleComponent>(player, defaultRule);
102+
break;
103+
case "InitialInfected":
104+
antag.ForceMakeAntag<ZombieRuleComponent>(player, defaultRule);
105+
break;
106+
}
107+
if (roleSystem.MindIsAntagonist(mindId)) // If he sucessfuly passed all checks and get his antag?
108+
return player.AttachedEntity;
109+
}
110+
return null;
111+
}
112+
113+
114+
public CompletionResult GetCompletion(IConsoleShell shell, string[] args)
115+
{
116+
if (args.Length == 1)
117+
{
118+
return CompletionResult.FromOptions(_antagTypes);
119+
}
120+
return CompletionResult.Empty;
121+
}
122+
}
123+
}

0 commit comments

Comments
 (0)