Skip to content

Commit

Permalink
Merge pull request #40 from ss14-harmony/StartingFresh
Browse files Browse the repository at this point in the history
Starting fresh
  • Loading branch information
KeldWolf authored Sep 12, 2024
2 parents 97a6731 + 8c64ea3 commit 692d340
Show file tree
Hide file tree
Showing 55 changed files with 548 additions and 122 deletions.
2 changes: 1 addition & 1 deletion Content.Client/VendingMachines/UI/VendingMachineItem.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
SeparationOverride="4">
<EntityPrototypeView
Name="ItemPrototype"
Margin="4 4"
Margin="4 0 0 0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
MinSize="32 32"
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/VendingMachines/UI/VendingMachineMenu.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
xmlns:co="clr-namespace:Content.Client.UserInterface.Controls">
<BoxContainer Name="MainContainer" Orientation="Vertical">
<LineEdit Name="SearchBar" PlaceHolder="{Loc 'vending-machine-component-search-filter'}" HorizontalExpand="True" Margin ="4 4"/>
<co:SearchListContainer Name="VendingContents" VerticalExpand="True" Margin="4 0"/>
<co:SearchListContainer Name="VendingContents" VerticalExpand="True" Margin="4 4"/>
<!-- Footer -->
<BoxContainer Orientation="Vertical">
<PanelContainer StyleClasses="LowDivider" />
Expand Down
6 changes: 3 additions & 3 deletions Content.Server/Anomaly/Effects/TechAnomalySystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ public override void Update(float frameTime)
while (query.MoveNext(out var uid, out var tech, out var anom))
{
if (_timing.CurTime < tech.NextTimer)
return;
continue;

tech.NextTimer = _timing.CurTime + TimeSpan.FromSeconds(tech.TimerFrequency * anom.Stability);
tech.NextTimer += TimeSpan.FromSeconds(tech.TimerFrequency * anom.Stability);

_signal.InvokePort(uid, tech.TimerPort);
}
Expand All @@ -61,7 +61,7 @@ private void CreateNewRandomLink(Entity<TechAnomalyComponent> tech, int count)
var devices = _lookup.GetEntitiesInRange<DeviceLinkSinkComponent>(Transform(tech).Coordinates, range);
if (devices.Count < 1)
return;

