Fix Fuel's field visibility, add it to the cutter

*Now* the fuel change events will work (and compile).
This commit is contained in:
2025-08-28 15:35:46 -05:00
parent ed2e1e75ef
commit f470687494
3 changed files with 7 additions and 3 deletions

View File

@@ -33,7 +33,7 @@ pub mod consumables {
use bevy::prelude::*;
#[derive(Component)]
pub struct Fuel(u32);
pub struct Fuel(pub u32);
#[derive(Event)]
pub struct FuelChanged;

View File

@@ -2,7 +2,10 @@ use bevy::{color::palettes::css::*, prelude::*, window::WindowResolution};
use bevy_inspector_egui::{bevy_egui::EguiPlugin, quick::WorldInspectorPlugin};
use crate::{
game::machines::{CuttingMachine, FlippingMachine, RotatingMachine, TransposingMachine},
game::{
consumables::Fuel,
machines::{CuttingMachine, FlippingMachine, RotatingMachine, TransposingMachine},
},
resources::UiTheme,
widgets::SpawnUi,
};
@@ -47,6 +50,7 @@ fn dummy_machines(mut commands: Commands) {
commands
.spawn((
CuttingMachine,
Fuel(10),
Sprite::from_color(RED, Vec2::splat(40.0)),
Transform::from_translation(Vec3::new(-40.0, 40.0, 0.0)),
Pickable::default(),

View File

@@ -12,7 +12,7 @@ impl SpawnUi for CuttingMachine {
commands.entity(base_entity).with_children(|commands| {
// Left panel. For fuel or machine stats or whatever.
// TODO: Pass along target machine, not the UI's root entity.
commands.spawn(FuelGauge::bundle(Entity::PLACEHOLDER));
commands.spawn(FuelGauge::bundle(machine_id));
// Center panel (placeholder for the Card view)
commands.spawn((