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,7 +67,7 @@ public sealed partial class ParticleAcceleratorSystem
|
||||
FireEmitter(comp.StarboardEmitter!.Value, strength);
|
||||
}
|
||||
|
||||
public void SwitchOn(EntityUid uid, ICommonSession? user = null, ParticleAcceleratorControlBoxComponent? comp = null)
|
||||
public void SwitchOn(EntityUid uid, EntityUid? user = null, ParticleAcceleratorControlBoxComponent? comp = null)
|
||||
{
|
||||
if (!Resolve(uid, ref comp))
|
||||
return;
|
||||
@@ -77,7 +77,7 @@ public sealed partial class ParticleAcceleratorSystem
|
||||
if (comp.Enabled || !comp.CanBeEnabled)
|
||||
return;
|
||||
|
||||
if (user?.AttachedEntity is { } player)
|
||||
if (user is { } player)
|
||||
_adminLogger.Add(LogType.Action, LogImpact.Low, $"{ToPrettyString(player):player} has turned {ToPrettyString(uid)} on");
|
||||
|
||||
comp.Enabled = true;
|
||||
@@ -90,14 +90,14 @@ public sealed partial class ParticleAcceleratorSystem
|
||||
UpdateUI(uid, comp);
|
||||
}
|
||||
|
||||
public void SwitchOff(EntityUid uid, ICommonSession? user = null, ParticleAcceleratorControlBoxComponent? comp = null)
|
||||
public void SwitchOff(EntityUid uid, EntityUid? user = null, ParticleAcceleratorControlBoxComponent? comp = null)
|
||||
{
|
||||
if (!Resolve(uid, ref comp))
|
||||
return;
|
||||
if (!comp.Enabled)
|
||||
return;
|
||||
|
||||
if (user?.AttachedEntity is { } player)
|
||||
if (user is { } player)
|
||||
_adminLogger.Add(LogType.Action, LogImpact.Low, $"{ToPrettyString(player):player} has turned {ToPrettyString(uid)} off");
|
||||
|
||||
comp.Enabled = false;
|
||||
@@ -138,7 +138,7 @@ public sealed partial class ParticleAcceleratorSystem
|
||||
UpdateUI(uid, comp);
|
||||
}
|
||||
|
||||
public void SetStrength(EntityUid uid, ParticleAcceleratorPowerState strength, ICommonSession? user = null, ParticleAcceleratorControlBoxComponent? comp = null)
|
||||
public void SetStrength(EntityUid uid, ParticleAcceleratorPowerState strength, EntityUid? user = null, ParticleAcceleratorControlBoxComponent? comp = null)
|
||||
{
|
||||
if (!Resolve(uid, ref comp))
|
||||
return;
|
||||
@@ -154,7 +154,7 @@ public sealed partial class ParticleAcceleratorSystem
|
||||
if (strength == comp.SelectedStrength)
|
||||
return;
|
||||
|
||||
if (user?.AttachedEntity is { } player)
|
||||
if (user is { } player)
|
||||
{
|
||||
var impact = strength switch
|
||||
{
|
||||
@@ -235,7 +235,8 @@ public sealed partial class ParticleAcceleratorSystem
|
||||
{
|
||||
if (!Resolve(uid, ref comp))
|
||||
return;
|
||||
if (!_uiSystem.TryGetUi(uid, ParticleAcceleratorControlBoxUiKey.Key, out var bui))
|
||||
|
||||
if (!_uiSystem.HasUi(uid, ParticleAcceleratorControlBoxUiKey.Key))
|
||||
return;
|
||||
|
||||
var draw = 0f;
|
||||
@@ -247,7 +248,7 @@ public sealed partial class ParticleAcceleratorSystem
|
||||
receive = powerConsumer.ReceivedPower;
|
||||
}
|
||||
|
||||
_uiSystem.SetUiState(bui, new ParticleAcceleratorUIState(
|
||||
_uiSystem.SetUiState(uid, ParticleAcceleratorControlBoxUiKey.Key, new ParticleAcceleratorUIState(
|
||||
comp.Assembled,
|
||||
comp.Enabled,
|
||||
comp.SelectedStrength,
|
||||
@@ -346,7 +347,7 @@ public sealed partial class ParticleAcceleratorSystem
|
||||
UpdateAppearance(uid, comp);
|
||||
|
||||
if (!args.Powered)
|
||||
_uiSystem.TryCloseAll(uid, ParticleAcceleratorControlBoxUiKey.Key);
|
||||
_uiSystem.CloseUi(uid, ParticleAcceleratorControlBoxUiKey.Key);
|
||||
}
|
||||
|
||||
private void OnUISetEnableMessage(EntityUid uid, ParticleAcceleratorControlBoxComponent comp, ParticleAcceleratorSetEnableMessage msg)
|
||||
@@ -361,10 +362,10 @@ public sealed partial class ParticleAcceleratorSystem
|
||||
if (msg.Enabled)
|
||||
{
|
||||
if (comp.Assembled)
|
||||
SwitchOn(uid, msg.Session, comp);
|
||||
SwitchOn(uid, msg.Actor, comp);
|
||||
}
|
||||
else
|
||||
SwitchOff(uid, msg.Session, comp);
|
||||
SwitchOff(uid, msg.Actor, comp);
|
||||
|
||||
UpdateUI(uid, comp);
|
||||
}
|
||||
@@ -378,7 +379,7 @@ public sealed partial class ParticleAcceleratorSystem
|
||||
if (TryComp<ApcPowerReceiverComponent>(uid, out var apcPower) && !apcPower.Powered)
|
||||
return;
|
||||
|
||||
SetStrength(uid, msg.State, msg.Session, comp);
|
||||
SetStrength(uid, msg.State, msg.Actor, comp);
|
||||
|
||||
UpdateUI(uid, comp);
|
||||
}
|
||||
@@ -392,7 +393,7 @@ public sealed partial class ParticleAcceleratorSystem
|
||||
if (TryComp<ApcPowerReceiverComponent>(uid, out var apcPower) && !apcPower.Powered)
|
||||
return;
|
||||
|
||||
RescanParts(uid, msg.Session, comp);
|
||||
RescanParts(uid, msg.Actor, comp);
|
||||
|
||||
UpdateUI(uid, comp);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user