Content update for UI prediction (#27214)
* Content update for UI refactor * Big update * Sharing * Remaining content updates * First big update * Prototype updates * AUGH * Fix UI comp ref * Cleanup - Fix predicted message, fix item slots, fix interaction range check. * Fix regressions * Make this predictive idk why it wasn't. * Fix slime merge * Merge conflict * Fix merge
This commit is contained in:
@@ -67,11 +67,7 @@ namespace Content.Server.Paper
|
||||
private void BeforeUIOpen(EntityUid uid, PaperComponent paperComp, BeforeActivatableUIOpenEvent args)
|
||||
{
|
||||
paperComp.Mode = PaperAction.Read;
|
||||
|
||||
if (!TryComp<ActorComponent>(args.User, out var actor))
|
||||
return;
|
||||
|
||||
UpdateUserInterface(uid, paperComp, actor.PlayerSession);
|
||||
UpdateUserInterface(uid, paperComp);
|
||||
}
|
||||
|
||||
private void OnExamined(EntityUid uid, PaperComponent paperComp, ExaminedEvent args)
|
||||
@@ -108,12 +104,10 @@ namespace Content.Server.Paper
|
||||
{
|
||||
var writeEvent = new PaperWriteEvent(uid, args.User);
|
||||
RaiseLocalEvent(args.Used, ref writeEvent);
|
||||
if (!TryComp<ActorComponent>(args.User, out var actor))
|
||||
return;
|
||||
|
||||
paperComp.Mode = PaperAction.Write;
|
||||
_uiSystem.TryOpen(uid, PaperUiKey.Key, actor.PlayerSession);
|
||||
UpdateUserInterface(uid, paperComp, actor.PlayerSession);
|
||||
_uiSystem.OpenUi(uid, PaperUiKey.Key, args.User);
|
||||
UpdateUserInterface(uid, paperComp);
|
||||
args.Handled = true;
|
||||
return;
|
||||
}
|
||||
@@ -157,9 +151,8 @@ namespace Content.Server.Paper
|
||||
if (TryComp<MetaDataComponent>(uid, out var meta))
|
||||
_metaSystem.SetEntityDescription(uid, "", meta);
|
||||
|
||||
if (args.Session.AttachedEntity != null)
|
||||
_adminLogger.Add(LogType.Chat, LogImpact.Low,
|
||||
$"{ToPrettyString(args.Session.AttachedEntity.Value):player} has written on {ToPrettyString(uid):entity} the following text: {args.Text}");
|
||||
_adminLogger.Add(LogType.Chat, LogImpact.Low,
|
||||
$"{ToPrettyString(args.Actor):player} has written on {ToPrettyString(uid):entity} the following text: {args.Text}");
|
||||
|
||||
_audio.PlayPvs(paperComp.Sound, uid);
|
||||
}
|
||||
@@ -213,13 +206,12 @@ namespace Content.Server.Paper
|
||||
_appearance.SetData(uid, PaperVisuals.Status, status, appearance);
|
||||
}
|
||||
|
||||
public void UpdateUserInterface(EntityUid uid, PaperComponent? paperComp = null, ICommonSession? session = null)
|
||||
public void UpdateUserInterface(EntityUid uid, PaperComponent? paperComp = null)
|
||||
{
|
||||
if (!Resolve(uid, ref paperComp))
|
||||
return;
|
||||
|
||||
if (_uiSystem.TryGetUi(uid, PaperUiKey.Key, out var bui))
|
||||
_uiSystem.SetUiState(bui, new PaperBoundUserInterfaceState(paperComp.Content, paperComp.StampedBy, paperComp.Mode), session);
|
||||
_uiSystem.SetUiState(uid, PaperUiKey.Key, new PaperBoundUserInterfaceState(paperComp.Content, paperComp.StampedBy, paperComp.Mode));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user