private void OnStartup(EntityUid uid, DeployableBarrierComponent component, ComponentStartup args) { if (!EntityManager.TryGetComponent(component.Owner, out LockComponent? lockComponent)) { return; } ToggleBarrierDeploy(component, lockComponent.Locked); }
private void ToggleBarrierDeploy(DeployableBarrierComponent component, bool isDeployed) { component.Owner.Transform.Anchored = isDeployed; if (!component.Owner.TryGetComponent(out AppearanceComponent? appearanceComponent)) { return; } var state = isDeployed ? DeployableBarrierState.Deployed : DeployableBarrierState.Idle; appearanceComponent.SetData(DeployableBarrierVisuals.State, state); }
private void ToggleBarrierDeploy(DeployableBarrierComponent component, bool isDeployed) { EntityManager.GetComponent <TransformComponent>(component.Owner).Anchored = isDeployed; if (!EntityManager.TryGetComponent(component.Owner, out AppearanceComponent? appearanceComponent)) { return; } var state = isDeployed ? DeployableBarrierState.Deployed : DeployableBarrierState.Idle; appearanceComponent.SetData(DeployableBarrierVisuals.State, state); if (EntityManager.TryGetComponent(component.Owner, out PointLightComponent? light)) { light.Enabled = isDeployed; } }
private void OnLockToggled(EntityUid uid, DeployableBarrierComponent component, LockToggledEvent args) { ToggleBarrierDeploy(component, args.Locked); }