Skip to content

Commit

Permalink
Merge branch 'refs/heads/master' into flesh_cult
Browse files Browse the repository at this point in the history
# Conflicts:
#	Content.Server/Administration/Systems/AdminVerbSystem.Antags.cs
  • Loading branch information
VigersRay committed Jan 1, 2025
2 parents 1cd0df3 + f849696 commit f245c19
Show file tree
Hide file tree
Showing 168 changed files with 77,516 additions and 61,562 deletions.
2 changes: 1 addition & 1 deletion Content.Client/Holopad/HolopadWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<Label Name="CallStatusText" Margin="10 5 10 0" ReservesSpace="False"/>
<BoxContainer Name="CallerIdContainer" Orientation="Vertical" ReservesSpace="False">
<RichTextLabel Name="CallerIdText" HorizontalAlignment="Center" Margin="0 0 0 0"/>
<Label Text="{Loc 'holopad-window-relay-label'}" Margin="10 5 10 0" ReservesSpace="False"/>
<Label Text="{Loc 'holopad-window-relay-label'}" Margin="10 10 10 0" ReservesSpace="False"/>
<RichTextLabel Name="HolopadIdText" HorizontalAlignment="Center" Margin="0 0 0 10"/>
</BoxContainer>
</BoxContainer>
Expand Down
23 changes: 23 additions & 0 deletions Content.Client/_Sunrise/AssaultOps/AssaultOps/AssaultOpsSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using Content.Shared._Sunrise.AssaultOps;
using Content.Shared.StatusIcon.Components;
using Robust.Shared.Prototypes;

namespace Content.Client._Sunrise.AssaultOps.AssaultOps;

public sealed class AssaultOpsSystem : EntitySystem
{
[Dependency] private readonly IPrototypeManager _prototype = default!;

public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<AssaultOperativeComponent, GetStatusIconsEvent>(GetVampireIcon);
}

