forked from space-wizards/space-station-14
-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/master' into fract-war-ebent-u…
…pdate-v0.7
- Loading branch information
Showing
429 changed files
with
48,470 additions
and
45,464 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
Content.Server/SS220/CultYogg/Cultists/CultYoggPurifiedSystem.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
Content.Shared/SS220/Paper/PaperAutoFormDatasetPrototype.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// © 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.Prototypes; | ||
|
||
namespace Content.Shared.SS220.Paper; | ||
|
||
[Prototype("paperAutoFormDataset")] | ||
public sealed partial class PaperAutoFormDatasetPrototype : IPrototype | ||
{ | ||
[ViewVariables] | ||
[IdDataField] | ||
public string ID { get; private set; } = default!; | ||
|
||
[DataField] | ||
public Dictionary<string, ReplacedData> KeyWordsReplace = []; | ||
} |
Oops, something went wrong.