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:
@@ -81,7 +81,10 @@ namespace Content.Server.PDA.Ringer
|
||||
|
||||
private void OnSetRingtone(EntityUid uid, RingerComponent ringer, RingerSetRingtoneMessage args)
|
||||
{
|
||||
ref var lastSetAt = ref CollectionsMarshal.GetValueRefOrAddDefault(_lastSetRingtoneAt, args.Session.UserId, out var exists);
|
||||
if (!TryComp(args.Actor, out ActorComponent? actorComp))
|
||||
return;
|
||||
|
||||
ref var lastSetAt = ref CollectionsMarshal.GetValueRefOrAddDefault(_lastSetRingtoneAt, actorComp.PlayerSession.UserId, out var exists);
|
||||
|
||||
// Delay on the client is 0.333, 0.25 is still enough and gives some leeway in case of small time differences
|
||||
if (exists && lastSetAt > _gameTiming.CurTime - TimeSpan.FromMilliseconds(250))
|
||||
@@ -111,7 +114,7 @@ namespace Content.Server.PDA.Ringer
|
||||
|
||||
// can't keep store open after locking it
|
||||
if (!uplink.Unlocked)
|
||||
_ui.TryCloseAll(uid, StoreUiKey.Key);
|
||||
_ui.CloseUi(uid, StoreUiKey.Key);
|
||||
|
||||
// no saving the code to prevent meta click set on sus guys pda -> wewlad
|
||||
args.Handled = true;
|
||||
@@ -130,7 +133,7 @@ namespace Content.Server.PDA.Ringer
|
||||
return;
|
||||
|
||||
uplink.Unlocked = false;
|
||||
_ui.TryCloseAll(uid, StoreUiKey.Key);
|
||||
_ui.CloseUi(uid, StoreUiKey.Key);
|
||||
}
|
||||
|
||||
public void RandomizeRingtone(EntityUid uid, RingerComponent ringer, MapInitEvent args)
|
||||
@@ -181,14 +184,12 @@ namespace Content.Server.PDA.Ringer
|
||||
|
||||
private void UpdateRingerUserInterface(EntityUid uid, RingerComponent ringer, bool isPlaying)
|
||||
{
|
||||
if (_ui.TryGetUi(uid, RingerUiKey.Key, out var bui))
|
||||
_ui.SetUiState(bui, new RingerUpdateState(isPlaying, ringer.Ringtone));
|
||||
_ui.SetUiState(uid, RingerUiKey.Key, new RingerUpdateState(isPlaying, ringer.Ringtone));
|
||||
}
|
||||
|
||||
public bool ToggleRingerUI(EntityUid uid, ICommonSession session)
|
||||
public bool ToggleRingerUI(EntityUid uid, EntityUid actor)
|
||||
{
|
||||
if (_ui.TryGetUi(uid, RingerUiKey.Key, out var bui))
|
||||
_ui.ToggleUi(bui, session);
|
||||
_ui.TryToggleUi(uid, RingerUiKey.Key, actor);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user