add dashboard indicator light for rotation stabiliser

This commit is contained in:
yuni 2024-05-15 04:43:33 +02:00
parent d1a906b487
commit e07ad4d236
4 changed files with 163 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

View file

@ -92,6 +92,8 @@ impl Plugin for HudPlugin {
enum Dashboard { enum Dashboard {
Leak, Leak,
Flashlight, Flashlight,
RotationStabiliser,
CruiseControl,
} }
#[derive(Component, Debug, Copy, Clone)] #[derive(Component, Debug, Copy, Clone)]
@ -433,6 +435,8 @@ pub fn setup(
// Car-Dashboard-Style icons // Car-Dashboard-Style icons
let dashboard_icon_size = 64.0; let dashboard_icon_size = 64.0;
let flashlight_visibility = bool2vis(visibility == Visibility::Visible && settings.flashlight_active); let flashlight_visibility = bool2vis(visibility == Visibility::Visible && settings.flashlight_active);
let rotation_stabiliser_visibility = bool2vis(visibility == Visibility::Visible && !settings.rotation_stabilizer_active);
let cruise_control_visibility = bool2vis(visibility == Visibility::Visible && settings.cruise_control_active);
let style_dashboard = Style { let style_dashboard = Style {
width: Val::Px(dashboard_icon_size), width: Val::Px(dashboard_icon_size),
height: Val::Px(dashboard_icon_size), height: Val::Px(dashboard_icon_size),
@ -472,6 +476,24 @@ pub fn setup(
}, },
Dashboard::Leak, Dashboard::Leak,
)); ));
builder.spawn((
ImageBundle {
image: UiImage::new(asset_server.load("sprites/dashboard_rotation_stabiliser.png")),
style: style_dashboard.clone(),
visibility: rotation_stabiliser_visibility,
..Default::default()
},
Dashboard::RotationStabiliser,
));
builder.spawn((
ImageBundle {
image: UiImage::new(asset_server.load("sprites/dashboard_cruise_control.png")),
style: style_dashboard.clone(),
visibility: cruise_control_visibility,
..Default::default()
},
Dashboard::CruiseControl,
));
}); });
// Add Speedometer // Add Speedometer
@ -634,6 +656,12 @@ fn update_dashboard(
Dashboard::Leak => { Dashboard::Leak => {
suit.integrity < 0.5 suit.integrity < 0.5
} }
Dashboard::RotationStabiliser => {
!settings.rotation_stabilizer_active
}
Dashboard::CruiseControl => {
settings.cruise_control_active
}
}); });
} }
} }

View file

@ -0,0 +1,133 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="256"
height="256"
viewBox="0 0 67.733334 67.733334"
version="1.1"
id="svg1"
inkscape:version="1.3.2 (091e20ef0f, 2023-11-25, custom)"
sodipodi:docname="dashboard_rotation_stabiliser.svg"
xml:space="preserve"
inkscape:export-filename="../../assets/sprites/dashboard_rotation_stabiliser.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"><sodipodi:namedview
id="namedview1"
pagecolor="#000000"
bordercolor="#252525"
borderopacity="1"
inkscape:showpageshadow="0"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#000000"
inkscape:document-units="px"
inkscape:zoom="1.6542969"
inkscape:cx="211.87249"
inkscape:cy="197.9693"
inkscape:window-width="2880"
inkscape:window-height="1673"
inkscape:window-x="0"
inkscape:window-y="92"
inkscape:window-maximized="1"
inkscape:current-layer="g227"
showgrid="true"
inkscape:export-bgcolor="#00000000"><inkscape:grid
id="grid1"
units="px"
originx="0"
originy="0"
spacingx="0.26458334"
spacingy="0.26458334"
empcolor="#0099e5"
empopacity="0.30196078"
color="#0099e5"
opacity="0.14901961"
empspacing="8"
dotted="false"
gridanglex="30"
gridanglez="30"
visible="true" /></sodipodi:namedview><defs
id="defs1"><marker
style="overflow:visible"
id="ConcaveTriangle"
refX="0"
refY="0"
orient="auto-start-reverse"
inkscape:stockid="Concave triangle arrow"
markerWidth="0.5"
markerHeight="0.5"
viewBox="0 0 1 1"
inkscape:isstock="true"
inkscape:collect="always"
preserveAspectRatio="xMidYMid"><path
transform="scale(0.7)"
d="M -2,-4 9,0 -2,4 c 2,-2.33 2,-5.66 0,-8 z"
style="fill:context-stroke;fill-rule:evenodd;stroke:none"
id="path7" /></marker><filter
style="color-interpolation-filters:sRGB"
id="filter1"
inkscape:label="bloom"
x="-0.1605499"
y="-0.1605499"
width="1.3210998"
height="1.3210998"><feConvolveMatrix
order="1 1"
kernelMatrix="1.0000000 "
id="feConvolveMatrix1"
result="result1"
bias="0.090000000000000024"
preserveAlpha="true"
edgeMode="none"
divisor="0" /><feGaussianBlur
stdDeviation="2"
id="feGaussianBlur1"
in="SourceGraphic" /><feComposite
id="feComposite1"
operator="arithmetic"
k1="1"
k2="0.99999999999999922"
k3="1"
k4="0"
in2="result1" /></filter></defs><g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"><g
id="g227"
style="filter:url(#filter1)"><circle
style="fill:none;stroke:#007e43;stroke-width:2.64583336;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:1"
id="path1"
cx="33.848091"
cy="33.848091"
r="19.068579"
inkscape:label="circle" /><path
style="fill:none;stroke:#007e43;stroke-width:2.64583;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#ConcaveTriangle)"
id="circle2"
inkscape:label="circle"
sodipodi:type="arc"
sodipodi:cx="33.848091"
sodipodi:cy="33.848091"
sodipodi:rx="25.4"
sodipodi:ry="25.4"
sodipodi:start="2.6179939"
sodipodi:end="3.8397244"
sodipodi:open="true"
sodipodi:arc-type="arc"
d="M 11.851046,46.54809 A 25.4,25.4 0 0 1 14.390563,17.521285" /><path
style="fill:none;stroke:#007e43;stroke-width:2.64583;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#ConcaveTriangle)"
id="path2"
inkscape:label="circle"
sodipodi:type="arc"
sodipodi:cx="33.848091"
sodipodi:cy="33.848091"
sodipodi:rx="25.4"
sodipodi:ry="25.4"
sodipodi:start="5.7595865"
sodipodi:end="0.6981317"
sodipodi:open="true"
sodipodi:arc-type="arc"
d="M 55.845136,21.148091 A 25.4,25.4 0 0 1 53.30562,50.174896" /></g></g></svg>

After

Width:  |  Height:  |  Size: 4.6 KiB

View file

@ -89,6 +89,7 @@ pub struct Settings {
pub is_zooming: bool, pub is_zooming: bool,
pub third_person: bool, pub third_person: bool,
pub rotation_stabilizer_active: bool, pub rotation_stabilizer_active: bool,
pub cruise_control_active: bool,
pub shadows_sun: bool, pub shadows_sun: bool,
pub shadows_pointlights: bool, pub shadows_pointlights: bool,
pub shadowmap_resolution: usize, pub shadowmap_resolution: usize,
@ -215,6 +216,7 @@ impl Default for Settings {
is_zooming: false, is_zooming: false,
third_person: true, third_person: true,
rotation_stabilizer_active: true, rotation_stabilizer_active: true,
cruise_control_active: true,
shadows_sun: true, shadows_sun: true,
shadows_pointlights: false, shadows_pointlights: false,
shadowmap_resolution: 2048, shadowmap_resolution: 2048,