Skip to content
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

Merged
merged 2 commits into from
May 26, 2024
Merged

Conversation

thokkat
Copy link
Contributor

@thokkat thokkat commented May 24, 2024

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.

@Try
Copy link
Owner

Try commented May 24, 2024

Hi, @thokkat , and thanks for PR!

Code looks good. Approving for now, will merge after finishing my work with sky

@thokkat
Copy link
Contributor Author

thokkat commented May 24, 2024

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 :)

if(i->handle().symbol_index()==instance)
return i.get();
Npc *WorldObjects::findNpcByInstance(size_t instance, uint32_t n) {
if(n==0)
Copy link
Owner

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.

@@ -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);
Copy link
Owner

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

@thokkat thokkat requested a review from Try May 26, 2024 20:54
@Try Try merged commit 406bb67 into Try:master May 26, 2024
1 check was pending
@Try
Copy link
Owner

Try commented May 26, 2024

Merged, thanks!

@thokkat thokkat deleted the marvin-gotoVob branch May 26, 2024 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants