Fix Fuel's field visibility, add it to the cutter
*Now* the fuel change events will work (and compile).
This commit is contained in:
@@ -33,7 +33,7 @@ pub mod consumables {
|
|||||||
use bevy::prelude::*;
|
use bevy::prelude::*;
|
||||||
|
|
||||||
#[derive(Component)]
|
#[derive(Component)]
|
||||||
pub struct Fuel(u32);
|
pub struct Fuel(pub u32);
|
||||||
|
|
||||||
#[derive(Event)]
|
#[derive(Event)]
|
||||||
pub struct FuelChanged;
|
pub struct FuelChanged;
|
||||||
|
|||||||
@@ -2,7 +2,10 @@ use bevy::{color::palettes::css::*, prelude::*, window::WindowResolution};
|
|||||||
use bevy_inspector_egui::{bevy_egui::EguiPlugin, quick::WorldInspectorPlugin};
|
use bevy_inspector_egui::{bevy_egui::EguiPlugin, quick::WorldInspectorPlugin};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
game::machines::{CuttingMachine, FlippingMachine, RotatingMachine, TransposingMachine},
|
game::{
|
||||||
|
consumables::Fuel,
|
||||||
|
machines::{CuttingMachine, FlippingMachine, RotatingMachine, TransposingMachine},
|
||||||
|
},
|
||||||
resources::UiTheme,
|
resources::UiTheme,
|
||||||
widgets::SpawnUi,
|
widgets::SpawnUi,
|
||||||
};
|
};
|
||||||
@@ -47,6 +50,7 @@ fn dummy_machines(mut commands: Commands) {
|
|||||||
commands
|
commands
|
||||||
.spawn((
|
.spawn((
|
||||||
CuttingMachine,
|
CuttingMachine,
|
||||||
|
Fuel(10),
|
||||||
Sprite::from_color(RED, Vec2::splat(40.0)),
|
Sprite::from_color(RED, Vec2::splat(40.0)),
|
||||||
Transform::from_translation(Vec3::new(-40.0, 40.0, 0.0)),
|
Transform::from_translation(Vec3::new(-40.0, 40.0, 0.0)),
|
||||||
Pickable::default(),
|
Pickable::default(),
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ impl SpawnUi for CuttingMachine {
|
|||||||
commands.entity(base_entity).with_children(|commands| {
|
commands.entity(base_entity).with_children(|commands| {
|
||||||
// Left panel. For fuel or machine stats or whatever.
|
// Left panel. For fuel or machine stats or whatever.
|
||||||
// TODO: Pass along target machine, not the UI's root entity.
|
// 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)
|
// Center panel (placeholder for the Card view)
|
||||||
commands.spawn((
|
commands.spawn((
|
||||||
|
|||||||
Reference in New Issue
Block a user