radioactivity icon on dashboard when near jupiter (with no meaning yet)

This commit is contained in:
yuni 2024-05-15 05:21:39 +02:00
parent a07955d635
commit 7ccc09c7a0
3 changed files with 128 additions and 2 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

View file

@ -94,6 +94,7 @@ enum Dashboard {
Flashlight, Flashlight,
RotationStabiliser, RotationStabiliser,
CruiseControl, CruiseControl,
Radioactivity,
} }
#[derive(Component, Debug, Copy, Clone)] #[derive(Component, Debug, Copy, Clone)]
@ -494,6 +495,15 @@ pub fn setup(
}, },
Dashboard::CruiseControl, Dashboard::CruiseControl,
)); ));
builder.spawn((
ImageBundle {
image: UiImage::new(asset_server.load("sprites/dashboard_radioactivity.png")),
style: style_dashboard.clone(),
visibility: Visibility::Hidden,
..Default::default()
},
Dashboard::Radioactivity,
));
}); });
// Add Speedometer // Add Speedometer
@ -638,7 +648,8 @@ pub fn setup(
fn update_dashboard( fn update_dashboard(
timer: ResMut<FPSUpdateTimer>, timer: ResMut<FPSUpdateTimer>,
mut q_dashboard: Query<(&mut Visibility, &Dashboard)>, mut q_dashboard: Query<(&mut Visibility, &Dashboard)>,
q_player: Query<&actor::Suit, With<actor::Player>>, id2pos: Res<game::Id2Pos>,
q_player: Query<(&actor::Suit, &Position), With<actor::Player>>,
settings: Res<Settings>, settings: Res<Settings>,
) { ) {
if !settings.hud_active || !timer.0.just_finished() { if !settings.hud_active || !timer.0.just_finished() {
@ -646,7 +657,7 @@ fn update_dashboard(
} }
let player = q_player.get_single(); let player = q_player.get_single();
if player.is_err() { return; } if player.is_err() { return; }
let suit = player.unwrap(); let (suit, pos) = player.unwrap();
for (mut vis, icon) in &mut q_dashboard { for (mut vis, icon) in &mut q_dashboard {
*vis = bool2vis(match icon { *vis = bool2vis(match icon {
@ -662,6 +673,13 @@ fn update_dashboard(
Dashboard::CruiseControl => { Dashboard::CruiseControl => {
settings.cruise_control_active settings.cruise_control_active
} }
Dashboard::Radioactivity => {
if let Some(pos_jupiter) = id2pos.0.get(cmd::ID_JUPITER) {
pos_jupiter.distance(pos.0) < 140_000_000.0
} else {
false
}
}
}); });
} }
} }

View file

@ -0,0 +1,108 @@
<?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_radioactivity.svg"
xml:space="preserve"
inkscape:export-filename="../../assets/sprites/dashboard_leak.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="2.3395291"
inkscape:cx="58.131356"
inkscape:cy="123.31541"
inkscape:window-width="2880"
inkscape:window-height="1765"
inkscape:window-x="0"
inkscape:window-y="0"
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"><filter
style="color-interpolation-filters:sRGB"
id="filter1"
inkscape:label="bloom"
x="-0.20615604"
y="-0.23572759"
width="1.4123121"
height="1.4714552"><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)"><path
id="path1"
style="fill:#a6720b;stroke-width:2.64583;stroke-linecap:round;stroke-linejoin:round"
d="m 57.150003,33.866669 c 0,8.462523 -4.59159,16.258741 -11.992506,20.362487 l -9.229858,-16.645624 2.172363,-3.716863 z"
sodipodi:nodetypes="ccccc" /><path
id="path2"
clip-path="none"
style="fill:#a6720b;stroke-width:2.64583;stroke-linecap:round;stroke-linejoin:round"
d="M 22.225001,54.030628 C 15.021112,49.871461 10.583334,42.185003 10.583334,33.866669 l 19.050001,0 2.007676,3.854952 z"
sodipodi:nodetypes="ccccc" /><circle
style="fill:none;fill-opacity:1;stroke:#a6720b;stroke-width:2.64583;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:1"
id="circle7"
cx="33.866669"
cy="33.866669"
r="4.2333336" /><path
id="path3"
style="fill:#a6720b;stroke-width:2.64583;stroke-linecap:round;stroke-linejoin:round"
d="m 22.225001,13.702709 c 7.203889,-4.1591673 16.079447,-4.1591669 23.283336,10e-7 l -9.525001,16.497784 -4.240635,-0.01264 z"
sodipodi:nodetypes="ccccc" /><circle
style="fill:none;fill-opacity:1;stroke:#a6720b;stroke-width:2.64583336;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:1"
id="path4"
cx="33.866669"
cy="33.866669"
r="22.408022" /></g></g></svg>

After

Width:  |  Height:  |  Size: 4 KiB