// SPDX-FileCopyrightText: 2025 GoobBot // SPDX-FileCopyrightText: 2025 Solstice // SPDX-FileCopyrightText: 2025 SolsticeOfTheWinter // // SPDX-License-Identifier: AGPL-3.0-or-later using Content.Server._Goobstation.Devil.Objectives.Components; using Content.Server.Objectives.Systems; using Content.Shared.Objectives.Components; namespace Content.Server._Goobstation.Devil.Objectives.Systems; public sealed partial class DevilObjectiveSystem : EntitySystem { [Dependency] private readonly NumberObjectiveSystem _number = default!; public override void Initialize() { base.Initialize(); SubscribeLocalEvent(OnContractGetProgress); } private void OnContractGetProgress(EntityUid uid, SignContractConditionComponent comp, ref ObjectiveGetProgressEvent args) { var target = _number.GetTarget(uid); args.Progress = target != 0 ? MathF.Min((float)comp.ContractsSigned / target, 1f) : 1f; } }