Fixed not tracking job playtime (#19639)

This commit is contained in:
DrSmugleaf
2023-08-29 13:39:16 -07:00
committed by GitHub
parent b2672bdd3b
commit 9567ae3b7f
3 changed files with 6 additions and 4 deletions

View File

@@ -30,14 +30,16 @@ public sealed class RoleSystem : EntitySystem
private void OnJobGetAllRoles(EntityUid uid, JobComponent component, ref MindGetAllRolesEvent args)
{
var name = "game-ticker-unknown-role";
string? playTimeTracker = null;
if (component.PrototypeId != null && _prototypes.TryIndex(component.PrototypeId, out JobPrototype? job))
{
name = job.Name;
playTimeTracker = job.PlayTimeTracker;
}
name = Loc.GetString(name);
args.Roles.Add(new RoleInfo(component, name, false));
args.Roles.Add(new RoleInfo(component, name, false, playTimeTracker));
}
private void SubscribeAntagEvents<T>() where T : AntagonistRoleComponent
@@ -51,7 +53,7 @@ public sealed class RoleSystem : EntitySystem
}
name = Loc.GetString(name);
args.Roles.Add(new RoleInfo(component, name, true));
args.Roles.Add(new RoleInfo(component, name, true, null));
});
SubscribeLocalEvent((EntityUid _, T _, ref MindIsAntagonistEvent args) => args.IsAntagonist = true);