Fix content UIs

This commit is contained in:
null
2024-05-05 01:39:06 +02:00
parent 0a4a2a88b6
commit 8a4cfda6d7
5 changed files with 31 additions and 40 deletions
@@ -134,7 +134,7 @@ namespace Content.Server.DeltaV.Harpy
if (HasComp<ActiveInstrumentComponent>(uid) &&
TryComp<ActorComponent>(uid, out var actor))
{
_instrument.ToggleInstrumentUi(uid, actor.PlayerSession);
_instrument.ToggleInstrumentUi(uid, uid);
}
}
@@ -56,7 +56,7 @@ public sealed class SubdermalBionicSyrinxImplantSystem : EntitySystem
ent.Comp.SpeechVerb = msg.Verb;
// verb is only important to metagamers so no need to log as opposed to name
_popupSystem.PopupEntity(Loc.GetString("voice-mask-popup-success"), ent, msg.Session);
_popupSystem.PopupEntity(Loc.GetString("voice-mask-popup-success"), ent, msg.Actor);
TrySetLastSpeechVerb(ent, msg.Verb);
@@ -89,18 +89,17 @@ public sealed class SubdermalBionicSyrinxImplantSystem : EntitySystem
{
if (message.Name.Length > HumanoidCharacterProfile.MaxNameLength || message.Name.Length <= 0)
{
_popupSystem.PopupEntity(Loc.GetString("voice-mask-popup-failure"), uid, message.Session, PopupType.SmallCaution);
_popupSystem.PopupEntity(Loc.GetString("voice-mask-popup-failure"), uid, message.Actor, PopupType.SmallCaution);
return;
}
component.VoiceName = message.Name;
if (message.Session.AttachedEntity != null)
_adminLogger.Add(LogType.Action, LogImpact.Medium, $"{ToPrettyString(message.Session.AttachedEntity.Value):player} set voice of {ToPrettyString(uid):mask}: {component.VoiceName}");
else
_adminLogger.Add(LogType.Action, LogImpact.Medium, $"Voice of {ToPrettyString(uid):mask} set: {component.VoiceName}");
_adminLogger.Add(LogType.Action, LogImpact.Medium, $"{ToPrettyString(message.Actor):player} set voice of {ToPrettyString(uid):mask}: {component.VoiceName}");
_popupSystem.PopupEntity(Loc.GetString("voice-mask-popup-success"), uid, message.Actor);
_popupSystem.PopupEntity(Loc.GetString("voice-mask-popup-success"), uid, message.Session);
TrySetLastKnownName(uid, message.Name);
UpdateUI(uid, component);
}
@@ -124,8 +123,8 @@ public sealed class SubdermalBionicSyrinxImplantSystem : EntitySystem
if (!Resolve(owner, ref component, logMissing: false))
return;
if (_uiSystem.TryGetUi(owner, VoiceMaskUIKey.Key, out var bui))
_uiSystem.SetUiState(bui, new VoiceMaskBuiState(component.VoiceName, component.SpeechVerb));
if (_uiSystem.HasUi(owner, VoiceMaskUIKey.Key))
_uiSystem.SetUiState(owner, VoiceMaskUIKey.Key, new VoiceMaskBuiState(component.VoiceName, component.SpeechVerb));
}
/// <summary>
@@ -80,14 +80,13 @@ public sealed partial class DeepFryerSystem
private void OnInsertItem(EntityUid uid, DeepFryerComponent component, DeepFryerInsertItemMessage args)
{
var user = args.Session.AttachedEntity;
var user = args.Actor;
if (user == null ||
!TryComp<HandsComponent>(user, out var handsComponent) ||
if (!TryComp<HandsComponent>(user, out var handsComponent) ||
handsComponent.ActiveHandEntity == null)
return;
if (handsComponent.ActiveHandEntity != null)
TryInsertItem(uid, component, user.Value, handsComponent.ActiveHandEntity.Value);
TryInsertItem(uid, component, user, handsComponent.ActiveHandEntity.Value);
}
}
@@ -131,8 +131,7 @@ public sealed partial class DeepFryerSystem : SharedDeepfryerSystem
component.FryingOilThreshold,
EntityManager.GetNetEntityArray(component.Storage.ContainedEntities.ToArray()));
if (!_uiSystem.TrySetUiState(uid, DeepFryerUiKey.Key, state))
_sawmill.Warning($"{ToPrettyString(uid)} was unable to set UI state.");
_uiSystem.SetUiState(uid, DeepFryerUiKey.Key, state);
}
/// <summary>
@@ -529,15 +528,12 @@ public sealed partial class DeepFryerSystem : SharedDeepfryerSystem
if (!_containerSystem.Remove(removedItem, component.Storage))
return;
var user = args.Session.AttachedEntity;
var user = args.Actor;
if (user != null)
{
_handsSystem.TryPickupAnyHand(user.Value, removedItem);
_handsSystem.TryPickupAnyHand(user, removedItem);
_adminLogManager.Add(LogType.Action, LogImpact.Low,
$"{ToPrettyString(user.Value)} took {ToPrettyString(args.Item)} out of {ToPrettyString(uid)}.");
}
_adminLogManager.Add(LogType.Action, LogImpact.Low,
$"{ToPrettyString(user)} took {ToPrettyString(args.Item)} out of {ToPrettyString(uid)}.");
_audioSystem.PlayPvs(component.SoundRemoveItem, uid, AudioParamsInsertRemove);
@@ -585,17 +581,17 @@ public sealed partial class DeepFryerSystem : SharedDeepfryerSystem
private void OnScoopVat(EntityUid uid, DeepFryerComponent component, DeepFryerScoopVatMessage args)
{
var user = args.Session.AttachedEntity;
var user = args.Actor;
if (user == null ||
!TryGetActiveHandSolutionContainer(uid, user.Value, out var heldItem, out var heldSolution,
!TryGetActiveHandSolutionContainer(uid, user, out var heldItem, out var heldSolution,
out var transferAmount))
return;
if (!_solutionContainerSystem.TryGetSolution(component.Owner, component.Solution.Name, out var solution))
return;
_solutionTransferSystem.Transfer(user.Value,
_solutionTransferSystem.Transfer(user,
uid,
solution.Value,
heldItem.Value,
@@ -607,10 +603,9 @@ public sealed partial class DeepFryerSystem : SharedDeepfryerSystem
private void OnClearSlagStart(EntityUid uid, DeepFryerComponent component, DeepFryerClearSlagMessage args)
{
var user = args.Session.AttachedEntity;
var user = args.Actor;
if (user == null ||
!TryGetActiveHandSolutionContainer(uid, user.Value, out var heldItem, out var heldSolution,
if (!TryGetActiveHandSolutionContainer(uid, user, out var heldItem, out var heldSolution,
out var transferAmount))
return;
@@ -620,17 +615,17 @@ public sealed partial class DeepFryerSystem : SharedDeepfryerSystem
_popupSystem.PopupEntity(
Loc.GetString("deep-fryer-oil-no-slag"),
uid,
user.Value);
user);
return;
}
var delay = Math.Clamp((float) wasteVolume * 0.1f, 1f, 5f);
var delay = TimeSpan.FromSeconds(Math.Clamp((float) wasteVolume * 0.1f, 1f, 5f));
var ev = new ClearSlagDoAfterEvent(heldSolution.Value.Comp.Solution, transferAmount);
//JJ Comment - not sure I have DoAfterArgs configured correctly.
var doAfterArgs = new DoAfterArgs(EntityManager, user.Value, delay, ev, uid, uid, heldItem)
var doAfterArgs = new DoAfterArgs(EntityManager, user, delay, ev, uid, uid, heldItem)
{
BreakOnDamage = true,
BreakOnMove = true,
@@ -641,6 +636,7 @@ public sealed partial class DeepFryerSystem : SharedDeepfryerSystem
_doAfterSystem.TryStartDoAfter(doAfterArgs);
}
[Obsolete("Obsolete")]
private void OnRemoveAllItems(EntityUid uid, DeepFryerComponent component, DeepFryerRemoveAllItemsMessage args)
{
if (component.Storage.ContainedEntities.Count == 0)
@@ -648,13 +644,10 @@ public sealed partial class DeepFryerSystem : SharedDeepfryerSystem
_containerSystem.EmptyContainer(component.Storage);
var user = args.Session.AttachedEntity;
var user = args.Actor;
if (user != null)
{
_adminLogManager.Add(LogType.Action, LogImpact.Low,
$"{ToPrettyString(user.Value)} removed all items from {ToPrettyString(uid)}.");
}
_adminLogManager.Add(LogType.Action, LogImpact.Low,
$"{ToPrettyString(user)} removed all items from {ToPrettyString(uid)}.");
_audioSystem.PlayPvs(component.SoundRemoveItem, uid, AudioParamsInsertRemove);
@@ -187,7 +187,7 @@ public sealed class ReverseEngineeringSystem : EntitySystem
if (!Resolve(uid, ref component))
return;
if (!_ui.TryGetUi(uid, ReverseEngineeringMachineUiKey.Key, out var bui))
if (!_ui.HasUi(uid, ReverseEngineeringMachineUiKey.Key))
return;
EntityUid? item = component.CurrentItem;
@@ -202,7 +202,7 @@ public sealed class ReverseEngineeringSystem : EntitySystem
var state = new ReverseEngineeringMachineScanUpdateState(netItem, canScan, component.CachedMessage, scanning, component.SafetyOn, component.AutoScan, component.Progress, remaining, component.AnalysisDuration);
_ui.SetUiState(bui, state);
_ui.SetUiState(uid, ReverseEngineeringMachineUiKey.Key, state);
}
private ReverseEngineeringTickResult Roll(ReverseEngineeringMachineComponent component, out int actualRoll)