Rat King Milsim + Buffs (#20190)
* rat king update * rummaging * buuuuunnnnncccchhh of shit * the last of it * make rat servants not ghost roles * pissma buff and cooldown
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
namespace Content.Server.NPC.HTN.Preconditions;
|
||||
|
||||
public sealed partial class HasOrdersPrecondition : HTNPrecondition
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entManager = default!;
|
||||
|
||||
[DataField("orders", required: true)] public Enum Orders = default!;
|
||||
|
||||
public override bool IsMet(NPCBlackboard blackboard)
|
||||
{
|
||||
return Equals(blackboard.GetValueOrDefault<Enum>(NPCBlackboard.CurrentOrders, _entManager), Orders);
|
||||
}
|
||||
}
|
||||
@@ -68,6 +68,20 @@ public sealed partial class MeleeOperator : HTNOperator, IHtnConditionalShutdown
|
||||
blackboard.Remove<EntityUid>(TargetKey);
|
||||
}
|
||||
|
||||
public override void TaskShutdown(NPCBlackboard blackboard, HTNOperatorStatus status)
|
||||
{
|
||||
base.TaskShutdown(blackboard, status);
|
||||
|
||||
ConditionalShutdown(blackboard);
|
||||
}
|
||||
|
||||
public override void PlanShutdown(NPCBlackboard blackboard)
|
||||
{
|
||||
base.PlanShutdown(blackboard);
|
||||
|
||||
ConditionalShutdown(blackboard);
|
||||
}
|
||||
|
||||
public override HTNOperatorStatus Update(NPCBlackboard blackboard, float frameTime)
|
||||
{
|
||||
base.Update(blackboard, frameTime);
|
||||
|
||||
@@ -320,6 +320,16 @@ public sealed partial class NPCBlackboard : IEnumerable<KeyValuePair<string, obj
|
||||
public const string VisionRadius = "VisionRadius";
|
||||
public const string UtilityTarget = "UtilityTarget";
|
||||
|
||||
/// <summary>
|
||||
/// A configurable "order" enum that can be given to an NPC from an external source.
|
||||
/// </summary>
|
||||
public const string CurrentOrders = "CurrentOrders";
|
||||
|
||||
/// <summary>
|
||||
/// A configurable target that's ordered by external sources.
|
||||
/// </summary>
|
||||
public const string CurrentOrderedTarget = "CurrentOrderedTarget";
|
||||
|
||||
public IEnumerator<KeyValuePair<string, object>> GetEnumerator()
|
||||
{
|
||||
return _blackboard.GetEnumerator();
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace Content.Server.NPC.Queries.Considerations;
|
||||
|
||||
public sealed partial class OrderedTargetCon : UtilityConsideration
|
||||
{
|
||||
|
||||
}
|
||||
@@ -191,6 +191,16 @@ public sealed class NPCUtilitySystem : EntitySystem
|
||||
|
||||
return 1f;
|
||||
}
|
||||
case OrderedTargetCon:
|
||||
{
|
||||
if (!blackboard.TryGetValue<EntityUid>(NPCBlackboard.CurrentOrderedTarget, out var orderedTarget, EntityManager))
|
||||
return 0f;
|
||||
|
||||
if (targetUid != orderedTarget)
|
||||
return 0f;
|
||||
|
||||
return 1f;
|
||||
}
|
||||
case TargetAccessibleCon:
|
||||
{
|
||||
if (_container.TryGetContainingContainer(targetUid, out var container))
|
||||
|
||||
Reference in New Issue
Block a user