Skip to content

Commit

Permalink
Improve fast NPC talk
Browse files Browse the repository at this point in the history
  • Loading branch information
hexhexD committed Oct 8, 2023
1 parent 4c6eee0 commit 37cd07a
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
1 change: 0 additions & 1 deletion control/timeouts.txt
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ ai_route_calcRoute 1
ai_route_npcTalk 10

# These timeouts are used in npc conversation (Task::TalkNPC)
ai_npc_talk_wait_to_answer 1.5
ai_npc_talk_wait_after_close_to_cancel 0.5
ai_npc_talk_wait_after_cancel_to_destroy 0.5

Expand Down
5 changes: 1 addition & 4 deletions src/Task/TalkNPC.pm
Original file line number Diff line number Diff line change
Expand Up @@ -360,9 +360,6 @@ sub iterate {
$self->setError(NPC_NO_RESPONSE, T("The NPC did not respond."));

} elsif ($self->{stage} == TALKING_TO_NPC) {
# $config{npcTimeResponse} seconds have passed since we sent the last conversation step
# or $ai_npc_talk_wait_to_answer seconds have passed since the npc answered us.

if (%talk && $ai_v{'npc_talk'}{'talk'} eq 'initiated') {
debug "Spining until a response is needed from us\n", 'ai_npcTalk';
return;
Expand All @@ -389,7 +386,7 @@ sub iterate {

#We must always wait for the last sent step to be answered, if it hasn't then cancel this task.
if ($self->{wait_for_answer}) {
if (timeOut($ai_v{'npc_talk'}{'time'}, $ai_npc_talk_wait_to_answer)) {
if (timeOut($ai_v{'npc_talk'}{'time'}, $timeResponse)) {
$self->{error_code} = NPC_TIMEOUT_AFTER_ASWER;
$self->{error_message} = "We have waited for too long after we sent a response to the npc.";
$self->cancelTalk;
Expand Down

0 comments on commit 37cd07a

Please sign in to comment.