Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions lua/keymap/debugKeyActions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,27 @@ local keyActionsDebugAI = {
action = 'UI_Lua import("/lua/ui/game/aichunktemplates.lua").AddUnitSelectionToEmptyChunkTemplate(32)',
category = 'ai'
},

['test_camera_angle_01'] = {
action = 'UI_Lua import("/lua/keymap/misckeyactions.lua").TestCameraAngle1(370)',
category = 'debug'
},
['test_camera_angle_02'] = {
action = 'UI_Lua import("/lua/keymap/misckeyactions.lua").TestCameraAngle1(470)',
category = 'debug'
},
['test_camera_angle_03'] = {
action = 'UI_Lua import("/lua/keymap/misckeyactions.lua").TestCameraAngle1(570)',
category = 'debug'
},
['test_camera_angle_04'] = {
action = 'UI_Lua import("/lua/keymap/misckeyactions.lua").TestCameraAngle1(670)',
category = 'debug'
},
['test_camera_angle_05'] = {
action = 'UI_Lua import("/lua/keymap/misckeyactions.lua").TestCameraAngle1(770)',
category = 'debug'
},
}

---@type table<string, UIKeyAction>
Expand Down
15 changes: 15 additions & 0 deletions lua/keymap/misckeyactions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -692,4 +692,19 @@ SelectCommander = function(zoomTo)
elseif zoomTo then
UIZoomTo(selectedUnits, 0)
end
end

function TestCameraAngle1(zoom)

-- camera in bottom right corner of Seton's Clutch

ConExecute("sc_VerticalSync 0")
ConExecute("cam_free 0")
ConExecute("sc_FrameTimeClamp 1")

local camera = GetCamera("WorldCamera")
local settings = camera:SaveSettings()
settings.Focus = Vector(230, 26, 860)
settings.Zoom = zoom
camera:RestoreSettings(settings)
end
19 changes: 18 additions & 1 deletion lua/proptree.lua
Original file line number Diff line number Diff line change
Expand Up @@ -268,12 +268,29 @@ Tree = Class(Prop) {
end,
}

local id = 0

---@class TreeGroup : Prop
TreeGroup = Class(Prop) {

IsTree = true,
IsTreeGroup = true,


OnCreate = function(self)
Prop.OnCreate(self)

-- break half of all trees for testing
ForkThread(
function()
WaitTicks(1)
id = id + 1
if math.mod(id, 2) == 0 then
self:Breakup()
end
end
)
end,

--- Break when colliding with a projectile of some sort
---@param self TreeGroup
---@param other string
Expand Down
8 changes: 7 additions & 1 deletion lua/system/blueprints-props.lua
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,9 @@ local function ProcessLOD(prop)
local sz = prop.SizeZ or 1

-- give more emphasis to the x / z value as that is easier to see in the average camera angle
local isTreeLike = prop.ScriptClass == 'Tree' or prop.ScriptClass == 'TreeGroup'
local weighted = 0.40 * sx + 0.2 * sy + 0.4 * sz
if prop.ScriptClass == 'Tree' or prop.ScriptClass == 'TreeGroup' then
if isTreeLike then
weighted = 2.6
end

Expand All @@ -132,6 +133,11 @@ local function ProcessLOD(prop)

-- sanitize the value
data.LODCutoff = MathFloor(LODCutoff / 10 + 1) * 10

if isTreeLike then
-- log the values to screen
LOG(prop.Interface.HelpText, k, data.LODCutoff)
end
end
end
end
Expand Down