-
Notifications
You must be signed in to change notification settings - Fork 90
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
Fix a non-working player check #725
Conversation
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.
Hi, @thokkat and thanks for the fix - one of overrides of addNpc
appears to be missing.
game/world/worldobjects.cpp
Outdated
@@ -322,6 +322,7 @@ Npc* WorldObjects::addNpc(size_t npcInstance, const Vec3& pos) { | |||
Npc* npc = new Npc(owner,npcInstance,pstr); | |||
npc->setPosition (pos.x,pos.y,pos.z); | |||
npc->updateTransform(); | |||
npc->autoEquipWeapons(); |
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.
Another override for WorldObjects::addNpc(size_t npcInstance, std::string_view at)
seem to be missing.
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.
I left it out because this function calls restPositionToTA
where it's already done. You want to have it added for consistency with other addNpc
function?
Additionally I found thatB_RefreshAtInsert
is called as well and added it.
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.
You want to have it added for consistency with other addNpc function?
Ideally, I think, we need to make it robust and leave no room for inconsistency. After giving more thought to it: maybe it's even better to add ProcessPolicy
as a parameter to npc
constructor. This will make any explicit/implicit use of isPlayer
correct.
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.
Done.
7cb8c7f
to
2387ef2
Compare
fixes a non-working isPlayer check
2387ef2
to
732807a
Compare
Merged, thanks! |
As described in #722 we don't know if
aiPolicy==Player
in npc constructor which means best weapon equip has to be done later.One of the
addNpc
functions already does this indirectly by callingrestPositionToTA
. The other one is never called for the player so weapon equip can be done here safely as well. This covers the case when marvin insert command is used which was the original motivation to do this in the constructor, see #653 (comment).Regarding the mentioned summons, I modified the wolf spell to summon the hero instead. Weapon was equipped while script had only a
createInvItem
line.Fixes #722