11using System . Diagnostics . CodeAnalysis ;
22using System . Linq ;
33using Content . Shared . _WL . CCVars ;
4+ using Content . Shared . Humanoid . Prototypes ;
45using Content . Shared . Preferences ;
56using JetBrains . Annotations ;
67using Robust . Shared . Configuration ;
@@ -23,6 +24,13 @@ public sealed partial class AgeRequirement : JobRequirement
2324
2425 [ DataField ]
2526 public int ? MaxAge ;
27+
28+ [ DataField ]
29+ public Dictionary < ProtoId < SpeciesPrototype > , int > SpeciesMinAge { get ; private set ; } = new ( ) ;
30+
31+ [ DataField ]
32+ public Dictionary < ProtoId < SpeciesPrototype > , int > SpeciesMaxAge { get ; private set ; } = new ( ) ;
33+
2634 //WL-Changes-end
2735
2836 public override bool Check (
@@ -50,8 +58,31 @@ public override bool Check(
5058 if ( profile . JobUnblockings . ContainsKey ( job . ID ) )
5159 isNeeded = false ;
5260
61+ var minAgeForSpecies = 0 ;
62+ var maxAgeForSpecies = 0 ;
63+
64+ if ( SpeciesMinAge . TryGetValue ( profile . Species , out var minAge ) )
65+ minAgeForSpecies = minAge ;
66+
67+ if ( SpeciesMaxAge . TryGetValue ( profile . Species , out var maxAge ) )
68+ maxAgeForSpecies = maxAge ;
69+
70+
5371 if ( isNeeded )
5472 {
73+ if ( minAgeForSpecies != 0 && profile . Age < minAgeForSpecies )
74+ {
75+ reason = FormattedMessage . FromMarkupPermissive ( Loc . GetString ( "role-timer-age-too-young" ,
76+ ( "age" , minAgeForSpecies ) ) ) ;
77+ return false ;
78+ }
79+ if ( maxAgeForSpecies != 0 && profile . Age > maxAgeForSpecies )
80+ {
81+ reason = FormattedMessage . FromMarkupPermissive ( Loc . GetString ( "role-timer-age-too-old" ,
82+ ( "age" , maxAgeForSpecies ) ) ) ;
83+ return false ;
84+ }
85+
5586 if ( MinAge != null && profile . Age < MinAge )
5687 {
5788 reason = FormattedMessage . FromMarkupPermissive ( Loc . GetString ( "role-timer-age-too-young" ,
0 commit comments