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

Extend functionality of selection sets (control groups) #4119

Merged
merged 20 commits into from Aug 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
101 changes: 59 additions & 42 deletions engine/User/CameraImpl.lua
Expand Up @@ -2,126 +2,143 @@
---@class Camera
local CameraImpl = {}


---@class UserCameraSettings
---@field Zoom number # See also `CameraImpl:GetFocusPosition()`
---@field Pitch number
---@field Heading number
---@field Focus Vector # See also `CameraImpl:GetFocusPosition()`

---@alias UserCameraAccelerationModes 'Linear' | 'FastInSlowOut' | 'SlowInOut'

---
function CameraImpl:EnableEaseInOut()
end

---
--- Returns the focus point (on the terrain) of the center of the screen
---@return Vector
function CameraImpl:GetFocusPosition()
end

---
--- Returns the highest possible zoom distance
---@return number
function CameraImpl:GetMaxZoom()
end

---
--- Returns the lowest possible zoom distance
---@return number
function CameraImpl:GetMinZoom()
end

---
--- Returns the target zoom distance
---@return number
function CameraImpl:GetTargetZoom()
end

---
--- Returns the current zoom distance
---@return number
function CameraImpl:GetZoom()
end

---
--- Disables rotating the camera
function CameraImpl:HoldRotation()
end

---
---@param position any
---@param orientationHPR any
---@param zoom any
---@param seconds any
--- Transforms the camera to the given position, orientation and zoom
---@param position Vector
---@param orientationHPR Vector
---@param zoom number
---@param seconds number
function CameraImpl:MoveTo(position, orientationHPR, zoom, seconds)
end

---
---@param region any
---@param seconds? any
--- Transforms the camera to be able to view the entire region
---@param region Rectangle
---@param seconds? number
function CameraImpl:MoveToRegion(region, seconds)
end

---
---@param ent any
---@param pitchAdjust any
---@param zoom any
---@param seconds any
--- Third-person like camera movement
---@param ent Unit
---@param pitchAdjust boolean
---@param zoom number
---@param seconds number
---@param transition any
function CameraImpl:NoseCam(ent, pitchAdjust, zoom, seconds, transition)
end

---
--- Resets the camera, including console commands applied to it
function CameraImpl:Reset()
end

---
---@param settings any
--- Applies the provided settings to the camera
---@see `CameraImpl:SaveSettings` to retrieve the settings
---@param settings UserCameraSettings
function CameraImpl:RestoreSettings(settings)
end

---
--- Reverts the camera to the basic rotation scheme
function CameraImpl:RevertRotation()
end

---
--- Returns the current camera settings
---@see `CameraImpl:RestoreSettings` to apply the settings
---@return UserCameraSettings
function CameraImpl:SaveSettings()
end

---
---@param accTypeName any
--- ???
---@param accTypeName UserCameraAccelerationModes
function CameraImpl:SetAccMode(accTypeName)
end

--- Sets zoom scale to allow zooming past or before the point where map fills control
function CameraImpl:SetMaxZoomMult()
end

---
---
---@param zoom any
function CameraImpl:SetTargetZoom(zoom)
end

---
--- Zooms the camera
---@param zoom any
---@param seconds any
function CameraImpl:SetZoom(zoom, seconds)
end

---
--- Snaps the camera to the given position, orientation and zoom
---@param position any
---@param orientationHPR any
---@param zoom any
function CameraImpl:SnapTo(position, orientationHPR, zoom)
end

---
---@param headingRate any
---@param zoomRate? any
--- Spins and rotates the camera
---@param headingRate number
---@param zoomRate? number
function CameraImpl:Spin(headingRate, zoomRate)
end

---
---@param ents any
---@param zoom any
---@param seconds any
--- ???
---@param ents UserUnit[]
---@param zoom number
---@param seconds number
function CameraImpl:TargetEntities(ents, zoom, seconds)
end

---
---@param ents any
---@param zoom any
---@param seconds any
--- Tracks several entities at a given zoom
---@param ents UserUnit[]
---@param zoom number
---@param seconds number
function CameraImpl:TrackEntities(ents, zoom, seconds)
end

---
--- Use the game clock for interval checks, useful if the game is slowed down during a cinemation. Defaults to using the system clock
function CameraImpl:UseGameClock()
end

---
--- use the system clock for interval checks, useful if the game is slowed down during a cinemation
function CameraImpl:UseSystemClock()
end

Expand Down
7 changes: 7 additions & 0 deletions init_faf.lua
Expand Up @@ -60,12 +60,19 @@ end
-- mods that have been integrated, based on folder name
local integratedMods = { }
integratedMods["nvidia fix"] = true

integratedMods = LowerHashTable(integratedMods)

-- mods that are deprecated, based on folder name
local deprecatedMods = { }
deprecatedMods["simspeed++"] = true
deprecatedMods["#quality of performance 2022"] = true

