Refactor minds to be entities with components, make roles components (#19591)

Co-authored-by: ShadowCommander <10494922+ShadowCommander@users.noreply.github.com>
Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com>
This commit is contained in:
DrSmugleaf
2023-08-28 16:53:24 -07:00
committed by GitHub
parent e0ee397af7
commit 15c0211fb2
119 changed files with 1445 additions and 1289 deletions

View File

@@ -1,4 +1,5 @@
using System.Linq;
using Content.Server.Mind;
using Content.Server.Objectives.Interfaces;
using Robust.Shared.Prototypes;
@@ -34,27 +35,29 @@ namespace Content.Server.Objectives
[DataField("difficultyOverride")]
private float? _difficultyOverride = null;
public bool CanBeAssigned(Mind.Mind mind)
public bool CanBeAssigned(EntityUid mindId, MindComponent mind)
{
foreach (var requirement in _requirements)
{
if (!requirement.CanBeAssigned(mind)) return false;
if (!requirement.CanBeAssigned(mindId, mind))
return false;
}
if (!CanBeDuplicateAssignment)
{
foreach (var objective in mind.AllObjectives)
{
if (objective.Prototype.ID == ID) return false;
if (objective.Prototype.ID == ID)
return false;
}
}
return true;
}
public Objective GetObjective(Mind.Mind mind)
public Objective GetObjective(EntityUid mindId, MindComponent mind)
{
return new(this, mind);
return new Objective(this, mindId, mind);
}
}
}