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:
metalgearsloth
2024-04-26 18:16:24 +10:00
committed by GitHub
parent 32b81de8c5
commit 5896e68752
279 changed files with 1308 additions and 1582 deletions

View File

@@ -92,15 +92,12 @@ public sealed class NewsSystem : SharedNewsSystem
if (msg.ArticleNum >= articles.Count)
return;
if (msg.Session.AttachedEntity is not { } actor)
return;
var article = articles[msg.ArticleNum];
if (CheckDeleteAccess(article, ent, actor))
if (CheckDeleteAccess(article, ent, msg.Actor))
{
_adminLogger.Add(
LogType.Chat, LogImpact.Medium,
$"{ToPrettyString(actor):actor} deleted news article {article.Title} by {article.Author}: {article.Content}"
$"{ToPrettyString(msg.Actor):actor} deleted news article {article.Title} by {article.Author}: {article.Content}"
);
articles.RemoveAt(msg.ArticleNum);
@@ -138,14 +135,11 @@ public sealed class NewsSystem : SharedNewsSystem
if (!TryGetArticles(ent, out var articles))
return;
if (msg.Session.AttachedEntity is not { } author)
return;
if (!_accessReader.FindStationRecordKeys(author, out _))
if (!_accessReader.FindStationRecordKeys(msg.Actor, out _))
return;
string? authorName = null;
if (_idCardSystem.TryFindIdCard(author, out var idCard))
if (_idCardSystem.TryFindIdCard(msg.Actor, out var idCard))
authorName = idCard.Comp.FullName;
var title = msg.Title.Trim();
@@ -164,7 +158,7 @@ public sealed class NewsSystem : SharedNewsSystem
_adminLogger.Add(
LogType.Chat,
LogImpact.Medium,
$"{ToPrettyString(author):actor} created news article {article.Title} by {article.Author}: {article.Content}"
$"{ToPrettyString(msg.Actor):actor} created news article {article.Title} by {article.Author}: {article.Content}"
);
articles.Add(article);
@@ -248,14 +242,14 @@ public sealed class NewsSystem : SharedNewsSystem
private void UpdateWriterUi(Entity<NewsWriterComponent> ent)
{
if (!_ui.TryGetUi(ent, NewsWriterUiKey.Key, out var ui))
if (!_ui.HasUi(ent, NewsWriterUiKey.Key))
return;
if (!TryGetArticles(ent, out var articles))
return;
var state = new NewsWriterBoundUserInterfaceState(articles.ToArray(), ent.Comp.PublishEnabled, ent.Comp.NextPublish);
_ui.SetUiState(ui, state);
_ui.SetUiState(ent.Owner, NewsWriterUiKey.Key, state);
}
private void UpdateReaderUi(Entity<NewsReaderCartridgeComponent> ent, EntityUid loaderUid)