forked from SerbiaStrong-220/space-station-14
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* basic implementation of mindslave * mindslave implementation 2 (broken) * mindslave implementation 3 (fixed) * mindslave implementation 4 * Fix NT issue * Added notification eui and minor fixes
- Loading branch information
Showing
35 changed files
with
888 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// © 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.MindSlave; | ||
using Content.Shared.StatusIcon.Components; | ||
|
||
namespace Content.Client.SS220.MindSlave; | ||
|
||
public sealed class MindSlaveSystem : EntitySystem | ||
{ | ||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<MindSlaveComponent, CanDisplayStatusIconsEvent>(OnSlaveGetIcons); | ||
SubscribeLocalEvent<MindSlaveMasterComponent, CanDisplayStatusIconsEvent>(OnMasterGetIcons); | ||
} | ||
|
||
private void OnSlaveGetIcons(Entity<MindSlaveComponent> entity, ref CanDisplayStatusIconsEvent args) | ||
{ | ||
if (TryComp<MindSlaveMasterComponent>(args.User, out var masterComp) && masterComp.EnslavedEntities.Contains(entity)) | ||
return; | ||
|
||
args.Cancelled = true; | ||
} | ||
|
||
private void OnMasterGetIcons(Entity<MindSlaveMasterComponent> entity, ref CanDisplayStatusIconsEvent args) | ||
{ | ||
if (HasComp<MindSlaveComponent>(args.User) && entity.Comp.EnslavedEntities.Contains(args.User.Value)) | ||
return; | ||
|
||
args.Cancelled = true; | ||
} | ||
} | ||
|
48 changes: 48 additions & 0 deletions
48
Content.Client/SS220/MindSlave/UI/MindSlaveNotificationEui.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,48 @@ | ||
// © SS220, An EULA/CLA with a hosting restriction, full text: https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/CLA.txt | ||
|
||
using Content.Client.Eui; | ||
using Content.Shared.Eui; | ||
using Content.Shared.SS220.MindSlave; | ||
using JetBrains.Annotations; | ||
using Robust.Client.Graphics; | ||
|
||
namespace Content.Client.SS220.MindSlave.UI; | ||
|
||
//Stolen from DeathReminder | ||
[UsedImplicitly] | ||
public sealed class MindSlaveNotificationEui : BaseEui | ||
{ | ||
private readonly MindSlaveNotificationWindow _window; | ||
|
||
public MindSlaveNotificationEui() | ||
{ | ||
_window = new MindSlaveNotificationWindow(); | ||
|
||
_window.AcceptButton.OnPressed += _ => | ||
{ | ||
_window.Close(); | ||
}; | ||
} | ||
|
||
public override void HandleState(EuiStateBase state) | ||
{ | ||
if (state is not MindSlaveNotificationEuiState newState) | ||
return; | ||
|
||
_window.TextLabel.Text = newState.IsEnslaved ? | ||
Loc.GetString("mindslave-notification-window-text-enslaved", ("name", newState.MasterName)) : | ||
Loc.GetString("mindslave-notification-window-text-freed"); | ||
} | ||
|
||
public override void Opened() | ||
{ | ||
IoCManager.Resolve<IClyde>().RequestWindowAttention(); | ||
_window.OpenCentered(); | ||
} | ||
|
||
public override void Closed() | ||
{ | ||
_window.Close(); | ||
} | ||
} | ||
|
54 changes: 54 additions & 0 deletions
54
Content.Client/SS220/MindSlave/UI/MindSlaveNotificationWindow.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,54 @@ | ||
// © SS220, An EULA/CLA with a hosting restriction, full text: https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/CLA.txt | ||
|
||
using Robust.Client.UserInterface; | ||
using Robust.Client.UserInterface.Controls; | ||
using Robust.Client.UserInterface.CustomControls; | ||
using System.Numerics; | ||
|
||
namespace Content.Client.SS220.MindSlave.UI; | ||
|
||
//Stolen from DeathReminder | ||
public sealed class MindSlaveNotificationWindow : DefaultWindow | ||
{ | ||
public readonly Button AcceptButton; | ||
public readonly Label TextLabel; | ||
|
||
public MindSlaveNotificationWindow() | ||
{ | ||
Title = Loc.GetString("mindslave-notification-window-title"); | ||
|
||
Contents.AddChild(new BoxContainer | ||
{ | ||
Orientation = BoxContainer.LayoutOrientation.Vertical, | ||
Children = | ||
{ | ||
new BoxContainer | ||
{ | ||
Orientation = BoxContainer.LayoutOrientation.Vertical, | ||
Children = | ||
{ | ||
(TextLabel = new Label() | ||
{ | ||
}), | ||
new BoxContainer | ||
{ | ||
Orientation = BoxContainer.LayoutOrientation.Horizontal, | ||
Align = BoxContainer.AlignMode.Center, | ||
Children = | ||
{ | ||
(AcceptButton = new Button | ||
{ | ||
Text = Loc.GetString("mindslave-notification-window-accept"), | ||
}), | ||
(new Control() | ||
{ | ||
MinSize = new Vector2(20, 0) | ||
}), | ||
} | ||
}, | ||
} | ||
}, | ||
} | ||
}); | ||
} | ||
} |
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
Oops, something went wrong.