Skip to content

Commit

Permalink
Don't turn to face the player to say hello if there is no hello response
Browse files Browse the repository at this point in the history
  • Loading branch information
Assumeru committed Aug 25, 2024
1 parent 50465a3 commit 1f5c314
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@
Bug #8085: Don't search in scripts or shaders directories for "Select directories you wish to add" menu in launcher
Bug #8097: GetEffect doesn't detect 0 magnitude spells
Bug #8124: Normal weapon resistance is applied twice for NPCs
Bug #8132: Actors without hello responses turn to face the player
Feature #1415: Infinite fall failsafe
Feature #2566: Handle NAM9 records for manual cell references
Feature #3501: OpenMW-CS: Instance Editing - Shortcuts for axial locking
Expand Down
2 changes: 1 addition & 1 deletion apps/openmw/mwbase/dialoguemanager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ namespace MWBase

virtual void goodbye() = 0;

virtual void say(const MWWorld::Ptr& actor, const ESM::RefId& topic) = 0;
virtual bool say(const MWWorld::Ptr& actor, const ESM::RefId& topic) = 0;

virtual void keywordSelected(std::string_view keyword, ResponseCallback* callback) = 0;
virtual void goodbyeSelected() = 0;
Expand Down
9 changes: 5 additions & 4 deletions apps/openmw/mwdialogue/dialoguemanagerimp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -620,25 +620,25 @@ namespace MWDialogue
return false;
}

void DialogueManager::say(const MWWorld::Ptr& actor, const ESM::RefId& topic)
bool DialogueManager::say(const MWWorld::Ptr& actor, const ESM::RefId& topic)
{
MWBase::SoundManager* sndMgr = MWBase::Environment::get().getSoundManager();
if (sndMgr->sayActive(actor))
{
// Actor is already saying something.
return;
return false;
}

if (actor.getClass().isNpc() && MWBase::Environment::get().getWorld()->isSwimming(actor))
{
// NPCs don't talk while submerged
return;
return false;
}

if (actor.getClass().getCreatureStats(actor).getKnockedDown())
{
// Unconscious actors can not speak
return;
return false;
}

const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
Expand All @@ -657,6 +657,7 @@ namespace MWDialogue
if (!info->mResultScript.empty())
executeScript(info->mResultScript, actor);
}
return info != nullptr;
}

int DialogueManager::countSavedGameRecords() const
Expand Down
2 changes: 1 addition & 1 deletion apps/openmw/mwdialogue/dialoguemanagerimp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ namespace MWDialogue

bool checkServiceRefused(ResponseCallback* callback, ServiceType service = ServiceType::Any) override;

void say(const MWWorld::Ptr& actor, const ESM::RefId& topic) override;
bool say(const MWWorld::Ptr& actor, const ESM::RefId& topic) override;

// calbacks for the GUI
void keywordSelected(std::string_view keyword, ResponseCallback* callback) override;
Expand Down
3 changes: 2 additions & 1 deletion apps/openmw/mwmechanics/actors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,8 @@ namespace MWMechanics
if (greetingTimer >= GREETING_SHOULD_START)
{
greetingState = Greet_InProgress;
MWBase::Environment::get().getDialogueManager()->say(actor, ESM::RefId::stringRefId("hello"));
if (!MWBase::Environment::get().getDialogueManager()->say(actor, ESM::RefId::stringRefId("hello")))
greetingState = Greet_Done;
greetingTimer = 0;
}
}
Expand Down

0 comments on commit 1f5c314

Please sign in to comment.