Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EE Merge + Station AI #148

Merged
merged 73 commits into from
Jan 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
d8ae58e
Station AI (#30944)
metalgearsloth Aug 28, 2024
c866ffb
Verb tweaks (#31309)
metalgearsloth Aug 25, 2024
d6b0b99
ItemToggle + slots stuff (#31312)
metalgearsloth Aug 25, 2024
56451fa
Station AI (#30944)
ElectroJr Jun 18, 2024
bdafdeb
Move SleepingSystem to Shared & cleanup (#28672)
Tayrtahn Jun 14, 2024
ede16f0
Potentially re-add EE changes?
sleepyyapril Jan 4, 2025
661bdba
Fix build errors
sleepyyapril Jan 4, 2025
006acf3
Add ContainerComp (#31311)
metalgearsloth Aug 25, 2024
b7e34aa
Localize ai dataset names (#33608)
MilenVolf Dec 6, 2024
b8e2844
Add LocalizedDatasetPrototype (#28310)
Tayrtahn May 28, 2024
c9e0e5d
SetStationAiName for testing
sleepyyapril Jan 4, 2025
0334cc6
Use EntityManager.System<>
sleepyyapril Jan 4, 2025
00adaa3
Re-add improved random sentience event (#29123)
Psychpsyo Aug 18, 2024
b262e8f
no name!
Psychpsyo Sep 8, 2024
385b667
fix shitcode
sleepyyapril Jan 4, 2025
f5e6583
HideSpawnMenu
sleepyyapril Jan 4, 2025
1b7d820
Merge branch 'master' into station-ai
sleepyyapril Jan 4, 2025
1ad367b
Yippee
sleepyyapril Jan 4, 2025
1f416da
Merge branch 'station-ai' of https://github.com/sleepyyapril/Einstein…
sleepyyapril Jan 4, 2025
ca0b40a
The Den Mass Cherry-Pick 01/06/25 (#1443)
angelofallars Jan 5, 2025
975c905
Automatic Changelog Update (#1443)
SimpleStation14 Jan 5, 2025
632cf60
Merge branch 'master' into station-ai
VMSolidus Jan 5, 2025
8b5eec7
Fix Face Markings Rendering Above Clothing (#1467)
angelofallars Jan 8, 2025
998e0ea
Automatic Changelog Update (#1467)
SimpleStation14 Jan 8, 2025
b39e126
Prisoner Headset Box in Warden's Locker (#1470)
Lumminal Jan 9, 2025
4907639
Automatic Changelog Update (#1470)
SimpleStation14 Jan 9, 2025
86296da
Adds Missing Lathe Recipes (#1472)
BlueHNT Jan 10, 2025
b89412a
Some Surgery Fixs (#1471)
Spatison Jan 10, 2025
77a7295
Automatic Changelog Update (#1472)
SimpleStation14 Jan 10, 2025
ba616f0
Automatic Changelog Update (#1471)
SimpleStation14 Jan 10, 2025
0f48142
Night And Thermal Vision (#1462)
Spatison Jan 10, 2025
83fa923
Automatic Changelog Update (#1462)
SimpleStation14 Jan 10, 2025
9c65527
Merge branch 'master' into station-ai
VMSolidus Jan 10, 2025
b38b7f9
CyberEyes Night Vision And Thermal Vision Modules (#1477)
VMSolidus Jan 10, 2025
7f32e00
Automatic Changelog Update (#1477)
SimpleStation14 Jan 10, 2025
df8ffb0
Assay Psionic Power (#1450)
VMSolidus Jan 11, 2025
f0a9bbd
Automatic Changelog Update (#1450)
SimpleStation14 Jan 11, 2025
6941a01
Update dev_map.yml
VMSolidus Jan 11, 2025
5a13b27
How the fuck did AI not have these?
VMSolidus Jan 11, 2025
0b0e9a8
I managed to get both AI Latejoin and Prisoner Latejoin working at th…
metalgearsloth Aug 29, 2024
5242ceb
Make AI Not Spawn With Clothes
VMSolidus Jan 11, 2025
6903924
Station AI (#1423)
VMSolidus Jan 11, 2025
14f738d
Automatic Changelog Update (#1423)
SimpleStation14 Jan 11, 2025
f92e2b3
Merge branch 'master' of https://github.com/Simple-Station/Einstein-E…
sleepyyapril Jan 11, 2025
1d1f9ac
y
sleepyyapril Jan 11, 2025
26eade2
1
sleepyyapril Jan 11, 2025
fcc908f
AI can now speak once more. (#33196)
ScarKy0 Nov 7, 2024
736f70b
Allow AI and observers to see electrified doors (#33466)
metalgearsloth Nov 23, 2024
d662644
Hiding and clearing department prototype code (#28114)
Peptide90 Jan 11, 2025
a8b6657
fix sentienceRule
sleepyyapril Jan 11, 2025
a89b6cb
Meta with AI
Mike32oz Jan 11, 2025
1a6bd6f
Fixup playerspawn stuff (#31546)
Fildrance Sep 27, 2024
a906ed7
feat: now when research is unlocked in console, approver of reasearch…
Fildrance Sep 3, 2024
c4d14da
Update SharedStationAiSystem.Held.cs
VMSolidus Jan 11, 2025
d7317a7
Update SharedStationAiSystem.Held.cs
VMSolidus Jan 11, 2025
f293d7e
add access reader log wire (#29094)
deltanedas Jun 22, 2024
1709427
Update AccessReaderSystem.cs
VMSolidus Jan 11, 2025
0f7a662
wheeee
VMSolidus Jan 11, 2025
e2526ec
Meta with AI (#1484)
VMSolidus Jan 11, 2025
12bf563
Automatic Changelog Update (#1484)
SimpleStation14 Jan 11, 2025
0ce4d63
Update silicon.yml
VMSolidus Jan 11, 2025
fa35a3a
Hiding and Clearing Department Prototype Code (#28114) (#1483)
VMSolidus Jan 11, 2025
81bab8a
Fix Ai Accessible Consoles (#1485)
VMSolidus Jan 11, 2025
19f894d
Add Station AI To Gax (#1486)
VMSolidus Jan 11, 2025
afa2085
Automatic Changelog Update (#1486)
SimpleStation14 Jan 11, 2025
7485e8d
Senior Physician CPR (#1476)
VMSolidus Jan 11, 2025
2f6f7be
Fix AbsorbentTest & Shadowkin Test Fail (#1458)
sleepyyapril Jan 11, 2025
02dfa2e
Radstation AI (#1487)
VMSolidus Jan 11, 2025
3ebe76e
Automatic Changelog Update (#1487)
SimpleStation14 Jan 11, 2025
e389dff
Porting over My Cruise Control Code From Frontier (#1482)
neuPanda Jan 11, 2025
07401aa
Automatic Changelog Update (#1482)
SimpleStation14 Jan 11, 2025
419257f
Merge branch 'master' of https://github.com/Simple-Station/Einstein-E…
sleepyyapril Jan 11, 2025
0c6d64f
Oops
sleepyyapril Jan 11, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public BanPanel()
var prototypeManager = IoCManager.Resolve<IPrototypeManager>();
foreach (var proto in prototypeManager.EnumeratePrototypes<DepartmentPrototype>())
{
CreateRoleGroup(proto.ID, proto.Roles, proto.Color);
CreateRoleGroup(proto.ID, proto.Roles.Select(p => p.Id), proto.Color);
}

CreateRoleGroup("Antagonist", prototypeManager.EnumeratePrototypes<AntagPrototype>().Select(p => p.ID), Color.Red);
Expand Down
8 changes: 0 additions & 8 deletions Content.Client/Bed/SleepingSystem.cs

This file was deleted.

13 changes: 5 additions & 8 deletions Content.Client/Chat/UI/EmotesMenu.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,15 @@ public sealed partial class EmotesMenu : RadialMenu
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly ISharedPlayerManager _playerManager = default!;

private readonly SpriteSystem _spriteSystem;
private readonly EntityWhitelistSystem _whitelistSystem;

public event Action<ProtoId<EmotePrototype>>? OnPlayEmote;

public EmotesMenu()
{
IoCManager.InjectDependencies(this);
RobustXamlLoader.Load(this);

_spriteSystem = _entManager.System<SpriteSystem>();
_whitelistSystem = _entManager.System<EntityWhitelistSystem>();
var spriteSystem = _entManager.System<SpriteSystem>();
var whitelistSystem = _entManager.System<EntityWhitelistSystem>();

var main = FindControl<RadialContainer>("Main");

Expand All @@ -40,8 +37,8 @@ public EmotesMenu()
var player = _playerManager.LocalSession?.AttachedEntity;
if (emote.Category == EmoteCategory.Invalid ||
emote.ChatTriggers.Count == 0 ||
!(player.HasValue && _whitelistSystem.IsWhitelistPassOrNull(emote.Whitelist, player.Value)) ||
_whitelistSystem.IsBlacklistPass(emote.Blacklist, player.Value))
!(player.HasValue && whitelistSystem.IsWhitelistPassOrNull(emote.Whitelist, player.Value)) ||
whitelistSystem.IsBlacklistPass(emote.Blacklist, player.Value))
continue;

if (!emote.Available &&
Expand All @@ -63,7 +60,7 @@ public EmotesMenu()
{
VerticalAlignment = VAlignment.Center,
HorizontalAlignment = HAlignment.Center,
Texture = _spriteSystem.Frame0(emote.Icon),
Texture = spriteSystem.Frame0(emote.Icon),
TextureScale = new Vector2(2f, 2f),
};

Expand Down
1 change: 1 addition & 0 deletions Content.Client/Commands/SetMenuVisibilityCommand.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Content.Client.Verbs;
using Content.Shared.Verbs;
using JetBrains.Annotations;
using Robust.Shared.Console;

Expand Down
19 changes: 16 additions & 3 deletions Content.Client/ContextMenu/UI/EntityMenuUIController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using Content.Shared.Examine;
using Content.Shared.IdentityManagement;
using Content.Shared.Input;
using Content.Shared.Verbs;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.Input;
Expand Down Expand Up @@ -194,8 +195,20 @@ public override void FrameUpdate(FrameEventArgs args)
return;

// Do we need to do in-range unOccluded checks?
var ignoreFov = !_eyeManager.CurrentEye.DrawFov ||
(_verbSystem.Visibility & MenuVisibility.NoFov) == MenuVisibility.NoFov;
var visibility = _verbSystem.Visibility;

if (!_eyeManager.CurrentEye.DrawFov)
{
visibility &= ~MenuVisibility.NoFov;
}

var ev = new MenuVisibilityEvent()
{
Visibility = visibility,
};

_entityManager.EventBus.RaiseLocalEvent(player, ref ev);
visibility = ev.Visibility;

_entityManager.TryGetComponent(player, out ExaminerComponent? examiner);
var xformQuery = _entityManager.GetEntityQuery<TransformComponent>();
Expand All @@ -209,7 +222,7 @@ public override void FrameUpdate(FrameEventArgs args)
continue;
}

if (ignoreFov)
if ((visibility & MenuVisibility.NoFov) == MenuVisibility.NoFov)
continue;

var pos = new MapCoordinates(_xform.GetWorldPosition(xform, xformQuery), xform.MapID);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
using Content.Shared.Electrocution;
using Robust.Client.GameObjects;
using Robust.Client.Player;
using Robust.Shared.Player;

namespace Content.Client.Electrocution;

/// <summary>
/// Shows the Electrocution HUD to entities with the ShowElectrocutionHUDComponent.
/// </summary>
public sealed class ElectrocutionHUDVisualizerSystem : VisualizerSystem<ElectrocutionHUDVisualsComponent>
{
[Dependency] private readonly IPlayerManager _playerMan = default!;

public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<ShowElectrocutionHUDComponent, ComponentInit>(OnInit);
SubscribeLocalEvent<ShowElectrocutionHUDComponent, ComponentShutdown>(OnShutdown);
SubscribeLocalEvent<ShowElectrocutionHUDComponent, LocalPlayerAttachedEvent>(OnPlayerAttached);
SubscribeLocalEvent<ShowElectrocutionHUDComponent, LocalPlayerDetachedEvent>(OnPlayerDetached);
}

private void OnPlayerAttached(Entity<ShowElectrocutionHUDComponent> ent, ref LocalPlayerAttachedEvent args)
{
ShowHUD();
}

private void OnPlayerDetached(Entity<ShowElectrocutionHUDComponent> ent, ref LocalPlayerDetachedEvent args)
{
RemoveHUD();
}

private void OnInit(Entity<ShowElectrocutionHUDComponent> ent, ref ComponentInit args)
{
if (_playerMan.LocalEntity == ent)
{
ShowHUD();
}
}

private void OnShutdown(Entity<ShowElectrocutionHUDComponent> ent, ref ComponentShutdown args)
{
if (_playerMan.LocalEntity == ent)
{
RemoveHUD();
}
}

// Show the HUD to the client.
// We have to look for all current entities that can be electrified and toggle the HUD layer on if they are.
private void ShowHUD()
{
var electrifiedQuery = AllEntityQuery<ElectrocutionHUDVisualsComponent, AppearanceComponent, SpriteComponent>();
while (electrifiedQuery.MoveNext(out var uid, out var _, out var appearanceComp, out var spriteComp))
{
if (!AppearanceSystem.TryGetData<bool>(uid, ElectrifiedVisuals.IsElectrified, out var electrified, appearanceComp))
continue;

if (electrified)
spriteComp.LayerSetVisible(ElectrifiedLayers.HUD, true);
else
spriteComp.LayerSetVisible(ElectrifiedLayers.HUD, false);
}
}

// Remove the HUD from the client.
// Find all current entities that can be electrified and hide the HUD layer.
private void RemoveHUD()
{
var electrifiedQuery = AllEntityQuery<ElectrocutionHUDVisualsComponent, AppearanceComponent, SpriteComponent>();
while (electrifiedQuery.MoveNext(out var uid, out var _, out var appearanceComp, out var spriteComp))
{

spriteComp.LayerSetVisible(ElectrifiedLayers.HUD, false);
}
}

// Toggle the HUD layer if an entity becomes (de-)electrified
protected override void OnAppearanceChange(EntityUid uid, ElectrocutionHUDVisualsComponent comp, ref AppearanceChangeEvent args)
{
if (args.Sprite == null)
return;

if (!AppearanceSystem.TryGetData<bool>(uid, ElectrifiedVisuals.IsElectrified, out var electrified, args.Component))
return;

var player = _playerMan.LocalEntity;
if (electrified && HasComp<ShowElectrocutionHUDComponent>(player))
args.Sprite.LayerSetVisible(ElectrifiedLayers.HUD, true);
else
args.Sprite.LayerSetVisible(ElectrifiedLayers.HUD, false);
}
}
2 changes: 1 addition & 1 deletion Content.Client/Interaction/DragDropSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ private void RemoveHighlights()
// CanInteract() doesn't support checking a second "target" entity.
// Doing so manually:
var ev = new GettingInteractedWithAttemptEvent(user, dragged);
RaiseLocalEvent(dragged, ev, true);
RaiseLocalEvent(dragged, ref ev);

if (ev.Cancelled)
return false;
Expand Down
15 changes: 12 additions & 3 deletions Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -707,8 +707,17 @@ public void RefreshJobs()
_jobPriorities.Clear();
var firstCategory = true;

var departments = _prototypeManager.EnumeratePrototypes<DepartmentPrototype>().ToArray();
Array.Sort(departments, DepartmentUIComparer.Instance);
// Get all displayed departments
var departments = new List<DepartmentPrototype>();
foreach (var department in _prototypeManager.EnumeratePrototypes<DepartmentPrototype>())
{
if (department.EditorHidden)
continue;

departments.Add(department);
}

departments.Sort(DepartmentUIComparer.Instance);

var items = new[]
{
Expand Down Expand Up @@ -886,7 +895,7 @@ private void UpdateRoleRequirements()
JobList.AddChild(category);
}

var jobs = department.Roles.Select(jobId => _prototypeManager.Index<JobPrototype>(jobId))
var jobs = department.Roles.Select(jobId => _prototypeManager.Index(jobId))
.Where(job => job.SetPreference)
.ToArray();
Array.Sort(jobs, JobUIComparer.Instance);
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Overlays/EquipmentHudSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ protected virtual void OnRefreshComponentHud(EntityUid uid, T component, Refresh
args.Components.Add(component);
}

private void RefreshOverlay(EntityUid uid)
protected void RefreshOverlay(EntityUid uid)
{
if (uid != _player.LocalSession?.AttachedEntity)
return;
Expand Down
48 changes: 48 additions & 0 deletions Content.Client/Overlays/Switchable/BaseSwitchableOverlay.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using System.Numerics;
using Content.Shared.Overlays.Switchable;
using Robust.Client.Graphics;
using Robust.Shared.Enums;
using Robust.Shared.Prototypes;

namespace Content.Client.Overlays.Switchable;

public sealed class BaseSwitchableOverlay<TComp> : Overlay where TComp : SwitchableOverlayComponent
{
[Dependency] private readonly IPrototypeManager _prototype = default!;

public override bool RequestScreenTexture => true;
public override OverlaySpace Space => OverlaySpace.WorldSpace;

private readonly ShaderInstance _shader;

public TComp? Comp = null;

public bool IsActive = true;

public BaseSwitchableOverlay()
{
IoCManager.InjectDependencies(this);
_shader = _prototype.Index<ShaderPrototype>("NightVision").InstanceUnique();
}

protected override void Draw(in OverlayDrawArgs args)
{
if (ScreenTexture is null || Comp is null || !IsActive)
return;

_shader.SetParameter("SCREEN_TEXTURE", ScreenTexture);
_shader.SetParameter("tint", Comp.Tint);
_shader.SetParameter("luminance_threshold", Comp.Strength);
_shader.SetParameter("noise_amount", Comp.Noise);

var worldHandle = args.WorldHandle;

var accumulator = Math.Clamp(Comp.PulseAccumulator, 0f, Comp.PulseTime);
var alpha = Comp.PulseTime <= 0f ? 1f : float.Lerp(1f, 0f, accumulator / Comp.PulseTime);

worldHandle.SetTransform(Matrix3x2.Identity);
worldHandle.UseShader(_shader);
worldHandle.DrawRect(args.WorldBounds, Comp.Color.WithAlpha(alpha));
worldHandle.UseShader(null);
}
}
87 changes: 87 additions & 0 deletions Content.Client/Overlays/Switchable/NightVisionSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
using Content.Shared.Inventory.Events;
using Content.Shared.Overlays.Switchable;
using Robust.Client.Graphics;

namespace Content.Client.Overlays.Switchable;

public sealed class NightVisionSystem : EquipmentHudSystem<NightVisionComponent>
{
[Dependency] private readonly IOverlayManager _overlayMan = default!;
[Dependency] private readonly ILightManager _lightManager = default!;

private BaseSwitchableOverlay<NightVisionComponent> _overlay = default!;

public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<NightVisionComponent, SwitchableOverlayToggledEvent>(OnToggle);

_overlay = new BaseSwitchableOverlay<NightVisionComponent>();
}

private void OnToggle(Entity<NightVisionComponent> ent, ref SwitchableOverlayToggledEvent args)
{
RefreshOverlay(args.User);
}

protected override void UpdateInternal(RefreshEquipmentHudEvent<NightVisionComponent> args)
{
base.UpdateInternal(args);

var active = false;
NightVisionComponent? nvComp = null;
foreach (var comp in args.Components)
{
if (comp.IsActive || comp.PulseTime > 0f && comp.PulseAccumulator < comp.PulseTime)
active = true;
else
continue;

if (comp.DrawOverlay)
{
if (nvComp == null)
nvComp = comp;
else if (nvComp.PulseTime > 0f && comp.PulseTime <= 0f)
nvComp = comp;
}

if (active && nvComp is { PulseTime: <= 0 })
break;
}

UpdateNightVision(active);
UpdateOverlay(nvComp);
}

protected override void DeactivateInternal()
{
base.DeactivateInternal();

UpdateNightVision(false);
UpdateOverlay(null);
}

private void UpdateNightVision(bool active)
{
_lightManager.DrawLighting = !active;
}

private void UpdateOverlay(NightVisionComponent? nvComp)
{
_overlay.Comp = nvComp;

switch (nvComp)
{
case not null when !_overlayMan.HasOverlay<BaseSwitchableOverlay<NightVisionComponent>>():
_overlayMan.AddOverlay(_overlay);
break;
case null:
_overlayMan.RemoveOverlay(_overlay);
break;
}

if (_overlayMan.TryGetOverlay<BaseSwitchableOverlay<ThermalVisionComponent>>(out var overlay))
overlay.IsActive = nvComp == null;
}
}
Loading
Loading