Skip to content

Commit

Permalink
Merge branch 'master' into holograms
Browse files Browse the repository at this point in the history
  • Loading branch information
Pspritechologist committed Feb 7, 2024
2 parents 4718be2 + 4b65cdf commit 29de297
Show file tree
Hide file tree
Showing 126 changed files with 1,269 additions and 703 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: PR Changelogs
concurrency: commit_action
on:
pull_request_target:
types: [closed]
Expand Down Expand Up @@ -48,6 +49,7 @@ jobs:

- name: Commit Changelog
run: |
git pull origin master
git add *.yml
git commit -m "${{ vars.CHANGELOG_MESSAGE }} (#${{ env.PR_NUMBER }})"
git push
Expand Down
92 changes: 92 additions & 0 deletions Content.Client/SimpleStation14/Overlays/Shaders/StaticOverlay.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
using Content.Shared.SimpleStation14.Silicon.Components;
using Content.Shared.SimpleStation14.Silicon.Systems;
using Content.Shared.StatusEffect;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.Player;
using Robust.Shared.Enums;
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;

namespace Content.Client.SimpleStation14.Overlays.Shaders;

public sealed class StaticOverlay : Overlay
{
[Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;

public override OverlaySpace Space => OverlaySpace.WorldSpace;
public override bool RequestScreenTexture => true;
private readonly ShaderInstance _staticShader;

private (TimeSpan, TimeSpan)? _time;
private float? _fullTimeLeft;
private float? _curTimeLeft;

public float MixAmount = 0;

public StaticOverlay()
{
IoCManager.InjectDependencies(this);
_staticShader = _prototypeManager.Index<ShaderPrototype>("SeeingStatic").InstanceUnique();
}

protected override void FrameUpdate(FrameEventArgs args)
{
var playerEntity = _playerManager.LocalPlayer?.ControlledEntity;

if (playerEntity == null)
return;

if (!_entityManager.TryGetComponent<SeeingStaticComponent>(playerEntity, out var staticComp)
|| !_entityManager.TryGetComponent<StatusEffectsComponent>(playerEntity, out var statusComp))
return;

var status = _entityManager.EntitySysManager.GetEntitySystem<StatusEffectsSystem>();

if (playerEntity == null || statusComp == null)
return;

if (!status.TryGetTime(playerEntity.Value, SeeingStaticSystem.StaticKey, out var timeTemp, statusComp))
return;

if (_time != timeTemp) // Resets the shader if the times change. This should factor in wheather it's a reset, or a increase, but I have a lot of cough syrup in me, so TODO.
{
_time = timeTemp;
_fullTimeLeft = null;
_curTimeLeft = null;
}

_fullTimeLeft ??= (float) (timeTemp.Value.Item2 - timeTemp.Value.Item1).TotalSeconds;
_curTimeLeft ??= _fullTimeLeft;

_curTimeLeft -= args.DeltaSeconds;

MixAmount = Math.Clamp(_curTimeLeft.Value / _fullTimeLeft.Value * staticComp.Multiplier, 0, 1);
}

protected override bool BeforeDraw(in OverlayDrawArgs args)
{
if (!_entityManager.TryGetComponent(_playerManager.LocalPlayer?.ControlledEntity, out EyeComponent? eyeComp))
return false;

if (args.Viewport.Eye != eyeComp.Eye)
return false;

return MixAmount > 0;
}

protected override void Draw(in OverlayDrawArgs args)
{
if (ScreenTexture == null)
return;

var handle = args.WorldHandle;
_staticShader.SetParameter("SCREEN_TEXTURE", ScreenTexture);
_staticShader.SetParameter("mixAmount", MixAmount);
handle.UseShader(_staticShader);
handle.DrawRect(args.WorldBounds, Color.White);
handle.UseShader(null);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
using Content.Client.SimpleStation14.Overlays.Shaders;
using Content.Shared.SimpleStation14.Silicon.Components;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.Player;

namespace Content.Client.SimpleStation14.Silicon.Systems;

/// <summary>
/// System to handle the SeeingStatic overlay.
/// </summary>
public sealed class SeeingStaticSystem : EntitySystem
{
[Dependency] private readonly IPlayerManager _player = default!;
[Dependency] private readonly IOverlayManager _overlayMan = default!;

private StaticOverlay _overlay = default!;

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

SubscribeLocalEvent<SeeingStaticComponent, ComponentInit>(OnInit);
SubscribeLocalEvent<SeeingStaticComponent, ComponentShutdown>(OnShutdown);

SubscribeLocalEvent<SeeingStaticComponent, PlayerAttachedEvent>(OnPlayerAttached);
SubscribeLocalEvent<SeeingStaticComponent, PlayerDetachedEvent>(OnPlayerDetached);

_overlay = new();
}

private void OnPlayerAttached(EntityUid uid, SeeingStaticComponent component, PlayerAttachedEvent args)
{
_overlayMan.AddOverlay(_overlay);
}

private void OnPlayerDetached(EntityUid uid, SeeingStaticComponent component, PlayerDetachedEvent args)
{
_overlay.MixAmount = 0;
_overlayMan.RemoveOverlay(_overlay);
}

private void OnInit(EntityUid uid, SeeingStaticComponent component, ComponentInit args)
{
if (_player.LocalPlayer?.ControlledEntity == uid)
_overlayMan.AddOverlay(_overlay);
}

private void OnShutdown(EntityUid uid, SeeingStaticComponent component, ComponentShutdown args)
{
if (_player.LocalPlayer?.ControlledEntity == uid)
{
_overlay.MixAmount = 0;
_overlayMan.RemoveOverlay(_overlay);
}
}
}
4 changes: 2 additions & 2 deletions Content.Server/Administration/Commands/SetOutfitCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public static bool SetOutfit(EntityUid target, string gear, IEntityManager entit
}
}

// Parkstation-IPC-Start
// Parkstation-Ipc-Start
// Pretty much copied from StationSpawningSystem.SpawnStartingGear
if (entityManager.TryGetComponent<EncryptionKeyHolderComponent>(target, out var keyHolderComp))
{
Expand All @@ -159,7 +159,7 @@ public static bool SetOutfit(EntityUid target, string gear, IEntityManager entit
entityManager.QueueDeleteEntity(earEntity);
}
}
// Parkstation-IPC-End
// Parkstation-Ipc-End

return true;
}
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Disease/DiseaseSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ public void TryAddDisease(EntityUid host, DiseasePrototype addedDisease, Disease

foreach (var disease in target.AllDiseases)
{
if (disease.ID == addedDisease?.ID) //ID because of the way protoypes work
if (disease.ID == addedDisease.ID) //ID because of the way protoypes work
return;
}

Expand Down
4 changes: 2 additions & 2 deletions Content.Server/Emp/EmpSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public void EmpPulse(MapCoordinates coordinates, float range, float energyConsum
{
foreach (var uid in _lookup.GetEntitiesInRange(coordinates, range))
{
var ev = new EmpPulseEvent(energyConsumption, false, false);
var ev = new EmpPulseEvent(energyConsumption, false, false, TimeSpan.FromSeconds(duration)); // Parkstation-IPCs
RaiseLocalEvent(uid, ref ev);
if (ev.Affected)
{
Expand Down Expand Up @@ -101,7 +101,7 @@ private void OnCameraSetActive(EntityUid uid, EmpDisabledComponent component, re
}

[ByRefEvent]
public record struct EmpPulseEvent(float EnergyConsumption, bool Affected, bool Disabled);
public record struct EmpPulseEvent(float EnergyConsumption, bool Affected, bool Disabled, TimeSpan Duration); // Parkstation-IPCs

[ByRefEvent]
public record struct EmpDisabledRemoved();
3 changes: 3 additions & 0 deletions Content.Server/Fluids/EntitySystems/AbsorbentSystem.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Content.Server.Chemistry.EntitySystems;
using Content.Server.Popups;
using Content.Server.SimpleStation14.EndOfRoundStats.MopUsed; // Parkstation-EndOfRoundStats
using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.Reagent;
using Content.Shared.FixedPoint;
Expand Down Expand Up @@ -213,6 +214,8 @@ private bool TryPuddleInteract(EntityUid user, EntityUid used, EntityUid target,
puddleSolution.AddReagent(PuddleSystem.EvaporationReagent, split.Volume);
absorberSoln.AddSolution(split, _prototype);

RaiseLocalEvent(new MopUsedStatEvent(user, split.Volume)); // Parkstation-EndOfRoundStats

_solutionSystem.UpdateChemicals(used, absorberSoln);
_solutionSystem.UpdateChemicals(target, puddleSolution);
_audio.PlayPvs(absorber.PickupSound, target);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@ namespace Content.Server.SimpleStation14.EndOfRoundStats.MopUsed;

public sealed class MopUsedStatEvent : EntityEventArgs
{
public String Mopper;
public EntityUid Mopper;
public FixedPoint2 AmountMopped;
public String? Username;

public MopUsedStatEvent(String mopper, FixedPoint2 amountMopped, String? username)
public MopUsedStatEvent(EntityUid mopper, FixedPoint2 amountMopped)
{
Mopper = mopper;
AmountMopped = amountMopped;
Username = username;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Linq;
using Content.Server.GameTicking;
using Content.Server.Mind;
using Content.Shared.FixedPoint;
using Content.Shared.GameTicking;
using Content.Shared.SimpleStation14.CCVar;
Expand All @@ -10,6 +11,7 @@ namespace Content.Server.SimpleStation14.EndOfRoundStats.MopUsed;
public sealed class MopUsedStatSystem : EntitySystem
{
[Dependency] private readonly IConfigurationManager _config = default!;
[Dependency] private readonly MindSystem _mind = default!;


Dictionary<MopperData, FixedPoint2> userMopStats = new();
Expand Down Expand Up @@ -37,10 +39,13 @@ private void OnMopUsed(MopUsedStatEvent args)
{
timesMopped++;

var name = MetaData(args.Mopper).EntityName;
var username = _mind.TryGetMind(args.Mopper, out var mind) && mind.Session != null ? mind.Session.Name : null;

var mopperData = new MopperData
{
Name = args.Mopper,
Username = args.Username
Name = name,
Username = username
};

if (userMopStats.ContainsKey(mopperData))
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/SimpleStation14/Eye/EyeStartup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ private void OnEyeStartup(EntityUid uid, EyeComponent component, ComponentStartu
if (_entityManager.HasComponent<GhostComponent>(uid))
component.VisibilityMask |= (uint) VisibilityFlags.AIEye;

_shadowkinPowerSystem.SetCanSeeInvisibility(uid, _entityManager.HasComponent<GhostComponent>(uid));
_shadowkinPowerSystem.SetVisibility(uid, _entityManager.HasComponent<GhostComponent>(uid));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ private void BurnEntity(EntityUid entity, DamageableComponent damageComp, float
if (damageDealt != null && damageDealt.Total > 0 && chargerComp.WarningTime < _timing.CurTime)
{
var popupBurn = Loc.GetString(chargerComp.OverheatString);
_popup.PopupEntity(popupBurn, entity, PopupType.MediumCaution);
_popup.PopupEntity(popupBurn, entity, entity, PopupType.MediumCaution);

chargerComp.WarningTime = TimeSpan.FromSeconds(_random.Next(3, 7)) + _timing.CurTime;
}
Expand Down
68 changes: 68 additions & 0 deletions Content.Server/SimpleStation14/Silicon/Systems/SiliconEmpSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
using Content.Server.Emp;
using Content.Server.Speech.Muting;
using Content.Server.Stunnable;
using Content.Shared.CombatMode.Pacification;
using Content.Shared.Eye.Blinding.Components;
using Content.Shared.Eye.Blinding.Systems;
using Content.Shared.SimpleStation14.Silicon.Components;
using Content.Shared.SimpleStation14.Silicon.Systems;
using Content.Shared.Speech.EntitySystems;
using Content.Shared.StatusEffect;
using Robust.Shared.Random;

namespace Content.Server.SimpleStation14.Silicon.Systems;

public sealed class SiliconEmpSystem : EntitySystem
{
[Dependency] private readonly StatusEffectsSystem _status = default!;
[Dependency] private readonly StunSystem _stun = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly SharedStutteringSystem _stuttering = default!;
[Dependency] private readonly SharedSlurredSystem _slurredSystem = default!;

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

SubscribeLocalEvent<SiliconComponent, EmpPulseEvent>(OnEmpPulse);
}

private void OnEmpPulse(EntityUid uid, SiliconComponent component, ref EmpPulseEvent args)
{
args.EnergyConsumption *= 0.25f; // EMPs drain a lot of freakin power.

if (!TryComp<StatusEffectsComponent>(uid, out var statusComp))
return;

args.Affected = true;
args.Disabled = true;

var duration = args.Duration / 1.5; // We divide the duration since EMPs are balanced for structures, not people.

if (duration.TotalSeconds * 0.25 >= 3) // If the EMP blast is strong enough, we stun them.
// This is mostly to prevent flickering in/out of being stunned. We also cap how long they can be stunned for.
{
_stun.TryParalyze(uid, TimeSpan.FromSeconds(Math.Min(duration.TotalSeconds * 0.25f, 15f)), true, statusComp);
}

_stun.TrySlowdown(uid, duration, true, _random.NextFloat(0.50f, 0.70f), _random.NextFloat(0.35f, 0.70f), statusComp);

_status.TryAddStatusEffect<SeeingStaticComponent>(uid, SeeingStaticSystem.StaticKey, duration, true, statusComp);

if (_random.Prob(0.60f))
_stuttering.DoStutter(uid, duration * 2, false, statusComp);
else if (_random.Prob(0.80f))
_slurredSystem.DoSlur(uid, duration * 2, statusComp);

if (_random.Prob(0.02f))
_status.TryAddStatusEffect<MutedComponent>(uid, "Muted", duration * 0.5, true, statusComp);

if (_random.Prob(0.02f))
_status.TryAddStatusEffect<TemporaryBlindnessComponent>(uid, TemporaryBlindnessSystem.BlindingStatusEffect, duration * 0.5, true, statusComp);

if (_random.Prob(0.08f))
_status.TryAddStatusEffect<PacifiedComponent>(uid, "Pacified", duration * 0.5, true, statusComp);

args.EnergyConsumption = 0;
}
}
Loading

0 comments on commit 29de297

Please sign in to comment.