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:
@@ -77,14 +77,17 @@ public sealed class PlayTimeTrackingSystem : EntitySystem
|
||||
return state.CurrentState is MobState.Alive or MobState.Critical;
|
||||
}
|
||||
|
||||
public IEnumerable<string> GetTimedRoles(Mind.Mind mind)
|
||||
public IEnumerable<string> GetTimedRoles(EntityUid mindId)
|
||||
{
|
||||
foreach (var role in mind.AllRoles)
|
||||
var ev = new MindGetAllRolesEvent(new List<RoleInfo>());
|
||||
RaiseLocalEvent(ref ev);
|
||||
|
||||
foreach (var role in ev.Roles)
|
||||
{
|
||||
if (role is not IRoleTimer timer)
|
||||
if (string.IsNullOrWhiteSpace(role.PlayTimeTrackerId))
|
||||
continue;
|
||||
|
||||
yield return _prototypes.Index<PlayTimeTrackerPrototype>(timer.Timer).ID;
|
||||
yield return _prototypes.Index<PlayTimeTrackerPrototype>(role.PlayTimeTrackerId).ID;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,7 +98,7 @@ public sealed class PlayTimeTrackingSystem : EntitySystem
|
||||
if (contentData?.Mind == null)
|
||||
return Enumerable.Empty<string>();
|
||||
|
||||
return GetTimedRoles(contentData.Mind);
|
||||
return GetTimedRoles(contentData.Mind.Value);
|
||||
}
|
||||
|
||||
private void OnRoleRemove(RoleRemovedEvent ev)
|
||||
|
||||
Reference in New Issue
Block a user