private void GetVampireIcon(EntityUid uid, AssaultOperativeComponent component, ref GetStatusIconsEvent args)
{
var iconPrototype = _prototype.Index(component.StatusIcon);
args.StatusIcons.Add(iconPrototype);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
using Content.Shared._Sunrise.AssaultOps.Icarus;

namespace Content.Client._Sunrise.AssaultOps.Icarus;

public sealed class IcarusTerminalBoundUserInterface : BoundUserInterface
{
private IcarusTerminalWindow? _window;

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

protected override void Open()
{
base.Open();
_window = new IcarusTerminalWindow();
_window.OnClose += Close;
_window.OpenCentered();

_window.FireButtonPressed += OnFireButtonPressed;
}

private void OnFireButtonPressed()
{
if (_window == null)
return;

SendMessage(new IcarusTerminalFireMessage());
}

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

if (_window == null)
return;

if (state is not IcarusTerminalUiState cast)
return;

_window.UpdateState(cast);
}

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

if (_window != null)
_window.OnClose -= Close;

_window?.Dispose();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<DefaultWindow xmlns="https://spacestation14.io"
Title="{Loc 'icarus-ui-window-title'}"
MinSize="300 120">
<BoxContainer Orientation="Vertical">
<Button Name="FireButton"
Text="{Loc 'icarus-ui-fire-button'}"
StyleClasses="Caution"
MinHeight="50"
Disabled="True" />
<BoxContainer Name="TimerBox" Orientation="Horizontal" Visible="False">
<Label Text="{Loc 'icarus-ui-timer-label'}" />
<Label Text=" " />
<Label Name="TimerValue" Text="-" />
</BoxContainer>
<BoxContainer Name="CooldownBox" Orientation="Horizontal" Visible="False">
<Label Text="{Loc 'icarus-ui-cooldown-label'}" />
<Label Text=" " />
<Label Name="CooldownValue" Text="-" />
</BoxContainer>
</BoxContainer>
</DefaultWindow>
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using Content.Shared._Sunrise.AssaultOps.Icarus;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;

namespace Content.Client._Sunrise.AssaultOps.Icarus;

[GenerateTypedNameReferences]
public sealed partial class IcarusTerminalWindow : DefaultWindow
{
public event Action? FireButtonPressed;

public IcarusTerminalWindow()
{
RobustXamlLoader.Load(this);

FireButton.OnPressed += _ => FireButtonPressed?.Invoke();
}

public void UpdateState(IcarusTerminalUiState state)
{
FireButton.Disabled = state.Status != IcarusTerminalStatus.FIRE_READY;
TimerBox.Visible = state.Status == IcarusTerminalStatus.FIRE_PREPARING;
CooldownBox.Visible = state.Status == IcarusTerminalStatus.COOLDOWN;

switch (state.Status)
{
case IcarusTerminalStatus.FIRE_PREPARING:
TimerValue.Text = state.RemainingTime.ToString();
break;
case IcarusTerminalStatus.COOLDOWN:
CooldownValue.Text = state.CooldownTime.ToString();
break;
}
}
}
54 changes: 54 additions & 0 deletions Content.Client/_Sunrise/Interrogator/InterrogatorSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
using Content.Shared._Sunrise.Interrogator;
using Content.Shared.Verbs;
using Robust.Client.GameObjects;
using DrawDepth = Content.Shared.DrawDepth.DrawDepth;

namespace Content.Client._Sunrise.Interrogator;

public sealed class InterrogatorSystem: SharedInterrogatorSystem
{
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;

public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<InterrogatorComponent, ComponentInit>(OnComponentInit);
SubscribeLocalEvent<InterrogatorComponent, GetVerbsEvent<AlternativeVerb>>(AddAlternativeVerbs);

SubscribeLocalEvent<InterrogatorComponent, AppearanceChangeEvent>(OnAppearanceChange);
}

private void OnAppearanceChange(EntityUid uid, InterrogatorComponent component, ref AppearanceChangeEvent args)
{
if (args.Sprite == null)
{
return;
}

if (!_appearance.TryGetData<bool>(uid, InterrogatorComponent.InterrogatorVisuals.ContainsEntity, out var isOpen, args.Component)
|| !_appearance.TryGetData<bool>(uid, InterrogatorComponent.InterrogatorVisuals.IsOn, out var isOn, args.Component))
{
return;
}

if (isOpen)
{
args.Sprite.LayerSetState(InterrogatorVisualLayers.Base, "open");
args.Sprite.LayerSetVisible(InterrogatorVisualLayers.Extract, false);
args.Sprite.DrawDepth = (int) DrawDepth.Objects;
}
else
{
args.Sprite.DrawDepth = (int) DrawDepth.Mobs;
args.Sprite.LayerSetState(InterrogatorVisualLayers.Extract, isOn ? "extraction-on" : "extraction-off");
args.Sprite.LayerSetVisible(InterrogatorVisualLayers.Extract, true);
}
}
}

public enum InterrogatorVisualLayers : byte
{
Base,
Extract,
}
15 changes: 15 additions & 0 deletions Content.Server/Administration/Systems/AdminVerbSystem.Antags.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Content.Server._Sunrise.AssaultOps;
using Content.Server._Sunrise.FleshCult.GameRule;
using Content.Server.Administration.Commands;
using Content.Server.Antag;
Expand Down Expand Up @@ -181,6 +182,20 @@ private void AddAntagVerbs(GetVerbsEvent<Verb> args)
};
args.Verbs.Add(vampire);

Verb assaultOperative = new()
{
Text = Loc.GetString("admin-verb-text-make-assault-operative"),
Category = VerbCategory.Antag,
Icon = new SpriteSpecifier.Rsi(new ResPath("/Textures/Structures/Wallmounts/posters.rsi"), "poster46_contraband"),
Act = () =>
{
_antag.ForceMakeAntag<AssaultOpsRuleComponent>(targetPlayer, "AssaultOps");
},
Impact = LogImpact.High,
Message = Loc.GetString("admin-verb-make-assault-operative"),
};
args.Verbs.Add(assaultOperative);