for (var i = 0; i < count; i++)
{
var device = _random.Pick(devices);
Expand Down
7 changes: 7 additions & 0 deletions Content.Server/Body/Components/BloodstreamComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,13 @@ public sealed partial class BloodstreamComponent : Component
[DataField]
public SoundSpecifier BloodHealedSound = new SoundPathSpecifier("/Audio/Effects/lightburn.ogg");

/// <summary>
/// The minimum amount damage reduction needed to play the healing sound/popup.
/// This prevents tiny amounts of heat damage from spamming the sound, e.g. spacing.
/// </summary>
[DataField]
public float BloodHealedSoundThreshold = -0.1f;

// TODO probably damage bleed thresholds.

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Body/Systems/BloodstreamSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ private void OnDamageChanged(Entity<BloodstreamComponent> ent, ref DamageChanged
}

// Heat damage will cauterize, causing the bleed rate to be reduced.
else if (totalFloat < 0 && oldBleedAmount > 0)
else if (totalFloat <= ent.Comp.BloodHealedSoundThreshold && oldBleedAmount > 0)
{
// Magically, this damage has healed some bleeding, likely
// because it's burn damage that cauterized their wounds.
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/EntityEffects/Effects/ActivateArtifact.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public sealed partial class ActivateArtifact : EntityEffect
public override void Effect(EntityEffectBaseArgs args)
{
var artifact = args.EntityManager.EntitySysManager.GetEntitySystem<ArtifactSystem>();
artifact.TryActivateArtifact(args.TargetEntity);
artifact.TryActivateArtifact(args.TargetEntity, logMissing: false);
}

protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) =>
Expand Down
14 changes: 7 additions & 7 deletions Content.Server/Forensics/Systems/ForensicPadSystem.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
using Content.Shared.Examine;
using Content.Shared.Interaction;
using Content.Shared.Inventory;
using Content.Server.Labels;
using Content.Server.Popups;
using Content.Shared.DoAfter;
using Content.Shared.Examine;
using Content.Shared.Forensics;
using Content.Shared.IdentityManagement;
using Content.Shared.Interaction;
using Content.Shared.Inventory;

namespace Content.Server.Forensics
{
Expand All @@ -17,6 +18,7 @@ public sealed class ForensicPadSystem : EntitySystem
[Dependency] private readonly InventorySystem _inventory = default!;
[Dependency] private readonly PopupSystem _popupSystem = default!;
[Dependency] private readonly MetaDataSystem _metaData = default!;
[Dependency] private readonly LabelSystem _label = default!;

public override void Initialize()
{
Expand Down Expand Up @@ -99,10 +101,8 @@ private void OnDoAfter(EntityUid uid, ForensicPadComponent padComponent, Forensi

if (args.Args.Target != null)
{
var name = HasComp<FingerprintComponent>(args.Args.Target)
? "forensic-pad-fingerprint-name"
: "forensic-pad-gloves-name";
_metaData.SetEntityName(uid, Loc.GetString(name, ("entity", args.Args.Target)));
string label = Identity.Name(args.Args.Target.Value, EntityManager);
_label.Label(uid, label);
}

padComponent.Sample = args.Sample;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
using Content.Server.StationEvents.Events;
using Content.Server.StationEvents.Events;
using Content.Shared.Roles;
using Robust.Shared.Prototypes;

namespace Content.Server.StationEvents.Components;

[RegisterComponent, Access(typeof(BureaucraticErrorRule))]
public sealed partial class BureaucraticErrorRuleComponent : Component
{

/// <summary>
/// The jobs that are ignored by this rule and won't have their slots changed.
/// </summary>
[DataField]
public List<ProtoId<JobPrototype>> IgnoredJobs = new();
}
5 changes: 4 additions & 1 deletion Content.Server/StationEvents/Events/BureaucraticErrorRule.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using System.Linq;
using Content.Server.GameTicking.Rules.Components;
using Content.Server.Station.Components;
using Content.Server.Station.Systems;
using Content.Server.StationEvents.Components;
using Content.Shared.GameTicking.Components;
using Content.Shared.Roles;
using JetBrains.Annotations;
using Robust.Shared.Random;

Expand All @@ -23,6 +23,9 @@ protected override void Started(EntityUid uid, BureaucraticErrorRuleComponent co

var jobList = _stationJobs.GetJobs(chosenStation.Value).Keys.ToList();

foreach(var job in component.IgnoredJobs)
jobList.Remove(job);

if (jobList.Count == 0)
return;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,11 @@ public void RandomizeArtifact(EntityUid uid, ArtifactComponent component)
/// <param name="uid"></param>
/// <param name="user"></param>
/// <param name="component"></param>
/// <param name="logMissing">Set this to false if you don't know if the entity is an artifact.</param>
/// <returns></returns>
public bool TryActivateArtifact(EntityUid uid, EntityUid? user = null, ArtifactComponent? component = null)
public bool TryActivateArtifact(EntityUid uid, EntityUid? user = null, ArtifactComponent? component = null, bool logMissing = true)
{
if (!Resolve(uid, ref component))
if (!Resolve(uid, ref component, logMissing))
return false;

// check if artifact is under suppression field
Expand Down
6 changes: 6 additions & 0 deletions Content.Shared/Atmos/Rotting/PerishableComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ public sealed partial class PerishableComponent : Component

[DataField, AutoNetworkedField]
public int Stage;

/// <summary>
/// If true, rot will always progress.
/// </summary>
[DataField, AutoNetworkedField]
public bool ForceRotProgression;
}


Expand Down
4 changes: 4 additions & 0 deletions Content.Shared/Atmos/Rotting/SharedRottingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ public bool IsRotProgressing(EntityUid uid, PerishableComponent? perishable)
if (!Resolve(uid, ref perishable, false))
return false;

// Overrides all the other checks.
if (perishable.ForceRotProgression)
return true;

// only dead things or inanimate objects can rot
if (TryComp<MobStateComponent>(uid, out var mobState) && !_mobState.IsDead(uid, mobState))
return false;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using Robust.Shared.GameStates;

namespace Content.Shared.Damage.Components;

/// <summary>
/// This is used for an effect that nullifies <see cref="SlowOnDamageComponent"/> and adds an alert.
/// </summary>
[RegisterComponent, NetworkedComponent, Access(typeof(SlowOnDamageSystem))]
public sealed partial class IgnoreSlowOnDamageComponent : Component;
19 changes: 19 additions & 0 deletions Content.Shared/Damage/Systems/SlowOnDamageSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ public override void Initialize()
SubscribeLocalEvent<ClothingSlowOnDamageModifierComponent, ExaminedEvent>(OnExamined);
SubscribeLocalEvent<ClothingSlowOnDamageModifierComponent, ClothingGotEquippedEvent>(OnGotEquipped);
SubscribeLocalEvent<ClothingSlowOnDamageModifierComponent, ClothingGotUnequippedEvent>(OnGotUnequipped);

SubscribeLocalEvent<IgnoreSlowOnDamageComponent, ComponentStartup>(OnIgnoreStartup);
SubscribeLocalEvent<IgnoreSlowOnDamageComponent, ComponentShutdown>(OnIgnoreShutdown);
SubscribeLocalEvent<IgnoreSlowOnDamageComponent, ModifySlowOnDamageSpeedEvent>(OnIgnoreModifySpeed);
}

private void OnRefreshMovespeed(EntityUid uid, SlowOnDamageComponent component, RefreshMovementSpeedModifiersEvent args)
Expand Down Expand Up @@ -84,6 +88,21 @@ private void OnGotUnequipped(Entity<ClothingSlowOnDamageModifierComponent> ent,
{
_movementSpeedModifierSystem.RefreshMovementSpeedModifiers(args.Wearer);
}

private void OnIgnoreStartup(Entity<IgnoreSlowOnDamageComponent> ent, ref ComponentStartup args)
{
_movementSpeedModifierSystem.RefreshMovementSpeedModifiers(ent);
}

private void OnIgnoreShutdown(Entity<IgnoreSlowOnDamageComponent> ent, ref ComponentShutdown args)
{
_movementSpeedModifierSystem.RefreshMovementSpeedModifiers(ent);
}

private void OnIgnoreModifySpeed(Entity<IgnoreSlowOnDamageComponent> ent, ref ModifySlowOnDamageSpeedEvent args)
{
args.Speed = 1f;
}
}

[ByRefEvent]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public sealed partial class RechargeBasicEntityAmmoComponent : Component

[DataField("rechargeSound")]
[AutoNetworkedField]
public SoundSpecifier RechargeSound = new SoundPathSpecifier("/Audio/Magic/forcewall.ogg")
public SoundSpecifier? RechargeSound = new SoundPathSpecifier("/Audio/Magic/forcewall.ogg")
{
Params = AudioParams.Default.WithVolume(-5f)
};
Expand All @@ -27,4 +27,7 @@ public sealed partial class RechargeBasicEntityAmmoComponent : Component
AutoNetworkedField]
[AutoPausedField]
public TimeSpan? NextCharge;

[DataField, AutoNetworkedField]
public bool ShowExamineText = true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ private void OnInit(EntityUid uid, RechargeBasicEntityAmmoComponent component, M

private void OnExamined(EntityUid uid, RechargeBasicEntityAmmoComponent component, ExaminedEvent args)
{
if (!component.ShowExamineText)
return;

if (!TryComp<BasicEntityAmmoProviderComponent>(uid, out var ammo)
|| ammo.Count == ammo.Capacity ||
component.NextCharge == null)
Expand Down
Loading

0 comments on commit 692d340

Please sign in to comment.