Skip to content

Commit

Permalink
Merge pull request DeltaV-Station#82 from DebugOk/merge-nyano-26/06
Browse files Browse the repository at this point in the history
Merge nyano up to 26/06
  • Loading branch information
DebugOk authored Jun 26, 2023
2 parents f86b954 + e3f0414 commit 30ebeb5
Show file tree
Hide file tree
Showing 233 changed files with 24,213 additions and 93,486 deletions.
4 changes: 2 additions & 2 deletions Content.Client/Access/UI/AgentIDCardBoundUserInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ protected override void Open()
_window.OpenCentered();

_window.OnClose += Close;
_window.OnNameEntered += OnNameChanged;
_window.OnJobEntered += OnJobChanged;
_window.OnNameChanged += OnNameChanged;
_window.OnJobChanged += OnJobChanged;
}

private void OnNameChanged(string newName)
Expand Down
12 changes: 7 additions & 5 deletions Content.Client/Access/UI/AgentIDCardWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,18 @@ namespace Content.Client.Access.UI
[GenerateTypedNameReferences]
public sealed partial class AgentIDCardWindow : DefaultWindow
{
public event Action<string>? OnNameEntered;

public event Action<string>? OnJobEntered;
public event Action<string>? OnNameChanged;
public event Action<string>? OnJobChanged;

public AgentIDCardWindow()
{
RobustXamlLoader.Load(this);

NameLineEdit.OnTextEntered += e => OnNameEntered?.Invoke(e.Text);
JobLineEdit.OnTextEntered += e => OnJobEntered?.Invoke(e.Text);
NameLineEdit.OnTextEntered += e => OnNameChanged?.Invoke(e.Text);
NameLineEdit.OnFocusExit += e => OnNameChanged?.Invoke(e.Text);

JobLineEdit.OnTextEntered += e => OnJobChanged?.Invoke(e.Text);
JobLineEdit.OnFocusExit += e => OnJobChanged?.Invoke(e.Text);
}

public void SetCurrentName(string name)
Expand Down
6 changes: 6 additions & 0 deletions Content.Client/Entry/EntryPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@ public override void Init()
_prototypeManager.RegisterIgnore("nukeopsRole");
_prototypeManager.RegisterIgnore("flavor");

// Begin Nyano-code: our ignored prototypes.
_prototypeManager.RegisterIgnore("npcConversationTree");
_prototypeManager.RegisterIgnore("shipwreckDestination");
_prototypeManager.RegisterIgnore("shipwreckFaction");
// End Nyano-code.

_componentFactory.GenerateNetIds();
_adminManager.Initialize();
_screenshotHook.Initialize();
Expand Down
4 changes: 1 addition & 3 deletions Content.Client/Labels/UI/HandLabelerBoundUserInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,12 @@ protected override void Open()
_window.OpenCentered();

_window.OnClose += Close;
_window.OnLabelEntered += OnLabelChanged;

_window.OnLabelChanged += OnLabelChanged;
}

private void OnLabelChanged(string newLabel)
{
SendMessage(new HandLabelerLabelChangedMessage(newLabel));
Close();
}

/// <summary>
Expand Down
7 changes: 3 additions & 4 deletions Content.Client/Labels/UI/HandLabelerWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
using System;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;

