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

View File

@ -21,7 +21,7 @@
fontSize="20" fontSize="20"
font="font_teutonic-arkham"/> font="font_teutonic-arkham"/>
<Cell class="claim" <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" /> tooltipPosition="Right" />
<!-- buttons at the bottom --> <!-- buttons at the bottom -->
@ -68,7 +68,7 @@
<TableLayout id="navPanelSettings" <TableLayout id="navPanelSettings"
active="false" active="false"
width="300" width="300"
height="335" height="380"
color="#000000" color="#000000"
outlineSize="2 2" outlineSize="2 2"
outline="grey" outline="grey"
@ -103,7 +103,24 @@
minValue="0" minValue="0"
maxValue="89" maxValue="89"
value="75" 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"/> tooltipPosition="Right"/>
</Cell> </Cell>
</Row> </Row>