Use conditions to store progress for Ninja objectives (#20254)
* TryGetObjectiveComp * helper function to get objective * store N of jacked doors in condition * store called in threat bool in condition * store techs in steal research condition * fix access * remove unused transform system * use popup from shared system * fix formatting * condition => obj everywhere * i fogror to remove downloaded nodes from role * change signature * use query * View Variables * spider charge detonated => condition
This commit is contained in:
@@ -292,6 +292,33 @@ public abstract class SharedMindSystem : EntitySystem
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool TryGetObjectiveComp<T>(EntityUid uid, [NotNullWhen(true)] out T? objective) where T : Component
|
||||
{
|
||||
if (TryGetMind(uid, out var mindId, out var mind) && TryGetObjectiveComp(mindId, out objective, mind))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
objective = default;
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool TryGetObjectiveComp<T>(EntityUid mindId, [NotNullWhen(true)] out T? objective, MindComponent? mind = null) where T : Component
|
||||
{
|
||||
if (Resolve(mindId, ref mind))
|
||||
{
|
||||
var query = GetEntityQuery<T>();
|
||||
foreach (var uid in mind.AllObjectives)
|
||||
{
|
||||
if (query.TryGetComponent(uid, out objective))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
objective = default;
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool TryGetSession(EntityUid? mindId, [NotNullWhen(true)] out ICommonSession? session)
|
||||
{
|
||||
session = null;
|
||||
|
||||
Reference in New Issue
Block a user