mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-06 17:13:51 +00:00
feat(editor): W hotkey adds patrol waypoint at cursor in NPC mode
When an NPC with Patrol behavior is selected in NPC mode, pressing W appends a waypoint at the current cursor position. Faster than clicking the panel button for laying out long routes.
This commit is contained in:
parent
4b3375ac44
commit
7fcc923d2e
1 changed files with 14 additions and 0 deletions
|
|
@ -348,6 +348,20 @@ void EditorApp::processEvents() {
|
|||
objectPlacer_.selectAll();
|
||||
showToast("Selected " + std::to_string(objectPlacer_.selectionCount()) + " objects");
|
||||
}
|
||||
// W: add patrol waypoint at cursor for the selected NPC (no modifiers,
|
||||
// editor must be in NPC mode and an NPC must be selected with Patrol behavior).
|
||||
if (sc == SDL_SCANCODE_W && mode_ == EditorMode::NPC &&
|
||||
!(event.key.keysym.mod & (KMOD_CTRL | KMOD_ALT | KMOD_SHIFT))) {
|
||||
auto* sel = npcSpawner_.getSelected();
|
||||
if (sel && sel->behavior == CreatureBehavior::Patrol &&
|
||||
terrainEditor_.brush().isActive()) {
|
||||
PatrolPoint pp;
|
||||
pp.position = terrainEditor_.brush().getPosition();
|
||||
pp.waitTimeMs = 2000.0f;
|
||||
sel->patrolPath.push_back(pp);
|
||||
showToast("Added patrol waypoint #" + std::to_string(sel->patrolPath.size()));
|
||||
}
|
||||
}
|
||||
// Ctrl+Y = Redo (alternate binding)
|
||||
if (sc == SDL_SCANCODE_Y && (event.key.keysym.mod & KMOD_CTRL)) {
|
||||
if (terrainEditor_.history().canRedo()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue