Skip to content

Commit

Permalink
Merge branch 'SerbiaStrong-220:master' into rcdupd
Browse files Browse the repository at this point in the history
  • Loading branch information
UrPrice authored Jan 5, 2025
2 parents 433fd01 + 0af2c99 commit 50c81ca
Show file tree
Hide file tree
Showing 307 changed files with 2,611 additions and 697 deletions.
71 changes: 71 additions & 0 deletions Content.Client/SS220/Afk/AfkSystem220.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// © SS220, An EULA/CLA with a hosting restriction, full text: https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/CLA.txt
using Content.Shared.SS220.Afk;
using Content.Shared.SS220.CCVars;
using Robust.Client.Input;
using Robust.Client.UserInterface;
using Robust.Shared.Configuration;
using Robust.Shared.Input;
using Robust.Shared.Timing;

namespace Content.Client.SS220.Afk;

public sealed class AfkSystem220 : EntitySystem
{
[Dependency] private readonly IInputManager _inputManager = default!;
[Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly IConfigurationManager _configurationManager = default!;

private bool _isAnyInput = false;
private TimeSpan? _lastActivityMessageTimestamp;
private TimeSpan _activityMessageInterval;

public override void Initialize()
{
base.Initialize();
_inputManager.UIKeyBindStateChanged += OnUIKeyBindStateChanged;
_activityMessageInterval = TimeSpan.FromSeconds(_configurationManager.GetCVar(CCVars220.AfkActivityMessageInterval));
}

public override void Shutdown()
{
base.Shutdown();
// The problem here is that shutdown can be very likely caused by disconnecting from server,
// that is caused by clicking the UI button, that is caused by user input and this UIKeyBindStateChanged event,
// so this is basically a modifying-collection-inside-iteration case. That is why I use DeferAction, so
// unsubscription will happen this or next frame but certainly not inside collection iteration.
// Yes, this is not the best solution, but probably the simplest for now.
_userInterfaceManager.DeferAction(() =>
{
_inputManager.UIKeyBindStateChanged -= OnUIKeyBindStateChanged;
});
}

public override void Update(float frameTime)
{
base.Update(frameTime);

// We need to initialize time and turns out that it does not work inside Initialize() call.
_lastActivityMessageTimestamp ??= _gameTiming.CurTime;

if (_gameTiming.CurTime - _lastActivityMessageTimestamp > _activityMessageInterval)
{
SendActivityMessage();
}
}

private bool OnUIKeyBindStateChanged(BoundKeyEventArgs args)
{
_isAnyInput = true;
return false;
}

private void SendActivityMessage()
{
_lastActivityMessageTimestamp = _gameTiming.CurTime;
if (!_isAnyInput)
return;
RaiseNetworkEvent(new PlayerActivityMessage());
_isAnyInput = false;
}
}
19 changes: 18 additions & 1 deletion Content.Server/Administration/Systems/AdminVerbSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
using Robust.Shared.Utility;
using System.Linq;
using Content.Server.Silicons.Laws;
using Content.Shared.Buckle;
using Content.Shared.Buckle.Components;
using Content.Shared.Movement.Components;
using Content.Shared.Silicons.Laws.Components;
using Robust.Server.Player;
Expand Down Expand Up @@ -73,6 +75,8 @@ public sealed partial class AdminVerbSystem : EntitySystem
[Dependency] private readonly AdminFrozenSystem _freeze = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly SiliconLawSystem _siliconLawSystem = default!;
[Dependency] private readonly SharedBuckleSystem _buckle = default!;


private readonly Dictionary<ICommonSession, List<EditSolutionsEui>> _openSolutionUis = new();

Expand Down Expand Up @@ -447,7 +451,20 @@ private void AddDebugVerbs(GetVerbsEvent<Verb> args)
Text = Loc.GetString("delete-verb-get-data-text"),
Category = VerbCategory.Debug,
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/VerbIcons/delete_transparent.svg.192dpi.png")),
Act = () => EntityManager.DeleteEntity(args.Target),
//ss220 delete buckled entity with target fix start (issue: #2409)
Act = () =>
{
if (TryComp<StrapComponent>(args.Target, out var strap))
{
foreach (var entity in strap.BuckledEntities)
{
_buckle.Unbuckle(entity, entity);
}
}

EntityManager.DeleteEntity(args.Target);
},
//ss220 delete buckled entity with target fix end (issue: #2409)
Impact = LogImpact.Medium,
ConfirmationPopup = true
};
Expand Down
21 changes: 21 additions & 0 deletions Content.Server/SS220/Afk/AfkSystem220.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// © SS220, An EULA/CLA with a hosting restriction, full text: https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/CLA.txt
using Content.Server.Afk;
using Content.Shared.SS220.Afk;

