mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 18:31:17 +03:00
# Conflicts: # Resources/Prototypes/Accents/word_replacements.yml # Resources/Prototypes/Entities/Mobs/Player/human.yml # Resources/Prototypes/Loadouts/Miscellaneous/trinkets.yml # Resources/Prototypes/Roles/Jobs/Cargo/quartermaster.yml # Resources/Prototypes/Roles/Jobs/Command/captain.yml # Resources/Prototypes/Roles/Jobs/Command/head_of_personnel.yml # Resources/Prototypes/Roles/Jobs/Engineering/chief_engineer.yml # Resources/Prototypes/Roles/Jobs/Medical/chief_medical_officer.yml # Resources/Prototypes/Roles/Jobs/Science/research_director.yml # Resources/Prototypes/Roles/Jobs/Security/head_of_security.yml # Resources/Textures/Clothing/Mask/sadmime.rsi/meta.json # Resources/Textures/Clothing/Mask/scaredmime.rsi/meta.json # Resources/Textures/Clothing/OuterClothing/WinterCoats/coat.rsi/meta.json # Resources/Textures/Clothing/OuterClothing/WinterCoats/coatatmos.rsi/meta.json # Resources/Textures/Clothing/OuterClothing/WinterCoats/coatcap.rsi/meta.json # Resources/Textures/Clothing/OuterClothing/WinterCoats/coatcargo.rsi/meta.json # Resources/Textures/Clothing/OuterClothing/WinterCoats/coatce.rsi/meta.json # Resources/Textures/Clothing/OuterClothing/WinterCoats/coatcentcom.rsi/meta.json # Resources/Textures/Clothing/OuterClothing/WinterCoats/coatchem.rsi/meta.json # Resources/Textures/Clothing/OuterClothing/WinterCoats/coatcmo.rsi/meta.json # Resources/Textures/Clothing/OuterClothing/WinterCoats/coatengi.rsi/meta.json # Resources/Textures/Clothing/OuterClothing/WinterCoats/coatgen.rsi/meta.json # Resources/Textures/Clothing/OuterClothing/WinterCoats/coathop.rsi/meta.json # Resources/Textures/Clothing/OuterClothing/WinterCoats/coathos.rsi/meta.json # Resources/Textures/Clothing/OuterClothing/WinterCoats/coathydro.rsi/meta.json # Resources/Textures/Clothing/OuterClothing/WinterCoats/coatjani.rsi/meta.json # Resources/Textures/Clothing/OuterClothing/WinterCoats/coatmed.rsi/meta.json # Resources/Textures/Clothing/OuterClothing/WinterCoats/coatmime.rsi/meta.json # Resources/Textures/Clothing/OuterClothing/WinterCoats/coatminer.rsi/meta.json # Resources/Textures/Clothing/OuterClothing/WinterCoats/coatparamed.rsi/meta.json # Resources/Textures/Clothing/OuterClothing/WinterCoats/coatqm.rsi/meta.json # Resources/Textures/Clothing/OuterClothing/WinterCoats/coatrd.rsi/meta.json # Resources/Textures/Clothing/OuterClothing/WinterCoats/coatrobo.rsi/meta.json # Resources/Textures/Clothing/OuterClothing/WinterCoats/coatsci.rsi/meta.json # Resources/Textures/Clothing/OuterClothing/WinterCoats/coatsec.rsi/meta.json # Resources/Textures/Clothing/OuterClothing/WinterCoats/coatviro.rsi/meta.json # Resources/Textures/Clothing/OuterClothing/WinterCoats/coatwarden.rsi/meta.json # Resources/Textures/Clothing/Shoes/Boots/winterboots.rsi/equipped-FEET.png # Resources/Textures/Clothing/Shoes/Boots/winterboots.rsi/icon.png # Resources/Textures/Clothing/Shoes/Boots/winterboots.rsi/inhand-left.png # Resources/Textures/Clothing/Shoes/Boots/winterboots.rsi/inhand-right.png # Resources/Textures/Clothing/Shoes/Boots/winterboots.rsi/meta.json # Resources/Textures/Clothing/Shoes/Boots/winterbootscargo.rsi/equipped-FEET.png # Resources/Textures/Clothing/Shoes/Boots/winterbootscargo.rsi/icon.png # Resources/Textures/Clothing/Shoes/Boots/winterbootscargo.rsi/inhand-left.png # Resources/Textures/Clothing/Shoes/Boots/winterbootscargo.rsi/inhand-right.png # Resources/Textures/Clothing/Shoes/Boots/winterbootscargo.rsi/meta.json # Resources/Textures/Clothing/Shoes/Boots/winterbootsengi.rsi/equipped-FEET.png # Resources/Textures/Clothing/Shoes/Boots/winterbootsengi.rsi/icon.png # Resources/Textures/Clothing/Shoes/Boots/winterbootsengi.rsi/inhand-left.png # Resources/Textures/Clothing/Shoes/Boots/winterbootsengi.rsi/inhand-right.png # Resources/Textures/Clothing/Shoes/Boots/winterbootsengi.rsi/meta.json # Resources/Textures/Clothing/Shoes/Boots/winterbootsmed.rsi/equipped-FEET.png # Resources/Textures/Clothing/Shoes/Boots/winterbootsmed.rsi/icon.png # Resources/Textures/Clothing/Shoes/Boots/winterbootsmed.rsi/inhand-left.png # Resources/Textures/Clothing/Shoes/Boots/winterbootsmed.rsi/inhand-right.png # Resources/Textures/Clothing/Shoes/Boots/winterbootsmed.rsi/meta.json # Resources/Textures/Clothing/Shoes/Boots/winterbootssci.rsi/equipped-FEET.png # Resources/Textures/Clothing/Shoes/Boots/winterbootssci.rsi/icon.png # Resources/Textures/Clothing/Shoes/Boots/winterbootssci.rsi/inhand-left.png # Resources/Textures/Clothing/Shoes/Boots/winterbootssci.rsi/inhand-right.png # Resources/Textures/Clothing/Shoes/Boots/winterbootssci.rsi/meta.json # Resources/Textures/Clothing/Shoes/Boots/winterbootssec.rsi/equipped-FEET.png # Resources/Textures/Clothing/Shoes/Boots/winterbootssec.rsi/icon.png # Resources/Textures/Clothing/Shoes/Boots/winterbootssec.rsi/inhand-left.png # Resources/Textures/Clothing/Shoes/Boots/winterbootssec.rsi/inhand-right.png # Resources/Textures/Clothing/Shoes/Boots/winterbootssec.rsi/meta.json # Resources/Textures/Clothing/Shoes/Boots/winterbootssyndicate.rsi/equipped-FEET.png # Resources/Textures/Clothing/Shoes/Boots/winterbootssyndicate.rsi/icon.png # Resources/Textures/Clothing/Shoes/Boots/winterbootssyndicate.rsi/inhand-left.png # Resources/Textures/Clothing/Shoes/Boots/winterbootssyndicate.rsi/inhand-right.png # Resources/Textures/Clothing/Shoes/Boots/winterbootssyndicate.rsi/meta.json # Resources/Textures/Clothing/Shoes/Boots/winterbootsweb.rsi/equipped-FEET.png # Resources/Textures/Clothing/Shoes/Boots/winterbootsweb.rsi/icon.png # Resources/Textures/Clothing/Shoes/Boots/winterbootsweb.rsi/inhand-left.png # Resources/Textures/Clothing/Shoes/Boots/winterbootsweb.rsi/inhand-right.png # Resources/Textures/Clothing/Shoes/Boots/winterbootsweb.rsi/meta.json
34 lines
1.2 KiB
C#
34 lines
1.2 KiB
C#
using System.Diagnostics.CodeAnalysis;
|
|
using Content.Shared.Players.PlayTimeTracking;
|
|
using Content.Shared.Roles;
|
|
using Robust.Shared.Player;
|
|
using Robust.Shared.Prototypes;
|
|
using Robust.Shared.Utility;
|
|
|
|
namespace Content.Shared.Preferences.Loadouts.Effects;
|
|
|
|
/// <summary>
|
|
/// Checks for a job requirement to be met such as playtime.
|
|
/// </summary>
|
|
public sealed partial class JobRequirementLoadoutEffect : LoadoutEffect
|
|
{
|
|
[DataField(required: true)]
|
|
public JobRequirement Requirement = default!;
|
|
|
|
public override bool Validate(HumanoidCharacterProfile profile, RoleLoadout loadout, LoadoutPrototype proto, ICommonSession? session, IDependencyCollection collection, [NotNullWhen(false)] out FormattedMessage? reason)
|
|
{
|
|
if (session == null)
|
|
{
|
|
reason = FormattedMessage.Empty;
|
|
return true;
|
|
}
|
|
|
|
var manager = collection.Resolve<ISharedPlaytimeManager>();
|
|
var playtimes = manager.GetPlayTimes(session);
|
|
return Requirement.Check(collection.Resolve<IEntityManager>(),
|
|
collection.Resolve<IPrototypeManager>(),
|
|
profile,
|
|
playtimes,
|
|
out reason);
|
|
}
|
|
}
|