-- as per #4119 the control groups (called selection sets in code) are completely overhauled and extended feature-wise,
-- because of that these mods are no longer viable.
deprecatedMods["group_split"] = true
deprecatedMods["Control Group Zoom Mod"] = true
deprecatedMods["additionalControlGroupStuff"] = true
deprecatedMods = LowerHashTable(deprecatedMods)

-- typical FA packages
Expand Down
6 changes: 6 additions & 0 deletions init_fafbeta.lua
Expand Up @@ -66,6 +66,12 @@ integratedMods = LowerHashTable(integratedMods)
local deprecatedMods = { }
deprecatedMods["simspeed++"] = true
deprecatedMods["#quality of performance 2022"] = true

-- as per #4119 the control groups (called selection sets in code) are completely overhauled and extended feature-wise,
-- because of that these mods are no longer viable.
deprecatedMods["group_split"] = true
deprecatedMods["Control Group Zoom Mod"] = true
deprecatedMods["additionalControlGroupStuff"] = true
deprecatedMods = LowerHashTable(deprecatedMods)

-- typical FA packages
Expand Down
6 changes: 6 additions & 0 deletions init_fafdevelop.lua
Expand Up @@ -66,6 +66,12 @@ integratedMods = LowerHashTable(integratedMods)
local deprecatedMods = { }
deprecatedMods["simspeed++"] = true
deprecatedMods["#quality of performance 2022"] = true

-- as per #4119 the control groups (called selection sets in code) are completely overhauled and extended feature-wise,
-- because of that these mods are no longer viable.
deprecatedMods["group_split"] = true
deprecatedMods["Control Group Zoom Mod"] = true
deprecatedMods["additionalControlGroupStuff"] = true
deprecatedMods = LowerHashTable(deprecatedMods)

-- typical FA packages
Expand Down
6 changes: 6 additions & 0 deletions init_shared.lua
Expand Up @@ -66,6 +66,12 @@ integratedMods = LowerHashTable(integratedMods)
local deprecatedMods = { }
deprecatedMods["simspeed++"] = true
deprecatedMods["#quality of performance 2022"] = true

-- as per #4119 the control groups (called selection sets in code) are completely overhauled and extended feature-wise,
-- because of that these mods are no longer viable.
deprecatedMods["group_split"] = true
deprecatedMods["Control Group Zoom Mod"] = true
deprecatedMods["additionalControlGroupStuff"] = true
deprecatedMods = LowerHashTable(deprecatedMods)

-- typical FA packages
Expand Down
4 changes: 0 additions & 4 deletions lua/SimCallbacks.lua
Expand Up @@ -522,10 +522,6 @@ Callbacks.OnControlGroupAssign = function(units)
end
end

Callbacks.OnControlGroupApply = function(units)
--LOG(repr(units))
end

local SimCamera = import('/lua/SimCamera.lua')

Callbacks.OnCameraFinish = SimCamera.OnCameraFinish
Expand Down
69 changes: 59 additions & 10 deletions lua/keymap/keyactions.lua
Expand Up @@ -61,6 +61,10 @@ keyActions = {
category = 'debug', order = 21,},
['toggle_reclaim_labels'] = {action = 'UI_Lua import("/lua/ui/game/reclaim.lua").ToggleReclaim()',
category = 'ui'},

['revert_selection_set'] = {action = 'UI_Lua import("/lua/ui/game/selection.lua").RevertSelectionSet()',
category = 'selection', order = 0,},

['group1'] = {action = 'UI_ApplySelectionSet 1',
category = 'selection', order = 1,},
['group2'] = {action = 'UI_ApplySelectionSet 2',
Expand All @@ -80,6 +84,7 @@ keyActions = {
['group9'] = {action = 'UI_ApplySelectionSet 9',
category = 'selection', order = 9,},
['group0'] = {action = 'UI_ApplySelectionSet 0',

category = 'selection', order = 10,},
['set_group1'] = {action = 'UI_MakeSelectionSet 1',
category = 'selection', order = 11,},
Expand All @@ -101,26 +106,70 @@ keyActions = {
category = 'selection', order = 19,},
['set_group0'] = {action = 'UI_MakeSelectionSet 0',
category = 'selection', order = 20,},

['append_group1'] = {action = 'UI_Lua import("/lua/ui/game/selection.lua").AppendSetToSelection(1)',
category = 'selection', order = 21,},
category = 'selection', order = 100 },
['append_group2'] = {action = 'UI_Lua import("/lua/ui/game/selection.lua").AppendSetToSelection(2)',
category = 'selection', order = 22,},
category = 'selection', order = 101 },
['append_group3'] = {action = 'UI_Lua import("/lua/ui/game/selection.lua").AppendSetToSelection(3)',
category = 'selection', order = 23,},
category = 'selection', order = 102 },
['append_group4'] = {action = 'UI_Lua import("/lua/ui/game/selection.lua").AppendSetToSelection(4)',
category = 'selection', order = 24,},
category = 'selection', order = 103 },
['append_group5'] = {action = 'UI_Lua import("/lua/ui/game/selection.lua").AppendSetToSelection(5)',
category = 'selection', order = 25,},
category = 'selection', order = 104 },
['append_group6'] = {action = 'UI_Lua import("/lua/ui/game/selection.lua").AppendSetToSelection(6)',
category = 'selection', order = 26,},
category = 'selection', order = 105 },
['append_group7'] = {action = 'UI_Lua import("/lua/ui/game/selection.lua").AppendSetToSelection(7)',
category = 'selection', order = 27,},
category = 'selection', order = 106 },
['append_group8'] = {action = 'UI_Lua import("/lua/ui/game/selection.lua").AppendSetToSelection(8)',
category = 'selection', order = 28,},
category = 'selection', order = 107 },
['append_group9'] = {action = 'UI_Lua import("/lua/ui/game/selection.lua").AppendSetToSelection(9)',
category = 'selection', order = 29,},
category = 'selection', order = 108 },
['append_group0'] = {action = 'UI_Lua import("/lua/ui/game/selection.lua").AppendSetToSelection(0)',
category = 'selection', order = 30,},
category = 'selection', order = 109 },