namespace Content.Server.SS220.Afk;

public sealed class AfkSystem220 : EntitySystem
{
[Dependency] private readonly IAfkManager _afkManager = default!;

public override void Initialize()
{
base.Initialize();
SubscribeNetworkEvent<PlayerActivityMessage>(OnActivityMessage);
}

private void OnActivityMessage(PlayerActivityMessage message, EntitySessionEventArgs args)
{
_afkManager.PlayerDidAction(args.SenderSession);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using Content.Server.SS220.GameTicking.Rules.Components;
using Content.Server.Station.Systems;
using Content.Server.SS220.CultYogg.Sacraficials;
using Content.Server.SS220.CultYogg.Nyarlathotep;
using Content.Server.RoundEnd;
using Content.Server.Zombies;
using Content.Shared.Audio;
Expand Down
5 changes: 3 additions & 2 deletions Content.Shared/Humanoid/Markings/MarkingCategories.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public enum MarkingCategories : byte
Chest,
Arms,
Legs,
Foots, // SS220 Add foots marking
Tail,
Overlay
}
Expand All @@ -39,8 +40,8 @@ public static MarkingCategories FromHumanoidVisualLayers(HumanoidVisualLayers la
HumanoidVisualLayers.LHand => MarkingCategories.Arms,
HumanoidVisualLayers.LLeg => MarkingCategories.Legs,
HumanoidVisualLayers.RLeg => MarkingCategories.Legs,
HumanoidVisualLayers.LFoot => MarkingCategories.Legs,
HumanoidVisualLayers.RFoot => MarkingCategories.Legs,
HumanoidVisualLayers.LFoot => MarkingCategories.Foots, // SS220 Add foots marking
HumanoidVisualLayers.RFoot => MarkingCategories.Foots, // SS220 Add foots marking
HumanoidVisualLayers.Tail => MarkingCategories.Tail,
_ => MarkingCategories.Overlay
};
Expand Down
10 changes: 10 additions & 0 deletions Content.Shared/SS220/Afk/PlayerActivityMessage.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// © SS220, An EULA/CLA with a hosting restriction, full text: https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/CLA.txt
using Robust.Shared.Serialization;

namespace Content.Shared.SS220.Afk;

/// <summary>
/// "Hey, I am not AFK!" type of message.
/// </summary>
[Serializable, NetSerializable]
public sealed class PlayerActivityMessage : EntityEventArgs;
3 changes: 3 additions & 0 deletions Content.Shared/SS220/CCVars/CCVars220.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ public sealed class CCVars220
public static readonly CVarDef<float> AfkTeleportToCryo =
CVarDef.Create("afk.teleport_to_cryo", 1800f, CVar.SERVERONLY);

public static readonly CVarDef<float> AfkActivityMessageInterval =
CVarDef.Create("afk.activity_message_interval", 20f, CVar.CLIENTONLY | CVar.CHEAT);

/// <summary>
/// Controls whether the server will deny any players that are not whitelisted in the Prime DB.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public sealed class SharedCultYoggCorruptedSystem : EntitySystem
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly SharedSoftDeleteSystem _softDeleteSystem = default!;

private readonly TimeSpan _corruptionDuration = TimeSpan.FromSeconds(2);
private readonly TimeSpan _corruptionDuration = TimeSpan.FromSeconds(1.8);
private readonly Dictionary<ProtoId<EntityPrototype>, CultYoggCorruptedPrototype> _recipesBySourcePrototypeId = [];
private readonly Dictionary<ProtoId<StackPrototype>, CultYoggCorruptedPrototype> _recipesBySourceStackType = [];
private readonly Dictionary<ProtoId<EntityPrototype>, CultYoggCorruptedPrototype> _recipiesByParentPrototypeId = [];
Expand Down Expand Up @@ -145,7 +145,7 @@ public bool TryCorruptContinuously(EntityUid user, EntityUid entity, bool isInHa
return false;
}
var e = new CultYoggCorruptDoAfterEvent(recipe, isInHand, callback);
var doafterArgs = new DoAfterArgs(EntityManager, user, _corruptionDuration, e, user, entity) //ToDo estimate time for corruption
var doafterArgs = new DoAfterArgs(EntityManager, user, _corruptionDuration, e, user, entity)
{
Broadcast = false,
BreakOnDamage = true,
Expand Down
11 changes: 4 additions & 7 deletions Content.Shared/SS220/CultYogg/MiGo/SharedMiGoSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
using Content.Shared.Verbs;
using Robust.Shared.Utility;
using Content.Shared.Mobs.Components;

using Robust.Shared.Audio;

namespace Content.Shared.SS220.CultYogg.MiGo;

Expand All @@ -58,9 +58,6 @@ public abstract class SharedMiGoSystem : EntitySystem
[Dependency] private readonly IPrototypeManager _proto = default!;
[Dependency] private readonly SharedMindSystem _mind = default!;


//[Dependency] private readonly CultYoggRuleSystem _cultYoggRule = default!; //maybe use this for enslavement

public override void Initialize()
{
base.Initialize();
Expand Down Expand Up @@ -319,7 +316,7 @@ public override void Update(float delta)
ChangeForm(uid, comp, true);
if (!comp.AudioPlayed)
{
_audio.PlayPredicted(comp.SoundMaterialize, uid, uid);
_audio.PlayPredicted(comp.SoundMaterialize, uid, uid, AudioParams.Default.WithMaxDistance(0.5f));
comp.AudioPlayed = true;
}
_actions.StartUseDelay(comp.MiGoAstralActionEntity);
Expand Down Expand Up @@ -358,7 +355,7 @@ private void MiGoAstral(Entity<MiGoComponent> uid, ref MiGoAstralEvent args)
var started = _doAfter.TryStartDoAfter(doafterArgs);
if (started)
{
_audio.PlayPredicted(uid.Comp.SoundDeMaterialize, uid, uid);
_audio.PlayPredicted(uid.Comp.SoundDeMaterialize, uid, uid, AudioParams.Default.WithMaxDistance(0.5f));
}
}
}
Expand All @@ -367,7 +364,7 @@ private void OnAfterMaterialize(Entity<MiGoComponent> uid, ref AfterMaterialize
args.Handled = true;

_physics.SetBodyType(uid, BodyType.KinematicController);
_audio.PlayPredicted(uid.Comp.SoundMaterialize, uid, uid);
_audio.PlayPredicted(uid.Comp.SoundMaterialize, uid, uid, AudioParams.Default.WithMaxDistance(0.5f));

if (!args.Cancelled)
{
Expand Down
9 changes: 9 additions & 0 deletions Resources/Audio/SS220/Weapons/Melee/homerun/attributions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
- files: ["homerun.ogg"]
license: "CC-BY-SA-3.0"
copyright: "Is taken from paradise station at commit 5180002295c625876e9fb60f07d08c882c1e443e"
source: "https://github.com/ss220club/Paradise-SS220/blob/master/sound/weapons/homerun.ogg"

- files: ["homerunbaton.ogg"]
license: "CC-BY-SA-3.0"
copyright: "https://github.com/ss220club/Paradise-SS220/blob/master/sound/weapons/homerun.ogg, https://github.com/ParadiseSS13/Paradise/blob/master/sound/weapons/batonextend.ogg, https://www.freesoundslibrary.com/bonk-sound-effect/"
source: "https://github.com/SerbiaStrong-220/space-station-14/tree/master/Resources/Audio/SS220/Weapons/Melee/homerun/homerunbaton.ogg"
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit 50c81ca

Please sign in to comment.