Send chat options event whenever NPC becomes idle

This commit is contained in:
Jordan Irwin 2023-12-21 21:02:08 -08:00
parent c15aa34830
commit 93178b8f09
No known key found for this signature in database
GPG key ID: E3E358C2F44C290A

View file

@ -338,6 +338,7 @@ public class SpeakerNPC extends PassiveNPC {
* the entity with whom the NPC should be talking.
*/
public void setAttending(final RPEntity rpentity) {
final RPEntity was_attending = attending;
attending = rpentity;
lastMessageTurn = SingletonRepository.getRuleProcessor().getTurn();
if (rpentity != null) {
@ -348,6 +349,10 @@ public class SpeakerNPC extends PassiveNPC {
}
setIdea(null);
learnedWordsInCurrentConversation = new HashSet<>();
// send chat option event when NPC becomes "idle"
if (was_attending instanceof Player) {
engine.addChatOptionsEvent((Player) was_attending);
}
}
// set facing direction
@ -478,11 +483,7 @@ public class SpeakerNPC extends PassiveNPC {
}
onGoodbye(attending);
engine.setCurrentState(ConversationStates.IDLE);
final Player player = attending instanceof Player ? (Player) attending : null;
setAttending(null);
if (player != null) {
engine.addChatOptionsEvent(player);
}
}
public boolean inConversationRange() {