Verb fleshCultist = new()
{
Text = "Make Flesh Cultist",
Expand Down

This file was deleted.

57 changes: 57 additions & 0 deletions Content.Server/GameTicking/Rules/GameRuleSystem.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
using Content.Server.Atmos.EntitySystems;
using Content.Server.Chat.Managers;
using Content.Server.Jobs;
using Content.Server.Preferences.Managers;
using Content.Server.Revolutionary.Components;
using Content.Shared.GameTicking.Components;
using Content.Shared.Preferences;
using Content.Shared.Roles;
using Robust.Server.GameObjects;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using Robust.Shared.Timing;

Expand All @@ -13,6 +19,8 @@ public abstract partial class GameRuleSystem<T> : EntitySystem where T : ICompon
[Dependency] protected readonly IChatManager ChatManager = default!;
[Dependency] protected readonly GameTicker GameTicker = default!;
[Dependency] protected readonly IGameTiming Timing = default!;
[Dependency] protected readonly IPrototypeManager _prototype = default!;
[Dependency] private readonly IComponentFactory _componentFactory = default!;

// Not protected, just to be used in utility methods
[Dependency] private readonly AtmosphereSystem _atmosphere = default!;
Expand All @@ -37,6 +45,55 @@ private void OnStartAttempt(RoundStartAttemptEvent args)
var query = QueryAllRules();
while (query.MoveNext(out var uid, out _, out var gameRule))
{
// Sunrise-Start
if (gameRule.MinCommandStaff > 0)
{
var availableHeads = new List<string>();

foreach (var playerSession in args.Players)
{
var userId = playerSession.UserId;
var preferencesManager = IoCManager.Resolve<IServerPreferencesManager>();
var prefs = preferencesManager.GetPreferences(userId);
var profile = prefs.SelectedCharacter as HumanoidCharacterProfile;
if (profile == null)
continue;
foreach (var profileJobPriority in profile.JobPriorities)
{
if (profileJobPriority.Value == JobPriority.Never)
continue;
if (!_prototype.TryIndex<JobPrototype>(profileJobPriority.Key.Id, out var job))
continue;
foreach (var special in job.Special)
{
if (special is not AddComponentSpecial componentSpecial)
continue;

foreach (var componentSpecialComponent in componentSpecial.Components)
{
var copy = _componentFactory.GetComponent(componentSpecialComponent.Value);
if (copy is CommandStaffComponent)
{
if (availableHeads.Contains(profileJobPriority.Key))
continue;
availableHeads.Add(profileJobPriority.Key);
}
}
}
}
}

if (gameRule.CancelPresetOnTooFewPlayers && availableHeads.Count < gameRule.MinCommandStaff)
{
ChatManager.SendAdminAnnouncement(Loc.GetString("preset-not-enough-ready-command-staff",
("readyCommandStaffCount", args.Players.Length),
("minimumCommandStaff", gameRule.MinCommandStaff),
("presetName", ToPrettyString(uid))));
args.Cancel();
}
}
// Sunrise-Edit

var minPlayers = gameRule.MinPlayers;
if (args.Players.Length >= minPlayers)
continue;
Expand Down
7 changes: 5 additions & 2 deletions Content.Server/Holopad/HolopadSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,10 @@ private void OnEmote(Entity<HolopadUserComponent> entity, ref EmoteEvent args)
if (TryComp<TelephoneComponent>(linkedHolopad, out var linkedHolopadTelephone) && linkedHolopadTelephone.Muted)
continue;

foreach (var receiver in GetLinkedHolopads(linkedHolopad))
var receivingHolopads = GetLinkedHolopads(linkedHolopad);
var range = receivingHolopads.Count > 1 ? ChatTransmitRange.HideChat : ChatTransmitRange.GhostRangeLimit;

foreach (var receiver in receivingHolopads)
{
if (receiver.Comp.Hologram == null)
continue;
Expand All @@ -391,7 +394,7 @@ private void OnEmote(Entity<HolopadUserComponent> entity, ref EmoteEvent args)
var name = Loc.GetString("holopad-hologram-name", ("name", ent));

// Force the emote, because if the user can do it, the hologram can too
_chatSystem.TryEmoteWithChat(receiver.Comp.Hologram.Value, args.Emote, ChatTransmitRange.Normal, false, name, true, true);
_chatSystem.TryEmoteWithChat(receiver.Comp.Hologram.Value, args.Emote, range, false, name, true, true);
}
}
}
Expand Down
Loading

0 comments on commit f245c19

Please sign in to comment.