-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ton of work refactoring Holograms, generally cleaning it up, and addi…
…ng new functionality. The AIEye can now function as a camera-bound Hologram (commented out), work still needs to be done on making Hologram disks and servers cool to use, and I need to decide how to determine what a Hologram collides with.
- Loading branch information
1 parent
15995ca
commit 4718be2
Showing
26 changed files
with
628 additions
and
412 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
Content.Client/SimpleStation14/Holograms/AcceptHologramEui.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,44 @@ | ||
using Content.Client.Eui; | ||
using Content.Client.Holograms; | ||
using Content.Shared.SimpleStation14.Holograms; | ||
using JetBrains.Annotations; | ||
using Robust.Client.Graphics; | ||
|
||
namespace Content.Client.SimpleStation14.Holograms; | ||
|
||
[UsedImplicitly] | ||
public sealed class AcceptHologramEui : BaseEui | ||
{ | ||
private readonly AcceptHologramWindow _window; | ||
|
||
public AcceptHologramEui() | ||
{ | ||
_window = new AcceptHologramWindow(); | ||
|
||
_window.DenyButton.OnPressed += _ => | ||
{ | ||
SendMessage(new AcceptHologramChoiceMessage(AcceptHologramUiButton.Deny)); | ||
_window.Close(); | ||
}; | ||
|
||
_window.OnClose += () => SendMessage(new AcceptHologramChoiceMessage(AcceptHologramUiButton.Deny)); | ||
|
||
_window.AcceptButton.OnPressed += _ => | ||
{ | ||
SendMessage(new AcceptHologramChoiceMessage(AcceptHologramUiButton.Accept)); | ||
_window.Close(); | ||
}; | ||
} | ||
|
||
public override void Opened() | ||
{ | ||
IoCManager.Resolve<IClyde>().RequestWindowAttention(); | ||
_window.OpenCentered(); | ||
} | ||
|
||
public override void Closed() | ||
{ | ||
_window.Close(); | ||
} | ||
|
||
} |
60 changes: 60 additions & 0 deletions
60
Content.Client/SimpleStation14/Holograms/AcceptHologramWindow.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,60 @@ | ||
using System.Numerics; | ||
using Robust.Client.UserInterface; | ||
using Robust.Client.UserInterface.Controls; | ||
using Robust.Client.UserInterface.CustomControls; | ||
using static Robust.Client.UserInterface.Controls.BoxContainer; | ||
|
||
namespace Content.Client.Holograms; | ||
|
||
public sealed class AcceptHologramWindow : DefaultWindow | ||
{ | ||
public readonly Button DenyButton; | ||
public readonly Button AcceptButton; | ||
|
||
public AcceptHologramWindow() | ||
{ | ||
|
||
Title = Loc.GetString("accept-hologram-window-title"); | ||
|
||
Contents.AddChild(new BoxContainer | ||
{ | ||
Orientation = LayoutOrientation.Vertical, | ||
Children = | ||
{ | ||
new BoxContainer | ||
{ | ||
Orientation = LayoutOrientation.Vertical, | ||
Children = | ||
{ | ||
new Label() | ||
{ | ||
Text = Loc.GetString("accept-hologram-window-prompt-text-part") | ||
}, | ||
new BoxContainer | ||
{ | ||
Orientation = LayoutOrientation.Horizontal, | ||
Align = AlignMode.Center, | ||
Children = | ||
{ | ||
(AcceptButton = new Button | ||
{ | ||
Text = Loc.GetString("accept-hologram-window-accept-button"), | ||
}), | ||
|
||
new Control() | ||
{ | ||
MinSize = new Vector2(20, 0) | ||
}, | ||
|
||
(DenyButton = new Button | ||
{ | ||
Text = Loc.GetString("accept-hologram-window-deny-button"), | ||
}) | ||
} | ||
}, | ||
} | ||
}, | ||
} | ||
}); | ||
} | ||
} |
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
32 changes: 32 additions & 0 deletions
32
Content.Server/SimpleStation14/Holograms/AcceptHologramEui.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,32 @@ | ||
using Content.Server.EUI; | ||
using Content.Shared.Eui; | ||
using Content.Shared.SimpleStation14.Holograms; | ||
|
||
namespace Content.Server.SimpleStation14.Holograms; | ||
|
||
public sealed class AcceptHologramEui : BaseEui | ||
{ | ||
private readonly HologramSystem _hologramSystem; | ||
private readonly Mind.Mind _mind; | ||
|
||
public AcceptHologramEui(Mind.Mind mind, HologramSystem hologramSys) | ||
{ | ||
_mind = mind; | ||
_hologramSystem = hologramSys; | ||
} | ||
|
||
public override void HandleMessage(EuiMessageBase msg) | ||
{ | ||
base.HandleMessage(msg); | ||
|
||
if (msg is not AcceptHologramChoiceMessage choice || | ||
choice.Button == AcceptHologramUiButton.Deny) | ||
{ | ||
Close(); | ||
return; | ||
} | ||
|
||
_hologramSystem.TransferMindToHologram(_mind); | ||
Close(); | ||
} | ||
} |
5 changes: 3 additions & 2 deletions
5
...Holograms/Components/HoloDiskComponent.cs → ...grams/Components/HologramDiskComponent.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
18 changes: 18 additions & 0 deletions
18
Content.Server/SimpleStation14/Holograms/Components/HologramDiskDummyComponent.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,18 @@ | ||
using Robust.Shared.Prototypes; | ||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; | ||
|
||
namespace Content.Server.SimpleStation14.Holograms.Components; | ||
|
||
/// <summary> | ||
/// For any items that should generate a 'dummy' hologram when inserted as a holo disk. | ||
/// Mostly intended for jokes and gaffs, but could be used for useful AI entities as well. | ||
/// </summary> | ||
[RegisterComponent] | ||
public sealed class HologramDiskDummyComponent : Component | ||
{ | ||
/// <summary> | ||
/// The prototype to spawn when this disk is inserted into a server. | ||
/// </summary> | ||
[DataField("prototype", required: true, customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>)), ViewVariables(VVAccess.ReadWrite)] | ||
public string HoloPrototype = default!; | ||
} |
34 changes: 34 additions & 0 deletions
34
Content.Server/SimpleStation14/Holograms/Systems/HologramProjectorSystem.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,34 @@ | ||
using Content.Server.Power.Components; | ||
using Content.Server.Power.EntitySystems; | ||
using Content.Server.SurveillanceCamera; | ||
using Content.Shared.SimpleStation14.Holograms; | ||
using Content.Shared.SimpleStation14.Holograms.Components; | ||
|
||
namespace Content.Server.SimpleStation14.Holograms; | ||
|
||
public sealed class HologramProjectorSystem : EntitySystem | ||
{ | ||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent((EntityUid ent, HologramProjectorComponent comp, ref PowerChangedEvent _) => CheckState(ent, comp)); | ||
SubscribeLocalEvent<HologramProjectorComponent, SurveillanceCameraChangeStateEvent>((ent, comp, args) => CheckState(ent, comp)); | ||
SubscribeLocalEvent<HologramProjectorComponent, MapInitEvent>((ent, comp, args) => CheckState(ent, comp)); | ||
} | ||
|
||
public void CheckState(EntityUid projector, HologramProjectorComponent? projComp = null) | ||
{ | ||
if (!Resolve(projector, ref projComp)) | ||
return; | ||
|
||
if (TryComp<ApcPowerReceiverComponent>(projector, out var powerComp) && !powerComp.Powered || | ||
TryComp<SurveillanceCameraComponent>(projector, out var cameraComp) && !cameraComp.Active) | ||
{ | ||
RemComp<HologramProjectorActiveComponent>(projector); | ||
return; | ||
} | ||
|
||
EnsureComp<HologramProjectorActiveComponent>(projector); | ||
} | ||
} |
Oops, something went wrong.