1111using Robust . Client . Player ;
1212using Robust . Shared . Map ;
1313using Robust . Shared . Timing ;
14+ using Robust . Shared . Asynchronous ;
15+ using System . Threading . Tasks ;
1416
1517namespace OpenDreamClient . Rendering ;
1618
@@ -56,6 +58,7 @@ public int GetAnimationFrame(IGameTiming gameTiming) {
5658 private readonly Dictionary < ( int X , int Y , int Z ) , Flick > _turfFlicks = new ( ) ;
5759 private readonly Dictionary < EntityUid , Flick > _movableFlicks = new ( ) ;
5860 private bool _receivedAllAppearancesMsg ;
61+ private readonly float timeToRefreshVerbs = 3f ;
5962
6063 [ Dependency ] private readonly IEntityManager _entityManager = default ! ;
6164 [ Dependency ] private readonly IDreamResourceManager _dreamResourceManager = default ! ;
@@ -69,6 +72,7 @@ public int GetAnimationFrame(IGameTiming gameTiming) {
6972 [ Dependency ] private readonly MapSystem _mapSystem = default ! ;
7073 [ Dependency ] private readonly IPrototypeManager _protoManager = default ! ;
7174 [ Dependency ] private readonly ClientVerbSystem _verbSystem = default ! ;
75+ [ Dependency ] private readonly ITaskManager _taskManager = default ! ;
7276
7377 public override void Initialize ( ) {
7478 UpdatesOutsidePrediction = true ;
@@ -78,6 +82,8 @@ public override void Initialize() {
7882 SubscribeNetworkEvent < AnimationEvent > ( OnAnimation ) ;
7983 SubscribeNetworkEvent < FlickEvent > ( OnFlick ) ;
8084 SubscribeLocalEvent < DMISpriteComponent , WorldAABBEvent > ( OnWorldAABB ) ;
85+
86+ _ = StartVerbRefresher ( ) ;
8187 }
8288
8389 public override void Shutdown ( ) {
@@ -365,7 +371,10 @@ public string GetName(ClientObjectReference reference) {
365371 return _movableFlicks . GetValueOrDefault ( entity ) ;
366372 }
367373
368- public void RefreshVerbs ( ) {
369- _verbSystem . RefreshVerbs ( ) ;
374+ private async Task StartVerbRefresher ( ) {
375+ while ( true ) {
376+ await Task . Delay ( TimeSpan . FromSeconds ( timeToRefreshVerbs ) ) ;
377+ _taskManager . RunOnMainThread ( _verbSystem . RefreshVerbs ) ;
378+ }
370379 }
371380}
0 commit comments