Fix AI shutting storage crash (#1344)
Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using Content.Server.AI.WorldState;
|
using Content.Server.AI.WorldState;
|
||||||
using Content.Server.AI.WorldState.States.Utility;
|
using Content.Server.AI.WorldState.States.Utility;
|
||||||
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
|
|
||||||
namespace Content.Server.AI.Utility.Considerations.State
|
namespace Content.Server.AI.Utility.Considerations.State
|
||||||
{
|
{
|
||||||
@@ -20,7 +21,8 @@ namespace Content.Server.AI.Utility.Considerations.State
|
|||||||
protected override float GetScore(Blackboard context)
|
protected override float GetScore(Blackboard context)
|
||||||
{
|
{
|
||||||
var stateData = context.GetState<StoredStateIsNullState>().GetValue();
|
var stateData = context.GetState<StoredStateIsNullState>().GetValue();
|
||||||
return stateData == null ? 1.0f : 0.0f;
|
context.GetStoredState(stateData, out StoredStateData<IEntity> state);
|
||||||
|
return state.GetValue() == null ? 1.0f : 0.0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -56,9 +56,9 @@ namespace Content.Server.AI.WorldState
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GetState(Type type, out IAiState state)
|
public void GetStoredState<T>(Type type, out StoredStateData<T> state)
|
||||||
{
|
{
|
||||||
state = _states[type];
|
state = (StoredStateData<T>) _states[type];
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -25,10 +25,7 @@ namespace Content.Server.AI.WorldState
|
|||||||
void CheckCache();
|
void CheckCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface IStoredState
|
public interface IStoredState {}
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The default class for state values. Also see CachedStateData and PlanningStateData
|
/// The default class for state values. Also see CachedStateData and PlanningStateData
|
||||||
|
|||||||
Reference in New Issue
Block a user