Skip to content

Commit

Permalink
Merge branch 'master' into N14-Crafting-Materials
Browse files Browse the repository at this point in the history
  • Loading branch information
stellar-novas authored Feb 3, 2025
2 parents 70603b2 + c7ded91 commit c5ae8aa
Show file tree
Hide file tree
Showing 24 changed files with 225 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ protected override void Open()
_window.OnReagentButtonPressed += (_, button, amount, isOutput) => SendMessage(new ChemMasterReagentAmountButtonMessage(button.Id, amount, button.IsBuffer, isOutput));
_window.OnSortMethodChanged += sortMethod => SendMessage(new ChemMasterSortMethodUpdated(sortMethod));
_window.OnTransferAmountChanged += amount => SendMessage(new ChemMasterTransferringAmountUpdated(amount));
_window.OnUpdateAmounts += amounts => SendMessage(new ChemMasterAmountsUpdated(amounts));
}

/// <summary>
Expand Down
8 changes: 7 additions & 1 deletion Content.Client/Chemistry/UI/ChemMasterWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,18 @@
</PanelContainer>
<RichTextLabel Name="AmountLabel" Text="{Loc 'chem-master-window-transferring-default-label'}" Margin="0 0 7 0" />
<LineEdit MinSize="140 0" Name="AmountLineEdit" Access="Public" PlaceHolder="{Loc 'chem-master-window-amount-placeholder'}" />
<BoxContainer Orientation="Horizontal" HorizontalExpand="True">
<Button Name="SetAmountButton" Text="{Loc 'chem-master-window-set-amount-label'}" HorizontalExpand="True" StyleClasses="OpenRight"/>
<Button Name="SaveAsFrequentButton" Text="{Loc 'chem-master-window-save-as-frequent-label'}" HorizontalExpand="True" StyleClasses="OpenLeft"/>
</BoxContainer>
<RichTextLabel Text="Both of the above buttons use the textbox" />
<Control MinSize="0 5" />
<GridContainer
Name="AmountButtons"
VerticalExpand="True"
HorizontalExpand="True"
Margin="2 2 2 2"
Columns="5" />
Columns="4" />
</BoxContainer>
</BoxContainer>
</controls:FancyWindow>
42 changes: 34 additions & 8 deletions Content.Client/Chemistry/UI/ChemMasterWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,12 @@ public sealed partial class ChemMasterWindow : FancyWindow
public event Action<int>? OnAmountButtonPressed;
public event Action<int>? OnSortMethodChanged;
public event Action<int>? OnTransferAmountChanged;
public event Action<List<int>>? OnUpdateAmounts;

public readonly Button[] PillTypeButtons;

private List<int> _amounts = new();

private const string TransferringAmountColor = "#ffffff";
private ReagentSortMethod _currentSortMethod = ReagentSortMethod.Alphabetical;
private ChemMasterBoundUserInterfaceState? _lastState;
Expand All @@ -48,7 +52,9 @@ public ChemMasterWindow()

AmountLabel.HorizontalAlignment = HAlignment.Center;
AmountLineEdit.OnTextEntered += SetAmount;
AmountLineEdit.OnFocusExit += SetAmount;

SetAmountButton.OnPressed += _ => SetAmountText(AmountLineEdit.Text);
SaveAsFrequentButton.OnPressed += HandleSaveAsFrequentPressed;

// Pill type selection buttons, in total there are 20 pills.
// Pill rsi file should have states named as pill1, pill2, and so on.
Expand Down Expand Up @@ -130,15 +136,19 @@ public ChemMasterWindow()
BufferTransferButton.OnPressed += HandleDiscardTransferPress;
BufferDiscardButton.OnPressed += HandleDiscardTransferPress;

var amounts = new List<int>()
{
1, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 125, 150, 175, 200, 225, 250, 275, 300, 500
};
CreateAmountButtons();

OnAmountButtonPressed += amount => SetAmountText(amount.ToString());
}

