Added reset all (non-free) skills (#1343)
* Added reset all (non-free) skills * I don't know why I didn't do this the first time * Formatting fixes * Removed old code and made removal function iterate in reverse order
This commit is contained in:
@@ -244,6 +244,26 @@ public abstract partial class CP14SharedSkillSystem : EntitySystem
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
/// <summary>
|
||||
/// Helper function to reset skills to only learned skills
|
||||
/// </summary>
|
||||
public bool TryResetSkills(EntityUid target,
|
||||
CP14SkillStorageComponent? component = null)
|
||||
{
|
||||
if (!Resolve(target, ref component, false))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
for(var i = component.LearnedSkills.Count - 1; i >= 0; i--)
|
||||
{
|
||||
if(HaveFreeSkill(target, component.LearnedSkills[i], component))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
TryRemoveSkill(target, component.LearnedSkills[i], component);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
[ByRefEvent]
|
||||
|
||||
Reference in New Issue
Block a user