Index: ps/trunk/binaries/data/config/default.cfg =================================================================== --- ps/trunk/binaries/data/config/default.cfg +++ ps/trunk/binaries/data/config/default.cfg @@ -218,6 +218,7 @@ reset = "R" ; Reset camera rotation to default. follow = "F" ; Follow the first unit in the selection rallypointfocus = "" ; Focus the camera on the rally point of the selected building +lastattackfocus = "Space" ; Focus the camera on the last notified attack zoom.in = Plus, NumPlus ; Zoom camera in (continuous control) zoom.out = Minus, NumMinus ; Zoom camera out (continuous control) zoom.wheel.in = WheelUp ; Zoom camera in (stepped control) @@ -385,7 +386,7 @@ 8 = Comma ; add eighth unit type to queue [hotkey.session.timewarp] -fastforward = Space ; If timewarp mode enabled, speed up the game +fastforward = "Ctrl+Space" ; If timewarp mode enabled, speed up the game rewind = "Shift+Backspace" ; If timewarp mode enabled, go back to earlier point in the game [hotkey.tab] Index: ps/trunk/binaries/data/mods/public/gui/session/chat/ChatMessageFormatSimulation.js =================================================================== --- ps/trunk/binaries/data/mods/public/gui/session/chat/ChatMessageFormatSimulation.js +++ ps/trunk/binaries/data/mods/public/gui/session/chat/ChatMessageFormatSimulation.js @@ -21,12 +21,8 @@ "icon": '[icon="icon_focusattacked"]', "attacker": colorizePlayernameByID(msg.attacker) }), - "callback": ((entityId, position) => function() { - let entState = entityId && GetEntityState(entityId); - if (entState && hasClass(entState, "Unit")) - setCameraFollow(entityId); - else - Engine.SetCameraTarget(position.x, position.y, position.z); + "callback": ((target, position) => function() { + focusAttack({ "target": target, "position": position }); })(msg.target, msg.position), "tooltip": translate("Click to focus on the attacked unit.") }; Index: ps/trunk/binaries/data/mods/public/gui/session/hotkeys/camera.xml =================================================================== --- ps/trunk/binaries/data/mods/public/gui/session/hotkeys/camera.xml +++ ps/trunk/binaries/data/mods/public/gui/session/hotkeys/camera.xml @@ -9,6 +9,12 @@ performCommand(g_Selection.toList().map(ent => GetEntityState(ent)), "focus-rally"); + + + focusAttack(g_LastAttack); + + + jumpCamera(1); Index: ps/trunk/binaries/data/mods/public/gui/session/messages.js =================================================================== --- ps/trunk/binaries/data/mods/public/gui/session/messages.js +++ ps/trunk/binaries/data/mods/public/gui/session/messages.js @@ -105,6 +105,8 @@ "defeated": translate("You have been defeated!") }; +var g_LastAttack; + /** * Defines how the GUI reacts to notifications that are sent by the simulation. * Don't open new pages (message boxes) here! Otherwise further notifications @@ -206,6 +208,8 @@ g_Selection.addList([notification.target]); } + g_LastAttack = { "target": notification.target, "position": notification.position }; + if (Engine.ConfigDB_GetValue("user", "gui.session.notifications.attack") !== "true") return; @@ -355,6 +359,21 @@ } } +function focusAttack(attack) +{ + if (!attack) + return; + + const entState = attack.target && GetEntityState(attack.target); + if (entState && hasClass(entState, "Unit")) + setCameraFollow(attack.target); + else + { + const position = attack.position; + Engine.SetCameraTarget(position.x, position.y, position.z); + } +} + function toggleTutorial() { let tutorialPanel = Engine.GetGUIObjectByName("tutorialPanel");