private void OnGetState(EntityUid uid, RadarConsoleComponent component, ref ComponentGetState args) { args.State = new RadarConsoleComponentState() { Range = component.MaxRange }; }
protected override void UpdateState(RadarConsoleComponent component) { var xform = Transform(component.Owner); var onGrid = xform.ParentUid == xform.GridUid; EntityCoordinates?coordinates = onGrid ? xform.Coordinates : null; Angle? angle = onGrid ? xform.LocalRotation : null; // Use ourself I guess. if (TryComp <IntrinsicUIComponent>(component.Owner, out var intrinsic)) { foreach (var uiKey in intrinsic.UIs) { if (uiKey.Key?.Equals(RadarConsoleUiKey.Key) == true) { coordinates = new EntityCoordinates(component.Owner, Vector2.Zero); angle = Angle.Zero; break; } } } var radarState = new RadarConsoleBoundInterfaceState( component.MaxRange, coordinates, angle, new List <DockingInterfaceState>()); _uiSystem.GetUiOrNull(component.Owner, RadarConsoleUiKey.Key)?.SetState(radarState); }
private void OnHandleState(EntityUid uid, RadarConsoleComponent component, ref ComponentHandleState args) { if (args.Current is not RadarConsoleComponentState state) { return; } component.MaxRange = state.Range; }
public void SetRange(RadarConsoleComponent component, float value) { if (component.MaxRange.Equals(value)) { return; } component.MaxRange = value; Dirty(component); UpdateState(component); }
protected override void UpdateState(RadarConsoleComponent component) { var xform = Transform(component.Owner); var onGrid = xform.ParentUid == xform.GridUid; var radarState = new RadarConsoleBoundInterfaceState( component.MaxRange, onGrid ? xform.Coordinates : null, onGrid ? xform.LocalRotation : null, new List <DockingInterfaceState>()); _uiSystem.GetUiOrNull(component.Owner, RadarConsoleUiKey.Key)?.SetState(radarState); }
private void OnRadarStartup(EntityUid uid, RadarConsoleComponent component, ComponentStartup args) { UpdateState(component); }
protected virtual void UpdateState(RadarConsoleComponent component) { }