private void CreateAmountButtons()
{
AmountButtons.DisposeAllChildren();

for (int i = 0; i < amounts.Count; i++)
for (int i = 0; i < _amounts.Count; i++)
{
var styleClass = StyleBase.ButtonOpenBoth;
var amount = amounts[i];
var amount = _amounts[i];
var columns = AmountButtons.Columns;

if (i == 0 || i % columns == 0)
Expand All @@ -158,8 +168,17 @@ public ChemMasterWindow()
button.OnPressed += _ => OnAmountButtonPressed?.Invoke(amount);
AmountButtons.AddChild(button);
}
}

OnAmountButtonPressed += amount => SetAmountText(amount.ToString());
private void HandleSaveAsFrequentPressed(BaseButton.ButtonEventArgs args)
{
if (!int.TryParse(AmountLineEdit.Text, out var amount)
|| _amounts.Any(a => amount == a))
return;

_amounts.Add(amount);
_amounts.Sort();
CreateAmountButtons();
}

private void HandleDiscardTransferPress(BaseButton.ButtonEventArgs args)
Expand Down Expand Up @@ -276,6 +295,13 @@ public void UpdateState(BoundUserInterfaceState state)
HandleSortMethodChange(castState.SortMethod);
SetAmountText(castState.TransferringAmount.ToString());

if (_amounts != castState.Amounts)
{
_amounts = castState.Amounts;
_amounts.Sort();
CreateAmountButtons();
}

BufferCurrentVolume.Text = $" {castState.PillBufferCurrentVolume?.Int() ?? 0}u";

InputEjectButton.Disabled = castState.ContainerInfo is null;
Expand Down
4 changes: 2 additions & 2 deletions Content.Server/Atmos/EntitySystems/BarotraumaSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ public override void Update(float frameTime)
if (pressure <= Atmospherics.HazardLowPressure)
{
// Deal damage and ignore resistances. Resistance to pressure damage should be done via pressure protection gear.
_damageableSystem.TryChangeDamage(uid, barotrauma.Damage * Atmospherics.LowPressureDamage, true, false, canSever: false); // Shitmed Change
_damageableSystem.TryChangeDamage(uid, barotrauma.Damage * Atmospherics.LowPressureDamage, true, false, canSever: false, doPartDamage: false); // Shitmed Change
if (!barotrauma.TakingDamage)
{
barotrauma.TakingDamage = true;
Expand All @@ -274,7 +274,7 @@ public override void Update(float frameTime)
{
var damageScale = MathF.Min(((pressure / Atmospherics.HazardHighPressure) - 1) * Atmospherics.PressureDamageCoefficient, Atmospherics.MaxHighPressureDamage);

_damageableSystem.TryChangeDamage(uid, barotrauma.Damage * damageScale, true, false, canSever: false); // Shitmed Change
_damageableSystem.TryChangeDamage(uid, barotrauma.Damage * damageScale, true, false, canSever: false, doPartDamage: false); // Shitmed Change
RaiseLocalEvent(uid, new MoodEffectEvent("MobHighPressure"));

if (!barotrauma.TakingDamage)
Expand Down
8 changes: 7 additions & 1 deletion Content.Server/Chemistry/Components/ChemMasterComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ public sealed partial class ChemMasterComponent : Component
public int SortMethod;

[DataField]
public int TransferringAmount;
public int TransferringAmount = 1;

[DataField]
public List<int> Amounts = new()
{
1, 5, 10, 15, 20, 25, 30, 50
};
}
}
8 changes: 7 additions & 1 deletion Content.Server/Chemistry/EntitySystems/ChemMasterSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,12 @@ public override void Initialize()
SubscribeLocalEvent<ChemMasterComponent, ChemMasterOutputToBottleMessage>(OnOutputToBottleMessage);
SubscribeLocalEvent<ChemMasterComponent, ChemMasterSortMethodUpdated>(OnSortMethodUpdated);
SubscribeLocalEvent<ChemMasterComponent, ChemMasterTransferringAmountUpdated>(OnTransferringAmountUpdated);
SubscribeLocalEvent<ChemMasterComponent, ChemMasterAmountsUpdated>(OnAmountsUpdated);
}

