-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into experimental-teleporter
- Loading branch information
Showing
108 changed files
with
869 additions
and
73 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
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
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,81 @@ | ||
using Content.Server.Administration.Logs; | ||
using Content.Server.Chat.Managers; | ||
using Content.Server.GameTicking; | ||
using Content.Shared._White; | ||
using Content.Shared.Database; | ||
using Content.Shared.GameTicking; | ||
using Content.Shared.Ghost; | ||
using Robust.Server.Player; | ||
using Robust.Shared.Configuration; | ||
using Robust.Shared.Network; | ||
using Robust.Shared.Timing; | ||
|
||
namespace Content.Server._White.Ghost; | ||
|
||
public sealed class GhostReturnToRoundSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly IChatManager _chatManager = default!; | ||
[Dependency] private readonly IAdminLogManager _adminLogger = default!; | ||
[Dependency] private readonly IPlayerManager _playerManager = default!; | ||
[Dependency] private readonly IGameTiming _gameTiming = default!; | ||
[Dependency] private readonly IConfigurationManager _cfg = default!; | ||
|
||
public override void Initialize() | ||
{ | ||
SubscribeNetworkEvent<GhostReturnToRoundRequest>(OnGhostReturnToRoundRequest); | ||
} | ||
|
||
private void OnGhostReturnToRoundRequest(GhostReturnToRoundRequest msg, EntitySessionEventArgs args) | ||
{ | ||
var uid = args.SenderSession.AttachedEntity; | ||
|
||
if (uid == null) | ||
return; | ||
|
||
var connectedClient = args.SenderSession.ConnectedClient; | ||
var userId = args.SenderSession.UserId; | ||
|
||
TryGhostReturnToRound(uid.Value, connectedClient, userId, out var message, out var wrappedMessage); | ||
|
||
_chatManager.ChatMessageToOne(Shared.Chat.ChatChannel.Server, | ||
message, | ||
wrappedMessage, | ||
default, | ||
false, | ||
connectedClient, | ||
Color.Red); | ||
} | ||
|
||
private void TryGhostReturnToRound(EntityUid uid, INetChannel connectedClient, NetUserId userId, out string message, out string wrappedMessage) | ||
{ | ||
var maxPlayers = _cfg.GetCVar(WhiteCVars.GhostRespawnMaxPlayers); | ||
if (_playerManager.PlayerCount >= maxPlayers) | ||
{ | ||
message = Loc.GetString("ghost-respawn-max-players", ("players", maxPlayers)); | ||
wrappedMessage = Loc.GetString("chat-manager-server-wrap-message", ("message", message)); | ||
return; | ||
} | ||
|
||
var deathTime = EnsureComp<GhostComponent>(uid).TimeOfDeath; | ||
var timeUntilRespawn = _cfg.GetCVar(WhiteCVars.GhostRespawnTime); | ||
var timePast = (_gameTiming.CurTime - deathTime).TotalMinutes; | ||
if (timePast >= timeUntilRespawn) | ||
{ | ||
var ticker = Get<GameTicker>(); | ||
_playerManager.TryGetSessionById(userId, out var targetPlayer); | ||
|
||
if (targetPlayer != null) | ||
ticker.Respawn(targetPlayer); | ||
|
||
_adminLogger.Add(LogType.Mind, LogImpact.Medium, $"{Loc.GetString("ghost-respawn-log-return-to-lobby", ("userName", connectedClient.UserName))}"); | ||
|
||
message = Loc.GetString("ghost-respawn-window-rules-footer"); | ||
wrappedMessage = Loc.GetString("chat-manager-server-wrap-message", ("message", message)); | ||
|
||
return; | ||
} | ||
|
||
message = Loc.GetString("ghost-respawn-time-left", ("time", (int) (timeUntilRespawn - timePast))); | ||
wrappedMessage = Loc.GetString("chat-manager-server-wrap-message", ("message", message)); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...ared/_White/BackStab/BackStabComponent.cs → ...White/Melee/BackStab/BackStabComponent.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
namespace Content.Server._White.Melee.Crit; | ||
|
||
[RegisterComponent] | ||
public sealed partial class CritComponent : Component | ||
{ | ||
[DataField] | ||
public float CritChance = 0.2f; | ||
|
||
[DataField] | ||
public float CritMultiplier = 2f; | ||
|
||
public float? RealChance; | ||
} |
Oops, something went wrong.