pub struct AmorphousEntity {Show 18 fields
pub name: String,
pub position: Vec3,
pub binding_field: ForceField,
pub glyph_ids: Vec<GlyphId>,
pub formation: Vec<Vec3>,
pub formation_chars: Vec<char>,
pub formation_colors: Vec<Vec4>,
pub hp: f32,
pub max_hp: f32,
pub entity_mass: f32,
pub entity_temperature: f32,
pub entity_entropy: f32,
pub cohesion: f32,
pub pulse_rate: f32,
pub pulse_depth: f32,
pub age: f32,
pub tags: Vec<String>,
pub despawn_requested: bool,
}Expand description
An amorphous visual entity held together by binding forces.
Fields§
§name: String§position: Vec3§binding_field: ForceFieldThe core force holding the entity together. Usually Gravity.
glyph_ids: Vec<GlyphId>IDs of glyphs that compose this entity.
formation: Vec<Vec3>Target positions (relative to entity center) for each glyph.
formation_chars: Vec<char>Character assigned to each formation slot.
formation_colors: Vec<Vec4>Color assigned to each formation slot.
hp: f32§max_hp: f32§entity_mass: f32§entity_temperature: f32§entity_entropy: f32§cohesion: f320.0 = fully dispersed, 1.0 = tight formation. Driven by hp/max_hp: cohesion = (hp / max_hp).sqrt()
pulse_rate: f32The entity’s pulse function (breathing/heartbeat rhythm).
pulse_depth: f32§age: f32Arbitrary string tags for filtering/grouping.
despawn_requested: boolSet to true to remove the entity on the next GC pass.
Implementations§
Source§impl AmorphousEntity
impl AmorphousEntity
pub fn new(name: impl Into<String>, position: Vec3) -> Self
Sourcepub fn update_cohesion(&mut self)
pub fn update_cohesion(&mut self)
Update cohesion based on current HP.
Sourcepub fn tick(&mut self, dt: f32, _time: f32) -> bool
pub fn tick(&mut self, dt: f32, _time: f32) -> bool
Advance entity time. Returns true if the entity should be removed (hp <= 0).
Sourcepub fn take_damage(&mut self, amount: f32)
pub fn take_damage(&mut self, amount: f32)
Apply damage to this entity.
Trait Implementations§
Source§impl Clone for AmorphousEntity
impl Clone for AmorphousEntity
Source§fn clone(&self) -> AmorphousEntity
fn clone(&self) -> AmorphousEntity
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for AmorphousEntity
impl RefUnwindSafe for AmorphousEntity
impl Send for AmorphousEntity
impl Sync for AmorphousEntity
impl Unpin for AmorphousEntity
impl UnsafeUnpin for AmorphousEntity
impl UnwindSafe for AmorphousEntity
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.