pub struct EntityPreference { /* private fields */ }Expand description
Defines a preference for a specific type of unit to occupy a formation block.
Multiple preferences can be defined in priority order, so the AI will try to place the highest priority matching units first.
Implementations§
Source§impl EntityPreference
impl EntityPreference
Sourcepub fn entity(&self) -> &Entity
pub fn entity(&self) -> &Entity
The type of unit entity (infantry, cavalry, artillery, etc.).
Note: This is called EntityClass in Rome 2 and EntityDescription in Shogun 2, but represents the same concept.
Sourcepub fn entity_weight(&self) -> &EntityWeight
pub fn entity_weight(&self) -> &EntityWeight
Weight class of the unit (light, medium, heavy, etc.). Introduced in Rome 2.
Sourcepub fn entity_class(&self) -> &String
pub fn entity_class(&self) -> &String
Entity class string identifier (used in Three Kingdoms).
Source§impl EntityPreference
impl EntityPreference
Sourcepub fn priority_mut(&mut self) -> &mut f32
pub fn priority_mut(&mut self) -> &mut f32
Priority for this entity type (higher = more preferred).
Sourcepub fn entity_mut(&mut self) -> &mut Entity
pub fn entity_mut(&mut self) -> &mut Entity
The type of unit entity (infantry, cavalry, artillery, etc.).
Note: This is called EntityClass in Rome 2 and EntityDescription in Shogun 2, but represents the same concept.
Sourcepub fn entity_weight_mut(&mut self) -> &mut EntityWeight
pub fn entity_weight_mut(&mut self) -> &mut EntityWeight
Weight class of the unit (light, medium, heavy, etc.). Introduced in Rome 2.
Sourcepub fn entity_class_mut(&mut self) -> &mut String
pub fn entity_class_mut(&mut self) -> &mut String
Entity class string identifier (used in Three Kingdoms).
Source§impl EntityPreference
impl EntityPreference
Sourcepub fn set_priority(&mut self, val: f32) -> &mut Self
pub fn set_priority(&mut self, val: f32) -> &mut Self
Priority for this entity type (higher = more preferred).
Sourcepub fn set_entity(&mut self, val: Entity) -> &mut Self
pub fn set_entity(&mut self, val: Entity) -> &mut Self
The type of unit entity (infantry, cavalry, artillery, etc.).
Note: This is called EntityClass in Rome 2 and EntityDescription in Shogun 2, but represents the same concept.
Sourcepub fn set_entity_weight(&mut self, val: EntityWeight) -> &mut Self
pub fn set_entity_weight(&mut self, val: EntityWeight) -> &mut Self
Weight class of the unit (light, medium, heavy, etc.). Introduced in Rome 2.
Sourcepub fn set_entity_class(&mut self, val: String) -> &mut Self
pub fn set_entity_class(&mut self, val: String) -> &mut Self
Entity class string identifier (used in Three Kingdoms).
Trait Implementations§
Source§impl Clone for EntityPreference
impl Clone for EntityPreference
Source§fn clone(&self) -> EntityPreference
fn clone(&self) -> EntityPreference
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for EntityPreference
impl Debug for EntityPreference
Source§impl Default for EntityPreference
impl Default for EntityPreference
Source§fn default() -> EntityPreference
fn default() -> EntityPreference
Source§impl<'de> Deserialize<'de> for EntityPreference
impl<'de> Deserialize<'de> for EntityPreference
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for EntityPreference
impl PartialEq for EntityPreference
Source§impl Serialize for EntityPreference
impl Serialize for EntityPreference
impl StructuralPartialEq for EntityPreference
Auto Trait Implementations§
impl Freeze for EntityPreference
impl RefUnwindSafe for EntityPreference
impl Send for EntityPreference
impl Sync for EntityPreference
impl Unpin for EntityPreference
impl UnsafeUnpin for EntityPreference
impl UnwindSafe for EntityPreference
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.