mirror of
https://github.com/DeltaV-Station/Delta-v.git
synced 2026-09-29 15:47:26 +00:00
Compare commits
187
Commits
yips
...
515fd80845
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
515fd80845 | ||
|
|
99a9f47e94 | ||
|
|
f5d4de4cf3 | ||
|
|
6edb3a2961 | ||
|
|
ce0410c41e | ||
|
|
d800d4a8c1 | ||
|
|
cea62ee53d | ||
|
|
c3bb3f001a | ||
|
|
a332245ff0 | ||
|
|
f94cab57df | ||
|
|
742524b2ff | ||
|
|
cdb104ee2e | ||
|
|
180281ae0d | ||
|
|
0a3507c93b | ||
|
|
2efc9871db | ||
|
|
814ef07035 | ||
|
|
657f1fd534 | ||
|
|
a8e51dffc3 | ||
|
|
84c7e3d877 | ||
|
|
d151384db8 | ||
|
|
7bcc06b46a | ||
|
|
e409e98bf6 | ||
|
|
760af2e261 | ||
|
|
ebc0340fc9 | ||
|
|
e8b6c42de4 | ||
|
|
5e0d668f60 | ||
|
|
2c1084da78 | ||
|
|
9304aad604 | ||
|
|
5132e64a0f | ||
|
|
d2bf1e9a39 | ||
|
|
865d254cd4 | ||
|
|
29ec2e659f | ||
|
|
690f64d592 | ||
|
|
b6e018eb18 | ||
|
|
8bcddf4333 | ||
|
|
34940ecde7 | ||
|
|
dafd97e6e1 | ||
|
|
593d35903d | ||
|
|
1856f65a18 | ||
|
|
9066c4af7f | ||
|
|
cf9a10af4e | ||
|
|
2d7af5622f | ||
|
|
974f5ff5fa | ||
|
|
88dc8af9a4 | ||
|
|
7c33759cbe | ||
|
|
baf009af3a | ||
|
|
b59dfa8991 | ||
|
|
e43a587ede | ||
|
|
00d77213c6 | ||
|
|
389a616138 | ||
|
|
07b029ff2b | ||
|
|
1043b40246 | ||
|
|
d0385ab8bb | ||
|
|
03347ed416 | ||
|
|
e9f0148287 | ||
|
|
0f7131d9e7 | ||
|
|
bf9b42c76c | ||
|
|
a635429d3e | ||
|
|
bd1e4224cd | ||
|
|
568621858e | ||
|
|
3df2209227 | ||
|
|
1da052e36f | ||
|
|
66b95a46ed | ||
|
|
92ba9edeee | ||
|
|
680092719f | ||
|
|
1afbadd404 | ||
|
|
2c190cf2f2 | ||
|
|
17d798a3e8 | ||
|
|
287714d87b | ||
|
|
029aaf8127 | ||
|
|
bbf1bec942 | ||
|
|
bd34a94587 | ||
|
|
86c54228f8 | ||
|
|
c66bf7c249 | ||
|
|
fd0f01e49a | ||
|
|
cfddb40c2f | ||
|
|
19d4eb8489 | ||
|
|
9bb7925bd2 | ||
|
|
e340ddcec9 | ||
|
|
e0b6261454 | ||
|
|
d741daca19 | ||
|
|
970c8d71b5 | ||
|
|
b6801b2fe5 | ||
|
|
5cd26f877e | ||
|
|
105ad32f98 | ||
|
|
e3566a4cc9 | ||
|
|
5e63549b8c | ||
|
|
5b08961c35 | ||
|
|
3c6ab7b676 | ||
|
|
23e55c9c40 | ||
|
|
ffa442f844 | ||
|
|
6d75455dd1 | ||
|
|
0d89320364 | ||
|
|
1984cc2118 | ||
|
|
3248ee4715 | ||
|
|
b2b08e698e | ||
|
|
3a612b9450 | ||
|
|
9746e92479 | ||
|
|
9d723af15d | ||
|
|
8e925a02b9 | ||
|
|
d898300c5c | ||
|
|
4294df8fd7 | ||
|
|
365209174b | ||
|
|
0c852409b3 | ||
|
|
9fb8bab84e | ||
|
|
c7e1c980b6 | ||
|
|
0516e97461 | ||
|
|
fd5b16abb3 | ||
|
|
1a9281ab63 | ||
|
|
c9038be25f | ||
|
|
b3cf460bda | ||
|
|
7fddf52368 | ||
|
|
4a96535892 | ||
|
|
93f614fdfc | ||
|
|
40997fb4a4 | ||
|
|
c3adbb32f1 | ||
|
|
3974a0331b | ||
|
|
92c6c8cfa3 | ||
|
|
ea313aae4a | ||
|
|
272c38a6d0 | ||
|
|
7f11e1eebb | ||
|
|
06429d050a | ||
|
|
ed07a12d24 | ||
|
|
493db6d129 | ||
|
|
d07f16f43f | ||
|
|
f580f3b060 | ||
|
|
e7869d8221 | ||
|
|
398e3eb75f | ||
|
|
0637a82e40 | ||
|
|
206ded17c8 | ||
|
|
847f534ff6 | ||
|
|
b38f0b1a59 | ||
|
|
efbeb5bf68 | ||
|
|
1f09c717f3 | ||
|
|
52ed881e2c | ||
|
|
393e1951a2 | ||
|
|
ca7c7daf6c | ||
|
|
697da0679a | ||
|
|
1b75cad94f | ||
|
|
82e5d9b924 | ||
|
|
e44717f262 | ||
|
|
9c83b91850 | ||
|
|
f027ae4566 | ||
|
|
724cd1c9b8 | ||
|
|
f44178bec3 | ||
|
|
877267cd31 | ||
|
|
3572bf4739 | ||
|
|
7867fb7f1f | ||
|
|
a3b1059c21 | ||
|
|
076d960072 | ||
|
|
acb6677aff | ||
|
|
c916f9a90b | ||
|
|
71b6dfc0b1 | ||
|
|
5fe8a394ba | ||
|
|
69d3d96d79 | ||
|
|
1e6f69361d | ||
|
|
cb71e8159c | ||
|
|
809525b1bd | ||
|
|
b81ccd4f15 | ||
|
|
c50871e76b | ||
|
|
1206fca623 | ||
|
|
140be08fbb | ||
|
|
b218279e7f | ||
|
|
5664d6746d | ||
|
|
ac747032ce | ||
|
|
42db88fa74 | ||
|
|
a52809279e | ||
|
|
07f73179cd | ||
|
|
d1c4e94499 | ||
|
|
481335487e | ||
|
|
ef0e8497ce | ||
|
|
06c5917dbf | ||
|
|
f0d1f668fe | ||
|
|
583eb39799 | ||
|
|
a0ebf263e3 | ||
|
|
898101b18e | ||
|
|
25f4ffda47 | ||
|
|
796e6e4405 | ||
|
|
5a4e73574d | ||
|
|
e4e3f30b84 | ||
|
|
b15639af05 | ||
|
|
009371129a | ||
|
|
09553d6b8e | ||
|
|
d736537261 | ||
|
|
c0fbc4f262 | ||
|
|
cc33dc08e8 | ||
|
|
f6558cef8e |
+10
-19
@@ -1,34 +1,25 @@
|
||||
# Last match in file takes precedence.
|
||||
# See https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners#example-of-a-codeowners-file
|
||||
|
||||
# C# code
|
||||
/Content.*/ @DeltaV-Station/maintainers
|
||||
|
||||
# Any assets
|
||||
/Resources/ @DeltaV-Station/maintainers
|
||||
* @DeltaV-Station/maintainers
|
||||
|
||||
# Server config files
|
||||
/Resources/ConfigPresets/ @Toby222
|
||||
/Resources/ConfigPresets/ @DeltaV-Station/lead-maintainers
|
||||
|
||||
# Github workflows
|
||||
/.github/ @DeltaV-Station/lead-maintainers
|
||||
|
||||
# Lobby art and music - automatically direction issues since its immediately visible to players
|
||||
/Resources/Audio/Lobby/ @DeltaV-Station/direction
|
||||
/Resources/Textures/LobbyScreens/ @DeltaV-Station/direction
|
||||
/Resources/Audio/Lobby/ @DeltaV-Station/direction @DeltaV-Station/maintainers
|
||||
/Resources/Textures/LobbyScreens/ @DeltaV-Station/direction @DeltaV-Station/maintainers
|
||||
|
||||
# Maps
|
||||
/Resources/Maps/ @DeltaV-Station/maptainers
|
||||
/Resources/Prototypes/Maps/ @DeltaV-Station/maptainers
|
||||
/Content.IntegrationTests/Tests/PostMapInitTest.cs @DeltaV-Station/maptainers
|
||||
/Content.IntegrationTests/Tests/PostMapInitTest.cs @DeltaV-Station/maptainers @DeltaV-Station/maintainers
|
||||
|
||||
# Server rules
|
||||
/Resources/ServerInfo/Guidebook/_DV/Rules/ @DeltaV-Station/head-administrators
|
||||
|
||||
# Wiki
|
||||
/.wiki/ @DeltaV-Station/direction
|
||||
|
||||
# Tools and scripts
|
||||
/Tools/ @Toby222
|
||||
|
||||
# Workflows, codeowners, templates, etc.
|
||||
/.github/ @Toby222
|
||||
|
||||
# Standalone files in the root repo
|
||||
/* @Toby222
|
||||
/.wiki/ @DeltaV-Station/direction
|
||||
@@ -26,7 +26,7 @@ This just saves them the trouble. Note that AGPL or MIT licensing is only applic
|
||||
- [ ] I confirm that I am the creator of the code in this PR, and allow licensing it under the following license(s), or that the original author(s) has given me permission to do so:
|
||||
- [X] AGPL (https://github.com/DeltaV-Station/Delta-v/blob/master/LICENSE-AGPLv3.txt) <!-- This one is required to contribute to DeltaV -->
|
||||
- [X] MIT (https://github.com/DeltaV-Station/Delta-v/blob/master/LICENSE-MIT.txt) <!-- Optional - A lot of other SS14 forks use MIT -->
|
||||
<!-- Feel free to add more licenses as you see fit -->
|
||||
<!-- Feel free to add more licenses as you see fit -->
|
||||
|
||||
**Changelog**
|
||||
<!-- Add a Changelog entry to make players aware of new features or changes that could affect gameplay.
|
||||
|
||||
@@ -59,7 +59,7 @@ public sealed partial class BountyEntry : BoxContainer
|
||||
|
||||
var claimedByText = string.IsNullOrEmpty(bounty.ClaimedBy) ? Loc.GetString("bounty-console-claimed-by-none") : bounty.ClaimedBy;
|
||||
ClaimedBylabel.SetMarkup(Loc.GetString("bounty-console-claimed-by", ("claimant", claimedByText)));
|
||||
StatusLabel.SetMarkup(Loc.GetString($"bounty-console-formatted-status-{bounty.Status.ToString()}"));
|
||||
StatusLabel.SetMarkup(Loc.GetString($"bounty-console-status-formatted-{bounty.Status.ToString()}"));
|
||||
// End DeltaV bounty claiming
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@ namespace Content.Client.Communications.UI
|
||||
_menu.OnBroadcast += BroadcastButtonPressed;
|
||||
_menu.OnAlertLevel += AlertLevelSelected;
|
||||
_menu.OnEmergencyLevel += EmergencyShuttleButtonPressed;
|
||||
_menu.OnExfiltrationLevel += ExfiltrationShuttleButtonPressed; // DeltaV - Exfiltration shuttle
|
||||
}
|
||||
|
||||
public void AlertLevelSelected(string level)
|
||||
@@ -48,13 +47,6 @@ namespace Content.Client.Communications.UI
|
||||
CallShuttle();
|
||||
}
|
||||
|
||||
// Begin DeltaV - Exfiltration Shuttle
|
||||
public void ExfiltrationShuttleButtonPressed()
|
||||
{
|
||||
SendMessage(new CommunicationsConsoleExfiltrationShuttleMessage(!_menu!.CountdownStarted));
|
||||
}
|
||||
// End DeltaV - Exfiltration Shuttle
|
||||
|
||||
public void AnnounceButtonPressed(string message)
|
||||
{
|
||||
var maxLength = _cfg.GetCVar(CCVars.ChatMaxAnnouncementLength);
|
||||
@@ -94,13 +86,6 @@ namespace Content.Client.Communications.UI
|
||||
_menu.CurrentLevel = commsState.CurrentAlert;
|
||||
_menu.CountdownEnd = commsState.ExpectedCountdownEnd;
|
||||
|
||||
|
||||
// Begin DeltaV - Exfiltration Shuttle
|
||||
_menu.CanExfiltrate = commsState.CanCall;
|
||||
_menu.ExfiltrationCountdownEnd = commsState.ExpectedExfiltrationCountdownEnd;
|
||||
_menu.ExfiltrationShuttleButton.Disabled = !_menu.CanExfiltrate;
|
||||
// End DeltaV - Exfiltration Shuttle
|
||||
|
||||
_menu.UpdateCountdown();
|
||||
_menu.UpdateAlertLevels(commsState.AlertLevels, _menu.CurrentLevel);
|
||||
_menu.AlertLevelButton.Disabled = !_menu.AlertLevelSelectable;
|
||||
|
||||
@@ -52,19 +52,10 @@
|
||||
|
||||
<RichTextLabel Name="CountdownLabel"/>
|
||||
|
||||
<!-- DeltaV - Exfiltration Shuttle -->
|
||||
<RichTextLabel Name="ExfiltrationCountdownLabel"/>
|
||||
|
||||
<Button Name="EmergencyShuttleButton"
|
||||
Access="Public"
|
||||
Text="Placeholder Text"
|
||||
ToolTip="{Loc 'comms-console-menu-emergency-shuttle-button-tooltip'}"/>
|
||||
|
||||
<!-- DeltaV - Exfiltration Shuttle -->
|
||||
<Button Name="ExfiltrationShuttleButton"
|
||||
Access="Public"
|
||||
Text="Placeholder Text"
|
||||
ToolTip="{Loc 'comms-console-menu-exfiltration-shuttle-button-tooltip'}"/>
|
||||
</BoxContainer>
|
||||
</BoxContainer>
|
||||
</BoxContainer>
|
||||
|
||||
@@ -29,12 +29,6 @@ namespace Content.Client.Communications.UI
|
||||
public event Action<string>? OnAnnounce;
|
||||
public event Action<string>? OnBroadcast;
|
||||
|
||||
// Begin DeltaV - Exfiltration Shuttle
|
||||
public bool CanExfiltrate;
|
||||
public TimeSpan? ExfiltrationCountdownEnd;
|
||||
public event Action? OnExfiltrationLevel;
|
||||
// End DeltaV - Exfiltration Shuttle
|
||||
|
||||
public CommunicationsConsoleMenu()
|
||||
{
|
||||
IoCManager.InjectDependencies(this);
|
||||
@@ -78,18 +72,12 @@ namespace Content.Client.Communications.UI
|
||||
|
||||
EmergencyShuttleButton.OnPressed += _ => OnEmergencyLevel?.Invoke();
|
||||
EmergencyShuttleButton.Disabled = !CanCall;
|
||||
|
||||
// Begin DeltaV - Exfiltration Shuttle
|
||||
ExfiltrationShuttleButton.OnPressed += _ => OnExfiltrationLevel?.Invoke();
|
||||
ExfiltrationShuttleButton.Disabled = !CanExfiltrate;
|
||||
// End DeltaV - Exfiltration Shuttle
|
||||
}
|
||||
|
||||
protected override void FrameUpdate(FrameEventArgs args)
|
||||
{
|
||||
base.FrameUpdate(args);
|
||||
UpdateCountdown();
|
||||
UpdateExfiltrationCountdown(); // DeltaV - Exfiltration shuttle
|
||||
}
|
||||
|
||||
// The current alert could make levels unselectable, so we need to ensure that the UI reacts properly.
|
||||
@@ -129,25 +117,6 @@ namespace Content.Client.Communications.UI
|
||||
}
|
||||
}
|
||||
|
||||
// Begin DeltaV - Exfiltration Shuttle
|
||||
public void UpdateExfiltrationCountdown()
|
||||
{
|
||||
if (ExfiltrationCountdownEnd is null)
|
||||
{
|
||||
ExfiltrationCountdownLabel.SetMessage(string.Empty);
|
||||
ExfiltrationShuttleButton.Text = Loc.GetString("comms-console-menu-call-exfiltration");
|
||||
return;
|
||||
}
|
||||
|
||||
var exfiltrationDiff = MathHelper.Max((ExfiltrationCountdownEnd - _timing.CurTime) ?? TimeSpan.Zero, TimeSpan.Zero);
|
||||
ExfiltrationShuttleButton.Text = Loc.GetString("comms-console-menu-recall-exfiltration");
|
||||
|
||||
var exfiltrationInfoText = Loc.GetString("comms-console-menu-exfiltration-time-remaining",
|
||||
("time", exfiltrationDiff.ToString(@"hh\:mm\:ss", CultureInfo.CurrentCulture)));
|
||||
ExfiltrationCountdownLabel.SetMessage(exfiltrationInfoText);
|
||||
}
|
||||
// End DeltaV - Exfiltration Shuttle
|
||||
|
||||
public void UpdateCountdown()
|
||||
{
|
||||
if (!CountdownStarted)
|
||||
|
||||
@@ -59,9 +59,12 @@
|
||||
<Label Text="{Loc 'health-analyzer-window-entity-temperature-text'}" />
|
||||
<Label Name="TemperatureLabel" />
|
||||
<Label Text="{Loc 'health-analyzer-window-entity-blood-level-text'}" />
|
||||
<Label Name="BloodLabel" />
|
||||
<Label Text="{Loc 'health-analyzer-window-entity-damage-total-text'}" />
|
||||
<Label Name="DamageLabel" />
|
||||
<!-- Begin DeltaV - Health Analyzer Plus -->
|
||||
<Label Name="BloodLevelLabel" />
|
||||
<!-- Label Name="BloodLabel" / -->
|
||||
<!-- Label Text="{Loc 'health-analyzer-window-entity-damage-total-text'}" / -->
|
||||
<!-- Label Name="DamageLabel" / -->
|
||||
<!-- End DeltaV - Health Analyzer Plus -->
|
||||
</GridContainer>
|
||||
</BoxContainer>
|
||||
|
||||
@@ -73,10 +76,41 @@
|
||||
|
||||
<PanelContainer StyleClasses="LowDivider" />
|
||||
|
||||
<BoxContainer
|
||||
Name="GroupsContainer"
|
||||
Margin="0 5 0 5"
|
||||
Orientation="Vertical">
|
||||
</BoxContainer>
|
||||
<!-- Begin DeltaV - Health Analyzer Plus -->
|
||||
<!-- BoxContainer Name="GroupsContainer" Margin="0 5 0 5" Orientation="Vertical" -->
|
||||
<!-- /BoxContainer -->
|
||||
|
||||
<GridContainer Margin="0 5 0 5" Columns="3" HorizontalAlignment="Center">
|
||||
<BoxContainer Name="DamageBox" Margin="5 5 5 5" Orientation="Vertical">
|
||||
<Label Name="TotalDamageLabel" HorizontalAlignment="Center" />
|
||||
<PanelContainer Name="DamageGroupsDivider" StyleClasses="LowDivider" />
|
||||
<Label
|
||||
Name="NoDamageLabel"
|
||||
HorizontalAlignment="Center"
|
||||
Text="{Loc 'health-analyzer-plus-window-no-damage-text'}"
|
||||
FontColorOverride="DeepSkyBlue"
|
||||
Margin="0 5 0 5" />
|
||||
<BoxContainer HorizontalAlignment="Center">
|
||||
<BoxContainer Name="DamageGroupsContainer" Margin="0 5 0 5" Orientation="Vertical" />
|
||||
</BoxContainer>
|
||||
</BoxContainer>
|
||||
|
||||
<PanelContainer StyleClasses="LowDivider" />
|
||||
|
||||
<BoxContainer Name="BloodstreamBox" Margin="5 5 5 5" Orientation="Vertical">
|
||||
<Label Name="TotalReagentQuantityLabel" HorizontalAlignment="Center" />
|
||||
<PanelContainer Name="BloodstreamReagentsDivider" StyleClasses="LowDivider" />
|
||||
<Label
|
||||
Name="NoReagentsLabel"
|
||||
HorizontalAlignment="Center"
|
||||
Text="{Loc 'health-analyzer-plus-window-no-reagents-text'}"
|
||||
FontColorOverride="DeepSkyBlue"
|
||||
Margin="0 5 0 5" />
|
||||
<BoxContainer HorizontalAlignment="Center">
|
||||
<BoxContainer Name="BloodstreamReagentListContainer" Orientation="Vertical" Margin="0 5 0 5" />
|
||||
</BoxContainer>
|
||||
</BoxContainer>
|
||||
</GridContainer>
|
||||
<!-- End DeltaV - Health Analyzer Plus -->
|
||||
|
||||
</BoxContainer>
|
||||
|
||||
@@ -19,12 +19,25 @@ using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.XAML;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
// BEGIN DeltaV
|
||||
using Content.Client._DV.Traits.Assorted;
|
||||
using Content.Shared._DV.Traits.Assorted;
|
||||
using Content.Shared._DV.Medical; // Uncloneable
|
||||
using Content.Shared._DV.MedicalRecords; // Medical Records
|
||||
|
||||
// Health Analyzer Plus
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.Body.Systems;
|
||||
using Content.Client.Body.Systems;
|
||||
using Content.Shared.Chemistry.EntitySystems;
|
||||
using Content.Client.Chemistry.Containers.EntitySystems;
|
||||
using Content.Shared.Body.Components;
|
||||
// END DeltaV
|
||||
namespace Content.Client.HealthAnalyzer.UI;
|
||||
|
||||
using Content.Client._DV.Traits.Assorted; // DeltaV
|
||||
using Content.Shared._DV.Traits.Assorted; // DeltaV
|
||||
using Content.Shared._DV.Medical; // DeltaV - Uncloneable
|
||||
using Content.Shared._DV.MedicalRecords; // DeltaV - Medical Records
|
||||
|
||||
|
||||
// Health analyzer UI is split from its window because it's used by both the
|
||||
// health analyzer item and the cryo pod UI.
|
||||
@@ -32,6 +45,8 @@ using Content.Shared._DV.MedicalRecords; // DeltaV - Medical Records
|
||||
[GenerateTypedNameReferences]
|
||||
public sealed partial class HealthAnalyzerControl : BoxContainer
|
||||
{
|
||||
private const string REAGENT_GROUP_MEDICINE = "Medicine"; // DeltaV - Health Analyzer
|
||||
|
||||
private readonly IEntityManager _entityManager;
|
||||
private readonly SpriteSystem _spriteSystem;
|
||||
private readonly IPrototypeManager _prototypes;
|
||||
@@ -41,6 +56,8 @@ public sealed partial class HealthAnalyzerControl : BoxContainer
|
||||
private readonly UnborgableSystem _unborgable; // DeltaV
|
||||
private readonly RedshirtSystem _redshirt; // DeltaV
|
||||
private readonly UncloneableSystem _uncloneable; // DeltaV
|
||||
private readonly SharedBloodstreamSystem _bloodstream; // DeltaV
|
||||
private readonly SharedSolutionContainerSystem _solutionContainer; // DeltaV
|
||||
|
||||
// Begin DeltaV - Medical Records
|
||||
private readonly ButtonGroup _triageStatusGroup = new();
|
||||
@@ -66,6 +83,8 @@ public sealed partial class HealthAnalyzerControl : BoxContainer
|
||||
_unborgable = _entityManager.System<UnborgableSystem>(); // DeltaV
|
||||
_redshirt = _entityManager.System<RedshirtSystem>(); // DeltaV
|
||||
_uncloneable = _entityManager.System<UncloneableSystem>(); // DeltaV
|
||||
_bloodstream = _entityManager.System<BloodstreamSystem>(); // DeltaV
|
||||
_solutionContainer = _entityManager.System<SolutionContainerSystem>(); // DeltaV
|
||||
|
||||
// Begin DeltaV - Medical Records
|
||||
foreach (var item in Enum.GetValues<TriageStatus>())
|
||||
@@ -138,9 +157,13 @@ public sealed partial class HealthAnalyzerControl : BoxContainer
|
||||
? $"{state.Temperature - Atmospherics.T0C:F1} °C ({state.Temperature:F1} K)"
|
||||
: Loc.GetString("health-analyzer-window-entity-unknown-value-text");
|
||||
|
||||
// Begin DeltaV - Health Analyzer Plus
|
||||
/*
|
||||
BloodLabel.Text = !float.IsNaN(state.BloodLevel)
|
||||
? $"{state.BloodLevel * 100:F1} %"
|
||||
: Loc.GetString("health-analyzer-window-entity-unknown-value-text");
|
||||
*/
|
||||
// End DeltaV - Health Analyzer Plus
|
||||
|
||||
StatusLabel.Text =
|
||||
_entityManager.TryGetComponent<MobStateComponent>(target.Value, out var mobStateComponent)
|
||||
@@ -149,16 +172,19 @@ public sealed partial class HealthAnalyzerControl : BoxContainer
|
||||
|
||||
// Total Damage
|
||||
|
||||
DamageLabel.Text = _damageable.GetTotalDamage(target.Value).ToString();
|
||||
// DamageLabel.Text = _damageable.GetTotalDamage(target.Value).ToString(); // DeltaV - Health Analyzer Plus
|
||||
|
||||
// Alerts
|
||||
// DeltaV traits - This is going to be horrid if we just keep adding things like this.
|
||||
var unborgable = _unborgable.IsUnborgable(target.Value);
|
||||
var redshirt = _redshirt.IsRedshirt(target.Value) && mobStateComponent?.CurrentState == MobState.Dead; // DeltaV - Redshirt
|
||||
var uncloneable = _uncloneable.IsUncloneable(target.Value) && mobStateComponent?.CurrentState == MobState.Dead; // DeltaV - Unclonable
|
||||
|
||||
// I'm just going to lump them all into 'extraTraitAlerts' to group our modifications as a single bool in the next check
|
||||
var extraTraitAlerts = unborgable || redshirt || uncloneable;
|
||||
// END DeltaV
|
||||
|
||||
var showAlerts = state.Unrevivable == true || state.Bleeding == true;
|
||||
var showAlerts = state.Unrevivable == true || state.Bleeding == true || extraTraitAlerts; // DeltaV - extra alerts
|
||||
|
||||
AlertsDivider.Visible = showAlerts;
|
||||
AlertsContainer.Visible = showAlerts;
|
||||
@@ -216,6 +242,7 @@ public sealed partial class HealthAnalyzerControl : BoxContainer
|
||||
var damagePerType = _damageable.GetAllDamage(target.Value).DamageDict;
|
||||
|
||||
DrawDiagnosticGroups(damageSortedGroups, damagePerType);
|
||||
DrawBloodstreamInfo(target.Value, state.BloodSolution, state.BloodLevel); // End DeltaV - Health Analyzer Plus
|
||||
|
||||
// Begin DeltaV - Medical Records
|
||||
if (state.MedicalRecord is not { } records)
|
||||
@@ -254,7 +281,15 @@ public sealed partial class HealthAnalyzerControl : BoxContainer
|
||||
Dictionary<ProtoId<DamageGroupPrototype>, FixedPoint2> groups,
|
||||
IReadOnlyDictionary<ProtoId<DamageTypePrototype>, FixedPoint2> damageDict)
|
||||
{
|
||||
GroupsContainer.RemoveAllChildren();
|
||||
// Begin DeltaV - Health Analyzer Plus
|
||||
// GroupsContainer.RemoveAllChildren();
|
||||
DamageGroupsContainer.RemoveAllChildren();
|
||||
|
||||
// Begin DeltaV - Health Analyzer Plus
|
||||
var totalDamage = damageDict.Sum(x => x.Value.Double());
|
||||
TotalDamageLabel.Text = Loc.GetString("health-analyzer-plus-window-entity-total-damage-text", ("amount", Math.Round(totalDamage, 2)));
|
||||
NoDamageLabel.Visible = totalDamage == 0;
|
||||
// End DeltaV - Health Analyzer Plus
|
||||
|
||||
foreach (var (damageGroupId, damageAmount) in groups)
|
||||
{
|
||||
@@ -275,7 +310,8 @@ public sealed partial class HealthAnalyzerControl : BoxContainer
|
||||
|
||||
groupContainer.AddChild(CreateDiagnosticGroupTitle(groupTitleText, damageGroupId));
|
||||
|
||||
GroupsContainer.AddChild(groupContainer);
|
||||
// GroupsContainer.AddChild(groupContainer); // DeltaV - Health Analyzer Plus
|
||||
DamageGroupsContainer.AddChild(groupContainer); // DeltaV - Health Analyzer Plus
|
||||
|
||||
// Show the damage for each type in that group.
|
||||
var group = _prototypes.Index(damageGroupId);
|
||||
@@ -296,6 +332,116 @@ public sealed partial class HealthAnalyzerControl : BoxContainer
|
||||
}
|
||||
}
|
||||
|
||||
// Begin DeltaV - Health Analyzer Plus
|
||||
private void DrawBloodstreamInfo(EntityUid target, Solution? bloodSolution, float bloodlevel)
|
||||
{
|
||||
BloodstreamReagentListContainer.RemoveAllChildren();
|
||||
|
||||
List<ReagentQuantity> bloodstream = new();
|
||||
double totalReagentQuantity = 0;
|
||||
double unknownReagents = 0;
|
||||
// Make sure we can access the bloodtype and reagents before trying to use them
|
||||
if (bloodSolution is not null)
|
||||
{
|
||||
if (!_entityManager.TryGetComponent<BloodstreamComponent>(target, out var bloodstreamComp) ||
|
||||
!_solutionContainer.ResolveSolution(target, bloodstreamComp.BloodSolutionName, ref bloodstreamComp.BloodSolution, out var bloodReagentSolution))
|
||||
return;
|
||||
|
||||
// Get the blood reagent IDs to ignore in the scan
|
||||
var bloodReagentIds = bloodstreamComp.BloodReferenceSolution.Select(b => b.Reagent);
|
||||
|
||||
// Get all of the medicines in the bloodstream
|
||||
foreach (var reagent in bloodSolution!.Contents)
|
||||
{
|
||||
if (bloodReagentIds.Contains(reagent.Reagent))
|
||||
continue;
|
||||
|
||||
if (_prototypes.Index<ReagentPrototype>(reagent.Reagent.Prototype).Group == REAGENT_GROUP_MEDICINE)
|
||||
{
|
||||
bloodstream.Add(reagent);
|
||||
totalReagentQuantity += reagent.Quantity.Double();
|
||||
}
|
||||
else
|
||||
{
|
||||
unknownReagents += reagent.Quantity.Double();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var bloodQuantityPercent = !float.IsNaN(bloodlevel)
|
||||
? $"{bloodlevel * 100:F1} %"
|
||||
: Loc.GetString("health-analyzer-window-entity-unknown-value-text");
|
||||
|
||||
// Display the percent and amount of blood in the system
|
||||
// Normal health scanner is percent only, this one adds the actual units too
|
||||
BloodLevelLabel.Text = Loc.GetString(
|
||||
"health-analyzer-plus-window-entity-blood-level-quantity-text",
|
||||
("percent", bloodQuantityPercent)
|
||||
);
|
||||
|
||||
// Display the total amount of reagents in the bloodstream, 0 is valid
|
||||
TotalReagentQuantityLabel.Text = Loc.GetString(
|
||||
"health-analyzer-plus-window-entity-total-reagents-text",
|
||||
("amount", Math.Round(totalReagentQuantity, 1).ToString("0.0"))
|
||||
);
|
||||
|
||||
// If the bloodstream was empty, display a message instead to fill the space with something
|
||||
NoReagentsLabel.Visible = bloodstream.Count == 0 && unknownReagents == 0;
|
||||
|
||||
// For each of the reagents in the bloodstream, add them to the list of reagents
|
||||
// If there are none, this loop will simply do nothing
|
||||
foreach (var (reagentID, reagentQuantity) in bloodstream)
|
||||
{
|
||||
var reagentPrototype = _prototypes.Index<ReagentPrototype>(reagentID.Prototype);
|
||||
|
||||
// Make a new container for each reagent we add to the list
|
||||
var reagentContainer = new BoxContainer
|
||||
{
|
||||
Align = AlignMode.Begin,
|
||||
Orientation = LayoutOrientation.Vertical
|
||||
};
|
||||
|
||||
// Add the string "[] <reagent_name>: <reagent_amount>u" for the current reagent
|
||||
// The [] is a unicode block character, and is colored with the reagent color
|
||||
// to make it easier to identify
|
||||
reagentContainer.AddChild(
|
||||
new RichTextLabel
|
||||
{
|
||||
Text = Loc.GetString("health-analyzer-plus-window-reagent-text",
|
||||
("reagentColor", reagentPrototype.SubstanceColor),
|
||||
("reagentName", reagentPrototype.LocalizedName),
|
||||
("amount", Math.Round(reagentQuantity.Double(), 1).ToString("0.0"))
|
||||
)
|
||||
}
|
||||
);
|
||||
|
||||
BloodstreamReagentListContainer.AddChild(reagentContainer);
|
||||
}
|
||||
|
||||
// Add unknown reagents (if any)
|
||||
if (unknownReagents > 0)
|
||||
{
|
||||
var unknownReagentContainer = new BoxContainer
|
||||
{
|
||||
Align = AlignMode.Begin,
|
||||
Orientation = LayoutOrientation.Vertical
|
||||
};
|
||||
|
||||
unknownReagentContainer.AddChild(
|
||||
new RichTextLabel
|
||||
{
|
||||
Text = Loc.GetString("health-analyzer-plus-window-unknown-reagents-text",
|
||||
("amount", Math.Round(unknownReagents, 1).ToString("0.0"))
|
||||
)
|
||||
}
|
||||
);
|
||||
BloodstreamReagentListContainer.AddChild(unknownReagentContainer);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
// End DeltaV - Health Analyzer Plus
|
||||
|
||||
private Texture GetTexture(string texture)
|
||||
{
|
||||
var rsiPath = new ResPath("/Textures/Objects/Devices/health_analyzer.rsi");
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
<ScrollContainer
|
||||
Margin="5 5 5 5"
|
||||
ReturnMeasure="True"
|
||||
VerticalExpand="True">
|
||||
VerticalExpand="True"
|
||||
VScrollBarHidden="True"
|
||||
HScrollBarHidden="True"> <!-- DeltaV - Hide the scroll bars -->
|
||||
|
||||
<ui:HealthAnalyzerControl
|
||||
Name="HealthAnalyzer"
|
||||
|
||||
@@ -32,10 +32,10 @@ namespace Content.Client.Labels.UI
|
||||
}
|
||||
|
||||
_window.OnLabelChanged += OnLabelChanged;
|
||||
_window.OnLabelSelected += OnLabelSelected; // Starlight
|
||||
Reload();
|
||||
_window.SetInitialLabelState(); // Must be after Reload() has set the label text
|
||||
}
|
||||
|
||||
private void OnLabelChanged(string newLabel)
|
||||
{
|
||||
// Focus moment
|
||||
@@ -45,7 +45,17 @@ namespace Content.Client.Labels.UI
|
||||
|
||||
SendPredictedMessage(new HandLabelerLabelChangedMessage(newLabel));
|
||||
}
|
||||
|
||||
// Starlight start
|
||||
private void OnLabelSelected(string label)
|
||||
{
|
||||
// Update UI and send message to sync with server
|
||||
if (_window != null)
|
||||
{
|
||||
_window.SetCurrentLabel(label);
|
||||
}
|
||||
SendPredictedMessage(new HandLabelerLabelChangedMessage(label));
|
||||
}
|
||||
// Starlight End
|
||||
public void Reload()
|
||||
{
|
||||
if (_window == null || !_entManager.TryGetComponent(Owner, out HandLabelerComponent? component))
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
<DefaultWindow xmlns="https://spacestation14.io"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
|
||||
Title="{Loc 'hand-labeler-ui-header'}"
|
||||
SetWidth="400"
|
||||
MinWidth="150">
|
||||
MinWidth="150"
|
||||
SetHeight="400"> <!-- Starlight - include gfx and set default height to include saved labels section nicely -->
|
||||
<BoxContainer Orientation="Vertical" SeparationOverride="4">
|
||||
<Label Name="CurrentTextLabel" Text="{Loc 'hand-labeler-current-text-label'}" />
|
||||
<LineEdit Name="LabelLineEdit" />
|
||||
@@ -10,5 +12,19 @@
|
||||
<Button Name="ResetLabelButton" Text="{Loc 'hand-labeler-ui-reset-label-text'}" StyleClasses="OpenRight" />
|
||||
<Button Name="ClearLabelButton" Text="{Loc 'hand-labeler-ui-clear-label-text'}" StyleClasses="OpenLeft" />
|
||||
</BoxContainer>
|
||||
<!-- Starlight Begin -->
|
||||
<Label Text="{Loc 'hand-labeler-saved-labels'}" />
|
||||
<PanelContainer VerticalExpand="True" SizeFlagsStretchRatio="1">
|
||||
<PanelContainer.PanelOverride>
|
||||
<gfx:StyleBoxFlat BackgroundColor="#1B1B1E" />
|
||||
</PanelContainer.PanelOverride>
|
||||
<ItemList Name="SavedLabelsList" VerticalExpand="True" SelectMode="Button" />
|
||||
</PanelContainer>
|
||||
|
||||
<BoxContainer Orientation="Horizontal" Align="Center">
|
||||
<Button Name="SaveLabelButton" Text="{Loc 'hand-labeler-save-label-text'}" StyleClasses="OpenRight" />
|
||||
<Button Name="DeleteLabelButton" Text="{Loc 'hand-labeler-delete-label-text'}" StyleClasses="OpenLeft" />
|
||||
</BoxContainer>
|
||||
<!-- Starlight end -->
|
||||
</BoxContainer>
|
||||
</DefaultWindow>
|
||||
|
||||
@@ -1,13 +1,19 @@
|
||||
using Robust.Client.UserInterface.CustomControls;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.UserInterface.XAML;
|
||||
using Robust.Client.UserInterface.Controls; // Starlight
|
||||
using Robust.Shared.Configuration; // Starlight
|
||||
using Content.Shared.Starlight.CCVar; // Starlight
|
||||
|
||||
namespace Content.Client.Labels.UI
|
||||
{
|
||||
[GenerateTypedNameReferences]
|
||||
public sealed partial class HandLabelerWindow : DefaultWindow
|
||||
{
|
||||
[Dependency] private readonly IConfigurationManager _cfg = default!; // Starlight
|
||||
|
||||
public event Action<string>? OnLabelChanged;
|
||||
public event Action<string>? OnLabelSelected; // Starlight
|
||||
|
||||
/// <summary>
|
||||
/// Is the user currently entering text into the control?
|
||||
@@ -17,10 +23,14 @@ namespace Content.Client.Labels.UI
|
||||
|
||||
private string _label = string.Empty;
|
||||
private string _initialLabel = string.Empty;
|
||||
private bool _deleteMode = false; // Starlight
|
||||
private List<string> _savedLabels = []; // Starlight
|
||||
|
||||
public HandLabelerWindow()
|
||||
{
|
||||
RobustXamlLoader.Load(this);
|
||||
IoCManager.InjectDependencies(this); // Starlight
|
||||
LoadSavedLabelsFromCVar(); // Starlight
|
||||
|
||||
LabelLineEdit.OnTextChanged += e =>
|
||||
{
|
||||
@@ -37,6 +47,42 @@ namespace Content.Client.Labels.UI
|
||||
};
|
||||
ResetLabelButton.OnPressed += _ => LabelLineEdit.SetText(_initialLabel, true);
|
||||
ClearLabelButton.OnPressed += _ => LabelLineEdit.SetText("", true);
|
||||
|
||||
// Starlight Begin
|
||||
SaveLabelButton.OnPressed += _ =>
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(_label) && !_savedLabels.Contains(_label))
|
||||
{
|
||||
_savedLabels.Add(_label);
|
||||
SaveSavedLabelsToCVar();
|
||||
UpdateSavedLabels(_savedLabels);
|
||||
}
|
||||
};
|
||||
|
||||
DeleteLabelButton.OnPressed += _ =>
|
||||
{
|
||||
_deleteMode = !_deleteMode;
|
||||
DeleteLabelButton.Pressed = _deleteMode;
|
||||
UpdateButtons();
|
||||
};
|
||||
|
||||
SavedLabelsList.OnItemSelected += args =>
|
||||
{
|
||||
if (_deleteMode)
|
||||
{
|
||||
_savedLabels.RemoveAt(args.ItemIndex);
|
||||
SaveSavedLabelsToCVar();
|
||||
UpdateSavedLabels(_savedLabels);
|
||||
UpdateButtons();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (SavedLabelsList[args.ItemIndex].Metadata is string label)
|
||||
{
|
||||
OnLabelSelected?.Invoke(label);
|
||||
}
|
||||
}
|
||||
}; // Starlight End
|
||||
}
|
||||
|
||||
protected override void Opened()
|
||||
@@ -70,15 +116,68 @@ namespace Content.Client.Labels.UI
|
||||
UpdateButtons();
|
||||
}
|
||||
|
||||
// Starlight begin
|
||||
public void UpdateSavedLabels(List<string> labels)
|
||||
{
|
||||
var items = new List<ItemList.Item>();
|
||||
foreach (var label in labels)
|
||||
{
|
||||
var item = new ItemList.Item(SavedLabelsList)
|
||||
{
|
||||
Text = label,
|
||||
Metadata = label
|
||||
};
|
||||
items.Add(item);
|
||||
}
|
||||
SavedLabelsList.SetItems(items);
|
||||
UpdateButtons();
|
||||
}
|
||||
// Starlight end
|
||||
|
||||
public void UpdateButtons()
|
||||
{
|
||||
ResetLabelButton.Disabled = (LabelLineEdit.Text == _initialLabel);
|
||||
ClearLabelButton.Disabled = (LabelLineEdit.Text == "");
|
||||
}
|
||||
|
||||
// Starlight begin
|
||||
var labelExists = false;
|
||||
foreach (var item in SavedLabelsList)
|
||||
{
|
||||
if ((item.Metadata as string) == _label.Trim())
|
||||
{
|
||||
labelExists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
SaveLabelButton.Disabled = string.IsNullOrWhiteSpace(_label) || labelExists;
|
||||
|
||||
DeleteLabelButton.Text = _deleteMode
|
||||
? Loc.GetString("hand-labeler-delete-mode-text")
|
||||
: Loc.GetString("hand-labeler-delete-label-text");
|
||||
|
||||
// Starlight end
|
||||
}
|
||||
public void SetMaxLabelLength(int maxLength)
|
||||
{
|
||||
LabelLineEdit.IsValid = s => s.Length <= maxLength;
|
||||
}
|
||||
// Starlight begin
|
||||
private void LoadSavedLabelsFromCVar()
|
||||
{
|
||||
var savedLabelsStr = _cfg.GetCVar(StarlightCCVars.HandLabelerSavedLabels);
|
||||
if (!string.IsNullOrEmpty(savedLabelsStr))
|
||||
{
|
||||
_savedLabels = new List<string>(savedLabelsStr.Split('\n', StringSplitOptions.RemoveEmptyEntries));
|
||||
UpdateSavedLabels(_savedLabels);
|
||||
}
|
||||
}
|
||||
|
||||
private void SaveSavedLabelsToCVar()
|
||||
{
|
||||
var savedLabelsStr = string.Join('\n', _savedLabels);
|
||||
_cfg.SetCVar(StarlightCCVars.HandLabelerSavedLabels, savedLabelsStr);
|
||||
_cfg.SaveToFile();
|
||||
}
|
||||
// Starlight end
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@ using Content.Shared.Preferences;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Shared.Enums;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Content.Client._CD.Records.UI; // DeltaV
|
||||
using Content.Shared._DV.Body.Systems; // DeltaV
|
||||
|
||||
namespace Content.Client.Lobby.UI;
|
||||
|
||||
@@ -193,6 +195,7 @@ public sealed partial class HumanoidProfileEditor
|
||||
RefreshLoadouts();
|
||||
UpdateSexControls(); // update sex for new species
|
||||
UpdateSpeciesGuidebookIcon();
|
||||
UpdateHeightControls(); // DeltaV
|
||||
ReloadPreview();
|
||||
}
|
||||
|
||||
@@ -204,23 +207,22 @@ public sealed partial class HumanoidProfileEditor
|
||||
ReloadProfilePreview();
|
||||
}
|
||||
|
||||
|
||||
private void UpdateHeightControls()
|
||||
{
|
||||
if (Profile == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var species = _species.Find(x => x.ID == Profile.Species);
|
||||
if (species != null)
|
||||
_defaultHeight = species.DefaultHeight;
|
||||
var prototype = _prototypeManager.Index(Profile.Species);
|
||||
_defaultHeight = prototype.DefaultHeight;
|
||||
|
||||
var prototype = _prototypeManager.Index<SpeciesPrototype>(Profile.Species);
|
||||
var sliderPercent = (Profile.Height - prototype.MinHeight) /
|
||||
(prototype.MaxHeight - prototype.MinHeight);
|
||||
CDHeightSlider.Value = sliderPercent;
|
||||
CDHeight.Text = Profile.Height.ToString(CultureInfo.InvariantCulture);
|
||||
|
||||
var scaleReference = _defaultHeight * prototype.BaseScale.Y;
|
||||
var newHeight = MathF.Round(MathHelper.Lerp(prototype.MinHeight, prototype.MaxHeight, sliderPercent), 2);
|
||||
CDHeightLabel.Text = UnitConversion.GetMetricAndImperialDisplayFromScale(scaleReference * newHeight);
|
||||
CDPullSpeedReductionLabel.Text = SmallCharacterSystem.GetPullSpeedPenaltyDisplayFromScale(newHeight);
|
||||
}
|
||||
// End CD - Character Records
|
||||
|
||||
|
||||
@@ -73,9 +73,13 @@
|
||||
<BoxContainer HorizontalExpand="True">
|
||||
<Label Text="{Loc 'humanoid-profile-editor-height-label'}" />
|
||||
<Control HorizontalExpand="True" />
|
||||
<Label Name="CDHeightLabel" />
|
||||
<Slider Name="CDHeightSlider" HorizontalAlignment="Right" SetWidth="300" MinValue="0.0" MaxValue="1.0"/>
|
||||
<LineEdit HorizontalAlignment="Right" Name="CDHeight" MinSize="60 0" Text="1.0" />
|
||||
<Button Name="CDHeightReset" Text="{Loc 'humanoid-profile-editor-reset-height-button'}" HorizontalAlignment="Right"/>
|
||||
</BoxContainer>
|
||||
<BoxContainer HorizontalExpand="True">
|
||||
<Label Text="{Loc 'humanoid-profile-editor-height-pull-speed-penalty-label'}" />
|
||||
<Control HorizontalExpand="True" />
|
||||
<Label Name="CDPullSpeedReductionLabel" />
|
||||
</BoxContainer>
|
||||
<!-- End CD - Character Records -->
|
||||
<!-- Sex -->
|
||||
|
||||
@@ -2,9 +2,6 @@ using Content.Client.Humanoid;
|
||||
using Content.Client.Message;
|
||||
using Content.Client.Players.PlayTimeTracking;
|
||||
using Content.Client.Sprite;
|
||||
using Content.Client.UserInterface.Systems.Guidebook;
|
||||
using Content.Shared._DV.Species; // DeltaV - Species hider
|
||||
using Content.Shared.Body;
|
||||
using Content.Shared.CCVar;
|
||||
using Content.Shared.GameTicking;
|
||||
using Content.Shared.Humanoid;
|
||||
@@ -22,13 +19,8 @@ using Robust.Shared.ContentPack;
|
||||
using Robust.Shared.Enums;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Direction = Robust.Shared.Maths.Direction;
|
||||
// Begin CD - Character Records
|
||||
using System.Globalization;
|
||||
using Content.Client._CD.Records.UI;
|
||||
using Content.Shared._CD.Records;
|
||||
// End CD - Character Records
|
||||
using Content.Shared._DV.Traits;
|
||||
using Content.Shared.Humanoid.Prototypes; // DV - Traits
|
||||
using Content.Client._CD.Records.UI; // CD - Character Records
|
||||
using Content.Shared._DV.Body.Systems; // DV - Traits
|
||||
|
||||
namespace Content.Client.Lobby.UI
|
||||
{
|
||||
@@ -221,34 +213,18 @@ namespace Content.Client.Lobby.UI
|
||||
// Begin CD - Character Records
|
||||
#region CDHeight
|
||||
|
||||
CDHeight.OnTextChanged += args =>
|
||||
{
|
||||
if (Profile is null || !float.TryParse(args.Text, out var newHeight))
|
||||
return;
|
||||
|
||||
var prototype = _prototypeManager.Index<SpeciesPrototype>(Profile.Species);
|
||||
newHeight = MathF.Round(Math.Clamp(newHeight, prototype.MinHeight, prototype.MaxHeight), 2);
|
||||
|
||||
// The percentage between the start and end numbers, aka "inverse lerp"
|
||||
var sliderPercent = (newHeight - prototype.MinHeight) /
|
||||
(prototype.MaxHeight - prototype.MinHeight);
|
||||
CDHeightSlider.Value = sliderPercent;
|
||||
|
||||
SetProfileHeight(newHeight);
|
||||
};
|
||||
|
||||
CDHeightReset.OnPressed += _ =>
|
||||
{
|
||||
CDHeight.SetText(_defaultHeight.ToString(CultureInfo.InvariantCulture), true);
|
||||
};
|
||||
|
||||
CDHeightSlider.OnValueChanged += _ =>
|
||||
{
|
||||
if (Profile is null)
|
||||
return;
|
||||
var prototype = _prototypeManager.Index<SpeciesPrototype>(Profile.Species);
|
||||
|
||||
var prototype = _prototypeManager.Index(Profile.Species);
|
||||
var newHeight = MathF.Round(MathHelper.Lerp(prototype.MinHeight, prototype.MaxHeight, CDHeightSlider.Value), 2);
|
||||
CDHeight.Text = newHeight.ToString(CultureInfo.InvariantCulture);
|
||||
|
||||
var speciesScale = prototype.BaseScale.Y;
|
||||
|
||||
CDHeightLabel.Text = UnitConversion.GetMetricAndImperialDisplayFromScale(newHeight * speciesScale);
|
||||
CDPullSpeedReductionLabel.Text = SmallCharacterSystem.GetPullSpeedPenaltyDisplayFromScale(newHeight);
|
||||
SetProfileHeight(newHeight);
|
||||
};
|
||||
|
||||
|
||||
@@ -88,9 +88,9 @@ public sealed partial class CryoPodWindow : FancyWindow
|
||||
// Health analyzer
|
||||
var maybePatient = _entityManager.GetEntity(msg.Health.TargetEntity);
|
||||
var hasPatient = msg.Health.TargetEntity.HasValue;
|
||||
var hasDamage = hasPatient && msg.HasDamage;
|
||||
// var hasDamage = hasPatient && msg.HasDamage; // DeltaV - Health Analyzer Plus
|
||||
|
||||
NoDamageText.Visible = (hasPatient && !hasDamage);
|
||||
NoDamageText.Visible = false; //(hasPatient && !hasDamage); // DeltaV - Health Analyzer Plus
|
||||
HealthSection.Visible = hasPatient;
|
||||
EjectPatientButton.Disabled = !hasPatient;
|
||||
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
<controls:FancyWindow xmlns="https://spacestation14.io"
|
||||
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
|
||||
xmlns:customControls="clr-namespace:Content.Client.Administration.UI.CustomControls"
|
||||
xmlns:chassisSpriteControls="clr-namespace:Content.Client._CD.Silicons.Borgs.UI"
|
||||
Title="{Loc 'borg-select-type-menu-title'}"
|
||||
SetSize="600 480">
|
||||
SetSize="550 300">
|
||||
<BoxContainer Orientation="Vertical">
|
||||
<BoxContainer Orientation="Horizontal" VerticalExpand="True">
|
||||
<!-- Left pane: selection of borg type -->
|
||||
@@ -30,9 +29,6 @@
|
||||
<RichTextLabel Name="DescriptionLabel" VerticalExpand="True" VerticalAlignment="Top" />
|
||||
</BoxContainer>
|
||||
</Control>
|
||||
|
||||
<chassisSpriteControls:ChassisSpriteSelection Name="ChassisSpriteSelection"/> <!-- CD change -->
|
||||
|
||||
<controls:ConfirmButton Name="ConfirmTypeButton" Text="{Loc 'borg-select-type-menu-confirm'}"
|
||||
Disabled="True" HorizontalAlignment="Right"
|
||||
MinWidth="200" />
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System.Linq;
|
||||
using Content.Client.UserInterface.Controls;
|
||||
using Content.Client.UserInterface.Systems.Guidebook;
|
||||
using Content.Shared._CD.Silicons; // CosmicDrift
|
||||
using Content.Shared.Guidebook;
|
||||
using Content.Shared.Silicons.Borgs;
|
||||
using Content.Shared.Silicons.Borgs.Components;
|
||||
@@ -30,7 +29,6 @@ public sealed partial class BorgSelectTypeMenu : FancyWindow
|
||||
private BorgTypePrototype? _selectedBorgType;
|
||||
|
||||
public event Action<ProtoId<BorgTypePrototype>>? ConfirmedBorgType;
|
||||
public event Action<EntityPrototype?>? ConfirmedBorgSubtype; // CosmicDrift event - borg subtypes
|
||||
|
||||
private static readonly List<ProtoId<GuideEntryPrototype>> GuidebookEntries = new() { "Cyborgs", "Robotics" };
|
||||
|
||||
@@ -58,13 +56,6 @@ public sealed partial class BorgSelectTypeMenu : FancyWindow
|
||||
|
||||
ConfirmTypeButton.OnPressed += ConfirmButtonPressed;
|
||||
HelpGuidebookIds = GuidebookEntries;
|
||||
|
||||
// Start CosmicDrift Changes - borg subtypes
|
||||
ChassisSpriteSelection.SubtypeSelected += () =>
|
||||
{
|
||||
ConfirmTypeButton.Disabled = false;
|
||||
};
|
||||
// End CosmicDrift Changes - borg subtypes
|
||||
}
|
||||
|
||||
private void UpdateInformation(BorgTypePrototype prototype)
|
||||
@@ -96,14 +87,6 @@ public sealed partial class BorgSelectTypeMenu : FancyWindow
|
||||
NameLabel.Text = PrototypeName(prototype);
|
||||
DescriptionLabel.Text = Loc.GetString($"borg-type-{prototype.ID}-desc");
|
||||
ChassisView.SetPrototype(prototype.DummyPrototype);
|
||||
|
||||
// Start CosmicDrift Changes - borg subtypes
|
||||
if (_selectedBorgType != null)
|
||||
{
|
||||
ConfirmTypeButton.Disabled = true;
|
||||
ChassisSpriteSelection.Update(_selectedBorgType);
|
||||
}
|
||||
// End CosmicDrift Changes - borg subtypes
|
||||
}
|
||||
|
||||
private void ConfirmButtonPressed(BaseButton.ButtonEventArgs obj)
|
||||
@@ -111,7 +94,6 @@ public sealed partial class BorgSelectTypeMenu : FancyWindow
|
||||
if (_selectedBorgType == null)
|
||||
return;
|
||||
|
||||
ConfirmedBorgSubtype?.Invoke(ChassisSpriteSelection.SubtypePrototype); // CosmicDrift
|
||||
ConfirmedBorgType?.Invoke(_selectedBorgType);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using Content.Shared._CD.Silicons; // CosmicDrift
|
||||
using Content.Shared._CD.Silicons.Borgs; // CosmicDrift
|
||||
using Content.Shared.Silicons.Borgs.Components;
|
||||
using Content.Shared.Silicons.Borgs.Components;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.UserInterface;
|
||||
|
||||
@@ -28,6 +26,5 @@ public sealed class BorgSelectTypeUserInterface : BoundUserInterface
|
||||
|
||||
_menu = this.CreateWindow<BorgSelectTypeMenu>();
|
||||
_menu.ConfirmedBorgType += prototype => SendPredictedMessage(new BorgSelectTypeMessage(prototype));
|
||||
_menu.ConfirmedBorgSubtype += subtypePrototype => SendPredictedMessage(new BorgSelectSubtypeMessage(subtypePrototype?.ID)); // CosmicDrift - borg subtypes
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
using Content.Client.PDA; // DeltaV
|
||||
using Content.Shared._CD.Silicons.Borgs; // CosmicDrift
|
||||
using Content.Client.PDA; // DeltaV
|
||||
using Content.Shared.Movement.Components;
|
||||
using Content.Shared.Silicons.Borgs;
|
||||
using Content.Shared.Silicons.Borgs.Components;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.ResourceManagement; // CosmicDrift
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations; // CosmicDrift
|
||||
using Robust.Shared.Timing; // CosmicDrift
|
||||
using Robust.Shared.Serialization; // DeltaV
|
||||
|
||||
namespace Content.Client.Silicons.Borgs;
|
||||
|
||||
@@ -20,7 +17,6 @@ public sealed partial class BorgSwitchableTypeSystem : SharedBorgSwitchableTypeS
|
||||
[Dependency] private readonly BorgSystem _borgSystem = default!;
|
||||
[Dependency] private readonly AppearanceSystem _appearance = default!;
|
||||
[Dependency] private readonly SpriteSystem _sprite = default!;
|
||||
[Dependency] private readonly IGameTiming _timing = default!; // CosmicDrift - borg subtypes
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -44,20 +40,15 @@ public sealed partial class BorgSwitchableTypeSystem : SharedBorgSwitchableTypeS
|
||||
Entity<BorgSwitchableTypeComponent> entity,
|
||||
BorgTypePrototype prototype)
|
||||
{
|
||||
// Begin Afterlight Addition - added checks to stop sprite state errors
|
||||
if (!_timing.IsFirstTimePredicted)
|
||||
return;
|
||||
|
||||
if (TryComp<BorgSwitchableSubtypeComponent>(entity, out var subtype) &&
|
||||
subtype.BorgSubtype != null)
|
||||
{
|
||||
var ev = new TypeTryingToUpdateVisualsEvent();
|
||||
RaiseLocalEvent(entity, ref ev);
|
||||
return;
|
||||
}
|
||||
// End Afterlight Additions - added checks to stop sprite state errors
|
||||
// Begin DeltaV Additions
|
||||
if (prototype.ClientComponents is {} add)
|
||||
EntityManager.AddComponents(entity, add);
|
||||
// End DeltaV Additions
|
||||
if (TryComp(entity, out SpriteComponent? sprite))
|
||||
{
|
||||
// Begin DeltaV Additions - work around engine bug with AddComponents
|
||||
((ISerializationHooks) sprite).AfterDeserialization();
|
||||
// End DeltaV Additions
|
||||
_sprite.LayerSetRsiState((entity, sprite), BorgVisualLayers.Body, prototype.SpriteBodyState);
|
||||
_sprite.LayerSetRsiState((entity, sprite), BorgVisualLayers.LightStatus, prototype.SpriteToggleLightState);
|
||||
}
|
||||
@@ -85,26 +76,6 @@ public sealed partial class BorgSwitchableTypeSystem : SharedBorgSwitchableTypeS
|
||||
}
|
||||
// DeltaV - borg pdas
|
||||
|
||||
// Start CosmicDrift Changes - borg subtypes
|
||||
if (prototype.SpriteBodyMovementState is { } movementState)
|
||||
{
|
||||
var spriteMovement = EnsureComp<SpriteMovementComponent>(entity);
|
||||
spriteMovement.NoMovementLayers.Clear();
|
||||
spriteMovement.NoMovementLayers["movement"] = new PrototypeLayerData
|
||||
{
|
||||
State = prototype.SpriteBodyState,
|
||||
};
|
||||
spriteMovement.MovementLayers.Clear();
|
||||
spriteMovement.MovementLayers["movement"] = new PrototypeLayerData
|
||||
{
|
||||
State = movementState,
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
RemComp<SpriteMovementComponent>(entity);
|
||||
}
|
||||
// End CosmicDrift Changes - borg subtypes
|
||||
base.UpdateEntityAppearance(entity, prototype);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,6 +70,11 @@ public sealed class ConfirmButton : Button
|
||||
[ViewVariables]
|
||||
public bool IsConfirming = false;
|
||||
|
||||
// Begin DeltaV
|
||||
[ViewVariables]
|
||||
public bool ForceDisabled = false;
|
||||
// End DeltaV
|
||||
|
||||
public ConfirmButton()
|
||||
{
|
||||
IoCManager.InjectDependencies(this);
|
||||
@@ -87,7 +92,7 @@ public sealed class ConfirmButton : Button
|
||||
}
|
||||
|
||||
if (Disabled && _gameTiming.CurTime > _nextCooldown)
|
||||
Disabled = false;
|
||||
Disabled = ForceDisabled; // DeltaV
|
||||
}
|
||||
|
||||
protected override void DrawModeChanged()
|
||||
|
||||
@@ -49,11 +49,6 @@
|
||||
<Control HorizontalExpand="True" />
|
||||
<Label Name="RecordContainerSpecies" Align="Right" />
|
||||
</BoxContainer>
|
||||
<BoxContainer Orientation="Horizontal" HorizontalExpand="True">
|
||||
<Label Text="{Loc 'humanoid-profile-editor-cd-records-height'}"/>
|
||||
<Control HorizontalExpand="True" />
|
||||
<Label Name="RecordContainerHeight" Align="Right" />
|
||||
</BoxContainer>
|
||||
<BoxContainer Orientation="Horizontal" HorizontalExpand="True">
|
||||
<Label Text="{Loc 'humanoid-profile-editor-cd-records-weight'}"/>
|
||||
<Control HorizontalExpand="True" />
|
||||
|
||||
@@ -325,8 +325,7 @@ public sealed partial class CharacterRecordViewer : FancyWindow
|
||||
RecordContainerJob.Text = record.JobTitle; /* At some point in the future we might want to display the icon */
|
||||
RecordContainerGender.Text = record.Gender.ToString();
|
||||
RecordContainerSpecies.Text = record.Species;
|
||||
RecordContainerHeight.Text = cr.Height + " " + UnitConversion.GetImperialDisplayLength(cr.Height);
|
||||
RecordContainerWeight.Text = cr.Weight + " " + UnitConversion.GetImperialDisplayMass(cr.Weight);
|
||||
RecordContainerWeight.Text = $"{cr.Weight} ({UnitConversion.GetImperialDisplayMass(cr.Weight)})";
|
||||
RecordContainerContactName.SetValue(cr.EmergencyContactName);
|
||||
|
||||
RecordContainerEmployment.Visible = false;
|
||||
|
||||
@@ -5,12 +5,6 @@
|
||||
<BoxContainer Orientation="Vertical" HorizontalExpand="True" Margin="10">
|
||||
<!-- Height, Weight -->
|
||||
<GridContainer Columns="2">
|
||||
<BoxContainer HorizontalExpand="True" SeparationOverride="2">
|
||||
<Label Text="{Loc 'humanoid-profile-editor-cd-records-height'}" />
|
||||
<Control HorizontalExpand="True" MinSize="5 0" />
|
||||
<LineEdit Name="HeightEdit" HorizontalAlignment="Right" MinSize="60 0" />
|
||||
<Label Name="HeightImperialLabel" MinWidth="60" />
|
||||
</BoxContainer>
|
||||
<BoxContainer HorizontalExpand="True" SeparationOverride="2">
|
||||
<Label Text="{Loc 'humanoid-profile-editor-cd-records-weight'}" />
|
||||
<Control HorizontalExpand="True" MinSize="5 0" />
|
||||
|
||||
@@ -25,14 +25,6 @@ public sealed partial class RecordEditorGui : Control
|
||||
|
||||
#region General
|
||||
|
||||
HeightEdit.OnTextChanged += args =>
|
||||
{
|
||||
if (!int.TryParse(args.Text, out var newHeight))
|
||||
return;
|
||||
UpdateImperialHeight(newHeight);
|
||||
UpdateRecords(_records.WithHeight(newHeight));
|
||||
};
|
||||
|
||||
WeightEdit.OnTextChanged += args =>
|
||||
{
|
||||
if (!int.TryParse(args.Text, out var newWeight))
|
||||
@@ -128,8 +120,6 @@ public sealed partial class RecordEditorGui : Control
|
||||
|
||||
private void UpdateWidgets()
|
||||
{
|
||||
HeightEdit.SetText(_records.Height.ToString());
|
||||
UpdateImperialHeight(_records.Height);
|
||||
WeightEdit.SetText(_records.Weight.ToString());
|
||||
UpdateImperialWeight(_records.Weight);
|
||||
ContactNameEdit.SetText(_records.EmergencyContactName);
|
||||
@@ -143,13 +133,8 @@ public sealed partial class RecordEditorGui : Control
|
||||
PostmortemEdit.SetText(_records.PostmortemInstructions);
|
||||
}
|
||||
|
||||
private void UpdateImperialHeight(int newHeight)
|
||||
{
|
||||
HeightImperialLabel.Text = UnitConversion.GetImperialDisplayLength(newHeight);
|
||||
}
|
||||
|
||||
private void UpdateImperialWeight(int newWeight)
|
||||
{
|
||||
WeightImperialLabel.Text = UnitConversion.GetImperialDisplayMass(newWeight);
|
||||
WeightImperialLabel.Text = $"({UnitConversion.GetImperialDisplayMass(newWeight)})";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,15 +2,47 @@ namespace Content.Client._CD.Records.UI;
|
||||
|
||||
public static class UnitConversion
|
||||
{
|
||||
/// <summary>
|
||||
/// DeltaV - The average height of a human in centimeters. According to the US CDC, its
|
||||
/// 171 for men and 160 for women. So average of that is ~165cm.
|
||||
///
|
||||
/// Just kidding, we're going with EE's arbitrary standard of 175cm.
|
||||
/// </summary>
|
||||
private const int AVERAGE_HEIGHT_CM = 175;
|
||||
|
||||
/// <summary>
|
||||
/// DeltaV - 1.0 scale is considered average for humans, so a scale of 1 will be 175cm.
|
||||
/// Ensure that scale also includes the base species height AND the user-defined height.
|
||||
/// </summary>
|
||||
/// <param name="scale"></param>
|
||||
/// <returns></returns>
|
||||
private static int GetMetricHeightFromScale(float scale = 1)
|
||||
{
|
||||
// cast as int because we don't care about decimal
|
||||
return (int)Math.Max(scale * AVERAGE_HEIGHT_CM, 1); // can't be shorter than 1cm I guess
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// DeltaV - Gets nicely formatted string that contains both metric and imperial measurements.
|
||||
/// With a scale of 1, it should look like... 175cm (5' 9")
|
||||
/// </summary>
|
||||
/// <param name="scale"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetMetricAndImperialDisplayFromScale(float scale = 1)
|
||||
{
|
||||
var metricHeight = GetMetricHeightFromScale(scale);
|
||||
return $"{metricHeight}cm ({GetImperialDisplayLength(metricHeight)})";
|
||||
}
|
||||
|
||||
public static string GetImperialDisplayLength(int lengthCm)
|
||||
{
|
||||
var heightIn = (int) Math.Round(lengthCm * 0.3937007874 /* cm to in*/);
|
||||
return $"({heightIn / 12}'{heightIn % 12}'')";
|
||||
var heightIn = (int)Math.Round(lengthCm * 0.3937007874 /* cm to in*/);
|
||||
return $"{heightIn / 12}'{heightIn % 12}\"";
|
||||
}
|
||||
|
||||
public static string GetImperialDisplayMass(int massKg)
|
||||
{
|
||||
var weightLbs = (int) Math.Round(massKg * 2.2046226218 /* kg to lbs */);
|
||||
return $"({weightLbs} lbs)";
|
||||
var weightLbs = (int)Math.Round(massKg * 2.2046226218 /* kg to lbs */);
|
||||
return $"{weightLbs} lbs";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,102 +0,0 @@
|
||||
using System.Linq;
|
||||
using Content.Client.Silicons.Borgs;
|
||||
using Content.Shared._CD.Silicons.Borgs;
|
||||
using Content.Shared.Movement.Components;
|
||||
using Content.Shared.Silicons.Borgs.Components;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Client._CD.Silicons.Borgs;
|
||||
|
||||
/// <summary>
|
||||
/// Primarily handles the appearance aspects of the borg subtype.
|
||||
/// </summary>
|
||||
public sealed class BorgSwitchableSubtypeSystem : SharedBorgSwitchableSubtypeSystem
|
||||
{
|
||||
[Dependency] private readonly SpriteSystem _sprite = default!;
|
||||
[Dependency] private readonly BorgSystem _borg = default!;
|
||||
[Dependency] private readonly AppearanceSystem _appearance = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<BorgSwitchableSubtypeComponent, ComponentStartup>(OnComponentStartup);
|
||||
SubscribeLocalEvent<BorgSwitchableSubtypeComponent, AfterAutoHandleStateEvent>(OnAutoHandleEvent);
|
||||
}
|
||||
|
||||
private void OnAutoHandleEvent(Entity<BorgSwitchableSubtypeComponent> ent, ref AfterAutoHandleStateEvent args)
|
||||
{
|
||||
SelectBorgSubtype(ent);
|
||||
}
|
||||
|
||||
private void OnComponentStartup(Entity<BorgSwitchableSubtypeComponent> ent, ref ComponentStartup args)
|
||||
{
|
||||
SelectBorgSubtype(ent);
|
||||
}
|
||||
|
||||
protected override void UpdateEntityAppearance(Entity<BorgSwitchableSubtypeComponent> entity, EntityPrototype borgSubtypePrototype)
|
||||
{
|
||||
// LOT of copy pasted code from BorgSwitchableTypeSystem, but is probably necessary unless the upstream code
|
||||
// is refactored
|
||||
|
||||
if (!borgSubtypePrototype.TryGetComponent<BorgSubtypeDefinitionComponent>(out var borgSubtype, ComponentFactory))
|
||||
return;
|
||||
|
||||
// get our required components
|
||||
var (owner, _) = entity;
|
||||
if (!TryComp<SpriteComponent>(entity, out var chassisSprite))
|
||||
return;
|
||||
|
||||
// remove all existing layers
|
||||
for (int i = chassisSprite.AllLayers.Count() - 1; i >= 0; i--)
|
||||
{
|
||||
_sprite.RemoveLayer((entity, chassisSprite), i);
|
||||
}
|
||||
|
||||
for (int i = 0; i < borgSubtype.LayerData.Length; i++)
|
||||
{
|
||||
var layerData = borgSubtype.LayerData[i];
|
||||
|
||||
layerData.RsiPath = borgSubtype.SpritePath?.ToString();
|
||||
if (borgSubtype.Offset != null)
|
||||
layerData.Offset = borgSubtype.Offset;
|
||||
_sprite.AddLayer((owner, chassisSprite), layerData, i);
|
||||
}
|
||||
|
||||
if (TryComp<BorgChassisComponent>(entity, out var chassis))
|
||||
{
|
||||
_borg.SetMindStates(
|
||||
(entity.Owner, chassis),
|
||||
borgSubtype.SpriteHasMindState,
|
||||
borgSubtype.SpriteNoMindState);
|
||||
|
||||
if (TryComp(entity, out AppearanceComponent? appearance))
|
||||
{
|
||||
// Queue update so state changes apply.
|
||||
_appearance.QueueUpdate(entity, appearance);
|
||||
}
|
||||
}
|
||||
|
||||
if (borgSubtype.SpriteBodyMovementState is { } movementState)
|
||||
{
|
||||
var spriteMovement = EnsureComp<SpriteMovementComponent>(entity);
|
||||
spriteMovement.NoMovementLayers.Clear();
|
||||
spriteMovement.NoMovementLayers["movement"] = new PrototypeLayerData
|
||||
{
|
||||
State = borgSubtype.SpriteBodyState,
|
||||
};
|
||||
spriteMovement.MovementLayers.Clear();
|
||||
spriteMovement.MovementLayers["movement"] = new PrototypeLayerData
|
||||
{
|
||||
State = movementState,
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
RemComp<SpriteMovementComponent>(entity);
|
||||
}
|
||||
|
||||
base.UpdateEntityAppearance(entity, borgSubtypePrototype);
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
<Control xmlns="https://spacestation14.io"
|
||||
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls">
|
||||
<BoxContainer Name="MainContainer"
|
||||
Orientation="Vertical"
|
||||
SeparationOverride="4"
|
||||
Visible="False">
|
||||
<controls:StripeBack>
|
||||
<Label Text="{Loc 'cd-borg-select-subtype-flavour-text'}"
|
||||
StyleClasses="LabelSubText"
|
||||
HorizontalAlignment="Center"
|
||||
Margin="0 12"/>
|
||||
</controls:StripeBack>
|
||||
<ScrollContainer Name="OptionsScrollContainer"
|
||||
HScrollEnabled="True"
|
||||
VScrollEnabled="False"
|
||||
MinHeight="96">
|
||||
<BoxContainer Name="OptionsContainer"
|
||||
Orientation="Horizontal"
|
||||
SeparationOverride="4"/>
|
||||
</ScrollContainer>
|
||||
|
||||
</BoxContainer>
|
||||
</Control>
|
||||
@@ -1,99 +0,0 @@
|
||||
using Content.Shared.Silicons.Borgs;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.XAML;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Client._CD.Silicons.Borgs.UI;
|
||||
|
||||
[GenerateTypedNameReferences]
|
||||
public sealed partial class ChassisSpriteSelection : Control
|
||||
{
|
||||
[Dependency] private readonly IComponentFactory _componentFactory = default!;
|
||||
[Dependency] private readonly IPrototypeManager _prototype = default!;
|
||||
|
||||
public EntityPrototype? SubtypePrototype;
|
||||
public event Action? SubtypeSelected;
|
||||
|
||||
private const int PrototypeViewSize = 2;
|
||||
private static readonly ProtoId<EntityCategoryPrototype> _borgSubtypeCategory = "BorgSubtype";
|
||||
|
||||
public ChassisSpriteSelection()
|
||||
{
|
||||
RobustXamlLoader.Load(this);
|
||||
IoCManager.InjectDependencies(this);
|
||||
}
|
||||
|
||||
public void Update(BorgTypePrototype borgTypePrototype)
|
||||
{
|
||||
MainContainer.Visible = true;
|
||||
|
||||
OptionsContainer.RemoveAllChildren();
|
||||
|
||||
var buttonGroup = new ButtonGroup();
|
||||
List<Button> buttons = new List<Button>();
|
||||
buttons.Add(CreateDefaultSubtypeButton(borgTypePrototype, buttonGroup));
|
||||
|
||||
foreach (var ent in _prototype.Categories.GetValueRefOrNullRef(_borgSubtypeCategory))
|
||||
{
|
||||
if (!ent.TryGetComponent<Shared._CD.Silicons.Borgs.BorgSubtypeDefinitionComponent>(out var subtype, _componentFactory))
|
||||
continue;
|
||||
|
||||
// Only add subtypes of the current selected 'main' borg type (engineering, medical, etc.)
|
||||
if (subtype.ParentType != borgTypePrototype.ID)
|
||||
continue;
|
||||
|
||||
var button = new Button
|
||||
{
|
||||
ToolTip = Loc.GetString($"al-borg-{borgTypePrototype.ID}-subtype-{ent.Name.Replace(' ', '-').ToLower()}-name"),
|
||||
Group = buttonGroup,
|
||||
MinHeight = 32,
|
||||
};
|
||||
|
||||
button.OnPressed += _ =>
|
||||
{
|
||||
SubtypePrototype = ent;
|
||||
SubtypeSelected?.Invoke();
|
||||
};
|
||||
|
||||
button.AddChild(CreateEntityPrototypeView(subtype.DummyPrototype));
|
||||
buttons.Add(button);
|
||||
}
|
||||
|
||||
foreach (var button in buttons)
|
||||
{
|
||||
OptionsContainer.AddChild(button);
|
||||
}
|
||||
}
|
||||
|
||||
private Button CreateDefaultSubtypeButton(BorgTypePrototype borgTypePrototype, ButtonGroup group)
|
||||
{
|
||||
var button = new Button
|
||||
{
|
||||
ToolTip = "default",
|
||||
Group = group,
|
||||
MinHeight = 32,
|
||||
};
|
||||
|
||||
button.OnPressed += _ =>
|
||||
{
|
||||
SubtypePrototype = null;
|
||||
SubtypeSelected?.Invoke();
|
||||
};
|
||||
|
||||
button.AddChild(CreateEntityPrototypeView(borgTypePrototype.DummyPrototype));
|
||||
|
||||
return button;
|
||||
}
|
||||
|
||||
private EntityPrototypeView CreateEntityPrototypeView(EntProtoId entProtoId)
|
||||
{
|
||||
var entPrototypeView = new EntityPrototypeView();
|
||||
|
||||
entPrototypeView.SetPrototype(entProtoId);
|
||||
entPrototypeView.Scale *= PrototypeViewSize;
|
||||
|
||||
return entPrototypeView;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using Content.Shared._DV.Communications;
|
||||
using Robust.Client.UserInterface;
|
||||
|
||||
namespace Content.Client._DV.Communications;
|
||||
|
||||
public sealed class DVCommunicationsConsoleBoundUserInterface : BoundUserInterface
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entity = default!;
|
||||
|
||||
private DVCommunicationsConsoleMenu? _menu;
|
||||
|
||||
public DVCommunicationsConsoleBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Open()
|
||||
{
|
||||
base.Open();
|
||||
|
||||
_menu = this.CreateWindow<DVCommunicationsConsoleMenu>();
|
||||
_menu.OnMessage += SendMessage;
|
||||
if (_entity.TryGetComponent<DVCommunicationsConsoleComponent>(Owner, out var comp))
|
||||
Update((Owner, comp));
|
||||
}
|
||||
|
||||
public void Update(Entity<DVCommunicationsConsoleComponent> ent)
|
||||
{
|
||||
_menu?.Update(ent, PlayerManager.LocalEntity!.Value);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
<controls:FancyWindow
|
||||
xmlns="https://spacestation14.io"
|
||||
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
|
||||
Title="{Loc 'comms-console-menu-title'}"
|
||||
MinSize="400 300">
|
||||
|
||||
<BoxContainer Name="HomeScreen" Orientation="Vertical" Margin="8">
|
||||
<Label Text="{Loc 'comms-console-menu-station-title'}" Name="StationHeaderLabel" StyleClasses="LabelKeyText" />
|
||||
<Button Name="AnnouncementTab" Text="{Loc 'comms-console-menu-tab.Announcement'}" />
|
||||
<Button Name="ScreenTab" Text="{Loc 'comms-console-menu-tab.Screen'}" />
|
||||
<Button Name="AlertLevelTab" Text="{Loc 'comms-console-menu-tab.AlertLevel'}" />
|
||||
|
||||
<Label Text="{Loc 'comms-console-menu-transit-title'}" Name="TransitHeaderLabel" StyleClasses="LabelKeyText" Margin="0 8 0 0" />
|
||||
<Button Name="ShuttlesTab" Text="{Loc 'comms-console-menu-tab.Shuttles'}" />
|
||||
|
||||
<Label Text="{Loc 'comms-console-menu-emergency-title'}" Name="EmergencyHeaderLabel" StyleClasses="LabelKeyText" Margin="0 8 0 0" />
|
||||
<Button Name="KeycardAuthenticationDeviceTab" Text="{Loc 'comms-console-menu-tab.KeycardAuthenticationDevice'}" />
|
||||
</BoxContainer>
|
||||
|
||||
<BoxContainer Orientation="Vertical">
|
||||
<Button Name="HomeButton" Text="{Loc 'comms-console-menu-home'}" Visible="False" />
|
||||
|
||||
<BoxContainer Name="AnnouncementScreen" Visible="False" Orientation="Vertical" HorizontalExpand="True" VerticalExpand="True" SeparationOverride="8" Margin="8">
|
||||
<PanelContainer StyleClasses="PanelDark" HorizontalExpand="True" VerticalExpand="True">
|
||||
<BoxContainer SeparationOverride="8" Margin="8" HorizontalExpand="True" Orientation="Vertical">
|
||||
<Label Text="{Loc 'comms-console-menu-announcement-text'}" StyleClasses="LabelKeyText" />
|
||||
<TextEdit Name="AnnounceInput"
|
||||
VerticalExpand="True"
|
||||
HorizontalExpand="True"
|
||||
VerticalAlignment="Stretch"
|
||||
HorizontalAlignment="Stretch"
|
||||
MinHeight="100" />
|
||||
</BoxContainer>
|
||||
</PanelContainer>
|
||||
<PanelContainer StyleClasses="PanelDark" HorizontalExpand="True">
|
||||
<Button Name="AnnounceButton" Margin="8" Text="{Loc 'comms-console-menu-send-announcement'}" />
|
||||
</PanelContainer>
|
||||
</BoxContainer>
|
||||
|
||||
<BoxContainer Name="ScreenScreen" Visible="False" Orientation="Vertical" HorizontalExpand="True" VerticalExpand="True" SeparationOverride="8" Margin="8">
|
||||
<PanelContainer StyleClasses="PanelDark" HorizontalExpand="True">
|
||||
<BoxContainer SeparationOverride="8" Margin="8" HorizontalExpand="True" Orientation="Vertical">
|
||||
<Label Text="{Loc 'comms-console-menu-screen-configuration'}" StyleClasses="LabelKeyText" />
|
||||
|
||||
<BoxContainer>
|
||||
<Label Text="{Loc 'comms-console-menu-screen-contents'}" HorizontalExpand="True" />
|
||||
<OptionButton Name="ScreenContentsButton" />
|
||||
</BoxContainer>
|
||||
<BoxContainer>
|
||||
<Label Text="{Loc 'comms-console-menu-alert-level-border'}" HorizontalExpand="True" />
|
||||
<Button Name="ScreenAlertBorder" Text="{Loc 'comms-console-menu-enable-border'}" ToggleMode="True" />
|
||||
</BoxContainer>
|
||||
</BoxContainer>
|
||||
</PanelContainer>
|
||||
|
||||
<PanelContainer StyleClasses="PanelDark">
|
||||
<BoxContainer Margin="8" Orientation="Vertical" SeparationOverride="4">
|
||||
<Label Text="{Loc 'comms-console-menu-screen-text'}" StyleClasses="LabelKeyText" />
|
||||
|
||||
<GridContainer Columns="2" HorizontalExpand="True">
|
||||
<Label Text="{Loc 'comms-console-menu-line-1'}" />
|
||||
<LineEdit Name="ScreenLine1" HorizontalExpand="True" StyleClasses="comms-console-display" />
|
||||
<Label Text="{Loc 'comms-console-menu-line-2'}" />
|
||||
<LineEdit Name="ScreenLine2" HorizontalExpand="True" StyleClasses="comms-console-display" />
|
||||
</GridContainer>
|
||||
|
||||
<Button Name="ScreenUpdateTextButton" Text="{Loc 'comms-console-menu-update-screen-text'}" HorizontalAlignment="Right" />
|
||||
</BoxContainer>
|
||||
</PanelContainer>
|
||||
</BoxContainer>
|
||||
|
||||
<BoxContainer Name="ShuttlesScreen" Visible="False" Orientation="Vertical" HorizontalExpand="True" VerticalExpand="True" SeparationOverride="8" Margin="8">
|
||||
<PanelContainer StyleClasses="PanelDark" HorizontalExpand="True">
|
||||
<BoxContainer Margin="8" HorizontalExpand="True" Orientation="Vertical">
|
||||
<Label Text="{Loc 'comms-console-menu-emergency-shuttle'}" StyleClasses="LabelKeyText" />
|
||||
<RichTextLabel Name="EmergencyStatus" Text="{Loc 'comms-console-menu-shuttle-not-coming'}" />
|
||||
<Button Name="ShuttleEmergencyButton" Text="{Loc 'comms-console-menu-call-emergency.True'}" HorizontalAlignment="Right" Margin="0 8 0 0" />
|
||||
</BoxContainer>
|
||||
</PanelContainer>
|
||||
<PanelContainer StyleClasses="PanelDark" HorizontalExpand="True">
|
||||
<BoxContainer Margin="8" HorizontalExpand="True" Orientation="Vertical">
|
||||
<Label Text="{Loc 'comms-console-menu-exfiltration-shuttle'}" StyleClasses="LabelKeyText" />
|
||||
<RichTextLabel Name="ExfiltrationStatus" Text="{Loc 'comms-console-menu-shuttle-not-coming'}" />
|
||||
<Button Name="ShuttleExfiltrationButton" Text="{Loc 'comms-console-menu-call-exfiltration.True'}" HorizontalAlignment="Right" Margin="0 8 0 0" />
|
||||
</BoxContainer>
|
||||
</PanelContainer>
|
||||
</BoxContainer>
|
||||
|
||||
<BoxContainer Name="AlertLevelScreen" Visible="False" Orientation="Vertical" HorizontalExpand="True" VerticalExpand="True" SeparationOverride="8" Margin="8">
|
||||
<PanelContainer StyleClasses="PanelDark" HorizontalExpand="True" MaxWidth="400">
|
||||
<BoxContainer Margin="8" HorizontalExpand="True" Orientation="Vertical">
|
||||
<Label Text="{Loc 'comms-console-menu-alert-level'}" StyleClasses="LabelKeyText" />
|
||||
<RichTextLabel Name="AlertLevel" HorizontalExpand="True" />
|
||||
<Button Name="AlertLevelsDropdown" Text="{Loc 'comms-console-menu-change-alert-level'}" HorizontalAlignment="Right" Margin="0 8 0 0" />
|
||||
</BoxContainer>
|
||||
</PanelContainer>
|
||||
</BoxContainer>
|
||||
|
||||
<BoxContainer Name="KeycardAuthenticationDeviceScreen" Visible="False" Orientation="Vertical" HorizontalExpand="True" VerticalExpand="True" SeparationOverride="8" Margin="8">
|
||||
<PanelContainer StyleClasses="PanelDark" HorizontalExpand="True" MaxWidth="400">
|
||||
<BoxContainer Margin="8" HorizontalExpand="True" Orientation="Vertical">
|
||||
<Label Text="{Loc 'comms-console-menu-declare-mayday.title'}" StyleClasses="LabelKeyText" />
|
||||
<RichTextLabel Text="{Loc 'comms-console-menu-declare-mayday.desc'}" />
|
||||
<controls:ConfirmButton Name="CallZeta" Text="{Loc 'comms-console-menu-declare-mayday.button'}" HorizontalAlignment="Stretch" Margin="0 8 0 0" />
|
||||
</BoxContainer>
|
||||
</PanelContainer>
|
||||
|
||||
<PanelContainer StyleClasses="PanelDark" HorizontalExpand="True" MaxWidth="400">
|
||||
<BoxContainer Margin="8" HorizontalExpand="True" Orientation="Vertical">
|
||||
<Label Text="{Loc 'comms-console-menu-request-codes.title'}" StyleClasses="LabelKeyText" />
|
||||
<RichTextLabel Text="{Loc 'comms-console-menu-request-codes.desc'}" />
|
||||
<controls:ConfirmButton Name="RequestCodes" Text="{Loc 'comms-console-menu-request-codes.button'}" HorizontalAlignment="Stretch" Margin="0 8 0 0" />
|
||||
</BoxContainer>
|
||||
</PanelContainer>
|
||||
</BoxContainer>
|
||||
</BoxContainer>
|
||||
</controls:FancyWindow>
|
||||
@@ -0,0 +1,320 @@
|
||||
using System.Globalization;
|
||||
using System.Numerics;
|
||||
using Content.Client.UserInterface.Controls;
|
||||
using Content.Shared._DV.Communications;
|
||||
using Content.Shared._DV.KeycardAuthenticationDevice;
|
||||
using Content.Shared._DV.Screens;
|
||||
using Content.Shared.Humanoid;
|
||||
using Content.Shared.Station;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.XAML;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Client._DV.Communications;
|
||||
|
||||
[GenerateTypedNameReferences]
|
||||
public sealed partial class DVCommunicationsConsoleMenu : FancyWindow
|
||||
{
|
||||
[Dependency] private readonly IGameTiming _timing = default!;
|
||||
[Dependency] private readonly IEntityManager _entity = default!;
|
||||
|
||||
private readonly SharedStationSystem _station;
|
||||
|
||||
private readonly BoxContainer[] _screens;
|
||||
private readonly ButtonGroup _group;
|
||||
|
||||
public event Action<BoundUserInterfaceMessage>? OnMessage;
|
||||
private Entity<DVCommunicationsConsoleComponent>? _console;
|
||||
private Entity<DVStationKeycardAuthenticationDeviceComponent>? _stationKeycardAuthenticationDevice;
|
||||
private EntityUid? _user;
|
||||
|
||||
private readonly Popup _alertLevelsPopup;
|
||||
private readonly BoxContainer _alertLevels = new()
|
||||
{
|
||||
Orientation = BoxContainer.LayoutOrientation.Vertical,
|
||||
};
|
||||
|
||||
private string _lastConfiguredLine1 = string.Empty;
|
||||
private string _lastConfiguredLine2 = string.Empty;
|
||||
|
||||
public DVCommunicationsConsoleMenu()
|
||||
{
|
||||
RobustXamlLoader.Load(this);
|
||||
IoCManager.InjectDependencies(this);
|
||||
|
||||
_station = _entity.System<SharedStationSystem>();
|
||||
|
||||
_group = new();
|
||||
_screens = new[]
|
||||
{
|
||||
HomeScreen, AnnouncementScreen, ScreenScreen, ShuttlesScreen, AlertLevelScreen,
|
||||
KeycardAuthenticationDeviceScreen,
|
||||
};
|
||||
|
||||
HomeButton.OnPressed += _ => SetScreen(HomeScreen);
|
||||
AnnouncementTab.OnPressed += _ => SetScreen(AnnouncementScreen);
|
||||
ScreenTab.OnPressed += _ => SetScreen(ScreenScreen);
|
||||
ShuttlesTab.OnPressed += _ => SetScreen(ShuttlesScreen);
|
||||
AlertLevelTab.OnPressed += _ => SetScreen(AlertLevelScreen);
|
||||
KeycardAuthenticationDeviceTab.OnPressed += _ => SetScreen(KeycardAuthenticationDeviceScreen);
|
||||
|
||||
foreach (var value in Enum.GetValues<DVScreenContent>())
|
||||
{
|
||||
ScreenContentsButton.AddItem(Loc.GetString($"comms-console-menu-screen-content.{value}"), (int)value);
|
||||
}
|
||||
|
||||
AnnounceButton.OnPressed += OnAnnouncePressed;
|
||||
ScreenUpdateTextButton.OnPressed += OnUpdateScreenText;
|
||||
ScreenContentsButton.OnItemSelected += OnScreenContentsSelected;
|
||||
ScreenAlertBorder.OnToggled += OnScreenAlertBorderToggled;
|
||||
|
||||
ShuttleEmergencyButton.OnPressed += OnEmergencyPressed;
|
||||
ShuttleExfiltrationButton.OnPressed += OnExfiltrationPressed;
|
||||
AlertLevelsDropdown.OnPressed += OnAlertLevelsDropdownPressed;
|
||||
|
||||
CallZeta.OnPressed += OnCallZetaPressed;
|
||||
RequestCodes.OnPressed += OnRequestCodesPressed;
|
||||
|
||||
_alertLevelsPopup = new()
|
||||
{
|
||||
Children = { _alertLevels },
|
||||
};
|
||||
_alertLevelsPopup.OnPopupHide += () => _alertLevelsPopup.Orphan();
|
||||
|
||||
AnnounceInput.Placeholder = new Rope.Leaf(Loc.GetString("comms-console-menu-announcement-placeholder"));
|
||||
}
|
||||
|
||||
private void OnAlertLevelsDropdownPressed(BaseButton.ButtonEventArgs args)
|
||||
{
|
||||
var globalPos = AlertLevelsDropdown.GlobalPosition;
|
||||
globalPos.Y += AlertLevelsDropdown.Size.Y + 1; // Place it below us, with a safety margin.
|
||||
_alertLevels.Measure(Window?.Size ?? Vector2Helpers.Infinity);
|
||||
var (minX, minY) = _alertLevels.DesiredSize;
|
||||
var box = UIBox2.FromDimensions(globalPos, new Vector2(Math.Max(minX, AlertLevelsDropdown.Width), minY));
|
||||
_alertLevelsPopup.Orphan();
|
||||
Root?.ModalRoot.AddChild(_alertLevelsPopup);
|
||||
_alertLevelsPopup.Open(box);
|
||||
}
|
||||
|
||||
protected override void FrameUpdate(FrameEventArgs args)
|
||||
{
|
||||
base.FrameUpdate(args);
|
||||
|
||||
if (_console is not { } console)
|
||||
return;
|
||||
|
||||
AnnounceButton.Disabled = _timing.CurTime <= console.Comp.CanAnnounceAt;
|
||||
AlertLevelsDropdown.Disabled = console.Comp.CanSetAlertAt is null || _timing.CurTime <= console.Comp.CanSetAlertAt;
|
||||
if (AlertLevelsDropdown.Disabled)
|
||||
_alertLevelsPopup.Close();
|
||||
|
||||
if (console.Comp.ExpectedEvacuationArrival is { } evacArrival)
|
||||
{
|
||||
var diff = MathHelper.Max(evacArrival - _timing.CurTime, TimeSpan.Zero);
|
||||
var infoText = Loc.GetString($"comms-console-menu-shuttle-eta",
|
||||
("time", diff.ToString(@"hh\:mm\:ss", CultureInfo.CurrentCulture)));
|
||||
EmergencyStatus.Text = infoText;
|
||||
}
|
||||
else
|
||||
{
|
||||
EmergencyStatus.Text = Loc.GetString("comms-console-menu-shuttle-not-coming");
|
||||
}
|
||||
|
||||
if (console.Comp.ExpectedExfiltrationArrival is { } exfiltrationArrival)
|
||||
{
|
||||
var diff = MathHelper.Max(exfiltrationArrival - _timing.CurTime, TimeSpan.Zero);
|
||||
var infoText = Loc.GetString($"comms-console-menu-shuttle-eta",
|
||||
("time", diff.ToString(@"hh\:mm\:ss", CultureInfo.CurrentCulture)));
|
||||
ExfiltrationStatus.Text = infoText;
|
||||
}
|
||||
else
|
||||
{
|
||||
ExfiltrationStatus.Text = Loc.GetString("comms-console-menu-shuttle-not-coming");
|
||||
}
|
||||
|
||||
UpdateKeycardAuthenticationDevice();
|
||||
}
|
||||
|
||||
private void SetScreen(Control screen)
|
||||
{
|
||||
foreach (var other in _screens)
|
||||
{
|
||||
other.Visible = false;
|
||||
}
|
||||
|
||||
screen.Visible = true;
|
||||
HomeButton.Visible = screen != HomeScreen;
|
||||
}
|
||||
|
||||
public void Update(Entity<DVCommunicationsConsoleComponent> console, EntityUid user)
|
||||
{
|
||||
_console = console;
|
||||
_user = user;
|
||||
if (_station.GetOwningStation(console) is { } station &&
|
||||
_entity.TryGetComponent<DVStationKeycardAuthenticationDeviceComponent>(station,
|
||||
out var keycardAuthenticationDevice))
|
||||
{
|
||||
_stationKeycardAuthenticationDevice = (station, keycardAuthenticationDevice);
|
||||
}
|
||||
|
||||
// If they only have the ability to announce, there's no point in having a home button
|
||||
if (console.Comp.CanAnnounce && !(console.Comp.CanAlertLevel || console.Comp.CanCallShuttles || console.Comp.CanConfigureScreens || console.Comp.CanKeycardAuthenticationDevice))
|
||||
{
|
||||
SetScreen(AnnouncementScreen);
|
||||
HomeButton.Visible = false;
|
||||
}
|
||||
|
||||
// Station
|
||||
StationHeaderLabel.Visible = console.Comp.CanAnnounce || console.Comp.CanConfigureScreens || console.Comp.CanAlertLevel;
|
||||
AnnouncementTab.Visible = console.Comp.CanAnnounce;
|
||||
ScreenTab.Visible = console.Comp.CanConfigureScreens;
|
||||
AlertLevelTab.Visible = console.Comp.CanAlertLevel;
|
||||
|
||||
// Shuttles
|
||||
TransitHeaderLabel.Visible = console.Comp.CanCallShuttles; // Should be only hidden if all buttons under are also hidden.
|
||||
ShuttlesTab.Visible = console.Comp.CanCallShuttles;
|
||||
|
||||
// Emergency
|
||||
EmergencyHeaderLabel.Visible = console.Comp.CanKeycardAuthenticationDevice; // Should be only hidden if all buttons under are also hidden.
|
||||
KeycardAuthenticationDeviceTab.Visible = console.Comp.CanKeycardAuthenticationDevice;
|
||||
|
||||
ShuttleEmergencyButton.Disabled = !console.Comp.ShuttlesCallable;
|
||||
ShuttleExfiltrationButton.Disabled = !console.Comp.ShuttlesCallable;
|
||||
|
||||
ShuttleEmergencyButton.Text =
|
||||
Loc.GetString($"comms-console-menu-call-emergency.{console.Comp.ExpectedEvacuationArrival is null}");
|
||||
ShuttleExfiltrationButton.Text =
|
||||
Loc.GetString($"comms-console-menu-call-exfiltration.{console.Comp.ExpectedExfiltrationArrival is null}");
|
||||
|
||||
_alertLevels.RemoveAllChildren();
|
||||
foreach (var level in console.Comp.AlertLevels)
|
||||
{
|
||||
if (level.Id == console.Comp.CurrentAlertLevel)
|
||||
{
|
||||
AlertLevel.Text = Loc.GetString("comms-console-menu-current-alert-level",
|
||||
("name", Loc.GetString(level.AlertLevel)),
|
||||
("color", level.Color),
|
||||
("description", Loc.GetString(level.Description)));
|
||||
}
|
||||
|
||||
if (!level.CanSet)
|
||||
continue;
|
||||
|
||||
var btn = new Button
|
||||
{
|
||||
Text = Loc.GetString(level.AlertLevel),
|
||||
ToggleMode = true,
|
||||
Group = _group,
|
||||
Pressed = level.Id == console.Comp.CurrentAlertLevel,
|
||||
};
|
||||
_alertLevels.AddChild(btn);
|
||||
btn.OnPressed += _ =>
|
||||
{
|
||||
_alertLevelsPopup.Close();
|
||||
OnMessage?.Invoke(new DVCommunicationsConsoleAlertLevelMessage(level.Id));
|
||||
};
|
||||
}
|
||||
|
||||
if (console.Comp.LastConfiguredLine1 != _lastConfiguredLine1)
|
||||
ScreenLine1.Text = console.Comp.LastConfiguredLine1;
|
||||
|
||||
if (console.Comp.LastConfiguredLine2 != _lastConfiguredLine2)
|
||||
ScreenLine2.Text = console.Comp.LastConfiguredLine2;
|
||||
|
||||
ScreenContentsButton.SelectId((int)console.Comp.LastConfiguredContent);
|
||||
ScreenAlertBorder.Pressed = console.Comp.LastConfiguredShowBorders;
|
||||
|
||||
_lastConfiguredLine1 = console.Comp.LastConfiguredLine1;
|
||||
_lastConfiguredLine2 = console.Comp.LastConfiguredLine2;
|
||||
|
||||
UpdateKeycardAuthenticationDevice();
|
||||
}
|
||||
|
||||
private void UpdateKeycardAuthenticationDevice()
|
||||
{
|
||||
if (_user is not { } user || _stationKeycardAuthenticationDevice is not { } station)
|
||||
return;
|
||||
|
||||
var canCall = !_entity.HasComponent<DVStationKeycardAuthenticationDeviceAlreadySwipedComponent>(user)
|
||||
&& _entity.HasComponent<HumanoidProfileComponent>(user) // Can't be AI or a borg
|
||||
&& station.Comp.AccessibleAfter <= _timing.CurTime;
|
||||
|
||||
CallZeta.ForceDisabled = !(canCall && station.Comp.SwipingFor is null or DVStationKeycardAction.Mayday);
|
||||
CallZeta.Disabled = CallZeta.ForceDisabled;
|
||||
RequestCodes.ForceDisabled = !(canCall && station.Comp.SwipingFor is null or DVStationKeycardAction.Scuttling);
|
||||
RequestCodes.Disabled = RequestCodes.ForceDisabled;
|
||||
|
||||
if (CallZeta.IsConfirming || RequestCodes.IsConfirming)
|
||||
return;
|
||||
|
||||
// Kinda messy but it works
|
||||
if (station.Comp.SwipesStartedAt is { } firstSwipeTime)
|
||||
{
|
||||
var countdown = firstSwipeTime + station.Comp.SwipeWindow;
|
||||
var timeRemaining = countdown.Subtract(_timing.CurTime);
|
||||
if (timeRemaining > TimeSpan.Zero && station.Comp.SwipingFor is DVStationKeycardAction.Mayday)
|
||||
CallZeta.Text = $"{timeRemaining:ss\\.fff}";
|
||||
|
||||
if (timeRemaining > TimeSpan.Zero && station.Comp.SwipingFor is DVStationKeycardAction.Scuttling)
|
||||
RequestCodes.Text = $"{timeRemaining:ss\\.fff}";
|
||||
}
|
||||
else
|
||||
{
|
||||
CallZeta.Text = Loc.GetString("comms-console-menu-declare-mayday.button");
|
||||
RequestCodes.Text = Loc.GetString("comms-console-menu-request-codes.button");
|
||||
}
|
||||
}
|
||||
|
||||
private void OnAnnouncePressed(BaseButton.ButtonEventArgs args)
|
||||
{
|
||||
OnMessage?.Invoke(new DVCommunicationsConsoleAnnouncementMessage(Rope.Collapse(AnnounceInput.TextRope)));
|
||||
}
|
||||
|
||||
private void UpdateScreens()
|
||||
{
|
||||
OnMessage?.Invoke(new DVCommunicationsConsoleScreenConfigurationMessage(
|
||||
(DVScreenContent) ScreenContentsButton.SelectedId,
|
||||
ScreenAlertBorder.Pressed,
|
||||
ScreenLine1.Text,
|
||||
ScreenLine2.Text));
|
||||
}
|
||||
|
||||
private void OnUpdateScreenText(BaseButton.ButtonEventArgs buttonEventArgs)
|
||||
{
|
||||
UpdateScreens();
|
||||
}
|
||||
|
||||
private void OnScreenContentsSelected(OptionButton.ItemSelectedEventArgs itemSelectedEventArgs)
|
||||
{
|
||||
ScreenContentsButton.SelectId(itemSelectedEventArgs.Id);
|
||||
UpdateScreens();
|
||||
}
|
||||
|
||||
private void OnScreenAlertBorderToggled(BaseButton.ButtonToggledEventArgs buttonToggledEventArgs)
|
||||
{
|
||||
UpdateScreens();
|
||||
}
|
||||
|
||||
private void OnExfiltrationPressed(BaseButton.ButtonEventArgs args)
|
||||
{
|
||||
OnMessage?.Invoke(new DVCommunicationsConsoleExfiltrationShuttleMessage(_console?.Comp.ExpectedExfiltrationArrival is null));
|
||||
}
|
||||
|
||||
private void OnEmergencyPressed(BaseButton.ButtonEventArgs args)
|
||||
{
|
||||
OnMessage?.Invoke(new DVCommunicationsConsoleEvacuationShuttleMessage(_console?.Comp.ExpectedEvacuationArrival is null));
|
||||
}
|
||||
|
||||
private void OnCallZetaPressed(BaseButton.ButtonEventArgs obj)
|
||||
{
|
||||
OnMessage?.Invoke(new DVCommunicationsConsoleKeycardAuthenticationDeviceMessage(DVStationKeycardAction.Mayday));
|
||||
}
|
||||
|
||||
private void OnRequestCodesPressed(BaseButton.ButtonEventArgs obj)
|
||||
{
|
||||
OnMessage?.Invoke(new DVCommunicationsConsoleKeycardAuthenticationDeviceMessage(DVStationKeycardAction.Scuttling));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using Content.Shared._DV.Communications;
|
||||
using Robust.Client.GameObjects;
|
||||
|
||||
namespace Content.Client._DV.Communications;
|
||||
|
||||
public sealed class DVCommunicationsConsoleSystem : SharedDVCommunicationsConsoleSystem
|
||||
{
|
||||
[Dependency] private readonly UserInterfaceSystem _userInterface = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<DVCommunicationsConsoleComponent, AfterAutoHandleStateEvent>(OnHandleState);
|
||||
}
|
||||
|
||||
private void OnHandleState(Entity<DVCommunicationsConsoleComponent> ent, ref AfterAutoHandleStateEvent args)
|
||||
{
|
||||
if (!_userInterface.TryGetOpenUi<DVCommunicationsConsoleBoundUserInterface>(ent.Owner,
|
||||
DVCommunicationsConsoleUi.Key,
|
||||
out var bui))
|
||||
return;
|
||||
|
||||
bui.Update(ent);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
using Content.Shared._DV.KeycardAuthenticationDevice;
|
||||
|
||||
namespace Content.Client._DV.KeycardAuthenticationDevice;
|
||||
|
||||
public sealed class DVStationKeycardAuthenticationDeviceSystem : SharedDVStationKeycardAuthenticationDeviceSystem;
|
||||
@@ -0,0 +1,104 @@
|
||||
using System.Numerics;
|
||||
using Content.Client.Graphics;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Shared.Enums;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Client._DV.Overlays;
|
||||
|
||||
/// <summary>
|
||||
/// Makes darkness visible, and bright lights painfully visible
|
||||
/// Tweakable. Algo is max((light*gain)^exp, lightFloor)
|
||||
/// </summary>
|
||||
public sealed class DarkVisionOverlay : Overlay
|
||||
{
|
||||
[Dependency] private readonly IClyde _clyde = default!;
|
||||
[Dependency] private readonly IPrototypeManager _prototype = default!;
|
||||
|
||||
public override OverlaySpace Space => OverlaySpace.WorldSpaceBelowWorld;
|
||||
|
||||
private readonly ProtoId<ShaderPrototype> _shaderProto = "DarkVision";
|
||||
|
||||
public float LightFloor = 0.5f;
|
||||
public float LightGain = 2f;
|
||||
public float LightExp = 1f;
|
||||
|
||||
private readonly ShaderInstance _copyShader;
|
||||
private readonly ShaderInstance _remapShader;
|
||||
private readonly OverlayResourceCache<CachedResources> _resources = new();
|
||||
|
||||
public DarkVisionOverlay()
|
||||
{
|
||||
IoCManager.InjectDependencies(this);
|
||||
|
||||
var proto = _prototype.Index<ShaderPrototype>(_shaderProto);
|
||||
_remapShader = proto.InstanceUnique();
|
||||
// With floor 0, gain 1, exp 1 the shader is an exact blend-mode-none copy.
|
||||
_copyShader = proto.InstanceUnique();
|
||||
_copyShader.SetParameter("lightFloor", 0f);
|
||||
_copyShader.SetParameter("lightGain", 1f);
|
||||
_copyShader.SetParameter("lightExp", 1f);
|
||||
}
|
||||
|
||||
protected override void Draw(in OverlayDrawArgs args)
|
||||
{
|
||||
var viewport = args.Viewport;
|
||||
var worldHandle = args.WorldHandle;
|
||||
|
||||
if (viewport.Eye == null)
|
||||
return;
|
||||
|
||||
var lightTarget = viewport.LightRenderTarget;
|
||||
var res = _resources.GetForViewport(viewport, static _ => new CachedResources());
|
||||
|
||||
if (res.ScratchTarget?.Size != lightTarget.Size)
|
||||
{
|
||||
res.ScratchTarget?.Dispose();
|
||||
res.ScratchTarget = _clyde.CreateLightRenderTarget(lightTarget.Size, "darkvision-scratch", depthStencil: false);
|
||||
}
|
||||
|
||||
var bounds = args.WorldBounds;
|
||||
var lightScale = lightTarget.Size / (Vector2) viewport.Size;
|
||||
var scale = viewport.RenderScale / (Vector2.One / lightScale);
|
||||
var localMatrix = lightTarget.GetWorldToLocalMatrix(viewport.Eye, scale);
|
||||
|
||||
// Copy the light buffer aside first: a texture can't be sampled while it is also the
|
||||
// render target being drawn into.
|
||||
worldHandle.RenderInRenderTarget(res.ScratchTarget, () =>
|
||||
{
|
||||
worldHandle.UseShader(_copyShader);
|
||||
worldHandle.SetTransform(localMatrix);
|
||||
worldHandle.DrawTextureRect(lightTarget.Texture, bounds);
|
||||
worldHandle.UseShader(null);
|
||||
}, Color.Black);
|
||||
|
||||
// Then write it back through the remap.
|
||||
_remapShader.SetParameter("lightFloor", LightFloor);
|
||||
_remapShader.SetParameter("lightGain", LightGain);
|
||||
_remapShader.SetParameter("lightExp", LightExp);
|
||||
worldHandle.RenderInRenderTarget(lightTarget, () =>
|
||||
{
|
||||
worldHandle.UseShader(_remapShader);
|
||||
worldHandle.SetTransform(localMatrix);
|
||||
worldHandle.DrawTextureRect(res.ScratchTarget.Texture, bounds);
|
||||
worldHandle.UseShader(null);
|
||||
}, null);
|
||||
}
|
||||
|
||||
protected override void DisposeBehavior()
|
||||
{
|
||||
_resources.Dispose();
|
||||
|
||||
base.DisposeBehavior();
|
||||
}
|
||||
|
||||
private sealed class CachedResources : IDisposable
|
||||
{
|
||||
public IRenderTexture? ScratchTarget;
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
ScratchTarget?.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
using Content.Shared._DV.Overlays.Components;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Shared.Player;
|
||||
|
||||
namespace Content.Client._DV.Overlays;
|
||||
|
||||
public sealed class DarkVisionSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly IOverlayManager _overlayMan = default!;
|
||||
[Dependency] private readonly ISharedPlayerManager _playerMan = default!;
|
||||
|
||||
private DarkVisionOverlay _overlay = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<DarkVisionComponent, ComponentInit>(OnInit);
|
||||
SubscribeLocalEvent<DarkVisionComponent, ComponentShutdown>(OnShutdown);
|
||||
SubscribeLocalEvent<DarkVisionComponent, LocalPlayerAttachedEvent>(OnPlayerAttached);
|
||||
SubscribeLocalEvent<DarkVisionComponent, LocalPlayerDetachedEvent>(OnPlayerDetached);
|
||||
|
||||
_overlay = new();
|
||||
}
|
||||
|
||||
private void OnInit(Entity<DarkVisionComponent> ent, ref ComponentInit args)
|
||||
{
|
||||
if (ent.Owner == _playerMan.LocalEntity)
|
||||
EnableOverlay(ent.Comp);
|
||||
}
|
||||
|
||||
private void OnShutdown(Entity<DarkVisionComponent> ent, ref ComponentShutdown args)
|
||||
{
|
||||
if (ent.Owner == _playerMan.LocalEntity)
|
||||
_overlayMan.RemoveOverlay(_overlay);
|
||||
}
|
||||
|
||||
private void OnPlayerAttached(Entity<DarkVisionComponent> ent, ref LocalPlayerAttachedEvent args)
|
||||
{
|
||||
EnableOverlay(ent.Comp);
|
||||
}
|
||||
|
||||
private void OnPlayerDetached(Entity<DarkVisionComponent> ent, ref LocalPlayerDetachedEvent args)
|
||||
{
|
||||
_overlayMan.RemoveOverlay(_overlay);
|
||||
}
|
||||
|
||||
private void EnableOverlay(DarkVisionComponent comp)
|
||||
{
|
||||
_overlay.LightFloor = comp.LightFloor;
|
||||
_overlay.LightGain = comp.LightGain;
|
||||
_overlay.LightExp = comp.LightExp;
|
||||
if (!_overlayMan.HasOverlay<DarkVisionOverlay>())
|
||||
_overlayMan.AddOverlay(_overlay);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
using System.Globalization;
|
||||
using Content.Client.GameTicking.Managers;
|
||||
using Content.Client.Interactable.Components;
|
||||
using Content.Client.TextScreen;
|
||||
using Content.Shared._DV.Screens;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
namespace Content.Client._DV.Screens;
|
||||
|
||||
public sealed class DVScreenSystem : DVSharedScreenSystem
|
||||
{
|
||||
[Dependency] private readonly DVTextVisualsSystem _textVisuals = default!;
|
||||
[Dependency] private readonly IGameTiming _timing = default!;
|
||||
[Dependency] private readonly ClientGameTicker _ticker = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<DVScreenComponent, ComponentInit>(OnInit);
|
||||
SubscribeLocalEvent<DVScreenComponent, AfterAutoHandleStateEvent>(OnScreenState);
|
||||
}
|
||||
|
||||
public override void FrameUpdate(float frameTime)
|
||||
{
|
||||
base.FrameUpdate(frameTime);
|
||||
|
||||
var query = EntityQueryEnumerator<DVScreenComponent>();
|
||||
while (query.MoveNext(out var uid, out var screen))
|
||||
{
|
||||
switch (screen.Content)
|
||||
{
|
||||
case DVScreenContent.Text:
|
||||
break;
|
||||
case DVScreenContent.CurrentTime:
|
||||
CurrentTime((uid, screen));
|
||||
break;
|
||||
case DVScreenContent.EstimatedTimeOfArrival:
|
||||
EstimatedTimeOfArrival((uid, screen));
|
||||
break;
|
||||
case DVScreenContent.AlertLevel:
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnInit(Entity<DVScreenComponent> ent, ref ComponentInit args)
|
||||
{
|
||||
// Remove interaction outline because it outlines the offscreen text and looks bad
|
||||
RemComp<InteractionOutlineComponent>(ent);
|
||||
}
|
||||
|
||||
private void OnScreenState(Entity<DVScreenComponent> ent, ref AfterAutoHandleStateEvent args)
|
||||
{
|
||||
UpdateVisuals(ent);
|
||||
|
||||
switch (ent.Comp.Content)
|
||||
{
|
||||
case DVScreenContent.Text:
|
||||
Text(ent);
|
||||
break;
|
||||
case DVScreenContent.CurrentTime:
|
||||
CurrentTime(ent);
|
||||
break;
|
||||
case DVScreenContent.EstimatedTimeOfArrival:
|
||||
EstimatedTimeOfArrival(ent);
|
||||
break;
|
||||
case DVScreenContent.AlertLevel:
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
}
|
||||
|
||||
private void Text(Entity<DVScreenComponent> ent)
|
||||
{
|
||||
_textVisuals.SetText(ent.Owner, ent.Comp.Line1, ent.Comp.Line2);
|
||||
}
|
||||
|
||||
private void CurrentTime(Entity<DVScreenComponent> ent)
|
||||
{
|
||||
var time = (_timing.CurTime - _ticker.RoundStartTimeSpan).Duration();
|
||||
_textVisuals.SetText(ent.Owner, Loc.GetString("status-display-time"), time.ToString("hh\\:mm"));
|
||||
}
|
||||
|
||||
private void EstimatedTimeOfArrival(Entity<DVScreenComponent> ent)
|
||||
{
|
||||
if (ent.Comp.TargetTime <= _timing.CurTime)
|
||||
{
|
||||
_textVisuals.SetText(ent.Owner, string.Empty, string.Empty);
|
||||
return;
|
||||
}
|
||||
|
||||
var time = (_timing.CurTime - ent.Comp.TargetTime).Duration();
|
||||
var formatted = time.ToString("mm\\:ss");
|
||||
Log.Debug($"{_timing.CurTime} - {ent.Comp.TargetTime} = {time}");
|
||||
var title = ent.Comp.ScreenIsAtDestination ? Loc.GetString("status-display-etd") : Loc.GetString("status-display-eta");
|
||||
|
||||
_textVisuals.SetText(ent.Owner, title, formatted);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Threading;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.Animations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Shared.Enums;
|
||||
|
||||
namespace Content.Client._DV.Screens;
|
||||
|
||||
[UsedImplicitly]
|
||||
public sealed class DVTextRenderingOverlay : Overlay
|
||||
{
|
||||
[Dependency] private readonly IClyde _clyde = default!;
|
||||
private readonly SpriteSystem _sprite;
|
||||
private readonly AnimationPlayerSystem _animationPlayer;
|
||||
|
||||
public override OverlaySpace Space => OverlaySpace.ScreenSpaceBelowWorld;
|
||||
|
||||
private readonly Queue<(Entity<DVTextVisualsComponent> Entity, Font Font, CancellationToken Cancellation)> _queue = new();
|
||||
|
||||
public const string MarqueeKey = "dv-text-screen-marquee";
|
||||
|
||||
public DVTextRenderingOverlay(SpriteSystem sprite, AnimationPlayerSystem animationPlayer)
|
||||
{
|
||||
IoCManager.InjectDependencies(this);
|
||||
_sprite = sprite;
|
||||
_animationPlayer = animationPlayer;
|
||||
|
||||
ZIndex = -100; // this needs to render before almost everything
|
||||
}
|
||||
|
||||
public CancellationTokenSource QueueRender(
|
||||
Entity<DVTextVisualsComponent> ent,
|
||||
Font font)
|
||||
{
|
||||
var source = new CancellationTokenSource();
|
||||
_queue.Enqueue((ent, font, source.Token));
|
||||
|
||||
return source;
|
||||
}
|
||||
|
||||
protected override void Draw(in OverlayDrawArgs args)
|
||||
{
|
||||
var screenHandle = args.ScreenHandle;
|
||||
|
||||
while (_queue.TryDequeue(out var queued))
|
||||
{
|
||||
if (queued.Cancellation.IsCancellationRequested)
|
||||
continue;
|
||||
|
||||
var font = queued.Font;
|
||||
foreach (var row in queued.Entity.Comp.Rows)
|
||||
{
|
||||
if (row.Text == string.Empty)
|
||||
{
|
||||
_sprite.LayerSetTexture(queued.Entity.Owner, row.Layer, null);
|
||||
continue;
|
||||
}
|
||||
|
||||
var dimensions = screenHandle.GetDimensions(queued.Font, row.Text, 1f);
|
||||
var dimensionsInt = new Vector2i((int)MathF.Round(dimensions.X), (int)MathF.Round(dimensions.Y));
|
||||
|
||||
if (row.Texture is null || row.Texture.Size != dimensionsInt)
|
||||
{
|
||||
row.Texture = _clyde.CreateRenderTarget(dimensionsInt,
|
||||
new RenderTargetFormatParameters(RenderTargetColorFormat.Rgba8),
|
||||
name: $"dv-text-visuals-{queued.Entity.Owner.Id}");
|
||||
|
||||
_sprite.LayerSetTexture(queued.Entity.Owner, row.Layer, row.Texture.Texture);
|
||||
_sprite.LayerSetOffset(queued.Entity.Owner, row.Layer, row.Offset);
|
||||
}
|
||||
|
||||
args.DrawingHandle.RenderInRenderTarget(row.Texture,
|
||||
() =>
|
||||
{
|
||||
screenHandle.DrawString(font, Vector2.Zero, row.Text);
|
||||
},
|
||||
Color.Transparent);
|
||||
}
|
||||
|
||||
_animationPlayer.Stop(queued.Entity.Owner, MarqueeKey);
|
||||
if (CreateMarqueeAnimation(queued.Entity) is { } animation)
|
||||
{
|
||||
queued.Entity.Comp.Animation = animation;
|
||||
_animationPlayer.Play(queued.Entity.Owner, animation, MarqueeKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Animation? CreateMarqueeAnimation(Entity<DVTextVisualsComponent> ent)
|
||||
{
|
||||
var largestRowWidth = ent.Comp.Rows.Aggregate(0, (i, row) => Math.Max(i, row.Texture?.Size.X ?? 0));
|
||||
var animationTime = ent.Comp.MarqueeRate * largestRowWidth;
|
||||
var marqueeWidth = new Vector2((float)ent.Comp.MarqueeWidth / EyeManager.PixelsPerMeter, 0);
|
||||
|
||||
var animation = new Animation
|
||||
{
|
||||
Length = animationTime,
|
||||
};
|
||||
|
||||
foreach (var row in ent.Comp.Rows)
|
||||
{
|
||||
if (row.Texture is null)
|
||||
continue;
|
||||
|
||||
var rowHalfWidth = new Vector2(row.Texture.Size.X / 2f / EyeManager.PixelsPerMeter, 0f);
|
||||
|
||||
if (row.Texture.Size.X <= ent.Comp.MarqueeWidth)
|
||||
continue;
|
||||
|
||||
animation.AnimationTracks.Add(new AnimationTrackLayerOffset()
|
||||
{
|
||||
Layer = row.Layer,
|
||||
KeyFrames =
|
||||
{
|
||||
new AnimationTrackProperty.KeyFrame(row.Offset + rowHalfWidth + marqueeWidth, 0f),
|
||||
new AnimationTrackProperty.KeyFrame(row.Offset - rowHalfWidth - marqueeWidth, (float)animationTime.TotalSeconds),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
return animation.AnimationTracks.Count > 0 ? animation : null;
|
||||
}
|
||||
|
||||
public sealed class AnimationTrackLayerOffset : AnimationTrackProperty
|
||||
{
|
||||
public required Enum Layer;
|
||||
private readonly SpriteSystem _sprite = IoCManager.Resolve<IEntityManager>().System<SpriteSystem>();
|
||||
|
||||
protected override void ApplyProperty(object context, object value)
|
||||
{
|
||||
if (value is not Vector2 vector)
|
||||
throw new InvalidOperationException("Value must be a .");
|
||||
|
||||
_sprite.LayerSetOffset((EntityUid) context, Layer, vector);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
using System.Numerics;
|
||||
using System.Threading;
|
||||
using Content.Shared._DV.Screens;
|
||||
using Robust.Client.Animations;
|
||||
using Robust.Client.Graphics;
|
||||
|
||||
namespace Content.Client._DV.Screens;
|
||||
|
||||
[RegisterComponent]
|
||||
[Access(typeof(DVTextVisualsSystem), typeof(DVTextRenderingOverlay))]
|
||||
public sealed partial class DVTextVisualsComponent : Component
|
||||
{
|
||||
[DataField(required: true)]
|
||||
public List<DVTextVisualsRow> Rows;
|
||||
|
||||
[DataField]
|
||||
public TimeSpan MarqueeRate = TimeSpan.FromSeconds(0.045f);
|
||||
|
||||
[DataField]
|
||||
public int MarqueeWidth = 24;
|
||||
|
||||
[DataField]
|
||||
public int MarqueePadding = 8;
|
||||
|
||||
public Animation? Animation;
|
||||
|
||||
public CancellationTokenSource? Token;
|
||||
}
|
||||
|
||||
[DataDefinition]
|
||||
public sealed partial class DVTextVisualsRow
|
||||
{
|
||||
public IRenderTexture? Texture;
|
||||
|
||||
[DataField]
|
||||
public string Text;
|
||||
|
||||
[DataField]
|
||||
public Vector2 Offset;
|
||||
|
||||
[DataField(required: true)]
|
||||
public Enum Layer = DVTextScreenVisualLayers.Line1;
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.ResourceManagement;
|
||||
|
||||
namespace Content.Client._DV.Screens;
|
||||
|
||||
public sealed class DVTextVisualsSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly IOverlayManager _overlay = default!;
|
||||
[Dependency] private readonly IResourceCache _resource = default!;
|
||||
[Dependency] private readonly SpriteSystem _sprite = default!;
|
||||
[Dependency] private readonly AnimationPlayerSystem _animationPlayer = default!;
|
||||
|
||||
private DVTextRenderingOverlay _textRendering = default!;
|
||||
|
||||
private Font _font = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
_textRendering = new(_sprite, _animationPlayer);
|
||||
_overlay.AddOverlay(_textRendering);
|
||||
_font = new VectorFont(_resource.GetResource<FontResource>("/Fonts/_DV/TinyUnicode.ttf"), 12);
|
||||
|
||||
SubscribeLocalEvent<DVTextVisualsComponent, ComponentInit>(OnComponentInit);
|
||||
SubscribeLocalEvent<DVTextVisualsComponent, ComponentShutdown>(OnComponentShutdown);
|
||||
|
||||
SubscribeLocalEvent<DVTextVisualsComponent, AnimationCompletedEvent>(OnAnimationComplete);
|
||||
}
|
||||
|
||||
public override void Shutdown()
|
||||
{
|
||||
_overlay.RemoveOverlay(_textRendering);
|
||||
}
|
||||
|
||||
private void OnComponentInit(Entity<DVTextVisualsComponent> ent, ref ComponentInit args)
|
||||
{
|
||||
ent.Comp.Token = _textRendering.QueueRender(ent, _font);
|
||||
}
|
||||
|
||||
private void OnComponentShutdown(Entity<DVTextVisualsComponent> ent, ref ComponentShutdown args)
|
||||
{
|
||||
foreach (var row in ent.Comp.Rows)
|
||||
{
|
||||
row.Texture?.Dispose();
|
||||
}
|
||||
ent.Comp.Token?.Cancel();
|
||||
}
|
||||
|
||||
private void OnAnimationComplete(Entity<DVTextVisualsComponent> ent, ref AnimationCompletedEvent args)
|
||||
{
|
||||
if (args.Key != DVTextRenderingOverlay.MarqueeKey || !args.Finished || ent.Comp.Animation is not { } animation)
|
||||
return;
|
||||
|
||||
_animationPlayer.Play(ent.Owner, animation, DVTextRenderingOverlay.MarqueeKey);
|
||||
}
|
||||
|
||||
public void SetText(Entity<DVTextVisualsComponent?> ent, params string[] rows)
|
||||
{
|
||||
if (!Resolve(ent, ref ent.Comp))
|
||||
return;
|
||||
|
||||
var count = Math.Min(rows.Length, ent.Comp.Rows.Count);
|
||||
for (var i = 0; i < count; i++)
|
||||
{
|
||||
ent.Comp.Rows[i].Text = rows[i];
|
||||
}
|
||||
|
||||
ent.Comp.Token?.Cancel();
|
||||
ent.Comp.Token = _textRendering.QueueRender((ent, ent.Comp), _font);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using Content.Client.Resources;
|
||||
using Content.Client.Stylesheets;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using static Content.Client.Stylesheets.StylesheetHelpers;
|
||||
|
||||
namespace Content.Client._DV.Stylesheets.Sheetlets;
|
||||
|
||||
[CommonSheetlet]
|
||||
public sealed class DVLineEditSheetlet : Sheetlet<PalettedStylesheet>
|
||||
{
|
||||
public override StyleRule[] GetRules(PalettedStylesheet sheet, object config)
|
||||
{
|
||||
var tinyUnicode = ResCache.GetFont("/Fonts/_DV/TinyUnicode.ttf", size: 24);
|
||||
|
||||
return
|
||||
[
|
||||
E<LineEdit>()
|
||||
.Class("comms-console-display")
|
||||
.Font(tinyUnicode),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Server.Administration.Managers;
|
||||
using Content.Shared._DV.Administration.Components; // DeltaV - Unorbitable
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Utility;
|
||||
@@ -6,7 +7,7 @@ using Robust.Shared.Utility;
|
||||
namespace Content.Server.Administration.Commands;
|
||||
|
||||
[AdminCommand(AdminFlags.Stealth)]
|
||||
public sealed class StealthminCommand : LocalizedCommands
|
||||
public sealed class StealthminCommand : LocalizedEntityCommands // DeltaV - Unorbitable, LocalizedCommands to LocalizedEntityCommands
|
||||
{
|
||||
[Dependency] private readonly IAdminManager _adminManager = default!;
|
||||
|
||||
@@ -26,8 +27,20 @@ public sealed class StealthminCommand : LocalizedCommands
|
||||
DebugTools.AssertNotNull(adminData);
|
||||
|
||||
if (!adminData!.Stealth)
|
||||
{
|
||||
_adminManager.Stealth(player);
|
||||
// DeltaV - Unorbitable START
|
||||
if (player.AttachedEntity is { } attachedEntity)
|
||||
EntityManager.EnsureComponent<UnorbitableComponent>(attachedEntity);
|
||||
// DeltaV END
|
||||
}
|
||||
else
|
||||
{
|
||||
_adminManager.UnStealth(player);
|
||||
// DeltaV - Unorbitable START
|
||||
if (player.AttachedEntity is { } attachedEntity)
|
||||
EntityManager.RemoveComponent<UnorbitableComponent>(attachedEntity);
|
||||
// DeltaV END
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Content.Server.Chat.Systems;
|
||||
using Content.Server.GameTicking;
|
||||
using Content.Server.Ninja.Systems;
|
||||
using Content.Shared._DV.Communications; // DeltaV Comms Console
|
||||
using Content.Shared.Communications;
|
||||
using Content.Shared.DoAfter;
|
||||
using Content.Shared.Interaction;
|
||||
@@ -35,7 +36,7 @@ public sealed class CommsHackerSystem : SharedCommsHackerSystem
|
||||
/// </summary>
|
||||
private void OnBeforeInteractHand(EntityUid uid, CommsHackerComponent comp, BeforeInteractHandEvent args)
|
||||
{
|
||||
if (args.Handled || !HasComp<CommunicationsConsoleComponent>(args.Target))
|
||||
if (args.Handled || !HasComp<DVCommunicationsConsoleComponent>(args.Target)) // DeltaV - Comms Console
|
||||
return;
|
||||
|
||||
// TODO: generic check event
|
||||
|
||||
@@ -23,7 +23,7 @@ using Robust.Shared.Configuration;
|
||||
|
||||
namespace Content.Server.Communications
|
||||
{
|
||||
public sealed partial class CommunicationsConsoleSystem : EntitySystem // DeltaV - Partial Class
|
||||
public sealed class CommunicationsConsoleSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly AccessReaderSystem _accessReaderSystem = default!;
|
||||
[Dependency] private readonly AlertLevelSystem _alertLevelSystem = default!;
|
||||
@@ -53,8 +53,6 @@ namespace Content.Server.Communications
|
||||
SubscribeLocalEvent<CommunicationsConsoleComponent, CommunicationsConsoleCallEmergencyShuttleMessage>(OnCallShuttleMessage);
|
||||
SubscribeLocalEvent<CommunicationsConsoleComponent, CommunicationsConsoleRecallEmergencyShuttleMessage>(OnRecallShuttleMessage);
|
||||
|
||||
InitializeExfiltration(); // DeltaV - Exfiltration shuttle
|
||||
|
||||
// On console init, set cooldown
|
||||
SubscribeLocalEvent<CommunicationsConsoleComponent, MapInitEvent>(OnCommunicationsConsoleMapInit);
|
||||
}
|
||||
@@ -138,7 +136,6 @@ namespace Content.Server.Communications
|
||||
List<string>? levels = null;
|
||||
string currentLevel = default!;
|
||||
float currentDelay = 0;
|
||||
TimeSpan? exfiltrationTime = null; // DeltaV - exfiltration shuttle
|
||||
|
||||
if (stationUid != null)
|
||||
{
|
||||
@@ -160,12 +157,6 @@ namespace Content.Server.Communications
|
||||
currentLevel = alertComp.CurrentLevel;
|
||||
currentDelay = _alertLevelSystem.GetAlertLevelDelay(stationUid.Value, alertComp);
|
||||
}
|
||||
// Begin DeltaV - exfiltration shuttle
|
||||
if (TryComp<StationExfiltrationComponent>(stationUid, out var exfiltration))
|
||||
{
|
||||
exfiltrationTime = exfiltration.ArrivalTime;
|
||||
}
|
||||
// End DeltaV - exfiltration shuttle
|
||||
}
|
||||
|
||||
_uiSystem.SetUiState(uid, CommunicationsConsoleUiKey.Key, new CommunicationsConsoleInterfaceState(
|
||||
@@ -174,8 +165,7 @@ namespace Content.Server.Communications
|
||||
levels,
|
||||
currentLevel,
|
||||
currentDelay,
|
||||
_roundEndSystem.ExpectedCountdownEnd,
|
||||
exfiltrationTime // DeltaV - exfiltration shuttle
|
||||
_roundEndSystem.ExpectedCountdownEnd
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Content.Server.RoundEnd; // DeltaV
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
|
||||
|
||||
namespace Content.Server.GameTicking.Rules.Components;
|
||||
@@ -43,4 +44,16 @@ public sealed partial class XenoborgsRuleComponent : Component
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public bool XenoborgShuttleCalled = false;
|
||||
|
||||
/// <summary>
|
||||
/// DeltaV - The behavior of the round if the mothership core is deleted.
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public RoundEndBehavior XenoborgRoundEndBehavior = RoundEndBehavior.BecomeSurvival;
|
||||
|
||||
/// <summary>
|
||||
/// DeltaV - The amount of time before the evac shuttle will arrive if the XenoborgRoundEndBehavior is set to ShuttleCall.
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public TimeSpan XenoborgShuttleDelay = TimeSpan.FromMinutes(10);
|
||||
}
|
||||
|
||||
@@ -30,10 +30,20 @@ public sealed partial class ZombieRuleComponent : Component
|
||||
/// <summary>
|
||||
/// DeltaV - The behavior of the round if all zombies are defeated.
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public RoundEndBehavior ZombieRoundEndBehavior = RoundEndBehavior.BecomeSurvival;
|
||||
|
||||
/// <summary>
|
||||
/// DeltaV - The amount of time before the evac shuttle will arrive if the ZombieRoundEndBehavior is set to ShuttleCall.
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public TimeSpan ZombieShuttleDelay = TimeSpan.FromMinutes(10);
|
||||
|
||||
/// <summary>
|
||||
/// DeltaV - If true, ZombieRuleSystem will do the ZombieRoundEndBehavior if zombies are defeated.
|
||||
/// This is needed because ZombieOutbreak uses the ZombieRuleComponent but the system won't know if
|
||||
/// it was roundstart or not.
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public bool IsRoundStartZombies = false;
|
||||
}
|
||||
|
||||
@@ -520,18 +520,17 @@ public sealed class NukeopsRuleSystem : GameRuleSystem<NukeopsRuleComponent>
|
||||
|
||||
// BEGIN DeltaV - Detect Nukie Failure Better
|
||||
// We need to use a EntityQueryEnumerator instead of a EntityQuery, because we need the uid to check for cuffs
|
||||
var operatives = new List<Entity<NukeOperativeComponent, MobStateComponent, TransformComponent>>();
|
||||
var operativesEnumerator = EntityQueryEnumerator<NukeOperativeComponent, MobStateComponent, TransformComponent>();
|
||||
while (operativesEnumerator.MoveNext(out var uid, out var nukeOp, out var mobState, out var transform))
|
||||
var operatives = new List<Entity<NukeOperativeComponent, MobStateComponent>>();
|
||||
var operativesEnumerator = EntityQueryEnumerator<NukeOperativeComponent, MobStateComponent>();
|
||||
while (operativesEnumerator.MoveNext(out var uid, out var nukeOp, out var mobState))
|
||||
{
|
||||
operatives.Add((uid, nukeOp, mobState, transform));
|
||||
operatives.Add((uid, nukeOp, mobState));
|
||||
}
|
||||
|
||||
var operativesAlive = operatives
|
||||
.Where(op => op.Comp3.MapID == shuttleMapId
|
||||
|| op.Comp3.MapID == targetStationMap)
|
||||
.Any(op => op.Comp2.CurrentState == MobState.Alive && op.Comp1.Running &&
|
||||
!TryComp<CuffableComponent>(op, out _)); // in the case the crew keeps one alive
|
||||
.Any(op => op.Comp1.Running
|
||||
&& op.Comp2.CurrentState == MobState.Alive
|
||||
&& TryComp<CuffableComponent>(op, out var cuffable) && cuffable.CuffedHandCount == 0); // in the case the crew keeps one alive
|
||||
// END DeltaV
|
||||
|
||||
if (operativesAlive)
|
||||
|
||||
@@ -42,6 +42,14 @@ public sealed class XenoborgsRuleSystem : GameRuleSystem<XenoborgsRuleComponent>
|
||||
colorOverride: AnnouncmentColor);
|
||||
|
||||
ent.Comp.MothershipCoreDeathAnnouncmentSent = true;
|
||||
|
||||
// BEGIN DeltaV - Convert to Survival
|
||||
if (ent.Comp.XenoborgRoundEndBehavior != RoundEndBehavior.Nothing)
|
||||
{
|
||||
_roundEnd.DoRoundEndBehavior(ent.Comp.XenoborgRoundEndBehavior, ent.Comp.XenoborgShuttleDelay);
|
||||
ent.Comp.XenoborgRoundEndBehavior = RoundEndBehavior.Nothing;
|
||||
}
|
||||
// END DeltaV
|
||||
}
|
||||
|
||||
// TODO: Refactor the end of round text
|
||||
|
||||
@@ -115,29 +115,30 @@ public sealed class ZombieRuleSystem : GameRuleSystem<ZombieRuleComponent>
|
||||
/// </summary>
|
||||
private void CheckRoundEnd(ZombieRuleComponent zombieRuleComponent)
|
||||
{
|
||||
// BEGIN DeltaV - Change mode to survival if zombies die
|
||||
// Zombies have failed to launch and the mode has been switched to survival
|
||||
if (zombieRuleComponent.ZombieRoundEndBehavior == RoundEndBehavior.Nothing)
|
||||
return;
|
||||
// END DeltaV
|
||||
|
||||
var healthy = GetHealthyHumans();
|
||||
if (healthy.Count == 1) // Only one human left. spooky
|
||||
_popup.PopupEntity(Loc.GetString("zombie-alone"), healthy[0], healthy[0]);
|
||||
|
||||
|
||||
// BEGIN DeltaV - Change mode to survival if zombies die
|
||||
var anyInitialInfectedAlive = EntityQuery<InitialInfectedComponent, MobStateComponent>(false)
|
||||
.Any(x => x.Item2.CurrentState != MobState.Dead);
|
||||
var anyLivingZombies = EntityQuery<ZombieComponent, MobStateComponent>(false)
|
||||
.Any(x => x.Item2.CurrentState != MobState.Dead);
|
||||
var anyPendingZombies = EntityQuery<PendingZombieComponent>(false).Any();
|
||||
|
||||
// All II turned/dead, all entities that have turned are dead, and there are no more pending zombies
|
||||
if (!anyInitialInfectedAlive && !anyLivingZombies && !anyPendingZombies)
|
||||
if (zombieRuleComponent.IsRoundStartZombies)
|
||||
{
|
||||
_roundEnd.DoRoundEndBehavior(zombieRuleComponent.ZombieRoundEndBehavior, zombieRuleComponent.ZombieShuttleDelay);
|
||||
zombieRuleComponent.ZombieRoundEndBehavior = RoundEndBehavior.Nothing; // stop this check in the future
|
||||
// Zombies have failed to launch and the mode has been switched to survival
|
||||
if (zombieRuleComponent.ZombieRoundEndBehavior == RoundEndBehavior.Nothing)
|
||||
return;
|
||||
|
||||
// BEGIN DeltaV - Change mode to survival if zombies die
|
||||
var anyInitialInfectedAlive = EntityQuery<InitialInfectedComponent, MobStateComponent>(false)
|
||||
.Any(x => x.Item2.CurrentState != MobState.Dead);
|
||||
var anyLivingZombies = EntityQuery<ZombieComponent, MobStateComponent>(false)
|
||||
.Any(x => x.Item2.CurrentState != MobState.Dead);
|
||||
var anyPendingZombies = EntityQuery<PendingZombieComponent>(false).Any();
|
||||
|
||||
// All II turned/dead, all entities that have turned are dead, and there are no more pending zombies
|
||||
if (!anyInitialInfectedAlive && !anyLivingZombies && !anyPendingZombies)
|
||||
{
|
||||
_roundEnd.DoRoundEndBehavior(zombieRuleComponent.ZombieRoundEndBehavior, zombieRuleComponent.ZombieShuttleDelay);
|
||||
zombieRuleComponent.ZombieRoundEndBehavior = RoundEndBehavior.Nothing; // stop this check in the future
|
||||
}
|
||||
}
|
||||
// END DeltaV
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ using Content.Shared.Movement.Systems;
|
||||
using Content.Shared.NameModifier.EntitySystems;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Server.Preferences.Managers; // DeltaV
|
||||
using Content.Shared._DV.Administration.EntitySystems; // DeltaV - Unorbitable
|
||||
using Content.Shared.Storage.Components;
|
||||
using Content.Shared.Tag;
|
||||
using Content.Shared.Warps;
|
||||
@@ -75,6 +76,7 @@ namespace Content.Server.Ghost
|
||||
[Dependency] private readonly GhostSpriteStateSystem _ghostState = default!;
|
||||
[Dependency] private readonly IServerPreferencesManager _preferencesManager = default!; // DeltaV
|
||||
[Dependency] private readonly IAdminManager _admin = default!; // DeltaV
|
||||
[Dependency] private readonly UnorbitableSystem _unorbitable = default!; // DeltaV - Unorbitable
|
||||
|
||||
private EntityQuery<GhostComponent> _ghostQuery;
|
||||
private EntityQuery<PhysicsComponent> _physicsQuery;
|
||||
@@ -341,6 +343,11 @@ namespace Content.Server.Ghost
|
||||
return;
|
||||
}
|
||||
|
||||
// DeltaV - Unorbitable START
|
||||
if (!_unorbitable.CanFollow(attached, realTarget))
|
||||
return;
|
||||
// DeltaV END
|
||||
|
||||
WarpTo(attached, realTarget);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,17 @@ public sealed partial class EmergencyLightComponent : SharedEmergencyLightCompon
|
||||
[DataField("chargingEfficiency")]
|
||||
public float ChargingEfficiency = 0.85f;
|
||||
|
||||
// Begin DeltaV Additions
|
||||
[DataField]
|
||||
public float MaydayRadius = 10f;
|
||||
|
||||
[DataField]
|
||||
public float MaydayFalloff = 0f;
|
||||
|
||||
[DataField]
|
||||
public float MaydayEnergy = 0.7f;
|
||||
// End DeltaV Additions
|
||||
|
||||
public Dictionary<EmergencyLightState, string> BatteryStateText = new()
|
||||
{
|
||||
{ EmergencyLightState.Full, "emergency-light-component-light-state-full" },
|
||||
|
||||
@@ -23,6 +23,7 @@ using Content.Server.Body.Systems;
|
||||
// Begin DeltaV
|
||||
using Content.Server._DV.MedicalRecords;
|
||||
using Content.Shared._DV.MedicalRecords;
|
||||
using Content.Shared.Chemistry.Components;
|
||||
// End DeltaV
|
||||
|
||||
namespace Content.Server.Medical;
|
||||
@@ -84,11 +85,11 @@ public sealed partial class HealthAnalyzerSystem : EntitySystem // DeltaV - Made
|
||||
if (component.MaxScanRange != null && !_transformSystem.InRange(patientCoordinates, transform.Coordinates, component.MaxScanRange.Value))
|
||||
{
|
||||
//Range too far, disable updates
|
||||
PauseAnalyzingEntity((uid, component), patient); // DeltaV - Analyzer Reactivation
|
||||
PauseAnalyzingEntity((uid, component), patient);
|
||||
continue;
|
||||
}
|
||||
|
||||
component.IsAnalyzerActive = true; // DeltaV - Analyzer Reactivation
|
||||
component.IsAnalyzerActive = true;
|
||||
UpdateScannedUser(uid, patient, true);
|
||||
}
|
||||
}
|
||||
@@ -196,7 +197,7 @@ public sealed partial class HealthAnalyzerSystem : EntitySystem // DeltaV - Made
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// DeltaV - If the scanner is active, sends one last update and sets it to inactive.
|
||||
/// If the scanner is active, sends one last update and sets it to inactive.
|
||||
/// </summary>
|
||||
/// <param name="healthAnalyzer">The health analyzer that's receiving the updates</param>
|
||||
/// <param name="target">The entity to analyze</param>
|
||||
@@ -269,9 +270,11 @@ public sealed partial class HealthAnalyzerSystem : EntitySystem // DeltaV - Made
|
||||
var bleeding = false;
|
||||
var unrevivable = false;
|
||||
|
||||
Solution? bloodSolution = null; // DeltaV - Health Analyzer Plus
|
||||
|
||||
if (TryComp<BloodstreamComponent>(entity, out var bloodstream) &&
|
||||
_solutionContainerSystem.ResolveSolution(entity, bloodstream.BloodSolutionName,
|
||||
ref bloodstream.BloodSolution, out var bloodSolution))
|
||||
ref bloodstream.BloodSolution, out bloodSolution)) // DeltaV - Health Analyzer Plus
|
||||
{
|
||||
bloodAmount = _bloodstreamSystem.GetBloodLevel(entity);
|
||||
bleeding = bloodstream.BleedAmount > 0;
|
||||
@@ -287,6 +290,7 @@ public sealed partial class HealthAnalyzerSystem : EntitySystem // DeltaV - Made
|
||||
null,
|
||||
bleeding,
|
||||
unrevivable,
|
||||
bloodSolution, // DeltaV - Health Analyzer Plus
|
||||
_medicalRecords.GetMedicalRecords(entity) // DeltaV - Medical Records
|
||||
);
|
||||
}
|
||||
|
||||
@@ -125,12 +125,12 @@ public sealed class ProjectileSystem : SharedProjectileSystem
|
||||
RaiseLocalEvent(projectile, ref pierceEv);
|
||||
|
||||
// If the object won't be destroyed, it "tanks" the penetration hit.
|
||||
if (damage.GetTotal() < damageRequired)
|
||||
if (damage.GetTotal() < damageRequired && !pierceEv.Pierced) // DeltaV - Addition of the NT-3
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!projectile.Comp.ProjectileSpent)
|
||||
if (!projectile.Comp.ProjectileSpent && !pierceEv.Pierced) // DeltaV - Addition of the NT-3
|
||||
{
|
||||
projectile.Comp.PenetrationAmount += damageRequired;
|
||||
// The projectile has dealt enough damage to be spent.
|
||||
@@ -139,7 +139,7 @@ public sealed class ProjectileSystem : SharedProjectileSystem
|
||||
return false;
|
||||
}
|
||||
|
||||
if (projectile.Comp.ProjectileSpent && pierceEv.Pierced) // DeltaV - Addition of the NT-3
|
||||
if (projectile.Comp.ProjectileSpent)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ using Content.Shared.StatusEffect;
|
||||
using Content.Shared.Store.Components;
|
||||
using Content.Shared.Stunnable;
|
||||
using Content.Shared.Tag;
|
||||
using Content.Shared.Weapons.Melee.Events; // DeltaV
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using Robust.Shared.Prototypes;
|
||||
@@ -64,6 +65,7 @@ public sealed partial class RevenantSystem : EntitySystem
|
||||
SubscribeLocalEvent<RevenantComponent, StatusEffectAddedEvent>(OnStatusAdded);
|
||||
SubscribeLocalEvent<RevenantComponent, StatusEffectEndedEvent>(OnStatusEnded);
|
||||
SubscribeLocalEvent<RoundEndTextAppendEvent>(_ => MakeVisible(true));
|
||||
SubscribeLocalEvent<RevenantComponent, MeleeAttackEvent>(OnMeleeAttack); // DeltaV
|
||||
|
||||
SubscribeLocalEvent<RevenantComponent, GetVisMaskEvent>(OnRevenantGetVis);
|
||||
|
||||
@@ -131,6 +133,14 @@ public sealed partial class RevenantSystem : EntitySystem
|
||||
ChangeEssenceAmount(uid, essenceDamage, component);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// DeltaV - No more attack spam and remaining invisible
|
||||
/// </summary>
|
||||
private void OnMeleeAttack(Entity<RevenantComponent> ent, ref MeleeAttackEvent args)
|
||||
{
|
||||
_statusEffects.TryAddStatusEffect<CorporealComponent>(ent, "Corporeal", ent.Comp.MeleeRevealTime, false);
|
||||
}
|
||||
|
||||
public bool ChangeEssenceAmount(EntityUid uid, FixedPoint2 amount, RevenantComponent? component = null, bool allowDeath = true, bool regenCap = false)
|
||||
{
|
||||
if (!Resolve(uid, ref component))
|
||||
|
||||
@@ -41,7 +41,8 @@ namespace Content.Server.StationEvents
|
||||
if (TryComp<NextEventComponent>(uid, out var nextEventComponent)
|
||||
&& _event.TryGenerateRandomEvent(component.ScheduledGameRules, TimeSpan.FromSeconds(component.TimeUntilNextEvent)) is {} firstEvent)
|
||||
{
|
||||
_chatManager.SendAdminAlert(Loc.GetString("station-event-system-run-event-delayed", ("eventName", firstEvent), ("seconds", (int)component.TimeUntilNextEvent)));
|
||||
var nextEventTime = GameTicker.RoundDuration() + TimeSpan.FromSeconds(component.TimeUntilNextEvent);
|
||||
_chatManager.SendAdminAlert(Loc.GetString("station-event-system-run-event-delayed", ("eventName", firstEvent), ("time", nextEventTime.ToString(@"hh\:mm\:ss"))));
|
||||
_next.UpdateNextEvent(nextEventComponent, firstEvent, GameTicker.RoundDuration() + TimeSpan.FromSeconds(component.TimeUntilNextEvent));
|
||||
}
|
||||
// End DeltaV Additions
|
||||
@@ -81,7 +82,7 @@ namespace Content.Server.StationEvents
|
||||
if (_event.TryGenerateRandomEvent(eventScheduler.ScheduledGameRules, nextEventTime) is not {} generatedEvent)
|
||||
continue;
|
||||
|
||||
_chatManager.SendAdminAlert(Loc.GetString("station-event-system-run-event-delayed", ("eventName", generatedEvent), ("seconds", (int)eventScheduler.TimeUntilNextEvent)));
|
||||
_chatManager.SendAdminAlert(Loc.GetString("station-event-system-run-event-delayed", ("eventName", generatedEvent), ("time", nextEventTime.ToString(@"hh\:mm\:ss"))));
|
||||
// Cycle the stashed event with the new generated event and time.
|
||||
var storedEvent = _next.UpdateNextEvent(nextEventComponent, generatedEvent, nextEventTime);
|
||||
if (string.IsNullOrEmpty(storedEvent)) //If there was no stored event don't try to run it.
|
||||
|
||||
@@ -14,9 +14,12 @@ public sealed class RampingStationEventSchedulerSystem : GameRuleSystem<RampingS
|
||||
[Dependency] private readonly IChatManager _chatManager = default!; // DeltaV
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly EventManagerSystem _event = default!;
|
||||
#if DEBUG // DeltaV - Only used if built by Debug
|
||||
[Dependency] private readonly GameTicker _gameTicker = default!;
|
||||
#endif
|
||||
[Dependency] private readonly NextEventSystem _next = default!; // DeltaV
|
||||
|
||||
[Dependency] private readonly IGameTiming _timing = default!; // DeltaV
|
||||
|
||||
/* DeltaV
|
||||
/// <summary>
|
||||
/// Returns the ChaosModifier which increases as round time increases to a point.
|
||||
@@ -50,7 +53,8 @@ public sealed class RampingStationEventSchedulerSystem : GameRuleSystem<RampingS
|
||||
if (TryComp<NextEventComponent>(uid, out var nextEventComponent)
|
||||
&& _event.TryGenerateRandomEvent(component.ScheduledGameRules, TimeSpan.FromSeconds(component.TimeUntilNextEvent)) is {} firstEvent)
|
||||
{
|
||||
_chatManager.SendAdminAlert(Loc.GetString("station-event-system-run-event-delayed", ("eventName", firstEvent), ("seconds", (int)component.TimeUntilNextEvent)));
|
||||
var nextEventTime = GameTicker.RoundDuration() + TimeSpan.FromSeconds(component.TimeUntilNextEvent);
|
||||
_chatManager.SendAdminAlert(Loc.GetString("station-event-system-run-event-delayed", ("eventName", firstEvent), ("time", nextEventTime.ToString(@"hh\:mm\:ss"))));
|
||||
_next.UpdateNextEvent(nextEventComponent, firstEvent, GameTicker.RoundDuration() + TimeSpan.FromSeconds(component.TimeUntilNextEvent));
|
||||
}
|
||||
// End DeltaV Additions: init NextEventComp
|
||||
@@ -83,7 +87,7 @@ public sealed class RampingStationEventSchedulerSystem : GameRuleSystem<RampingS
|
||||
if (_event.TryGenerateRandomEvent(scheduler.ScheduledGameRules, nextEventTime) is not {} generatedEvent)
|
||||
continue;
|
||||
|
||||
_chatManager.SendAdminAlert(Loc.GetString("station-event-system-run-event-delayed", ("eventName", generatedEvent), ("seconds", (int)scheduler.TimeUntilNextEvent)));
|
||||
_chatManager.SendAdminAlert(Loc.GetString("station-event-system-run-event-delayed", ("eventName", generatedEvent), ("time", nextEventTime.ToString(@"hh\:mm\:ss"))));
|
||||
// Cycle the stashed event with the new generated event and time.
|
||||
string? storedEvent = _next.UpdateNextEvent(nextEventComponent, generatedEvent, nextEventTime);
|
||||
if (string.IsNullOrEmpty(storedEvent)) //If there was no stored event don't try to run it.
|
||||
@@ -114,13 +118,28 @@ public sealed class RampingStationEventSchedulerSystem : GameRuleSystem<RampingS
|
||||
// Begin DeltaV Additions
|
||||
var averageTimeUntilNextEvent = component.TimeKeyPoints[0].Y;
|
||||
var timeUntilNextEventDeviation = _random.NextFloat(-1f, 1f) * component.TimeDeviation;
|
||||
var roundTime = (float)_gameTicker.RoundDuration().TotalMinutes;
|
||||
var absoluteTimePoint = 0f;
|
||||
|
||||
var ruleActivated = TimeSpan.FromSeconds(0);
|
||||
if (TryComp<GameRuleComponent>(uid, out var gameRule))
|
||||
{
|
||||
ruleActivated = gameRule.ActivatedAt;
|
||||
}
|
||||
|
||||
var ruleTime = _timing.CurTime.Subtract(ruleActivated);
|
||||
|
||||
#if DEBUG
|
||||
_chatManager.SendAdminAlert(Loc.GetString("station-event-system-debug-round-time", ("time", _gameTicker.RoundDuration())));
|
||||
_chatManager.SendAdminAlert(Loc.GetString("station-event-system-debug-ramping-time", ("time", ruleActivated)));
|
||||
// This will be what the keypoint system looks at to determine where to start ramping
|
||||
_chatManager.SendAdminAlert(Loc.GetString("station-event-system-debug-keypoint-time", ("time", ruleTime)));
|
||||
_chatManager.SendAdminAlert("_______________"); // Easier to read
|
||||
#endif
|
||||
|
||||
var absoluteTimePoint = 0f;
|
||||
foreach (var point in component.TimeKeyPoints)
|
||||
{
|
||||
absoluteTimePoint += point.X;
|
||||
if (roundTime >= absoluteTimePoint)
|
||||
if (ruleTime.TotalMinutes >= absoluteTimePoint)
|
||||
averageTimeUntilNextEvent = point.Y;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
using Content.Shared._CD.Silicons.Borgs;
|
||||
using Content.Shared.Inventory;
|
||||
|
||||
namespace Content.Server._CD.Silicons.Borgs;
|
||||
|
||||
/// <summary>
|
||||
/// Server-side logic that shouldn't be exposed to the client.
|
||||
/// </summary>
|
||||
public sealed class BorgSwitchableSubstypeSystem : SharedBorgSwitchableSubtypeSystem
|
||||
{
|
||||
[Dependency] private readonly InventorySystem _inventorySystem = default!;
|
||||
|
||||
protected override void SelectBorgSubtype(Entity<BorgSwitchableSubtypeComponent> ent)
|
||||
{
|
||||
if (ent.Comp.BorgSubtype == null)
|
||||
return;
|
||||
|
||||
if (!Prototypes.Index(ent.Comp.BorgSubtype.Value)
|
||||
.TryGetComponent<BorgSubtypeDefinitionComponent>(out var borgSubtype, ComponentFactory))
|
||||
return;
|
||||
|
||||
// Configure special components
|
||||
if (Prototypes.TryIndex(ent.Comp.BorgSubtype, out var previousPrototype) &&
|
||||
previousPrototype.TryGetComponent<BorgSubtypeDefinitionComponent>(out var previousSubtype, ComponentFactory))
|
||||
{
|
||||
if (previousSubtype.AddComponents is { } removeComponents)
|
||||
EntityManager.RemoveComponents(ent, removeComponents);
|
||||
}
|
||||
|
||||
if (borgSubtype.AddComponents is { } addComponents)
|
||||
{
|
||||
EntityManager.AddComponents(ent, addComponents);
|
||||
}
|
||||
|
||||
// inventory template configuration (hats spacing)
|
||||
if (TryComp(ent, out InventoryComponent? inventory))
|
||||
{
|
||||
_inventorySystem.SetTemplateId((ent.Owner, inventory), borgSubtype.InventoryTemplateId);
|
||||
}
|
||||
|
||||
base.SelectBorgSubtype(ent);
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
using Content.Server._DV.Station.Components;
|
||||
using Content.Server._DV.Station.Systems;
|
||||
using Content.Shared._DV.Communications;
|
||||
|
||||
namespace Content.Server.Communications;
|
||||
|
||||
public sealed partial class CommunicationsConsoleSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly StationExfiltrationSystem _stationExfiltration = default!;
|
||||
|
||||
private void InitializeExfiltration()
|
||||
{
|
||||
SubscribeLocalEvent<CommunicationsConsoleComponent, CommunicationsConsoleExfiltrationShuttleMessage>(OnExfiltrationMessage);
|
||||
}
|
||||
|
||||
private void OnExfiltrationMessage(Entity<CommunicationsConsoleComponent> ent, ref CommunicationsConsoleExfiltrationShuttleMessage args)
|
||||
{
|
||||
if (_stationSystem.GetOwningStation(ent) is not { } station)
|
||||
return;
|
||||
|
||||
if (!CanUse(args.Actor, ent))
|
||||
{
|
||||
_popupSystem.PopupEntity(Loc.GetString("comms-console-permission-denied"), ent, args.Actor);
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.Call)
|
||||
_stationExfiltration.Call(station);
|
||||
else
|
||||
_stationExfiltration.Recall(station);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,184 @@
|
||||
using Content.Server._DV.Station.Components;
|
||||
using Content.Server._DV.Station.Systems;
|
||||
using Content.Server.AlertLevel;
|
||||
using Content.Server.Communications;
|
||||
using Content.Server.RoundEnd;
|
||||
using Content.Server.Shuttles.Systems;
|
||||
using Content.Shared._DV.Communications;
|
||||
using Content.Shared.CCVar;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Station;
|
||||
using Robust.Shared.Configuration;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server._DV.Communications;
|
||||
|
||||
public sealed class DVCommunicationsConsoleSystem : SharedDVCommunicationsConsoleSystem
|
||||
{
|
||||
[Dependency] private readonly SharedStationSystem _station = default!;
|
||||
[Dependency] private readonly EmergencyShuttleSystem _emergencyShuttle = default!;
|
||||
[Dependency] private readonly IPrototypeManager _prototype = default!;
|
||||
[Dependency] private readonly RoundEndSystem _roundEnd = default!;
|
||||
[Dependency] private readonly IConfigurationManager _configuration = default!;
|
||||
[Dependency] private readonly AlertLevelSystem _alertLevel = default!;
|
||||
[Dependency] private readonly StationExfiltrationSystem _stationExfiltration = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<RoundEndSystemChangedEvent>(OnRoundEndChanged);
|
||||
SubscribeLocalEvent<StationExfiltrationChangedEvent>(OnExfiltrationChanged);
|
||||
SubscribeLocalEvent<AlertLevelChangedEvent>(OnAlertLevelChanged);
|
||||
}
|
||||
|
||||
private void OnAlertLevelChanged(AlertLevelChangedEvent ev)
|
||||
{
|
||||
var query = EntityQueryEnumerator<DVCommunicationsConsoleComponent>();
|
||||
while (query.MoveNext(out var uid, out var comp))
|
||||
{
|
||||
if (_station.GetOwningStation(uid) != ev.Station)
|
||||
continue;
|
||||
|
||||
var alertLevel = Comp<AlertLevelComponent>(ev.Station);
|
||||
comp.CanSetAlertAt = Timing.CurTime + TimeSpan.FromSeconds(alertLevel.CurrentDelay);
|
||||
comp.CurrentAlertLevel = ev.AlertLevel;
|
||||
if (alertLevel.IsLevelLocked)
|
||||
comp.CanSetAlertAt = null;
|
||||
Dirty(uid, comp);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnExfiltrationChanged(ref StationExfiltrationChangedEvent ev)
|
||||
{
|
||||
var query = EntityQueryEnumerator<DVCommunicationsConsoleComponent>();
|
||||
while (query.MoveNext(out var uid, out var comp))
|
||||
{
|
||||
if (_station.GetOwningStation(uid) != ev.Station)
|
||||
continue;
|
||||
|
||||
comp.ExpectedExfiltrationArrival = ev.Station.Comp.ArrivalTime;
|
||||
Dirty(uid, comp);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnRoundEndChanged(RoundEndSystemChangedEvent ev)
|
||||
{
|
||||
var query = EntityQueryEnumerator<DVCommunicationsConsoleComponent>();
|
||||
while (query.MoveNext(out var uid, out var comp))
|
||||
{
|
||||
comp.ExpectedEvacuationArrival = _roundEnd.ExpectedCountdownEnd;
|
||||
comp.ExpectedEvacuationDuration = _roundEnd.ExpectedShuttleLength;
|
||||
comp.ShuttlesCallable = ShuttlesCallable();
|
||||
Dirty(uid, comp);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnMapInit(Entity<DVCommunicationsConsoleComponent> ent, ref MapInitEvent args)
|
||||
{
|
||||
base.OnMapInit(ent, ref args);
|
||||
|
||||
if (_station.GetOwningStation(ent) is not { } station)
|
||||
return;
|
||||
|
||||
if (!TryComp<AlertLevelComponent>(station, out var alertLevel))
|
||||
return;
|
||||
|
||||
ent.Comp.CurrentAlertLevel = alertLevel.CurrentLevel;
|
||||
var proto = _prototype.Index<AlertLevelPrototype>(alertLevel.AlertLevelPrototype);
|
||||
foreach (var (name, detail) in proto.Levels)
|
||||
{
|
||||
ent.Comp.AlertLevels.Add(new($"alert-level-{name}", $"alert-level-{name}-announcement", name, !detail.DisableSelection, detail.Color));
|
||||
}
|
||||
ent.Comp.CanSetAlertAt = Timing.CurTime + TimeSpan.FromSeconds(alertLevel.CurrentDelay);
|
||||
if (alertLevel.IsLevelLocked)
|
||||
ent.Comp.CanSetAlertAt = null;
|
||||
ent.Comp.ShuttlesCallable = ShuttlesCallable();
|
||||
|
||||
ent.Comp.ExpectedEvacuationArrival = _roundEnd.ExpectedCountdownEnd;
|
||||
ent.Comp.ExpectedEvacuationDuration = _roundEnd.ExpectedShuttleLength;
|
||||
if (TryComp<StationExfiltrationComponent>(station, out var exfiltration))
|
||||
ent.Comp.ExpectedExfiltrationArrival = exfiltration.ArrivalTime;
|
||||
|
||||
Dirty(ent);
|
||||
}
|
||||
|
||||
private bool ShuttlesCallable()
|
||||
{
|
||||
// Defer to what the round end system thinks we should be able to do.
|
||||
if (_emergencyShuttle.EmergencyShuttleArrived || !_roundEnd.CanCallOrRecall())
|
||||
return false;
|
||||
|
||||
// Calling shuttle checks
|
||||
if (_roundEnd.ExpectedCountdownEnd is null)
|
||||
return true;
|
||||
|
||||
// Recalling shuttle checks
|
||||
var recallThreshold = _configuration.GetCVar(CCVars.EmergencyRecallTurningPoint);
|
||||
|
||||
// shouldn't really be happening if we got here
|
||||
if (_roundEnd.ShuttleTimeLeft is not { } left
|
||||
|| _roundEnd.ExpectedShuttleLength is not { } expected)
|
||||
return false;
|
||||
|
||||
return !(left.TotalSeconds / expected.TotalSeconds < recallThreshold);
|
||||
}
|
||||
|
||||
protected override void OnAlertLevel(Entity<DVCommunicationsConsoleComponent> ent, ref DVCommunicationsConsoleAlertLevelMessage args)
|
||||
{
|
||||
base.OnAlertLevel(ent, ref args);
|
||||
|
||||
if (!AccessReader.IsAllowed(ent, args.Actor))
|
||||
return;
|
||||
|
||||
if (_station.GetOwningStation(ent) is not { } station)
|
||||
return;
|
||||
|
||||
_alertLevel.SetLevel(station, args.AlertLevel, true, true);
|
||||
AdminLog.Add(LogType.Action, LogImpact.High, $"{ToPrettyString(args.Actor):player} has set the alert level to {args.AlertLevel:level} on {ToPrettyString(station):station} using {ToPrettyString(ent):console}");
|
||||
}
|
||||
|
||||
protected override void OnEvacuationShuttle(Entity<DVCommunicationsConsoleComponent> ent, ref DVCommunicationsConsoleEvacuationShuttleMessage args)
|
||||
{
|
||||
base.OnEvacuationShuttle(ent, ref args);
|
||||
|
||||
if (!AccessReader.IsAllowed(ent, args.Actor))
|
||||
return;
|
||||
|
||||
if (args.Call)
|
||||
{
|
||||
var ev = new CommunicationConsoleCallShuttleAttemptEvent(ent, default!, args.Actor);
|
||||
RaiseLocalEvent(ref ev);
|
||||
|
||||
_roundEnd.RequestRoundEnd(args.Actor);
|
||||
AdminLog.Add(LogType.Action, LogImpact.High, $"{ToPrettyString(args.Actor):player} has called the evacuation shuttle using {ToPrettyString(ent):console}");
|
||||
}
|
||||
else
|
||||
{
|
||||
_roundEnd.CancelRoundEndCountdown(args.Actor);
|
||||
AdminLog.Add(LogType.Action, LogImpact.High, $"{ToPrettyString(args.Actor):player} has recalled the evacuation shuttle using {ToPrettyString(ent):console}");
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnExfiltrationShuttle(Entity<DVCommunicationsConsoleComponent> ent, ref DVCommunicationsConsoleExfiltrationShuttleMessage args)
|
||||
{
|
||||
base.OnExfiltrationShuttle(ent, ref args);
|
||||
|
||||
if (!AccessReader.IsAllowed(ent, args.Actor))
|
||||
return;
|
||||
|
||||
if (_station.GetOwningStation(ent) is not { } station)
|
||||
return;
|
||||
|
||||
if (args.Call)
|
||||
{
|
||||
_stationExfiltration.Call(station);
|
||||
AdminLog.Add(LogType.Action, LogImpact.High, $"{ToPrettyString(args.Actor):player} has called the exfiltration shuttle using {ToPrettyString(ent):console}");
|
||||
}
|
||||
else
|
||||
{
|
||||
_stationExfiltration.Recall(station);
|
||||
AdminLog.Add(LogType.Action, LogImpact.High, $"{ToPrettyString(args.Actor):player} has recalled the exfiltration shuttle using {ToPrettyString(ent):console}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,7 @@ public sealed partial class GameTicker
|
||||
public bool ConvertRoundToSurvival()
|
||||
{
|
||||
// Ramping scheduler is already added. Do nothing.
|
||||
if (IsGameRuleActive(RampingSchedulerProto))
|
||||
if (IsGameRuleAdded(RampingSchedulerProto))
|
||||
{
|
||||
_chatManager.SendAdminAlert("RampingStationEventScheduler detected. No rules added.");
|
||||
return true;
|
||||
@@ -44,7 +44,7 @@ public sealed partial class GameTicker
|
||||
var rampingSchedulerStart = _gameTiming.CurTime.Add(GracePeriod);
|
||||
EnsureComp<DelayedStartRuleComponent>(rampingScheduler).RuleStartTime = rampingSchedulerStart;
|
||||
|
||||
_chatManager.SendAdminAlert($"Major antag defeated. Converting to survival at {rampingSchedulerStart}.");
|
||||
_chatManager.SendAdminAlert($"Major antag defeated. Converting to survival at {(RoundDuration() + GracePeriod).ToString(@"hh\:mm\:ss")}.");
|
||||
|
||||
// End Basic Rules
|
||||
var basicRules = EntityQueryEnumerator<BasicStationEventSchedulerComponent>();
|
||||
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
using Content.Server.AlertLevel;
|
||||
using Content.Server.Audio.Jukebox;
|
||||
using Content.Server.Instruments;
|
||||
using Content.Server.Light.Components;
|
||||
using Content.Server.Light.EntitySystems;
|
||||
using Content.Server.Nuke;
|
||||
using Content.Server.RoundEnd;
|
||||
using Content.Shared._DV.KeycardAuthenticationDevice;
|
||||
using Content.Shared.Audio.Jukebox;
|
||||
using Content.Shared.Light.Components;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server._DV.KeycardAuthenticationDevice;
|
||||
|
||||
public sealed class DVStationKeycardAuthenticationDeviceSystem : SharedDVStationKeycardAuthenticationDeviceSystem
|
||||
{
|
||||
[Dependency] private readonly NukeCodePaperSystem _nukeCodePaper = default!;
|
||||
[Dependency] private readonly AlertLevelSystem _alertLevel = default!;
|
||||
[Dependency] private readonly RoundEndSystem _roundEnd = default!;
|
||||
[Dependency] private readonly IPrototypeManager _prototype = default!;
|
||||
[Dependency] private readonly PoweredLightSystem _poweredLight = default!;
|
||||
[Dependency] private readonly PointLightSystem _pointLight = default!;
|
||||
[Dependency] private readonly SharedUserInterfaceSystem _userInterface = default!;
|
||||
[Dependency] private readonly JukeboxSystem _jukebox = default!;
|
||||
|
||||
protected override void Mayday(Entity<DVStationKeycardAuthenticationDeviceComponent> station)
|
||||
{
|
||||
base.Mayday(station);
|
||||
|
||||
_alertLevel.SetLevel(station, "zeta", true, true, true, true);
|
||||
var alertLevel = Comp<AlertLevelComponent>(station);
|
||||
var level = _prototype.Index<AlertLevelPrototype>(alertLevel.AlertLevelPrototype).Levels[alertLevel.CurrentLevel];
|
||||
_roundEnd.RequestRoundEnd(level.ShuttleTime, null, null, false, cantRecall: true);
|
||||
|
||||
var bulbQuery = GetEntityQuery<LightBulbComponent>();
|
||||
var tubeQuery = EntityQueryEnumerator<PoweredLightComponent>();
|
||||
while (tubeQuery.MoveNext(out var uid, out var light))
|
||||
{
|
||||
if (Station.GetOwningStation(uid) != station.Owner)
|
||||
continue;
|
||||
|
||||
if (_poweredLight.GetBulb(uid, light) is not { } bulb || !bulbQuery.TryComp(bulb, out var bulbComp))
|
||||
continue;
|
||||
|
||||
bulbComp.LightEnergy /= 2;
|
||||
bulbComp.PowerUse /= 2;
|
||||
|
||||
_poweredLight.SetState(uid, light.On, light);
|
||||
}
|
||||
|
||||
var emergencyQuery = EntityQueryEnumerator<EmergencyLightComponent, PointLightComponent>();
|
||||
while (emergencyQuery.MoveNext(out var uid, out var emergency, out var light))
|
||||
{
|
||||
if (Station.GetOwningStation(uid) != station.Owner)
|
||||
continue;
|
||||
|
||||
_pointLight.SetEnergy(uid, emergency.MaydayEnergy, light);
|
||||
_pointLight.SetRadius(uid, emergency.MaydayRadius, light);
|
||||
_pointLight.SetFalloff(uid, emergency.MaydayFalloff, light);
|
||||
}
|
||||
|
||||
var instrumentQuery = EntityQueryEnumerator<InstrumentComponent>();
|
||||
while (instrumentQuery.MoveNext(out var uid, out _))
|
||||
{
|
||||
if (Station.GetOwningStation(uid) != station.Owner)
|
||||
continue;
|
||||
|
||||
_userInterface.CloseUis(uid);
|
||||
}
|
||||
|
||||
var jukeboxQuery = EntityQueryEnumerator<JukeboxComponent>();
|
||||
while (jukeboxQuery.MoveNext(out var uid, out var jukebox))
|
||||
{
|
||||
if (Station.GetOwningStation(uid) != station.Owner)
|
||||
continue;
|
||||
|
||||
_jukebox.Stop((uid, jukebox));
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Scuttling(Entity<DVStationKeycardAuthenticationDeviceComponent> station)
|
||||
{
|
||||
base.Scuttling(station);
|
||||
|
||||
_nukeCodePaper.SendNukeCodes(station);
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ using Content.Server.NodeContainer.Nodes;
|
||||
using Content.Shared._DV.NodeCrawl;
|
||||
using Content.Shared.Atmos;
|
||||
using Content.Shared.NodeContainer;
|
||||
using Content.Shared.Polymorph;
|
||||
using Content.Shared.Zombies;
|
||||
using Robust.Shared.Reflection;
|
||||
using Robust.Shared.Utility;
|
||||
@@ -30,6 +31,7 @@ public sealed class NodeCrawlSystem : SharedNodeCrawlSystem
|
||||
SubscribeLocalEvent<NodeCrawlerComponent, InhaleLocationEvent>(OnInhaleLocation);
|
||||
SubscribeLocalEvent<NodeCrawlerComponent, ExhaleLocationEvent>(OnExhaleLocation);
|
||||
SubscribeLocalEvent<NodeCrawlerComponent, AtmosExposedGetAirEvent>(OnGetAir);
|
||||
SubscribeLocalEvent<NodeCrawlerComponent, PolymorphActionEvent>(OnPolymorph);
|
||||
|
||||
SubscribeLocalEvent<NodeCrawlerComponent, EntityZombifiedEvent>(OnZombify);
|
||||
}
|
||||
@@ -222,4 +224,15 @@ public sealed class NodeCrawlSystem : SharedNodeCrawlSystem
|
||||
ent.Comp.EnterDelay = ent.Comp.ZombieEnterDelay;
|
||||
Dirty(ent);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Exit on polymorph or else the entity's movement bugs out.
|
||||
/// </summary>
|
||||
/// <param name="ent"></param>
|
||||
/// <param name="args"></param>
|
||||
private void OnPolymorph(Entity<NodeCrawlerComponent> ent, ref PolymorphActionEvent args)
|
||||
{
|
||||
if (ent.Comp.Mover.HasValue)
|
||||
ExitNodeCrawl(ent);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Shared.Tag;
|
||||
using Content.Shared.Whitelist;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server._DV.Projectiles.Components;
|
||||
@@ -21,10 +22,14 @@ public sealed partial class PiercingProjectileComponent : Component
|
||||
public float PierceCounter;
|
||||
|
||||
/// <summary>
|
||||
/// The tag that will cause the piercing bullet to increment it's <see cref="PierceCounter"/>.
|
||||
/// The whitelist for checking what increments the <see cref="PierceCounter"/>.
|
||||
/// </summary>
|
||||
/// <example>
|
||||
/// If this has the tag "Wall" in it, any entity with the tag "Wall" will increment <see cref="PierceCounter"/>
|
||||
/// upon being hit.
|
||||
/// </example>
|
||||
[DataField]
|
||||
public List<ProtoId<TagPrototype>> PierceBlockTag = ["Wall", "Window"];
|
||||
public EntityWhitelist PierceCounterWhitelist;
|
||||
|
||||
/// <summary>
|
||||
/// The number of entities it is allowed to pierce before being deleted.
|
||||
|
||||
@@ -3,7 +3,7 @@ using Content.Shared.FixedPoint;
|
||||
namespace Content.Server._DV.Projectiles.Events;
|
||||
|
||||
/// <summary>
|
||||
/// Raised when a piercing projectile hits an entity that doesn't follow upstream piercing rules.
|
||||
/// Raised when a piercing projectile that doesn't follow upstream piercing rules hits an entity.
|
||||
/// </summary>
|
||||
[ByRefEvent]
|
||||
public record struct ProjectilePierceEvent(EntityUid Target, FixedPoint2 RequiredDamage, bool Pierced = false);
|
||||
|
||||
@@ -1,29 +1,33 @@
|
||||
using Content.Server._DV.Projectiles.Components;
|
||||
using Content.Server._DV.Projectiles.Events;
|
||||
using Content.Shared.Tag;
|
||||
using Content.Shared.Whitelist;
|
||||
|
||||
namespace Content.Server._DV.Projectiles.Systems;
|
||||
|
||||
public sealed class PiercingProjectileSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly TagSystem _tagSystem = default!;
|
||||
[Dependency] private readonly EntityWhitelistSystem _whitelist = default!;
|
||||
|
||||
// Mobs return a required Damage amount of Float.MaxValue. Therefore, we need to check for absurdly high values.
|
||||
private readonly int _indestructibleNumber = 20000000;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<PiercingProjectileComponent, ProjectilePierceEvent>(OnPierce);
|
||||
}
|
||||
|
||||
private void OnPierce(Entity<PiercingProjectileComponent> bullet, ref ProjectilePierceEvent args)
|
||||
{
|
||||
// If the target doesn't have any tags to stop the bullet from piercing, it's automatically true.
|
||||
if (!_tagSystem.HasAnyTag(args.Target, bullet.Comp.PierceBlockTag))
|
||||
if (_whitelist.IsWhitelistFail(bullet.Comp.PierceCounterWhitelist, args.Target))
|
||||
{
|
||||
args.Pierced = true;
|
||||
return;
|
||||
}
|
||||
// If it does have the tag to stop it and enough health to count as "strongly armored", it'll block the bullet.
|
||||
if (bullet.Comp.HealthThreshold < args.RequiredDamage)
|
||||
if (bullet.Comp.HealthThreshold < args.RequiredDamage && args.RequiredDamage < _indestructibleNumber)
|
||||
return;
|
||||
|
||||
if (bullet.Comp.Direction == null) // Get the direction of the bullet to determine which walls count.
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
using Content.Server.AlertLevel;
|
||||
using Content.Server.Screens.Components;
|
||||
using Content.Shared._DV.Communications;
|
||||
using Content.Shared._DV.Screens;
|
||||
using Content.Shared.DeviceNetwork.Events;
|
||||
using Content.Shared.Station;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
namespace Content.Server._DV.Screens;
|
||||
|
||||
public sealed class DVScreenSystem : DVSharedScreenSystem
|
||||
{
|
||||
[Dependency] private readonly IGameTiming _timing = default!;
|
||||
[Dependency] private readonly SharedStationSystem _station = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<DVScreenComponent, DeviceNetworkPacketEvent>(OnPacket);
|
||||
SubscribeLocalEvent<AlertLevelChangedEvent>(OnAlertLevelChanged);
|
||||
}
|
||||
|
||||
private void OnPacket(Entity<DVScreenComponent> ent, ref DeviceNetworkPacketEvent args)
|
||||
{
|
||||
if (args.Data.TryGetValue(ShuttleTimerMasks.ShuttleMap, out _))
|
||||
OnShuttlePacket(ent, ref args);
|
||||
if (args.Data.TryGetValue(DVScreenPackets.Text, out (string, string)? text))
|
||||
OnTextPacket(ent, text.Value, ref args);
|
||||
if (args.Data.TryGetValue(DVScreenPackets.ShowBorders, out bool? showBorders))
|
||||
OnBordersPacket(ent, showBorders.Value, ref args);
|
||||
if (args.Data.TryGetValue(DVScreenPackets.Content, out DVScreenContent? content))
|
||||
OnContentPacket(ent, content.Value, ref args);
|
||||
}
|
||||
|
||||
private void OnShuttlePacket(Entity<DVScreenComponent> ent, ref DeviceNetworkPacketEvent args)
|
||||
{
|
||||
var xform = Transform(ent);
|
||||
|
||||
args.Data.TryGetValue(ShuttleTimerMasks.ShuttleMap, out EntityUid? shuttleMap);
|
||||
args.Data.TryGetValue(ShuttleTimerMasks.SourceMap, out EntityUid? source);
|
||||
args.Data.TryGetValue(ShuttleTimerMasks.DestMap, out EntityUid? dest);
|
||||
args.Data.TryGetValue(ShuttleTimerMasks.Docked, out bool docked);
|
||||
var screenIsAtDestination = docked;
|
||||
string key;
|
||||
|
||||
switch (xform.MapUid)
|
||||
{
|
||||
// sometimes the timer transforms on FTL shuttles have a hyperspace mapuid, so matching by grid works as a fallback.
|
||||
case var local when local == shuttleMap || xform.GridUid == shuttleMap:
|
||||
key = ShuttleTimerMasks.ShuttleTime;
|
||||
break;
|
||||
case var origin when origin == source:
|
||||
key = ShuttleTimerMasks.SourceTime;
|
||||
break;
|
||||
case var remote when remote == dest:
|
||||
key = ShuttleTimerMasks.DestTime;
|
||||
screenIsAtDestination = false;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
if (!args.Data.TryGetValue(key, out TimeSpan duration))
|
||||
return;
|
||||
|
||||
ent.Comp.ScreenIsAtDestination = screenIsAtDestination;
|
||||
ent.Comp.TargetTime = _timing.CurTime + duration;
|
||||
Dirty(ent);
|
||||
UpdateVisuals(ent);
|
||||
}
|
||||
|
||||
private void OnTextPacket(Entity<DVScreenComponent> ent, (string, string) text, ref DeviceNetworkPacketEvent args)
|
||||
{
|
||||
ent.Comp.Line1 = text.Item1;
|
||||
ent.Comp.Line2 = text.Item2;
|
||||
|
||||
Dirty(ent);
|
||||
UpdateVisuals(ent);
|
||||
}
|
||||
|
||||
private void OnBordersPacket(Entity<DVScreenComponent> ent, bool showBorders, ref DeviceNetworkPacketEvent args)
|
||||
{
|
||||
ent.Comp.ShowAlertBorder = showBorders;
|
||||
|
||||
Dirty(ent);
|
||||
UpdateVisuals(ent);
|
||||
}
|
||||
|
||||
private void OnContentPacket(Entity<DVScreenComponent> ent, DVScreenContent content, ref DeviceNetworkPacketEvent args)
|
||||
{
|
||||
ent.Comp.Content = content;
|
||||
|
||||
Dirty(ent);
|
||||
UpdateVisuals(ent);
|
||||
}
|
||||
|
||||
private void OnAlertLevelChanged(AlertLevelChangedEvent ev)
|
||||
{
|
||||
var query = EntityQueryEnumerator<DVScreenComponent>();
|
||||
while (query.MoveNext(out var uid, out var screen))
|
||||
{
|
||||
if (_station.GetOwningStation(uid) != ev.Station)
|
||||
continue;
|
||||
|
||||
screen.AlertLevel = ev.AlertLevel;
|
||||
Dirty(uid, screen);
|
||||
UpdateVisuals((uid, screen));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,7 +32,6 @@ public sealed class StationExfiltrationSystem : EntitySystem
|
||||
[Dependency] private readonly ShuttleSystem _shuttle = default!;
|
||||
[Dependency] private readonly StationSystem _station = default!;
|
||||
[Dependency] private readonly NavMapSystem _navMap = default!;
|
||||
[Dependency] private readonly CommunicationsConsoleSystem _communicationsConsole = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -169,7 +168,8 @@ public sealed class StationExfiltrationSystem : EntitySystem
|
||||
_chat.DispatchStationAnnouncement(ent, Loc.GetString(ent.Comp.CalledAnnouncement, ("time", ent.Comp.TravelTime.TotalSeconds), ("station", Name(ent))), sender: Loc.GetString(ent.Comp.Sender), colorOverride: Color.Gold);
|
||||
}
|
||||
|
||||
_communicationsConsole.UpdateCommsConsoleInterface();
|
||||
var evt = new StationExfiltrationChangedEvent((ent, ent.Comp), true);
|
||||
RaiseLocalEvent(ref evt);
|
||||
}
|
||||
|
||||
public void Recall(Entity<StationExfiltrationComponent?> ent)
|
||||
@@ -180,6 +180,10 @@ public sealed class StationExfiltrationSystem : EntitySystem
|
||||
ent.Comp.ArrivalTime = null;
|
||||
_chat.DispatchStationAnnouncement(ent, Loc.GetString(ent.Comp.RecalledAnnouncement, ("station", Name(ent))), sender: Loc.GetString(ent.Comp.Sender), colorOverride: Color.Gold);
|
||||
|
||||
_communicationsConsole.UpdateCommsConsoleInterface();
|
||||
var evt = new StationExfiltrationChangedEvent((ent, ent.Comp), false);
|
||||
RaiseLocalEvent(ref evt);
|
||||
}
|
||||
}
|
||||
|
||||
[ByRefEvent]
|
||||
public readonly record struct StationExfiltrationChangedEvent(Entity<StationExfiltrationComponent> Station, bool Exfiltrating);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Content.Server._DV.StationEvents.Components;
|
||||
using Content.Server.Antag;
|
||||
using Content.Server.Communications;
|
||||
using Content.Server.StationEvents.Events;
|
||||
using Content.Shared._DV.Communications;
|
||||
using Content.Shared.Forensics.Components;
|
||||
using Content.Shared.GameTicking.Components;
|
||||
using Content.Shared.Ghost;
|
||||
@@ -43,7 +43,7 @@ public sealed class FugitiveRule : StationEventSystem<FugitiveRuleComponent>
|
||||
ChatSystem.DispatchGlobalAnnouncement(announcement, sender: sender, colorOverride: comp.Color);
|
||||
|
||||
// send the report to every comms console on the station
|
||||
var query = EntityQueryEnumerator<TransformComponent, CommunicationsConsoleComponent>();
|
||||
var query = EntityQueryEnumerator<TransformComponent, DVCommunicationsConsoleComponent>();
|
||||
var consoles = new List<TransformComponent>();
|
||||
while (query.MoveNext(out var console, out var xform, out _))
|
||||
{
|
||||
|
||||
@@ -19,6 +19,7 @@ using Content.Shared._Goobstation.Flashbang;
|
||||
using Content.Shared._Starlight.Flash.Components;
|
||||
using Content.Shared.Body.Components;
|
||||
using Content.Shared.Flash; // Delta V - Flash Work
|
||||
using Content.Shared._DV.Body.Components; // Delta V - Remove various comps related to breathing
|
||||
|
||||
|
||||
namespace Content.Server._Starlight;
|
||||
@@ -68,6 +69,8 @@ public sealed class ShadekinSystem : EntitySystem
|
||||
{
|
||||
UpdateAlert(uid, component, (short)component.CurrentState);
|
||||
RemComp<InternalsComponent>(uid);
|
||||
RemComp<RespiratorComponent>(uid);
|
||||
RemComp<AffectedByCPRComponent>(uid); // No lungs = no CPR
|
||||
}
|
||||
|
||||
private void OnEyeColorChange(EntityUid uid, ShadekinComponent component, EyeColorInitEvent args)
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using Content.Shared._DV.Humanoid;
|
||||
using Content.Shared._DV.Humanoid; // DeltaV
|
||||
using Content.Shared.Humanoid.Markings;
|
||||
using Content.Shared.Humanoid;
|
||||
using Content.Shared.Sprite;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Utility;
|
||||
@@ -18,7 +16,6 @@ public abstract partial class SharedVisualBodySystem : EntitySystem
|
||||
[Dependency] private readonly IPrototypeManager _prototype = default!;
|
||||
[Dependency] private readonly MarkingManager _marking = default!;
|
||||
[Dependency] private readonly SharedContainerSystem _container = default!;
|
||||
[Dependency] private readonly SharedScaleVisualsSystem _scaleVisualsSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -28,7 +25,6 @@ public abstract partial class SharedVisualBodySystem : EntitySystem
|
||||
SubscribeLocalEvent<VisualOrganMarkingsComponent, BodyRelayedEvent<OrganCopyAppearanceEvent>>(OnMarkingsOrganCopyAppearance);
|
||||
SubscribeLocalEvent<VisualOrganComponent, BodyRelayedEvent<ApplyOrganProfileDataEvent>>(OnVisualOrganApplyProfile);
|
||||
SubscribeLocalEvent<VisualOrganMarkingsComponent, BodyRelayedEvent<ApplyOrganMarkingsEvent>>(OnMarkingsOrganApplyMarkings);
|
||||
SubscribeLocalEvent<HumanoidProfileComponent, ApplyOrganProfileDataEvent>(OnApplyOrganProfileData); // Delta V - Taking the solution from CD
|
||||
|
||||
InitializeModifiers();
|
||||
InitializeInitial();
|
||||
@@ -100,36 +96,9 @@ public abstract partial class SharedVisualBodySystem : EntitySystem
|
||||
if (!other.Layer.Equals(ent.Comp.Layer))
|
||||
return;
|
||||
|
||||
// Delta V - Begin Fix Height for Cloning
|
||||
var height = other.Profile.Height;
|
||||
if (TryComp<HumanoidProfileComponent>(args.Body.Owner, out var component))
|
||||
ScaleBody((args.Body.Owner, component), height, height);
|
||||
// Delta V - End
|
||||
|
||||
SetOrganAppearance(ent, other.Data);
|
||||
}
|
||||
|
||||
// Delta V - BEGIN CD Solution
|
||||
private void OnApplyOrganProfileData(Entity<HumanoidProfileComponent> entity, ref ApplyOrganProfileDataEvent args)
|
||||
{
|
||||
var speciesPrototype = _prototype.Index(entity.Comp.Species);
|
||||
if (args.Base == null)
|
||||
return;
|
||||
|
||||
var height = Math.Clamp(MathF.Round(args.Base.Value.Height, 2), speciesPrototype.MinHeight, speciesPrototype.MaxHeight);
|
||||
|
||||
ScaleBody(entity, speciesPrototype.ScaleHeight ? height : 1f, height);
|
||||
}
|
||||
|
||||
private void ScaleBody(Entity<HumanoidProfileComponent> entity, float heightX, float heightY)
|
||||
{
|
||||
_scaleVisualsSystem.SetSpriteScale(
|
||||
entity.Owner,
|
||||
new Vector2(heightX, heightY)
|
||||
);
|
||||
}
|
||||
// Delta V - END
|
||||
|
||||
|
||||
private void OnMarkingsOrganCopyAppearance(Entity<VisualOrganMarkingsComponent> ent, ref BodyRelayedEvent<OrganCopyAppearanceEvent> args)
|
||||
{
|
||||
|
||||
@@ -392,7 +392,6 @@ public abstract partial class SharedBuckleSystem
|
||||
if (TryComp<PhysicsComponent>(buckle, out var physics))
|
||||
_physics.ResetDynamics(buckle, physics);
|
||||
|
||||
// TOOD: DV - This fails when you try to buckle the entity you're carrying to something. Figure out why later.
|
||||
DebugTools.AssertEqual(xform.ParentUid, strap.Owner);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,9 +18,8 @@ namespace Content.Shared.Communications
|
||||
public List<string>? AlertLevels;
|
||||
public string CurrentAlert;
|
||||
public float CurrentAlertDelay;
|
||||
public readonly TimeSpan? ExpectedExfiltrationCountdownEnd;
|
||||
|
||||
public CommunicationsConsoleInterfaceState(bool canAnnounce, bool canCall, List<string>? alertLevels, string currentAlert, float currentAlertDelay, TimeSpan? expectedCountdownEnd, TimeSpan? expectedExfiltrationCountdownEnd) // DeltaV - Exfiltration Shuttle
|
||||
public CommunicationsConsoleInterfaceState(bool canAnnounce, bool canCall, List<string>? alertLevels, string currentAlert, float currentAlertDelay, TimeSpan? expectedCountdownEnd)
|
||||
{
|
||||
CanAnnounce = canAnnounce;
|
||||
CanCall = canCall;
|
||||
@@ -29,7 +28,6 @@ namespace Content.Shared.Communications
|
||||
AlertLevels = alertLevels;
|
||||
CurrentAlert = currentAlert;
|
||||
CurrentAlertDelay = currentAlertDelay;
|
||||
ExpectedExfiltrationCountdownEnd = expectedExfiltrationCountdownEnd; // DeltaV - Exfiltration Shuttle
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using Content.Shared._DV.Administration.EntitySystems; // DeltaV - Unorbitable
|
||||
using Content.Shared.Administration.Managers;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Follower.Components;
|
||||
@@ -33,6 +34,7 @@ public sealed class FollowerSystem : EntitySystem
|
||||
[Dependency] private readonly SharedPhysicsSystem _physicsSystem = default!;
|
||||
[Dependency] private readonly INetManager _netMan = default!;
|
||||
[Dependency] private readonly ISharedAdminManager _adminManager = default!;
|
||||
[Dependency] private readonly UnorbitableSystem _unorbitable = default!; // DeltaV - Unorbitable
|
||||
|
||||
private static readonly ProtoId<TagPrototype> ForceableFollowTag = "ForceableFollow";
|
||||
private static readonly ProtoId<TagPrototype> PreventGhostnadoWarpTag = "NotGhostnadoWarpable";
|
||||
@@ -98,6 +100,11 @@ public sealed class FollowerSystem : EntitySystem
|
||||
if (ev.User == ev.Target || IsClientSide(ev.Target))
|
||||
return;
|
||||
|
||||
// DeltaV - Unorbitable START
|
||||
if (!_unorbitable.CanFollow(ev.User, ev.Target))
|
||||
return;
|
||||
// DeltaV END
|
||||
|
||||
if (HasComp<GhostComponent>(ev.User))
|
||||
{
|
||||
var verb = new AlternativeVerb()
|
||||
@@ -187,6 +194,11 @@ public sealed class FollowerSystem : EntitySystem
|
||||
if (follower == entity || TerminatingOrDeleted(entity))
|
||||
return;
|
||||
|
||||
// DeltaV - Unorbitable START
|
||||
if (!_unorbitable.CanFollow(follower, entity))
|
||||
return;
|
||||
// DeltaV END
|
||||
|
||||
// No recursion for you
|
||||
var targetXform = Transform(entity);
|
||||
while (targetXform.ParentUid.IsValid())
|
||||
|
||||
@@ -2,8 +2,7 @@ using Content.Shared.Armor; // DeltaV - Addition of HandHeldArmor
|
||||
using Content.Shared.Atmos;
|
||||
using Content.Shared.Camera;
|
||||
using Content.Shared.Cuffs;
|
||||
using Content.Shared.Damage; // DeltaV End - Addition of HandHeldArmor
|
||||
using Content.Shared.Damage.Systems; // DeltaV End - Addition of HandHeldArmor
|
||||
using Content.Shared.Damage.Systems; // DeltaV - Addition of HandHeldArmor
|
||||
using Content.Shared.Hands.Components;
|
||||
using Content.Shared.Movement.Systems;
|
||||
using Content.Shared.Projectiles;
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
using System.Numerics; // DeltaV
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Humanoid.Prototypes;
|
||||
using Content.Shared.IdentityManagement;
|
||||
using Content.Shared.Preferences;
|
||||
using Content.Shared.Sprite; // DeltaV
|
||||
using Robust.Shared.GameObjects.Components.Localization;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
@@ -11,6 +13,7 @@ public sealed class HumanoidProfileSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly IPrototypeManager _prototype = default!;
|
||||
[Dependency] private readonly GrammarSystem _grammar = default!;
|
||||
[Dependency] private readonly SharedScaleVisualsSystem _scale = default!; // DeltaV
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -28,6 +31,7 @@ public sealed class HumanoidProfileSystem : EntitySystem
|
||||
ent.Comp.Age = profile.Age;
|
||||
ent.Comp.Species = profile.Species;
|
||||
ent.Comp.Sex = profile.Sex;
|
||||
ent.Comp.Height = profile.Height; // DeltaV
|
||||
Dirty(ent);
|
||||
|
||||
var sexChanged = new SexChangedEvent(ent.Comp.Sex, profile.Sex);
|
||||
@@ -37,6 +41,15 @@ public sealed class HumanoidProfileSystem : EntitySystem
|
||||
{
|
||||
_grammar.SetGender((ent, grammar), profile.Gender);
|
||||
}
|
||||
|
||||
// START DeltaV - Apply profile/species size
|
||||
// Assume 1.0 scale unless the original scale exists (blame Allulalo)
|
||||
var scale = Vector2.One;
|
||||
if (TryComp<ScaleVisualsComponent>(ent, out var scaledVisuals) && scaledVisuals.OriginalScale is { } originalScale)
|
||||
scale = originalScale;
|
||||
|
||||
_scale.SetSpriteScale(ent, scale);
|
||||
// END DeltaV
|
||||
}
|
||||
|
||||
private void OnExamined(Entity<HumanoidProfileComponent> ent, ref ExaminedEvent args)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Numerics; // DeltaV
|
||||
using Content.Shared.Body;
|
||||
using Content.Shared.Dataset;
|
||||
using Content.Shared.Humanoid.Markings;
|
||||
@@ -111,7 +112,7 @@ public sealed partial class SpeciesPrototype : IPrototype
|
||||
/// The base height scale for this species
|
||||
/// </summary>
|
||||
[DataField("baseScale")]
|
||||
public System.Numerics.Vector2 BaseScale = new(1f, 1f);
|
||||
public Vector2 BaseScale = new(1f, 1f);
|
||||
// End DV - CD Character Records shouldn't nuke species heights
|
||||
|
||||
// Begin CD - Character Records
|
||||
@@ -119,13 +120,13 @@ public sealed partial class SpeciesPrototype : IPrototype
|
||||
/// The minimum height for this species
|
||||
/// </summary>
|
||||
[DataField("minHeight")]
|
||||
public float MinHeight = 0.9f; // DeltaV - less trolling with the heights
|
||||
public float MinHeight = 0.8f; // DeltaV
|
||||
|
||||
/// <summary>
|
||||
/// The maximum height for this species
|
||||
/// </summary>
|
||||
[DataField("maxHeight")]
|
||||
public float MaxHeight = 1.1f; // DeltaV - less trolling with the heights
|
||||
public float MaxHeight = 1.2f; // DeltaV
|
||||
|
||||
/// <summary>
|
||||
/// The default height for this species
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Content.Shared._DV.Overlays;
|
||||
using Content.Shared._DV.Overlays; // DeltaV
|
||||
using Content.Shared._DV.Psionics.Events; // DeltaV
|
||||
using Content.Shared.Armor;
|
||||
using Content.Shared.Atmos;
|
||||
@@ -85,13 +85,15 @@ public partial class InventorySystem
|
||||
SubscribeLocalEvent<InventoryComponent, WieldAttemptEvent>(RefRelayInventoryEvent);
|
||||
SubscribeLocalEvent<InventoryComponent, UnwieldAttemptEvent>(RefRelayInventoryEvent);
|
||||
SubscribeLocalEvent<InventoryComponent, IngestionAttemptEvent>(RefRelayInventoryEvent);
|
||||
// DeltaV Start - Psionic Events
|
||||
// DeltaV Start
|
||||
// Psionic Events
|
||||
SubscribeLocalEvent<InventoryComponent, DispelledEvent>(RefRelayInventoryEvent);
|
||||
SubscribeLocalEvent<InventoryComponent, PsionicPowerUseAttemptEvent>(RefRelayInventoryEvent);
|
||||
SubscribeLocalEvent<InventoryComponent, TargetedByPsionicPowerEvent>(RefRelayInventoryEvent);
|
||||
SubscribeLocalEvent<InventoryComponent, NoosphericFryEvent>(RefRelayInventoryEvent);
|
||||
SubscribeLocalEvent<InventoryComponent, WeightlessnessChangedEvent>(RefRelayInventoryEvent); // Heavy Clothing
|
||||
// DeltaV End - Psionic Events
|
||||
// Heavy Clothing
|
||||
SubscribeLocalEvent<InventoryComponent, WeightlessnessChangedEvent>(RefRelayInventoryEvent);
|
||||
// DeltaV End
|
||||
|
||||
// Eye/vision events
|
||||
SubscribeLocalEvent<InventoryComponent, CanSeeAttemptEvent>(RelayInventoryEvent);
|
||||
|
||||
@@ -90,7 +90,7 @@ public sealed partial class LabelSystem : EntitySystem
|
||||
private void OnRefreshNameModifiers(Entity<LabelComponent> entity, ref RefreshNameModifiersEvent args)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(entity.Comp.CurrentLabel))
|
||||
args.AddModifier("comp-label-format", extraArgs: ("label", entity.Comp.CurrentLabel));
|
||||
args.AddModifier("comp-label-format", 100, extraArgs: ("label", entity.Comp.CurrentLabel)); // Coyote: add priority of 100 to reverse order of label and baseName
|
||||
}
|
||||
|
||||
private void OnComponentInit(Entity<PaperLabelComponent> ent, ref ComponentInit args)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Shared._DV.MedicalRecords; // DeltaV - Medical Records
|
||||
using Content.Shared.Chemistry.Components; // DeltaV - Health Analyzer Plus
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.MedicalScanner;
|
||||
@@ -29,11 +30,12 @@ public struct HealthAnalyzerUiState
|
||||
public bool? ScanMode;
|
||||
public bool? Bleeding;
|
||||
public bool? Unrevivable;
|
||||
public readonly Solution? BloodSolution; // DeltaV - Health Analyzer Plus
|
||||
public MedicalRecord? MedicalRecord; // DeltaV - Medical Records
|
||||
|
||||
public HealthAnalyzerUiState() {}
|
||||
|
||||
public HealthAnalyzerUiState(NetEntity? targetEntity, float temperature, float bloodLevel, bool? scanMode, bool? bleeding, bool? unrevivable, MedicalRecord? medicalRecord = null) // DeltaV - Medical Records
|
||||
public HealthAnalyzerUiState(NetEntity? targetEntity, float temperature, float bloodLevel, bool? scanMode, bool? bleeding, bool? unrevivable, Solution? bloodSolution, MedicalRecord? medicalRecord = null) // DeltaV - Health Analyzer Plus, Medical Records
|
||||
{
|
||||
TargetEntity = targetEntity;
|
||||
Temperature = temperature;
|
||||
@@ -41,6 +43,7 @@ public struct HealthAnalyzerUiState
|
||||
ScanMode = scanMode;
|
||||
Bleeding = bleeding;
|
||||
Unrevivable = unrevivable;
|
||||
BloodSolution = bloodSolution; // DeltaV - Health Analyzer Plus
|
||||
MedicalRecord = medicalRecord; // DeltaV - Medical Records
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
using Content.Shared._DV.Body.Components; // DeltaV
|
||||
using Content.Shared._DV.Body.Systems; // DeltaV
|
||||
using Content.Shared._ST.Interaction; // Stellar - interaction particles
|
||||
using Content.Shared._Floof.OfferItem; // Floof
|
||||
using Content.Shared.ActionBlocker;
|
||||
@@ -10,6 +12,7 @@ using Content.Shared.Database;
|
||||
using Content.Shared.Hands;
|
||||
using Content.Shared.Hands.Components;
|
||||
using Content.Shared.Hands.EntitySystems;
|
||||
using Content.Shared.Humanoid; // DeltaV
|
||||
using Content.Shared.IdentityManagement;
|
||||
using Content.Shared.Input;
|
||||
using Content.Shared.Interaction;
|
||||
@@ -55,6 +58,7 @@ public sealed class PullingSystem : EntitySystem
|
||||
[Dependency] private readonly HeldSpeedModifierSystem _clothingMoveSpeed = default!;
|
||||
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
||||
[Dependency] private readonly SharedVirtualItemSystem _virtual = default!;
|
||||
[Dependency] private readonly SmallCharacterSystem _smallCharacter = default!; // DeltaV
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -295,6 +299,14 @@ public sealed class PullingSystem : EntitySystem
|
||||
|
||||
private void OnRefreshMovespeed(EntityUid uid, PullerComponent component, RefreshMovementSpeedModifiersEvent args)
|
||||
{
|
||||
// BEGIN DeltaV - Slow if smaller puller
|
||||
if (TryComp<SmallCharacterComponent>(uid, out var smol))
|
||||
{
|
||||
var sizePenalty = _smallCharacter.ApplyPullSpeedPenalty((uid, smol), component.Pulling);
|
||||
args.ModifySpeed(sizePenalty, sizePenalty);
|
||||
}
|
||||
// END DeltaV
|
||||
|
||||
if (TryComp<HeldSpeedModifierComponent>(component.Pulling, out var heldMoveSpeed) && component.Pulling.HasValue)
|
||||
{
|
||||
var (walkMod, sprintMod) =
|
||||
|
||||
@@ -97,7 +97,7 @@ public sealed partial class ParcelWrappingSystem
|
||||
if (target == user)
|
||||
{
|
||||
var selfMsg = Loc.GetString("parcel-wrap-popup-being-wrapped-self");
|
||||
_popup.PopupClient(selfMsg, user, user);
|
||||
_popup.PopupEntity(selfMsg, user, user);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -143,7 +143,7 @@ public sealed partial class ParcelWrappingSystem
|
||||
|
||||
// Spawn the actual parcel entity.
|
||||
var targetTransform = Transform(target);
|
||||
var spawned = Spawn(GetParcelPrototype(wrapper, target), targetTransform.Coordinates);
|
||||
var spawned = SpawnAtPosition(GetParcelPrototype(wrapper, target), targetTransform.Coordinates);
|
||||
_transform.SetLocalRotation(spawned, targetTransform.LocalRotation);
|
||||
|
||||
// If the target is in a container, try to put the parcel in its place in the container.
|
||||
|
||||
@@ -177,7 +177,7 @@ namespace Content.Shared.Preferences
|
||||
_traitPreferences = traitPreferences;
|
||||
_loadouts = loadouts;
|
||||
// Begin CD - Character Records
|
||||
Height = height;
|
||||
Height = height; // This is the user-set scale on the profile editor. Not actual height measurements.
|
||||
CDCharacterRecords = cdCharacterRecords;
|
||||
// End CD - Character Records
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Shared.Access.Components;
|
||||
using Content.Shared.Access.Systems; // DeltaV
|
||||
using Content.Shared.Administration.Logs;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Doors.Components;
|
||||
@@ -19,6 +20,7 @@ namespace Content.Shared.Remotes.EntitySystems;
|
||||
public abstract class SharedDoorRemoteSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly SharedAirlockSystem _airlock = default!;
|
||||
[Dependency] private readonly AccessReaderSystem _accessReader = default!; // DeltaV
|
||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||
[Dependency] private readonly SharedDoorSystem _doorSystem = default!;
|
||||
[Dependency] private readonly SharedElectrocutionSystem _electrify = default!;
|
||||
@@ -96,6 +98,19 @@ public abstract class SharedDoorRemoteSystem : EntitySystem
|
||||
else if (entity.Comp.RequireTagWhitelist)
|
||||
return;
|
||||
|
||||
// Begin DeltaV - Emergency access only bypasses open/close; bolting and toggling emergency access still require actual access.
|
||||
if (entity.Comp.Mode != OperatingMode.OpenClose
|
||||
&& accessComponent != null
|
||||
&& !_accessReader.IsAllowed(accessTarget, args.Target.Value, accessComponent))
|
||||
{
|
||||
if (isAirlock)
|
||||
_doorSystem.Deny(args.Target.Value, doorComp, user: args.User, predicted: true);
|
||||
|
||||
_popup.PopupClient(Loc.GetString("door-remote-denied"), args.User, args.User);
|
||||
return;
|
||||
}
|
||||
// End DeltaV
|
||||
|
||||
switch (entity.Comp.Mode)
|
||||
{
|
||||
case OperatingMode.OpenClose:
|
||||
|
||||
@@ -300,4 +300,12 @@ public sealed partial class RevenantComponent : Component
|
||||
public string HarvestingState = "harvesting";
|
||||
#endregion
|
||||
[DataField] public EntityUid? HauntAction; // Imp
|
||||
|
||||
#region Melee
|
||||
/// <summary>
|
||||
/// DeltaV - The amount of time a rev is revealed after making a melee attack.
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public TimeSpan MeleeRevealTime = TimeSpan.FromSeconds(2);
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using Content.Shared._CD.Silicons.Borgs; // CosmicDrift - borg subtypes
|
||||
using Content.Shared.Actions;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Components;
|
||||
@@ -97,10 +96,6 @@ public abstract partial class SharedBorgSwitchableTypeSystem : EntitySystem // D
|
||||
_userInterface.CloseUi((ent.Owner, null), BorgSwitchableTypeUiKey.SelectBorgType);
|
||||
|
||||
UpdateEntityAppearance(ent);
|
||||
|
||||
// AL - event for subtype system, always runs at end of borg type code
|
||||
var ev = new AfterBorgTypeSelectEvent();
|
||||
RaiseLocalEvent(ent, ref ev);
|
||||
}
|
||||
|
||||
protected void UpdateEntityAppearance(Entity<BorgSwitchableTypeComponent> entity)
|
||||
@@ -125,25 +120,24 @@ public abstract partial class SharedBorgSwitchableTypeSystem : EntitySystem // D
|
||||
{
|
||||
footstepModifier.FootstepSoundCollection = prototype.FootstepCollection;
|
||||
}
|
||||
// Start CosmicDrift Changes - Moved to BorgSwitchableTypeSystem.cs
|
||||
// if (prototype.SpriteBodyMovementState is { } movementState)
|
||||
// {
|
||||
// var spriteMovement = EnsureComp<SpriteMovementComponent>(entity);
|
||||
// spriteMovement.NoMovementLayers.Clear();
|
||||
// spriteMovement.NoMovementLayers["movement"] = new PrototypeLayerData
|
||||
// {
|
||||
// State = prototype.SpriteBodyState,
|
||||
// };
|
||||
// spriteMovement.MovementLayers.Clear();
|
||||
// spriteMovement.MovementLayers["movement"] = new PrototypeLayerData
|
||||
// {
|
||||
// State = movementState,
|
||||
// };
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// RemComp<SpriteMovementComponent>(entity);
|
||||
// }
|
||||
// End CosmicDrift Changes - Moved to BorgSwitchableTypeSystem.cs
|
||||
|
||||
if (prototype.SpriteBodyMovementState is { } movementState)
|
||||
{
|
||||
var spriteMovement = EnsureComp<SpriteMovementComponent>(entity);
|
||||
spriteMovement.NoMovementLayers.Clear();
|
||||
spriteMovement.NoMovementLayers["movement"] = new PrototypeLayerData
|
||||
{
|
||||
State = prototype.SpriteBodyState,
|
||||
};
|
||||
spriteMovement.MovementLayers.Clear();
|
||||
spriteMovement.MovementLayers["movement"] = new PrototypeLayerData
|
||||
{
|
||||
State = movementState,
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
RemComp<SpriteMovementComponent>(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,11 +25,27 @@ public sealed partial class ScaleVisualsComponent : Component
|
||||
[ViewVariables]
|
||||
public Vector2? OriginalScale;
|
||||
|
||||
// Delta V Addition
|
||||
/// <summary>
|
||||
/// Base Scale of the Species, which we use to set a new height relative to this.
|
||||
/// DeltaV - Contains the species scale. Set dynamically by
|
||||
/// baseScale in the Species prototype.
|
||||
/// </summary>
|
||||
[DataField, AutoNetworkedField]
|
||||
[ViewVariables]
|
||||
public Vector2 SpeciesScale = Vector2.One;
|
||||
public Vector2 SpeciesScale = new(1f, 1f);
|
||||
|
||||
/// <summary>
|
||||
/// DeltaV - Contains the user-defined scale from the character creation
|
||||
/// screen.
|
||||
/// </summary>
|
||||
[DataField, AutoNetworkedField]
|
||||
[ViewVariables]
|
||||
public Vector2 ProfileScale = new(1f, 1f);
|
||||
|
||||
/// <summary>
|
||||
/// DeltaV - Contains the computer scale from applying Scale, SpeciesScale, and ProfileScale.
|
||||
/// This will contain the actual scale after all modifiers are applied.
|
||||
/// </summary>
|
||||
[DataField, AutoNetworkedField]
|
||||
[ViewVariables]
|
||||
public Vector2 ComputedScale;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System.Numerics;
|
||||
using Content.Shared.Humanoid; // DeltaV
|
||||
using Robust.Shared.Prototypes; // DeltaV
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Sprite;
|
||||
@@ -6,6 +8,7 @@ namespace Content.Shared.Sprite;
|
||||
public abstract class SharedScaleVisualsSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||
[Dependency] private readonly IPrototypeManager _proto = default!; // DeltaV
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -39,15 +42,28 @@ public abstract class SharedScaleVisualsSystem : EntitySystem
|
||||
{
|
||||
var comp = EnsureComp<ScaleVisualsComponent>(uid);
|
||||
comp.Scale = scale;
|
||||
|
||||
// BEGIN DeltaV - Apply species and profile height
|
||||
// We have to ensure this is idempotent so that if it gets applied more than once
|
||||
// the sprite size at the end is the same.
|
||||
if (TryComp<HumanoidProfileComponent>(uid, out var profile))
|
||||
{
|
||||
var speciesProto = _proto.Index(profile.Species);
|
||||
comp.SpeciesScale = speciesProto.BaseScale;
|
||||
scale *= comp.SpeciesScale; // Apply both species scale and character-defined height
|
||||
|
||||
Vector2 profileHeight = new(profile.Height, profile.Height);
|
||||
comp.ProfileScale = profileHeight;
|
||||
scale *= comp.ProfileScale;
|
||||
}
|
||||
|
||||
comp.ComputedScale = scale; // Nice to know what the computed size is in case of bugs
|
||||
// END DeltaV
|
||||
|
||||
Dirty(uid, comp);
|
||||
|
||||
// Delta V - Begin Species Scaling
|
||||
// 120% species scale => add 0.2 to scale
|
||||
var newScale = scale + comp.SpeciesScale - Vector2.One;
|
||||
// Delta V - End Species Scaling
|
||||
|
||||
var appearanceComponent = EnsureComp<AppearanceComponent>(uid);
|
||||
_appearance.SetData(uid, ScaleVisuals.Scale, newScale /* Delta V - Custom Species Scale */, appearanceComponent);
|
||||
_appearance.SetData(uid, ScaleVisuals.Scale, scale, appearanceComponent);
|
||||
|
||||
// Raise an event for content use.
|
||||
var ev = new ScaleEntityEvent(uid, scale);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Mobs;
|
||||
using Content.Shared.Mobs.Systems;
|
||||
using Content.Shared.Stealth.Components;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
using Content.Shared.Prototypes;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Shared._CD.Prototypes;
|
||||
|
||||
public sealed class ALPrototypeSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly IComponentFactory _compFactory = default!;
|
||||
[Dependency] private readonly IPrototypeManager _prototype = default!;
|
||||
|
||||
public IEnumerable<(EntityPrototype Prototype, T Component)> EnumerateComponents<T>() where T : IComponent, new()
|
||||
{
|
||||
foreach (var entity in _prototype.EnumeratePrototypes<EntityPrototype>())
|
||||
{
|
||||
if (entity.TryGetComponent(out T? comp, _compFactory))
|
||||
yield return (entity, comp);
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<EntityPrototype> EnumerateEntities<T>() where T : IComponent, new()
|
||||
{
|
||||
foreach (var entity in _prototype.EnumeratePrototypes<EntityPrototype>())
|
||||
{
|
||||
if (entity.HasComponent<T>(_compFactory))
|
||||
yield return entity;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
using System.Numerics;
|
||||
using Content.Shared.Inventory;
|
||||
using Content.Shared.Silicons.Borgs;
|
||||
using Content.Shared.Silicons.Borgs.Components;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Shared._CD.Silicons.Borgs;
|
||||
|
||||
/// <summary>
|
||||
/// Information relating to a borg's subtype. Should be mostly cosmetic.
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
|
||||
[EntityCategory("BorgSubtype")]
|
||||
public sealed partial class BorgSubtypeDefinitionComponent : Component
|
||||
{
|
||||
private static ProtoId<SoundCollectionPrototype> DefaultFootsteps = new("FootstepBorg"); // DeltaV - Removed Readonly
|
||||
|
||||
/// <summary>
|
||||
/// <inheritdoc cref="BorgTypePrototype.InventoryTemplateId"/>
|
||||
/// </summary>
|
||||
[DataField, AutoNetworkedField] public ProtoId<InventoryTemplatePrototype> InventoryTemplateId = "borgShort";
|
||||
|
||||
/// <summary>
|
||||
/// The parent borg type of this subtype.
|
||||
/// </summary>
|
||||
[DataField(required: true), AutoNetworkedField]
|
||||
public string ParentType;
|
||||
|
||||
/// <summary>
|
||||
/// <inheritdoc cref="BorgTypePrototype.AddComponents"/>
|
||||
/// </summary>
|
||||
[DataField] public ComponentRegistry? AddComponents;
|
||||
|
||||
/// <summary>
|
||||
/// Sprite path that the prototype's layer data will reference.
|
||||
/// </summary>
|
||||
[DataField, AutoNetworkedField] public ResPath? SpritePath;
|
||||
|
||||
/// <summary>
|
||||
/// The visual layer data for the subtype.
|
||||
/// At the minimum should have definitions for each value of <see cref="BorgVisualLayers"/>.
|
||||
/// </summary>
|
||||
[DataField(required: true), AutoNetworkedField]
|
||||
public PrototypeLayerData[] LayerData;
|
||||
|
||||
|
||||
[DataField(required: true), AutoNetworkedField]
|
||||
public string SpriteHasMindState;
|
||||
|
||||
[DataField(required: true), AutoNetworkedField]
|
||||
public string SpriteNoMindState;
|
||||
|
||||
[DataField, AutoNetworkedField] public string? SpriteBodyState;
|
||||
|
||||
[DataField, AutoNetworkedField] public Vector2? Offset;
|
||||
|
||||
[DataField(required: true), AutoNetworkedField]
|
||||
public EntProtoId DummyPrototype;
|
||||
|
||||
[DataField, AutoNetworkedField] public string PetSuccessString = "petting-success-generic-cyborg";
|
||||
[DataField, AutoNetworkedField] public string PetFailureString = "petting-failure-generic-cyborg";
|
||||
|
||||
/// <summary>
|
||||
/// Sound specifier for footstep sounds created by this subtype.
|
||||
/// </summary>
|
||||
[DataField, AutoNetworkedField]
|
||||
public SoundSpecifier FootstepCollection { get; set; } = new SoundCollectionSpecifier(DefaultFootsteps);
|
||||
|
||||
/// <summary>
|
||||
/// <inheritdoc cref="BorgTypePrototype.SpriteBodyMovementState"/>
|
||||
/// </summary>
|
||||
[DataField, AutoNetworkedField]
|
||||
public string? SpriteBodyMovementState { get; set; }
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Shared._CD.Silicons.Borgs;
|
||||
|
||||
/// <summary>
|
||||
/// Component given to borgs that should be able to select subtypes inside of the borg type selection menu.
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
[AutoGenerateComponentState(true)]
|
||||
public sealed partial class BorgSwitchableSubtypeComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// The <see cref="BorgSubtypeDefinitionComponent"/> of this chassis.
|
||||
/// </summary>
|
||||
[DataField, AutoNetworkedField]
|
||||
public ProtoId<EntityPrototype>? BorgSubtype;
|
||||
}
|
||||
@@ -1,100 +0,0 @@
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Components;
|
||||
using Content.Shared.Movement.Components;
|
||||
using Content.Shared.Silicons.Borgs;
|
||||
using Content.Shared.Silicons.Borgs.Components;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Shared._CD.Silicons.Borgs;
|
||||
|
||||
/// <summary>
|
||||
/// Shared behaviour for borg switchable subtype logic.
|
||||
/// Essentially a reimplementation of <see cref="SharedBorgSwitchableTypeSystem"/> specifically for cosmetic functions.
|
||||
/// </summary>
|
||||
public abstract class SharedBorgSwitchableSubtypeSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly InteractionPopupSystem _interactionPopup = default!;
|
||||
[Dependency] protected readonly IPrototypeManager Prototypes = default!;
|
||||
[Dependency] protected readonly IComponentFactory ComponentFactory = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
SubscribeLocalEvent<BorgSwitchableSubtypeComponent, MapInitEvent>(OnMapInit); // make sure that our subtype is selected first
|
||||
SubscribeLocalEvent<BorgSwitchableSubtypeComponent, AfterBorgTypeSelectEvent>(OnBorgTypeSelect);
|
||||
SubscribeLocalEvent<BorgSwitchableSubtypeComponent, TypeTryingToUpdateVisualsEvent>(OnBorgTypeUpdatingVisuals);
|
||||
|
||||
Subs.BuiEvents<BorgSwitchableTypeComponent>(BorgSwitchableTypeUiKey.SelectBorgType,
|
||||
sub =>
|
||||
{
|
||||
sub.Event<BorgSelectSubtypeMessage>(SelectSubtypeMessageHandler);
|
||||
});
|
||||
|
||||
base.Initialize();
|
||||
}
|
||||
|
||||
private void OnBorgTypeUpdatingVisuals(Entity<BorgSwitchableSubtypeComponent> ent, ref TypeTryingToUpdateVisualsEvent args)
|
||||
{
|
||||
if (!ent.Comp.BorgSubtype.HasValue)
|
||||
return;
|
||||
|
||||
Dirty(ent);
|
||||
SelectBorgSubtype(ent);
|
||||
}
|
||||
|
||||
private void OnMapInit(Entity<BorgSwitchableSubtypeComponent> ent, ref MapInitEvent args)
|
||||
{
|
||||
if (ent.Comp.BorgSubtype != null)
|
||||
{
|
||||
SelectBorgSubtype(ent);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnBorgTypeSelect(Entity<BorgSwitchableSubtypeComponent> ent, ref AfterBorgTypeSelectEvent args)
|
||||
{
|
||||
if (!ent.Comp.BorgSubtype.HasValue)
|
||||
return;
|
||||
|
||||
UpdateEntityAppearance(ent);
|
||||
Dirty(ent);
|
||||
}
|
||||
|
||||
protected virtual void SelectBorgSubtype(Entity<BorgSwitchableSubtypeComponent> ent)
|
||||
{
|
||||
UpdateEntityAppearance(ent);
|
||||
}
|
||||
|
||||
private void UpdateEntityAppearance(Entity<BorgSwitchableSubtypeComponent> entity)
|
||||
{
|
||||
if (!Prototypes.TryIndex(entity.Comp.BorgSubtype, out var subtypePrototype))
|
||||
return;
|
||||
|
||||
UpdateEntityAppearance(entity, subtypePrototype);
|
||||
}
|
||||
|
||||
protected virtual void UpdateEntityAppearance(Entity<BorgSwitchableSubtypeComponent> entity,
|
||||
EntityPrototype borgSubtypePrototype)
|
||||
{
|
||||
if (!borgSubtypePrototype.TryGetComponent<BorgSubtypeDefinitionComponent>(out var borgSubtype, ComponentFactory))
|
||||
return;
|
||||
|
||||
if (TryComp(entity, out InteractionPopupComponent? popup))
|
||||
{
|
||||
_interactionPopup.SetInteractSuccessString((entity.Owner, popup), borgSubtype.PetSuccessString);
|
||||
_interactionPopup.SetInteractFailureString((entity.Owner, popup), borgSubtype.PetFailureString);
|
||||
}
|
||||
|
||||
if (TryComp(entity, out FootstepModifierComponent? footstepModifier))
|
||||
{
|
||||
footstepModifier.FootstepSoundCollection = borgSubtype.FootstepCollection;
|
||||
}
|
||||
}
|
||||
|
||||
private void SelectSubtypeMessageHandler(EntityUid uid, BorgSwitchableTypeComponent borgSwitchableTypeComponent, BorgSelectSubtypeMessage args)
|
||||
{
|
||||
if (!TryComp<BorgSwitchableSubtypeComponent>(uid, out var subtypeComp))
|
||||
return;
|
||||
|
||||
subtypeComp.BorgSubtype = args.Subtype;
|
||||
Dirty(uid, subtypeComp);
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared._CD.Silicons.Borgs;
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class BorgSelectSubtypeMessage(ProtoId<EntityPrototype>? subtype) : BoundUserInterfaceMessage
|
||||
{
|
||||
public ProtoId<EntityPrototype>? Subtype = subtype;
|
||||
}
|
||||
|
||||
[ByRefEvent]
|
||||
public record struct AfterBorgTypeSelectEvent;
|
||||
|
||||
[ByRefEvent]
|
||||
public record struct TypeTryingToUpdateVisualsEvent;
|
||||
@@ -0,0 +1,12 @@
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared._DV.Administration.Components;
|
||||
|
||||
/// This component prevents an entity from being followed by ghosts.
|
||||
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
|
||||
public sealed partial class UnorbitableComponent : Component
|
||||
{
|
||||
/// Whether to allow adminned players to follow the entity.
|
||||
[DataField, AutoNetworkedField]
|
||||
public bool AllowAdmins = false;
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using Content.Shared._DV.Administration.Components;
|
||||
using Content.Shared.Administration.Managers;
|
||||
using Content.Shared.Follower;
|
||||
using Content.Shared.Follower.Components;
|
||||
|
||||
namespace Content.Shared._DV.Administration.EntitySystems;
|
||||
|
||||
public sealed class UnorbitableSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly FollowerSystem _followerSystem = default!;
|
||||
[Dependency] private readonly ISharedAdminManager _admin = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<UnorbitableComponent, ComponentInit>(OnInit);
|
||||
}
|
||||
|
||||
private void OnInit(Entity<UnorbitableComponent> ent, ref ComponentInit args)
|
||||
{
|
||||
if (!HasComp<FollowedComponent>(ent))
|
||||
return;
|
||||
|
||||
_followerSystem.StopAllFollowers(ent);
|
||||
}
|
||||
|
||||
public bool CanFollow(EntityUid follower, EntityUid target)
|
||||
{
|
||||
if (TryComp<UnorbitableComponent>(target, out var unorbitable))
|
||||
{
|
||||
return unorbitable.AllowAdmins && _admin.IsAdmin(follower);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using Content.Shared._DV.Body.Systems;
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared._DV.Body.Components;
|
||||
|
||||
/// <summary>
|
||||
/// If an entity has this, if a small character has penalties (such as pull speed),
|
||||
/// the small character will ignore the penalties associated with their size.
|
||||
///
|
||||
/// Mostly used for things like wheeled/floating objects.
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
[AutoGenerateComponentState]
|
||||
[Access(typeof(SmallCharacterSystem))]
|
||||
public sealed partial class SmallCharacterComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// The speed of which to scale the small character's pull speed by if the
|
||||
/// object is big enough to warrant a pull-speed slowdown.
|
||||
/// </summary>
|
||||
[DataField, AutoNetworkedField]
|
||||
public float PullSpeedPenalty = 1f;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
namespace Content.Shared._DV.Body.Components;
|
||||
|
||||
/// <summary>
|
||||
/// If an entity has this, if a small character has penalties (such as pull speed),
|
||||
/// the small character will ignore the penalties associated with their size.
|
||||
///
|
||||
/// Mostly used for things like wheeled/floating objects.
|
||||
///
|
||||
/// See <see cref="Systems.SmallCharacterSystem"/>
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public sealed partial class UnaffectedBySizePenaltyComponent : Component;
|
||||
@@ -1,5 +1,6 @@
|
||||
using Content.Shared._DV.Body.Components;
|
||||
using Content.Shared._DV.Body.Events;
|
||||
using Content.Shared.Buckle;
|
||||
using Content.Shared.DoAfter;
|
||||
using Content.Shared.Mobs.Components;
|
||||
using Content.Shared.Mobs.Systems;
|
||||
@@ -13,6 +14,7 @@ public sealed class CPRSystem : EntitySystem
|
||||
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
|
||||
[Dependency] private readonly SharedDoAfterSystem _doAfterSystem = default!;
|
||||
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;
|
||||
[Dependency] private readonly SharedBuckleSystem _buckle = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -85,7 +87,7 @@ public sealed class CPRSystem : EntitySystem
|
||||
{
|
||||
Act = () => StartCPR(user, target, cprComp.TimeLength),
|
||||
Text = Loc.GetString("cpr-verb-start"),
|
||||
Priority = 2,
|
||||
Priority = _buckle.IsBuckled(target) ? 3 : 1, // Higher priority if they are buckled. Otherwise, this conflicts with trying to carry.
|
||||
Disabled = alreadyAffected,
|
||||
Message = alreadyAffected ? Loc.GetString("cpr-verb-disabled-description") : Loc.GetString("cpr-verb-description"),
|
||||
};
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
using Content.Shared._DV.Body.Components;
|
||||
using Content.Shared.GameTicking;
|
||||
using Content.Shared.Humanoid;
|
||||
using Content.Shared.Item;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Physics.Components;
|
||||
|
||||
namespace Content.Shared._DV.Body.Systems;
|
||||
|
||||
/// <summary>
|
||||
/// Used to relay or subscribe to events if a character's scale is 1.0 or below.
|
||||
/// This is only used for the height slider scale.
|
||||
/// </summary>
|
||||
public sealed partial class SmallCharacterSystem : EntitySystem
|
||||
{
|
||||
private const float NO_PENALTY = 1.0f;
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<PlayerSpawnCompleteEvent>(OnSpawn);
|
||||
}
|
||||
|
||||
private void OnSpawn(PlayerSpawnCompleteEvent ev)
|
||||
{
|
||||
if (TryComp<HumanoidProfileComponent>(ev.Mob, out var profile))
|
||||
ApplySmallCharacter(ev.Mob, profile.Height);
|
||||
}
|
||||
|
||||
[PublicAPI]
|
||||
public float ApplyPullSpeedPenalty(Entity<SmallCharacterComponent?> puller, EntityUid? pulledEntity)
|
||||
{
|
||||
// Ignore if they aren't pulling anything...
|
||||
if (!pulledEntity.HasValue)
|
||||
return NO_PENALTY;
|
||||
|
||||
// Ignore if they aren't a small character in the first place
|
||||
if (!Resolve(puller, ref puller.Comp, false))
|
||||
return NO_PENALTY;
|
||||
|
||||
// If the pulled entity has the component that ignores the penalty
|
||||
if (HasComp<UnaffectedBySizePenaltyComponent>(pulledEntity))
|
||||
return NO_PENALTY;
|
||||
|
||||
// Ignore if it's an item that can be held or stored. It would be weird to
|
||||
// slow by X% from pulling a piece of paper or a gun when you can just hold it
|
||||
// and not suffer from a penalty.
|
||||
if (HasComp<ItemComponent>(pulledEntity))
|
||||
return NO_PENALTY;
|
||||
|
||||
// Ignore if the object is floating in the air.
|
||||
if (TryComp<PhysicsComponent>(pulledEntity, out var pulledPhysics)
|
||||
&& pulledPhysics.BodyStatus == BodyStatus.InAir)
|
||||
return NO_PENALTY;
|
||||
|
||||
return puller.Comp.PullSpeedPenalty;
|
||||
}
|
||||
|
||||
#region Static Members
|
||||
/// <summary>
|
||||
/// Gets the move-speed penalty as a float. Should be applied multiplicatively.
|
||||
/// Caps at 1 so we don't make bigger characters faster when pulling.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[PublicAPI]
|
||||
public static float GetPullSpeedPenaltyFromScale(float scale = 1.0f)
|
||||
{
|
||||
return Math.Min(scale * scale, 1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calculates a well-formed display string of the pull speed penalty.
|
||||
/// Used primarily in the character editor to get the well-formed percent
|
||||
/// without having to duplicate formulas.
|
||||
/// </summary>
|
||||
/// <param name="scale"></param>
|
||||
/// <returns></returns>
|
||||
[PublicAPI]
|
||||
public static string GetPullSpeedPenaltyDisplayFromScale(float scale = 1.0f)
|
||||
{
|
||||
return $"{Math.Round((1 - GetPullSpeedPenaltyFromScale(scale)) * 100)}%";
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Private Members
|
||||
private void ApplySmallCharacter(EntityUid uid, float scale = 1)
|
||||
{
|
||||
if (scale >= 1)
|
||||
return;
|
||||
|
||||
// The character scale is stored in the HumanoidProfileComponent if you ever
|
||||
// need it.
|
||||
var comp = EnsureComp<SmallCharacterComponent>(uid);
|
||||
comp.PullSpeedPenalty = GetPullSpeedPenaltyFromScale(scale);
|
||||
Dirty(uid, comp);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -30,6 +30,7 @@ using System.Numerics;
|
||||
using Content.Shared._DV.Polymorph;
|
||||
using Content.Shared._Floof.OfferItem;
|
||||
using Content.Shared.Hands.EntitySystems;
|
||||
using Content.Shared.Buckle;
|
||||
|
||||
namespace Content.Shared._DV.Carrying;
|
||||
|
||||
@@ -70,7 +71,7 @@ public sealed class CarryingSystem : EntitySystem
|
||||
SubscribeLocalEvent<BeingCarriedComponent, GettingInteractedWithAttemptEvent>(OnInteractedWith);
|
||||
SubscribeLocalEvent<BeingCarriedComponent, PullAttemptEvent>(OnPullAttempt);
|
||||
SubscribeLocalEvent<BeingCarriedComponent, StartClimbEvent>(OnDrop);
|
||||
SubscribeLocalEvent<BeingCarriedComponent, BuckledEvent>(OnDrop);
|
||||
SubscribeLocalEvent<BeingCarriedComponent, BuckledEvent>(OnBuckle);
|
||||
SubscribeLocalEvent<BeingCarriedComponent, UnbuckledEvent>(OnDrop);
|
||||
SubscribeLocalEvent<BeingCarriedComponent, StrappedEvent>(OnDrop);
|
||||
SubscribeLocalEvent<BeingCarriedComponent, UnstrappedEvent>(OnDrop);
|
||||
@@ -220,6 +221,13 @@ public sealed class CarryingSystem : EntitySystem
|
||||
DropCarried(ent.Comp.Carrier, ent);
|
||||
}
|
||||
|
||||
private void OnBuckle(Entity<BeingCarriedComponent> ent, ref BuckledEvent args)
|
||||
{
|
||||
// Buckling to a bed already handles the reparenting to the entity that the carried
|
||||
// entity is buckled to, and then relays the BuckledEvent, so don't reparent to the grid.
|
||||
DropCarried(ent.Comp.Carrier, ent, attachToGrid: false);
|
||||
}
|
||||
|
||||
private void OnRemoved(Entity<BeingCarriedComponent> ent, ref ComponentRemove args)
|
||||
{
|
||||
/*
|
||||
@@ -327,9 +335,9 @@ public sealed class CarryingSystem : EntitySystem
|
||||
return true;
|
||||
}
|
||||
|
||||
public void DropCarried(EntityUid carrier, EntityUid carried)
|
||||
public void DropCarried(EntityUid carrier, EntityUid carried, bool attachToGrid = true)
|
||||
{
|
||||
Drop(carried);
|
||||
Drop(carried, attachToGrid);
|
||||
CleanupCarrier(carrier, carried);
|
||||
}
|
||||
|
||||
@@ -341,12 +349,15 @@ public sealed class CarryingSystem : EntitySystem
|
||||
_movementSpeed.RefreshMovementSpeedModifiers(carrier);
|
||||
}
|
||||
|
||||
private void Drop(EntityUid carried)
|
||||
private void Drop(EntityUid carried, bool attachToGrid = true)
|
||||
{
|
||||
RemComp<BeingCarriedComponent>(carried);
|
||||
RemComp<KnockedDownComponent>(carried); // TODO SHITMED: make sure this doesnt let you make someone with no legs walk
|
||||
_actionBlocker.UpdateCanMove(carried);
|
||||
_transform.AttachToGridOrMap(carried);
|
||||
|
||||
// Some systems will handle re-parenting and then throw an event, and this changes the parent when it should not
|
||||
if (attachToGrid)
|
||||
_transform.AttachToGridOrMap(carried);
|
||||
_standingState.Stand(carried);
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user