added distance multiplier as option

This commit is contained in:
Chr1Z93 2023-11-24 15:32:09 +01:00
parent 5ea2fbb2b8
commit 6748f9b197
3 changed files with 38 additions and 8 deletions

View File

@ -1 +1 @@
{"claims":{"Black":[],"Blue":[],"Brown":[],"Green":[],"Grey":[],"Orange":[],"Pink":[],"Purple":[],"Red":[],"Teal":[],"White":[],"Yellow":[]},"pitch":[],"visibility":{"Black":{"full":false,"play":false},"Blue":{"full":false,"play":false},"Brown":{"full":false,"play":false},"Green":{"full":false,"play":false},"Grey":{"full":false,"play":false},"Orange":{"full":false,"play":false},"Pink":{"full":false,"play":false},"Purple":{"full":false,"play":false},"Red":{"full":false,"play":false},"Teal":{"full":false,"play":false},"White":{"full":false,"play":false},"Yellow":{"full":false,"play":false}}}
{"claims":{"Black":[],"Blue":[],"Brown":[],"Green":[],"Grey":[],"Orange":[],"Pink":[],"Purple":[],"Red":[],"Teal":[],"White":[],"Yellow":[]},"distance":[],"pitch":[],"visibility":{"Black":{"full":false,"play":false},"Blue":{"full":false,"play":false},"Brown":{"full":false,"play":false},"Green":{"full":false,"play":false},"Grey":{"full":false,"play":false},"Orange":{"full":false,"play":false},"Pink":{"full":false,"play":false},"Purple":{"full":false,"play":false},"Red":{"full":false,"play":false},"Teal":{"full":false,"play":false},"White":{"full":false,"play":false},"Yellow":{"full":false,"play":false}}}

View File

@ -66,6 +66,7 @@ local settingsOpenForColor
local visibility = {}
local claims = {}
local pitch = {}
local distance = {}
---------------------------------------------------------
-- save/load functionality
@ -75,7 +76,8 @@ function onSave()
return JSON.encode({
visibility = visibility,
claims = claims,
pitch = pitch
pitch = pitch,
distance = distance
})
end
@ -85,6 +87,7 @@ function onLoad(savedData)
visibility = loadedData.visibility
claims = loadedData.claims
pitch = loadedData.pitch
distance = loadedData.distance
else
local allColors = Player.getColors()
@ -346,6 +349,9 @@ function loadCamera(player, index)
-- set pitch to default if not edited
lookHere.pitch = pitch[player.color] or 75
-- update distance based on selected multiplier
lookHere.distance = lookHere.distance * (distance[player.color] or 100) / 100
-- delay is to account for colorswap
Wait.frames(function() player.lookAt(lookHere) end, 2)
end
@ -366,8 +372,9 @@ function loadDefaultSettings(player)
claims[player.color][color] = (player.color == color)
end
-- reset pitch for that player
-- reset pitch/distance for that player
pitch[player.color] = nil
distance[player.color] = nil
-- update the UI accordingly
updateSettingsUI(player)
@ -389,15 +396,21 @@ function toggleSettings(player)
end
end
-- called by the slider
-- called by the navigation overlay options
function updatePitch(player, number)
pitch[player.color] = number
end
-- called by the navigation overlay options
function updateDistance(player, number)
distance[player.color] = number
end
-- updates the settings UI for the provided player
function updateSettingsUI(player)
-- update the slider
-- update the sliders
UI.setAttribute("sliderPitch", "value", pitch[player.color] or 75)
UI.setAttribute("sliderDistance", "value", distance[player.color] or 100)
-- update the claims
local matColorList = { "White", "Orange", "Green", "Red" }

View File

@ -21,7 +21,7 @@
fontSize="20"
font="font_teutonic-arkham"/>
<Cell class="claim"
tooltip="Clicking this seat in the navigation overlay will now only swap the playercolor for you."
tooltip="Clicking this seat in the navigation overlay&#xA;will now only swap the playercolor for you."
tooltipPosition="Right" />
<!-- buttons at the bottom -->
@ -68,7 +68,7 @@
<TableLayout id="navPanelSettings"
active="false"
width="300"
height="335"
height="380"
color="#000000"
outlineSize="2 2"
outline="grey"
@ -103,7 +103,24 @@
minValue="0"
maxValue="89"
value="75"
tooltip="This controls the camera pitch ('nodding your head')."
tooltip="This controls the camera pitch&#xA;('nodding your head')."
tooltipPosition="Right"/>
</Cell>
</Row>
<!-- Option: Custom distance -->
<Row class="nav_option-text">
<Cell class="nav_option-text">
<Text class="nav_option-header">Viewing distance (relative):</Text>
</Cell>
<Cell class="nav_option-button">
<Slider id="sliderDistance"
onValueChanged="797ede/updateDistance"
wholeNumbers="true"
minValue="50"
maxValue="200"
value="100"
tooltip="This controls the camera distance&#xA;(from 50% to 200% of the default settings)."
tooltipPosition="Right"/>
</Cell>
</Row>