-
Notifications
You must be signed in to change notification settings - Fork 86
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
Add goto vob
and goto camera
marvin commands
#634
Conversation
Hi, @thokkat , and thanks for PR! Code looks good. Approving for now, will merge after finishing my work with sky |
Sure no hurry. Just some pr/issue spam incoming from my side. Want to wrap up stuff lying around :) |
game/world/worldobjects.cpp
Outdated
if(i->handle().symbol_index()==instance) | ||
return i.get(); | ||
Npc *WorldObjects::findNpcByInstance(size_t instance, uint32_t n) { | ||
if(n==0) |
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.
Normally in C++ indexing is normally zero-based.
I'm suggesting to have this function as zero-based, and in that case -1
passed from caller will be casted to UINT_MAX
and result into null result.
game/world/world.h
Outdated
@@ -104,7 +104,8 @@ class World final { | |||
|
|||
auto takeHero() -> std::unique_ptr<Npc>; | |||
Npc* player() const { return npcPlayer; } | |||
Npc* findNpcByInstance(size_t instance); | |||
Npc* findNpcByInstance(size_t instance, uint32_t n = 1); | |||
Item* findItemByInstance(size_t instance, uint32_t n = 1); |
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 project indices are nominated in size_t
, not uint
Merged, thanks! |
goto vob
teleports the player to a vob that matches the given name. A index number can be added to teleport to the n_th vob in case there exist multiple, often the case for items. Only npcs and items are tested for now but in vanilla it works for all kind of vobs.goto camera
teleports the player to the camera position. I found this came in handy when I wanted to observe a npc without percs being triggered but then move quickly to the scene to look what would happen.