Add prediction for Tech Disks, cleanup (#29061)

* Add prediction for Tech Disks, cleanup

* Remove IsServer check in OnMapInit

* Use HashSet for techs, remove LINQ
This commit is contained in:
Tayrtahn
2024-06-19 11:04:30 -04:00
committed by GitHub
parent 20544b0c76
commit 024521b66b
6 changed files with 137 additions and 131 deletions

View File

@@ -280,4 +280,23 @@ public abstract class SharedResearchSystem : EntitySystem
comp.UnlockedTechnologies.Clear();
Dirty(uid, comp);
}
/// <summary>
/// Adds a lathe recipe to the specified technology database
/// without checking if it can be unlocked.
/// </summary>
public void AddLatheRecipe(EntityUid uid, string recipe, TechnologyDatabaseComponent? component = null)
{
if (!Resolve(uid, ref component))
return;
if (component.UnlockedRecipes.Contains(recipe))
return;
component.UnlockedRecipes.Add(recipe);
Dirty(uid, component);
var ev = new TechnologyDatabaseModifiedEvent();
RaiseLocalEvent(uid, ref ev);
}
}