Fix deployable barrier light toggle (#4739)

This commit is contained in:
Alex Evgrashin
2021-10-02 17:53:20 +03:00
committed by GitHub
parent b5a8e21f78
commit 3b9146a11d
2 changed files with 3 additions and 8 deletions

View File

@@ -21,19 +21,11 @@ namespace Content.Client.Security
{
case DeployableBarrierState.Idle:
sprite.LayerSetState(0, "idle");
ToggleLight(component, false);
break;
case DeployableBarrierState.Deployed:
sprite.LayerSetState(0, "deployed");
ToggleLight(component, true);
break;
}
}
private void ToggleLight(AppearanceComponent component, bool enabled)
{
if (component.Owner.TryGetComponent(out PointLightComponent? light))
light.Enabled = enabled;
}
}
}

View File

@@ -38,6 +38,9 @@ namespace Content.Server.Security.Systems
var state = isDeployed ? DeployableBarrierState.Deployed : DeployableBarrierState.Idle;
appearanceComponent.SetData(DeployableBarrierVisuals.State, state);
if (component.Owner.TryGetComponent(out PointLightComponent? light))
light.Enabled = isDeployed;
}
}
}