Skip to content

Commit

Permalink
Add markers for easier merges
Browse files Browse the repository at this point in the history
  • Loading branch information
TheArturZh committed Oct 24, 2023
1 parent dfd8745 commit 213574c
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ public bool IsAllowed(JobPrototype job, HumanoidCharacterProfile profile, [NotNu
return CheckAllowed(job, profile, out reason);
}

//SS220 Species-Job-Requirement begin
public void BuildReason(ReasonList reasons, out FormattedMessage reason)
{
reason = FormattedMessage.FromMarkup(string.Join('\n', reasons));
Expand Down Expand Up @@ -167,6 +168,7 @@ public bool CheckRoleTime(HashSet<JobRequirement>? requirements, [NotNullWhen(fa
}
return true;
}
//SS220 Species-Job-Requirement end

public bool CheckRoleTime(HashSet<JobRequirement>? requirements, ReasonList reasons)
{
Expand All @@ -185,6 +187,6 @@ public bool CheckRoleTime(HashSet<JobRequirement>? requirements, ReasonList reas
reasons.Add(jobReason.ToMarkup());
}

return reasons.Count == 0;
return reasons.Count == 0; //SS220 Species-Job-Requirement
}
}
4 changes: 2 additions & 2 deletions Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ private void SetSpecies(string newSpecies)
RebuildSpriteView(); // they might have different inv so we need a new dummy
IsDirty = true;
_needUpdatePreview = true;
UpdateRoleRequirements();
UpdateRoleRequirements(); //SS220 Species-Job-Requirement
}

private void SetName(string newName)
Expand Down Expand Up @@ -833,7 +833,7 @@ public void Save()
_preferencesManager.UpdateCharacter(Profile, CharacterSlot);
OnProfileChanged?.Invoke(Profile, CharacterSlot);
_needUpdatePreview = true;
UpdateRoleRequirements();
UpdateRoleRequirements(); //SS220 Species-Job-Requirement
}
}

Expand Down
1 change: 1 addition & 0 deletions Content.Server/GameTicking/GameTicker.Spawning.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ private void SpawnPlayer(IPlayerSession player, EntityUid station, string? jobId
if (jobId != null && !_playTimeTrackings.IsAllowed(player, jobId))
return;

//SS220 Species-Job-Requirement
if (jobId != null && !_roleSpeciesRestrictSystem.IsAllowed(player, jobId))
return;

Expand Down
1 change: 1 addition & 0 deletions Content.Shared/Humanoid/Prototypes/SpeciesPrototype.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ public sealed class SpeciesPrototype : IPrototype
[DataField("buttScanTexture")]
public string ButtScanTexture = "/Textures/SS220/Interface/Butts/human.png";

//SS220 Species-Job-Requirement
[DataField("blockedJobs", required: false, customTypeSerializer: typeof(PrototypeIdListSerializer<JobPrototype>))]
public List<string> BlockedJobs { get; } = default!;
}
Expand Down
3 changes: 3 additions & 0 deletions Content.Shared/Roles/JobRequirements.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public sealed partial class OverallPlaytimeRequirement : JobRequirement

public static class JobRequirements
{
//SS220 Species-Job-Requirement begin
public static bool TryRequirementsSpeciesMet(
JobPrototype job,
SpeciesPrototype species,
Expand All @@ -87,6 +88,8 @@ public static bool TryRequirementsSpeciesMet(
}
return true;
}
//SS220 Species-Job-Requirement end

public static bool TryRequirementsMet(
JobPrototype job,
Dictionary<string, TimeSpan> playTimes,
Expand Down

0 comments on commit 213574c

Please sign in to comment.