Addressed feedback

This commit is contained in:
Sam
2022-02-12 20:52:01 -05:00
parent 49e8803ee0
commit c77270b799
10 changed files with 120 additions and 63 deletions

View File

@ -1,4 +1,4 @@
use crate::sys::agent::ReadData;
use crate::sys::agent::{AgentData, ReadData};
use common::{
comp::{buff::BuffKind, Alignment, Pos},
consts::GRAVITY,
@ -70,3 +70,12 @@ pub fn aim_projectile(speed: f32, pos: Vec3<f32>, tgt: Vec3<f32>) -> Option<Dir>
pub fn get_entity_by_id(id: u64, read_data: &ReadData) -> Option<EcsEntity> {
read_data.uid_allocator.retrieve_entity_internal(id)
}
impl<'a> AgentData<'a> {
pub fn has_buff(&self, read_data: &ReadData, buff: BuffKind) -> bool {
read_data
.buffs
.get(*self.entity)
.map_or(false, |b| b.kinds.contains_key(&buff))
}
}