namespace Content.Client.Labels.UI
{
[GenerateTypedNameReferences]
public sealed partial class HandLabelerWindow : DefaultWindow
{
public event Action<string>? OnLabelEntered;
public event Action<string>? OnLabelChanged;

public HandLabelerWindow()
{
RobustXamlLoader.Load(this);

LabelLineEdit.OnTextEntered += e => OnLabelEntered?.Invoke(e.Text);
LabelLineEdit.OnTextEntered += e => OnLabelChanged?.Invoke(e.Text);
LabelLineEdit.OnFocusExit += e => OnLabelChanged?.Invoke(e.Text);
}

public void SetCurrentLabel(string label)
Expand Down
32 changes: 32 additions & 0 deletions Content.Client/Nyanotrasen/Holograms/HologramVisualizer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using Robust.Shared.Random;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Shared.Prototypes;

namespace Content.Client.Holograms;

public sealed class HologramVisualizerSystem : EntitySystem
{
[Dependency] private readonly IPrototypeManager _protoMan = default!;
[Dependency] private readonly IRobustRandom _random = default!;

private readonly static string ShaderName = "Hologram";
private ShaderInstance _shader = default!;

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

_shader = _protoMan.Index<ShaderPrototype>(ShaderName).InstanceUnique();

SubscribeLocalEvent<HologramVisualsComponent, ComponentInit>(OnComponentInit);
}

private void OnComponentInit(EntityUid uid, HologramVisualsComponent component, ComponentInit args)
{
if (!TryComp<SpriteComponent>(uid, out var sprite))
return;

sprite.PostShader = _shader;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace Content.Client.Holograms
{
[RegisterComponent]
public sealed class HologramVisualsComponent : Component
{
}
}
11 changes: 11 additions & 0 deletions Content.Client/Nyanotrasen/Laundry/LaundryVisuals.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespace Content.Client.Laundry;

public enum WashingMachineVisualLayers : byte
{
Normal,
Broken,
Contents,
NormalDoor,
BrokenDoor,
}

33 changes: 31 additions & 2 deletions Content.IntegrationTests/Tests/Interaction/InteractionTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace Content.IntegrationTests.Tests.Interaction;
[FixtureLifeCycle(LifeCycle.InstancePerTestCase)]
public abstract partial class InteractionTest
{
protected virtual string PlayerPrototype => "AdminObserver";
protected virtual string PlayerPrototype => "MobInteractionTestObserver";

protected PairTracker PairTracker = default!;
protected TestMapData MapData = default!;
Expand Down Expand Up @@ -118,7 +118,36 @@ public abstract partial class InteractionTest
[SetUp]
public virtual async Task Setup()
{
PairTracker = await PoolManager.GetServerClient(new PoolSettings());
const string TestPrototypes = @"
- type: entity
id: MobInteractionTestObserver
name: observer
noSpawn: true
save: false
description: Boo!
components:
- type: Access
groups:
- AllAccess
- type: Body
prototype: Aghost
- type: DoAfter
- type: Ghost
canInteract: true
- type: Hands
- type: Mind
- type: Stripping
- type: Tag
tags:
- CanPilot
- BypassInteractionRangeChecks
- type: Thieving
stripTimeReduction: 9999
stealthy: true
- type: UserInterface
";

PairTracker = await PoolManager.GetServerClient(new PoolSettings{ExtraPrototypes = TestPrototypes});

// server dependencies
SEntMan = Server.ResolveDependency<IEntityManager>();
Expand Down
4 changes: 3 additions & 1 deletion Content.Server/Chat/TypingIndicator/TypingIndicatorSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ private void OnClientTypingChanged(TypingChangedEvent ev, EntitySessionEventArgs
SetTypingIndicatorEnabled(uid.Value, ev.IsTyping);
}

private void SetTypingIndicatorEnabled(EntityUid uid, bool isEnabled, AppearanceComponent? appearance = null)
// Begin Nyano-code: API made public for conversational NPCs.
public void SetTypingIndicatorEnabled(EntityUid uid, bool isEnabled, AppearanceComponent? appearance = null)
// End Nyano-code.
{
if (!Resolve(uid, ref appearance, false))
return;
Expand Down
5 changes: 5 additions & 0 deletions Content.Server/Disease/DiseaseSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ public override void Update(float frameTime)
base.Update(frameTime);
foreach (var entity in AddQueue)
{
// Begin Nyano-code: avoid adding diseases to deleted entities.
if (Deleted(entity))
continue;
// End Nyano-code.

EnsureComp<DiseasedComponent>(entity);
}

Expand Down
12 changes: 12 additions & 0 deletions Content.Server/GameTicking/GameTicker.RoundFlow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,13 @@ public TimeSpan RoundDuration()

private void AnnounceRound()
{
// Begin Nyano-code: support systems intercepting AnnounceRound.
var ev = new AnnounceRoundAttemptEvent();
RaiseLocalEvent(ref ev);
if (ev.Handled)
return;
// End Nyano-code.

if (Preset == null) return;

var options = _prototypeManager.EnumeratePrototypes<RoundAnnouncementPrototype>().ToList();
Expand Down Expand Up @@ -732,4 +739,9 @@ public void AddLine(string text)
_doNewLine = true;
}
}

// Begin Nyano-code: support systems intercepting AnnounceRound.
[ByRefEvent]
public record struct AnnounceRoundAttemptEvent(bool Handled);
// End Nyano-code.
}
11 changes: 1 addition & 10 deletions Content.Server/Labels/Label/HandLabelerSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public override void Initialize()
base.Initialize();

SubscribeLocalEvent<HandLabelerComponent, AfterInteractEvent>(AfterInteractOn);
SubscribeLocalEvent<HandLabelerComponent, ActivateInWorldEvent>(OnActivate);
SubscribeLocalEvent<HandLabelerComponent, GetVerbsEvent<UtilityVerb>>(OnUtilityVerb);
// Bound UI subscriptions
SubscribeLocalEvent<HandLabelerComponent, HandLabelerLabelChangedMessage>(OnHandLabelerLabelChanged);
Expand All @@ -54,6 +53,7 @@ private void OnUtilityVerb(EntityUid uid, HandLabelerComponent handLabeler, GetV

args.Verbs.Add(verb);
}

private void AfterInteractOn(EntityUid uid, HandLabelerComponent handLabeler, AfterInteractEvent args)
{
if (args.Target is not {Valid: true} target || !handLabeler.Whitelist.IsValid(target) || !args.CanReach)
Expand Down Expand Up @@ -88,15 +88,6 @@ private void AddLabelTo(EntityUid uid, HandLabelerComponent? handLabeler, Entity
result = Loc.GetString("hand-labeler-successfully-applied");
}

private void OnActivate(EntityUid uid, HandLabelerComponent handLabeler, ActivateInWorldEvent args)
{
if (!EntityManager.TryGetComponent(args.User, out ActorComponent? actor))
return;

handLabeler.Owner.GetUIOrNull(HandLabelerUiKey.Key)?.Open(actor.PlayerSession);
args.Handled = true;
}

private void OnHandLabelerLabelChanged(EntityUid uid, HandLabelerComponent handLabeler, HandLabelerLabelChangedMessage args)
{
if (args.Session.AttachedEntity is not {Valid: true} player)
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/NPC/Pathfinding/PathfindingSystem.Grid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ private void UpdateGrid()
while (query.MoveNext(out var comp))
{
if (comp.DirtyChunks.Count == 0 ||
comp.NextUpdate < curTime ||
curTime < comp.NextUpdate ||
!TryComp<MapGridComponent>(comp.Owner, out var mapGridComp))
{
continue;
Expand Down
16 changes: 16 additions & 0 deletions Content.Server/NPC/Systems/FactionSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,22 @@ public void AddFaction(EntityUid uid, string faction, bool dirty = true)
}
}

// Begin Nyano-code: API expansion.
/// <summary>
/// Clears an entity's factions.
/// </summary>
public void ClearFactions(EntityUid uid, bool dirty = true)
{
var comp = EnsureComp<FactionComponent>(uid);
comp.Factions.Clear();

if (dirty)
{
RefreshFactions(comp);
}
}
// End Nyano-code.

/// <summary>
/// Removes this entity from the particular faction.
/// </summary>
Expand Down
16 changes: 9 additions & 7 deletions Content.Server/NPC/Systems/NPCCombatSystem.Ranged.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ private void InitializeRanged()
SubscribeLocalEvent<NPCRangedCombatComponent, ComponentShutdown>(OnRangedShutdown);
}

// Begin Nyano-code: support for mobile ranged NPCs.
private void OnRangedSteering(EntityUid uid, NPCRangedCombatComponent component, ref NPCSteeringEvent args)
{
args.Steering.CanSeek = true;
Expand Down Expand Up @@ -62,6 +63,7 @@ private void OnRangedSteering(EntityUid uid, NPCRangedCombatComponent component,
args.Interest[i] = MathF.Max(args.Interest[i], result);
}
}
// End Nyano-code.


private void OnRangedStartup(EntityUid uid, NPCRangedCombatComponent component, ComponentStartup args)
Expand Down Expand Up @@ -91,9 +93,9 @@ private void UpdateRanged(float frameTime)
var bodyQuery = GetEntityQuery<PhysicsComponent>();
var xformQuery = GetEntityQuery<TransformComponent>();
var combatQuery = GetEntityQuery<CombatModeComponent>();
var query = EntityQueryEnumerator<NPCRangedCombatComponent, TransformComponent>();
var query = EntityQueryEnumerator<NPCRangedCombatComponent, TransformComponent, ActiveNPCComponent>();

while (query.MoveNext(out var uid, out var comp, out var xform))
while (query.MoveNext(out var uid, out var comp, out var xform, out _))
{
if (comp.Status == CombatStatus.Unspecified)
continue;
Expand Down Expand Up @@ -145,15 +147,15 @@ private void UpdateRanged(float frameTime)
if (!comp.TargetInLOS)
{
comp.ShootAccumulator = 0f;

// Begin Nyano-code: support for mobile ranged NPCs.
if (!comp.CanMove || distance >= 9f)
{
comp.Status = CombatStatus.TargetUnreachable;
continue;
}
else
{
comp.Status = CombatStatus.NotInSight;
}
// End Nyano-code.

continue;
}

if (!oldInLos && comp.SoundTargetInLOS != null)
Expand Down
Loading

0 comments on commit 30ebeb5

Please sign in to comment.