-
Notifications
You must be signed in to change notification settings - Fork 200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adv-Rumors additional conversation options #1182
Conversation
…tfig relationships
Add keywords for both versions of names
is this PR still a draft or is it ready for review? |
Fix OVERLAY_WIDGETS global being present in the internal script
@myk002 ready for review |
internal/advtools/convo.lua
Outdated
local function addHistFigWhereaboutsChoice(profile) | ||
for i, c in pairs(adventure.conversation.conv_choice_info) do | ||
if c.cc.type == df.talk_choice_type.AskWhereabouts and | ||
c.cc.invocation_target_hfid ~= -1 and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if profile.histfig_id
is never equal to -1, then you can remove the check for -1
internal/advtools/convo.lua
Outdated
local caste = creature.caste[histfig.caste] | ||
name = caste.caste_name[0] | ||
end | ||
local title = "Ask for the whereabouts of the " .. name .. " " .. dfhack.TranslateName(histfig.name, true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we only need the english name here? are they never referenced by their native name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In vanilla convo system yeah they're only referenced by their English name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is that what you want, though? @Ozzatron what do you think?
internal/advtools/convo.lua
Outdated
if profile._type == df.relationship_profile_hf_historicalst then | ||
title = title .. " (Heard of)" | ||
end | ||
local choice = new_choice(df.talk_choice_type.AskWhereabouts, title, dfhack.TranslateName(histfig.name):split()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we adding keywords for the untranslated name if the translated name appears in the text itself?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Vanilla keyword behavior
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and the translated name is already in the keyword list?
internal/advtools/convo.lua
Outdated
local function addIdentityWhereaboutsChoice(identity) | ||
for i, c in pairs(adventure.conversation.conv_choice_info) do | ||
if c.cc.type == df.talk_choice_type.AskWhereabouts and | ||
c.cc.invocation_target_hfid ~= -1 and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above -- if identity.impersonated_hf
is never -1, then we don't need this check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's possible for impersonated hf identity to be -1
internal/advtools/convo.lua
Outdated
local identity_name = identity.name | ||
local name = "" | ||
local creature = df.creature_raw.find(identity.race) | ||
if creature then | ||
local caste = creature.caste[identity.caste] | ||
name = caste.caste_name[0] | ||
else | ||
-- no race given for the identity, assume it's the histfig | ||
local histfig = df.historical_figure.find(identity.histfig_id) | ||
creature = df.creature_raw.find(histfig.race) | ||
if creature then | ||
local caste = creature.caste[histfig.caste] | ||
name = caste.caste_name[0] | ||
end | ||
end | ||
local title = "Ask for the whereabouts of the " .. name .. " " .. dfhack.TranslateName(identity_name, true) | ||
local choice = new_choice(df.talk_choice_type.AskWhereabouts, title) | ||
-- insert before the last choice, which is usually "back" | ||
adventure.conversation.conv_choice_info:insert(#adventure.conversation.conv_choice_info-1, choice, dfhack.TranslateName(identity_name):split()) | ||
choice.cc.invocation_target_hfid = identity.impersonated_hf | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this duplicates too much of the logic in addHistFigWhereaboutsChoice
; please refactor
internal/advtools/convo.lua
Outdated
for _, profile in pairs(visual) do | ||
addHistFigWhereaboutsChoice(profile) | ||
end | ||
|
||
-- This option will likely always fail unless the false identity is impersonating someone | ||
-- but giving away the false identity's true historical figure feels cheap. | ||
for _, profile in pairs(identity) do | ||
addIdentityWhereaboutsChoice(df.identity.find(profile.identity_id)) | ||
end | ||
|
||
-- Historical entities go last so as to not give away fake identities | ||
for _, profile in pairs(historical) do | ||
addHistFigWhereaboutsChoice(profile) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with the loop through adventure.conversation.conv_choice_info
, each of these has quadradic runtime complexity. perhaps it would be a good idea to make a single loop through adventure.conversation.conv_choice_info
and cache the results? (and update the cache as you add more entries)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also, ipairs
is semantically appropriate for vectors, not pairs
end | ||
end | ||
|
||
-- generate extra keywords for all options |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if this is being run unconditionally down here, why are you adding keywords in new_choice
? can the call to add_keywords
be removed from new_choice
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is because new_choice might have its own "vanilla"-style added keywords which is just a few, while this section ensures more searchability
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
previous comments appear to be unaddressed
Co-authored-by: Myk <[email protected]>
Adds "ask whereabouts of" conversation options for ALL your histfig relationships