ammo system

* heads have abilities
* health and ammo shows in ui
This commit is contained in:
2025-04-02 01:35:02 +08:00
parent 8187eb58a9
commit 01e6e944d3
13 changed files with 360 additions and 234 deletions

View File

@@ -1,7 +1,7 @@
use super::AimState;
use crate::{
GameState,
backpack::BackpackHead,
backpack::UiHeadState,
heads_ui::HeadsImages,
loading_assets::UIAssets,
npc::{Hitpoints, NpcHead},
@@ -18,7 +18,7 @@ struct HeadDamage;
#[derive(Resource, Default, PartialEq)]
struct TargetUi {
head: Option<BackpackHead>,
head: Option<UiHeadState>,
}
pub fn plugin(app: &mut App) {
@@ -150,7 +150,7 @@ fn sync(
let mut new_state = None;
if let Some(e) = aim.target {
if let Ok((hp, head)) = target_data.get(e) {
new_state = Some(BackpackHead {
new_state = Some(UiHeadState {
head: head.0,
health: hp.health(),
ammo: 1.,