* real? * ok * real 2 * one more thing that i forgot to port part 2 * i am dumb * mofo og * waaaagh * some rework placeholders * porting part 2 * bruh. * bruh 2 * bruh 3. * Update ChangelingRuleSystem.cs * Update AdminVerbSystem.Antags.cs * говнокрад это SubGamemode * тяжело... * пу-пу-пу --------- Co-authored-by: whateverusername0 <whateveremail> Co-authored-by: username <113782077+whateverusername0@users.noreply.github.com>
32 lines
1.2 KiB
C#
32 lines
1.2 KiB
C#
using Content.Server.Objectives.Components;
|
|
using Content.Shared.Objectives.Components;
|
|
|
|
namespace Content.Server.Objectives.Systems;
|
|
|
|
public sealed partial class ChangelingObjectiveSystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly NumberObjectiveSystem _number = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<AbsorbConditionComponent, ObjectiveGetProgressEvent>(OnAbsorbGetProgress);
|
|
SubscribeLocalEvent<StealDNAConditionComponent, ObjectiveGetProgressEvent>(OnStealDNAGetProgress);
|
|
}
|
|
|
|
private void OnAbsorbGetProgress(EntityUid uid, AbsorbConditionComponent comp, ref ObjectiveGetProgressEvent args)
|
|
{
|
|
var target = _number.GetTarget(uid);
|
|
if (target != 0)
|
|
args.Progress = MathF.Min(comp.Absorbed / target, 1f);
|
|
else args.Progress = 1f;
|
|
}
|
|
private void OnStealDNAGetProgress(EntityUid uid, StealDNAConditionComponent comp, ref ObjectiveGetProgressEvent args)
|
|
{
|
|
var target = _number.GetTarget(uid);
|
|
if (target != 0)
|
|
args.Progress = MathF.Min(comp.DNAStolen / target, 1f);
|
|
else args.Progress = 1f;
|
|
}
|
|
}
|