-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Коллективный разум * Колективный разум гуманоидному ксеносу
- Loading branch information
Showing
24 changed files
with
453 additions
and
25 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using Content.Client.Chat.Managers; | ||
using Content.Shared.Sunrise.CollectiveMind; | ||
using Robust.Client.Player; | ||
|
||
namespace Content.Client.Chat | ||
{ | ||
public sealed class CollectiveMindChatUpdateSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly IChatManager _chatManager = default!; | ||
[Dependency] private readonly IPlayerManager _playerManager = default!; | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
SubscribeLocalEvent<CollectiveMindComponent, ComponentInit>(OnInit); | ||
SubscribeLocalEvent<CollectiveMindComponent, ComponentRemove>(OnRemove); | ||
} | ||
|
||
public CollectiveMindComponent? Player => CompOrNull<CollectiveMindComponent>(_playerManager.LocalSession?.AttachedEntity); | ||
public bool IsCollectiveMind => Player != null; | ||
|
||
private void OnInit(EntityUid uid, CollectiveMindComponent component, ComponentInit args) | ||
{ | ||
_chatManager.UpdatePermissions(); | ||
} | ||
|
||
private void OnRemove(EntityUid uid, CollectiveMindComponent component, ComponentRemove args) | ||
{ | ||
_chatManager.UpdatePermissions(); | ||
} | ||
} | ||
} |
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,42 @@ | ||
using Content.Server.Chat.Systems; | ||
using Content.Shared.Administration; | ||
using Robust.Shared.Console; | ||
using Robust.Shared.Enums; | ||
|
||
namespace Content.Server.Chat.Commands | ||
{ | ||
[AnyCommand] | ||
internal sealed class CollectiveMindCommand : IConsoleCommand | ||
{ | ||
public string Command => "cmsay"; | ||
public string Description => "Send chat messages to the collective mind."; | ||
public string Help => "cmsay <text>"; | ||
|
||
public void Execute(IConsoleShell shell, string argStr, string[] args) | ||
{ | ||
if (shell.Player is not { } player) | ||
{ | ||
shell.WriteError("This command cannot be run from the server."); | ||
return; | ||
} | ||
|
||
if (player.Status != SessionStatus.InGame) | ||
return; | ||
|
||
if (player.AttachedEntity is not {} playerEntity) | ||
{ | ||
shell.WriteError("You don't have an entity!"); | ||
return; | ||
} | ||
|
||
if (args.Length < 1) | ||
return; | ||
|
||
var message = string.Join(" ", args).Trim(); | ||
if (string.IsNullOrEmpty(message)) | ||
return; | ||
|
||
EntitySystem.Get<ChatSystem>().TrySendInGameICMessage(playerEntity, message, InGameICChatType.CollectiveMind, ChatTransmitRange.Normal); | ||
} | ||
} | ||
} |
Oops, something went wrong.