private void OnAmountsUpdated(Entity<ChemMasterComponent> ent, ref ChemMasterAmountsUpdated args) =>
ent.Comp.Amounts = args.Amounts;

private void SubscribeUpdateUiState<T>(Entity<ChemMasterComponent> ent, ref T ev) =>
UpdateUiState(ent);

Expand Down Expand Up @@ -97,7 +101,8 @@ private void UpdateUiState(Entity<ChemMasterComponent> ent, bool updateLabel = f
chemMaster.PillDosageLimit,
updateLabel,
chemMaster.SortMethod,
chemMaster.TransferringAmount);
chemMaster.TransferringAmount,
chemMaster.Amounts);

_userInterfaceSystem.SetUiState(owner, ChemMasterUiKey.Key, state);
}
Expand Down Expand Up @@ -366,6 +371,7 @@ private void OnSortMethodUpdated(EntityUid uid, ChemMasterComponent chemMaster,
private void OnTransferringAmountUpdated(EntityUid uid, ChemMasterComponent chemMaster, ChemMasterTransferringAmountUpdated args)
{
chemMaster.TransferringAmount = args.TransferringAmount;
ClickSound((uid, chemMaster));
UpdateUiState((uid, chemMaster));
}
}
Expand Down
2 changes: 2 additions & 0 deletions Content.Server/Cloning/CloningSystem.Utility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,9 @@ private void UpdateCloneAppearance(
pref = pref.WithFlavorText(flavorText);

_humanoidSystem.LoadProfile(mob, pref);
return;
}
_humanoidSystem.LoadProfile(mob, pref);
}

/// <summary>
Expand Down
11 changes: 10 additions & 1 deletion Content.Shared/Chemistry/SharedChemMaster.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ public sealed class ChemMasterTransferringAmountUpdated(int transferringAmount)
public readonly int TransferringAmount = transferringAmount;
}

[Serializable, NetSerializable]
public sealed class ChemMasterAmountsUpdated(List<int> amounts) : BoundUserInterfaceMessage
{
public readonly List<int> Amounts = amounts;
}