['add_selection_to_selection_set1'] = {action = 'UI_Lua import("/lua/ui/game/selection.lua").AppendSelectionToSet(1)',
category = 'selection', order = 110 },
['add_selection_to_selection_set2'] = {action = 'UI_Lua import("/lua/ui/game/selection.lua").AppendSelectionToSet(2)',
category = 'selection', order = 111 },
['add_selection_to_selection_set3'] = {action = 'UI_Lua import("/lua/ui/game/selection.lua").AppendSelectionToSet(3)',
category = 'selection', order = 112 },
['add_selection_to_selection_set4'] = {action = 'UI_Lua import("/lua/ui/game/selection.lua").AppendSelectionToSet(4)',
category = 'selection', order = 113 },
['add_selection_to_selection_set5'] = {action = 'UI_Lua import("/lua/ui/game/selection.lua").AppendSelectionToSet(5)',
category = 'selection', order = 114 },
['add_selection_to_selection_set6'] = {action = 'UI_Lua import("/lua/ui/game/selection.lua").AppendSelectionToSet(6)',
category = 'selection', order = 115 },
['add_selection_to_selection_set7'] = {action = 'UI_Lua import("/lua/ui/game/selection.lua").AppendSelectionToSet(7)',
category = 'selection', order = 116 },
['add_selection_to_selection_set8'] = {action = 'UI_Lua import("/lua/ui/game/selection.lua").AppendSelectionToSet(8)',
category = 'selection', order = 117 },
['add_selection_to_selection_set9'] = {action = 'UI_Lua import("/lua/ui/game/selection.lua").AppendSelectionToSet(9)',
category = 'selection', order = 118 },
['add_selection_to_selection_set0'] = {action = 'UI_Lua import("/lua/ui/game/selection.lua").AppendSelectionToSet(0)',
category = 'selection', order = 119 },

['combine_and_select_with_selection_set1'] = {action = 'UI_Lua import("/lua/ui/game/selection.lua").CombineSelectionAndSet(1)',
category = 'selection', order = 120 },
['combine_and_select_with_selection_set2'] = {action = 'UI_Lua import("/lua/ui/game/selection.lua").CombineSelectionAndSet(2)',
category = 'selection', order = 121 },
['combine_and_select_with_selection_set3'] = {action = 'UI_Lua import("/lua/ui/game/selection.lua").CombineSelectionAndSet(3)',
category = 'selection', order = 122 },
['combine_and_select_with_selection_set4'] = {action = 'UI_Lua import("/lua/ui/game/selection.lua").CombineSelectionAndSet(4)',
category = 'selection', order = 123 },
['combine_and_select_with_selection_set5'] = {action = 'UI_Lua import("/lua/ui/game/selection.lua").CombineSelectionAndSet(5)',
category = 'selection', order = 124 },
['combine_and_select_with_selection_set6'] = {action = 'UI_Lua import("/lua/ui/game/selection.lua").CombineSelectionAndSet(6)',
category = 'selection', order = 125 },
['combine_and_select_with_selection_set7'] = {action = 'UI_Lua import("/lua/ui/game/selection.lua").CombineSelectionAndSet(7)',
category = 'selection', order = 126 },
['combine_and_select_with_selection_set8'] = {action = 'UI_Lua import("/lua/ui/game/selection.lua").CombineSelectionAndSet(8)',
category = 'selection', order = 127 },
['combine_and_select_with_selection_set9'] = {action = 'UI_Lua import("/lua/ui/game/selection.lua").CombineSelectionAndSet(9)',
category = 'selection', order = 128 },
['combine_and_select_with_selection_set0'] = {action = 'UI_Lua import("/lua/ui/game/selection.lua").CombineSelectionAndSet(0)',
category = 'selection', order = 129 },

['fac_group1'] = {action = 'UI_Lua import("/lua/ui/game/selection.lua").FactorySelection(1)',
category = 'selection', order = 31,},
['fac_group2'] = {action = 'UI_Lua import("/lua/ui/game/selection.lua").FactorySelection(2)',
Expand Down