Skip to content

Commit

Permalink
Update LocalPlayer to LocalEntity where applicable
Browse files Browse the repository at this point in the history
  • Loading branch information
vaketola committed Apr 27, 2024
1 parent e6698fe commit cdf7f1c
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public override void Initialize()
}


public EmpathyChatComponent? Player => CompOrNull<EmpathyChatComponent>(_playerManager.LocalPlayer?.ControlledEntity);
public EmpathyChatComponent? Player => CompOrNull<EmpathyChatComponent>(_playerManager.LocalEntity);
public bool IsShadowkin => Player != null;

private void OnInit(EntityUid uid, EmpathyChatComponent component, ComponentInit args)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public ColorTintOverlay()
protected override void Draw(in OverlayDrawArgs args)
{
if (ScreenTexture == null ||
_player.LocalPlayer?.ControlledEntity is not { Valid: true } player ||
_player.LocalEntity is not { Valid: true } player ||
Comp != null && !_entity.HasComponent(player, Comp.GetType()))
return;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public EtherealOverlay()
protected override void Draw(in OverlayDrawArgs args)
{
if (ScreenTexture == null) return;
if (_player.LocalPlayer?.ControlledEntity is not { Valid: true } player) return;
if (_player.LocalEntity is not { Valid: true } player) return;

_shader?.SetParameter("SCREEN_TEXTURE", ScreenTexture);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ protected override void Draw(in OverlayDrawArgs args)

foreach (var humanoid in _entityManager.EntityQuery<HumanoidAppearanceComponent>(true))
{
if (_playerManager.LocalPlayer?.ControlledEntity == humanoid.Owner)
if (_playerManager.LocalEntity == humanoid.Owner)
continue;

var cont = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ public override void Initialize()

private void OnStartup(EntityUid uid, ShadowkinDarkSwappedComponent component, ComponentStartup args)
{
if (_player.LocalPlayer?.ControlledEntity != uid)
if (_player.LocalEntity != uid)
return;

AddOverlay();
}

private void OnShutdown(EntityUid uid, ShadowkinDarkSwappedComponent component, ComponentShutdown args)
{
if (_player.LocalPlayer?.ControlledEntity != uid)
if (_player.LocalEntity != uid)
return;

RemoveOverlay();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ public override void Initialize()

private void OnStartup(EntityUid uid, ShadowkinComponent component, ComponentStartup args)
{
if (_player.LocalPlayer?.ControlledEntity != uid)
if (_player.LocalEntity != uid)
return;

_overlay.AddOverlay(_tintOverlay);
}

private void OnShutdown(EntityUid uid, ShadowkinComponent component, ComponentShutdown args)
{
if (_player.LocalPlayer?.ControlledEntity != uid)
if (_player.LocalEntity != uid)
return;

_overlay.RemoveOverlay(_tintOverlay);
Expand All @@ -73,7 +73,7 @@ public override void Update(float frameTime)
{
base.Update(frameTime);

var uid = _player.LocalPlayer?.ControlledEntity;
var uid = _player.LocalEntity;
if (uid == null ||
!_entity.TryGetComponent(uid, out ShadowkinComponent? comp) ||
!_entity.TryGetComponent(uid, out SpriteComponent? sprite) ||
Expand Down

0 comments on commit cdf7f1c

Please sign in to comment.