public enum ChemMasterMode
{
Transfer,
Expand Down Expand Up @@ -152,7 +158,8 @@ public sealed class ChemMasterBoundUserInterfaceState(
uint pillDosageLimit,
bool updateLabel,
int sortMethod,
int transferringAmount)
int transferringAmount,
List<int> amounts)
: BoundUserInterfaceState
{
public readonly ContainerInfo? ContainerInfo = containerInfo;
Expand All @@ -179,6 +186,8 @@ public sealed class ChemMasterBoundUserInterfaceState(

public readonly int SortMethod = sortMethod;
public readonly int TransferringAmount = transferringAmount;

public readonly List<int> Amounts = amounts;
}

[Serializable, NetSerializable]
Expand Down
13 changes: 8 additions & 5 deletions Content.Shared/Damage/Systems/DamageableSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public void DamageChanged(EntityUid uid, DamageableComponent component, DamageSp
public DamageSpecifier? TryChangeDamage(EntityUid? uid, DamageSpecifier damage, bool ignoreResistances = false,
bool interruptsDoAfters = true, DamageableComponent? damageable = null, EntityUid? origin = null,
// Shitmed Change
bool? canSever = true, bool? canEvade = false, float? partMultiplier = 1.00f, TargetBodyPart? targetPart = null)
bool? canSever = true, bool? canEvade = false, float? partMultiplier = 1.00f, TargetBodyPart? targetPart = null, bool doPartDamage = true)
{
if (!uid.HasValue || !_damageableQuery.Resolve(uid.Value, ref damageable, false))
{
Expand All @@ -153,11 +153,14 @@ public void DamageChanged(EntityUid uid, DamageableComponent component, DamageSp
return null;

// Shitmed Change Start
var partDamage = new TryChangePartDamageEvent(damage, origin, targetPart, ignoreResistances, canSever ?? true, canEvade ?? false, partMultiplier ?? 1.00f);
RaiseLocalEvent(uid.Value, ref partDamage);
if (doPartDamage)
{
var partDamage = new TryChangePartDamageEvent(damage, origin, targetPart, ignoreResistances, canSever ?? true, canEvade ?? false, partMultiplier ?? 1.00f);
RaiseLocalEvent(uid.Value, ref partDamage);

if (partDamage.Evaded || partDamage.Cancelled)
return null;
if (partDamage.Evaded || partDamage.Cancelled)
return null;
}

// Shitmed Change End

Expand Down
11 changes: 11 additions & 0 deletions Resources/Audio/Effects/Footsteps/attributions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,14 @@
license: "CC-BY-SA-3.0"
copyright: "Made by majormoth(Discord)"
source: "https://discord.com/channels/1301753657024319488/1332696230572331048/1335279751866351759"

- files:
- gear1.ogg
- gear2.ogg
- gear3.ogg
- gear4.ogg
- gear5.ogg
- gear6.ogg
license: "Custom"
copyright: "Valve Software, Non-Commercial Steam Subscriber Agreement"
source: "https://store.steampowered.com/app/220/HalfLife_2/"
Binary file added Resources/Audio/Effects/Footsteps/gear1.ogg
Binary file not shown.
Binary file added Resources/Audio/Effects/Footsteps/gear2.ogg
Binary file not shown.
Binary file added Resources/Audio/Effects/Footsteps/gear3.ogg
Binary file not shown.
Binary file added Resources/Audio/Effects/Footsteps/gear4.ogg
Binary file not shown.
Binary file added Resources/Audio/Effects/Footsteps/gear5.ogg
Binary file not shown.
Binary file added Resources/Audio/Effects/Footsteps/gear6.ogg
Binary file not shown.
40 changes: 40 additions & 0 deletions Resources/Changelog/Changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11033,3 +11033,43 @@ Entries:
id: 6787
time: '2025-02-01T22:43:56.0000000+00:00'
url: https://github.com/Simple-Station/Einstein-Engines/pull/1699
- author: VMSolidus
changes:
- type: Add
message: >-
Added sound effects for all variety of "Tactical Webbing", such as
Security Webbing, Chest Rigs, etc.
id: 6788
time: '2025-02-02T02:08:49.0000000+00:00'
url: https://github.com/Simple-Station/Einstein-Engines/pull/1701
- author: VMSolidus
changes:
- type: Fix
message: Space no longer gibs you instantly.
id: 6789
time: '2025-02-03T04:45:50.0000000+00:00'
url: https://github.com/Simple-Station/Einstein-Engines/pull/1708
- author: VMSolidus
changes:
- type: Fix
message: >-
Both standard Cloner, and Metem Machines(when you win the psychic
willpower roll) now correctly transfer over your old character
appearance.
id: 6790
time: '2025-02-03T04:56:21.0000000+00:00'
url: https://github.com/Simple-Station/Einstein-Engines/pull/1709
- author: VMSolidus
changes:
- type: Tweak
message: 'Made hardsuits 5db quieter. '
id: 6791
time: '2025-02-03T05:14:24.0000000+00:00'
url: https://github.com/Simple-Station/Einstein-Engines/pull/1710
- author: sleepyyapril
changes:
- type: Tweak
message: Tweaked the ChemMaster to no longer have 300 buttons.
id: 6792
time: '2025-02-03T10:53:53.0000000+00:00'
url: https://github.com/Simple-Station/Einstein-Engines/pull/1711
Loading

0 comments on commit c5ae8aa

Please sign in to comment.