Skip to content

Commit d41c6b9

Browse files
authored
Hotfix 22.01.2026 (#1430)
* hotfix * grid merge * oops * wtf? * Update RobustToolbox * gpt? * fix
1 parent e9bef78 commit d41c6b9

File tree

17 files changed

+933
-266
lines changed

17 files changed

+933
-266
lines changed

Content.Server/Backmen/NPC/Components/NPCConversationComponent.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
namespace Content.Server.Backmen.NPC.Components;
88

9+
[AutoGenerateComponentPause]
910
[RegisterComponent]
1011
[Access(typeof(NPCConversationSystem))]
1112
public sealed partial class NPCConversationComponent : Component
@@ -74,6 +75,7 @@ public sealed partial class NPCConversationComponent : Component
7475
/// </summary>
7576
[ViewVariables]
7677
[DataField("nextResponse", customTypeSerializer: typeof(TimeOffsetSerializer))]
78+
[AutoPausedField]
7779
public TimeSpan NextResponse;
7880

7981
/// <summary>
@@ -93,6 +95,7 @@ public sealed partial class NPCConversationComponent : Component
9395
/// </summary>
9496
[ViewVariables]
9597
[DataField("nextAttentionLoss", customTypeSerializer: typeof(TimeOffsetSerializer))]
98+
[AutoPausedField]
9699
public TimeSpan NextAttentionLoss;
97100

98101
/// <summary>
@@ -144,9 +147,34 @@ public sealed partial class NPCConversationComponent : Component
144147
/// </remarks>
145148
[ViewVariables]
146149
[DataField("nextIdleChat", customTypeSerializer: typeof(TimeOffsetSerializer))]
150+
[AutoPausedField]
147151
public TimeSpan NextIdleChat;
148152

149153
#endregion
150154

155+
#region GPT Integration
156+
157+
/// <summary>
158+
/// Whether or not the NPC should use GPT API for responses when no matching topic is found.
159+
/// </summary>
160+
[ViewVariables(VVAccess.ReadWrite)]
161+
[DataField("useGpt")]
162+
public bool UseGpt = false;
163+
164+
/// <summary>
165+
/// System prompt for GPT to define NPC's personality and behavior.
166+
/// </summary>
167+
[ViewVariables(VVAccess.ReadWrite)]
168+
[DataField("gptSystemPrompt")]
169+
public string? GptSystemPrompt;
170+
171+
/// <summary>
172+
/// Whether GPT is currently processing a request.
173+
/// </summary>
174+
[ViewVariables]
175+
public bool GptProcessing = false;
176+
177+
#endregion
178+
151179
}
152180

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using Content.Server.NPC;
2+
using Content.Server.NPC.HTN.Preconditions;
3+
using Content.Shared.Standing;
4+
5+
namespace Content.Server.Backmen.NPC.HTN;
6+
7+
/// <summary>
8+
/// Checks if the owner is laydown or not
9+
/// </summary>
10+
public sealed partial class LaydownPrecondition : HTNPrecondition
11+
{
12+
private StandingStateSystem _stand = default!;
13+
14+
[ViewVariables(VVAccess.ReadWrite)]
15+
[DataField("isDown")]
16+
public bool IsDown = true;
17+
18+
public override void Initialize(IEntitySystemManager sysManager)
19+
{
20+
base.Initialize(sysManager);
21+
_stand = sysManager.GetEntitySystem<StandingStateSystem>();
22+
}
23+
24+
public override bool IsMet(NPCBlackboard blackboard)
25+
{
26+
var owner = blackboard.GetValue<EntityUid>(NPCBlackboard.Owner);
27+
28+
return IsDown && _stand.IsDown(owner) ||
29+
!IsDown && !_stand.IsDown(owner);
30+
}
31+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
using Content.Server.NPC;
2+
using Content.Server.NPC.HTN;
3+
using Content.Server.NPC.HTN.PrimitiveTasks;
4+
using Content.Shared.Standing;
5+
6+
namespace Content.Server.Backmen.NPC.HTN.PrimitiveTasks.Operators.Combat;
7+
8+
public sealed partial class StandOperator : HTNOperator
9+
{
10+
private StandingStateSystem _stand = default!;
11+
12+
[DataField("shutdownState")]
13+
public HTNPlanState ShutdownState { get; private set; } = HTNPlanState.TaskFinished;
14+
15+
public override void Startup(NPCBlackboard blackboard)
16+
{
17+
base.Startup(blackboard);
18+
var owner = blackboard.GetValue<EntityUid>(NPCBlackboard.Owner);
19+
_stand.Stand(owner);
20+
}
21+
22+
public override void Initialize(IEntitySystemManager sysManager)
23+
{
24+
base.Initialize(sysManager);
25+
_stand = sysManager.GetEntitySystem<StandingStateSystem>();
26+
}
27+
28+
public override HTNOperatorStatus Update(NPCBlackboard blackboard, float frameTime)
29+
{
30+
return HTNOperatorStatus.Finished;
31+
}
32+
}

0 commit comments

Comments
 (0)