Skip to main content

ObjectDef

Struct ObjectDef 

Source
pub struct ObjectDef {
Show 29 fields pub id: u32, pub name: String, pub group: String, pub icon: Option<String>, pub model: Option<String>, pub behaviour: Option<String>, pub scale: ObjectScale, pub color: Option<[u8; 3]>, pub fx: Option<u32>, pub alpha: f32, pub shininess: Option<f32>, pub auto_fade: u32, pub detail_tex: Option<String>, pub collision_mode: CollisionMode, pub material: String, pub health: f32, pub health_change: Option<f32>, pub sway_speed: Option<f32>, pub sway_power: f32, pub max_weight: u32, pub state: ObjectState, pub align: u32, pub search_ratio: f32, pub grow_time: u32, pub spawn: Option<SpawnDef>, pub harvest: Vec<HarvestDef>, pub script: Option<String>, pub description: Option<String>, pub in_editor: bool,
}
Expand description

Full definition of a single world-object type.

Represents one entry from an objects*.inf file.

§.inf fields mapped

.inf fieldStruct fieldNotes
ididRequired
namenameRequired
groupgroup
iconicon
modelmodel
behaviourbehaviour
colcollision_mode0–3
healthhealth
healthchangehealth_change
matmaterial
fxfxBlitz3D FX flags
scale / x / y / zscale
color / r / g / bcolor
alphaalpha
shineshininess
swayspeedsway_speed
swaypowersway_power
maxweightmax_weight
statestate
alignalign
autofadeauto_fade
detailtexdetail_tex
searchratio / findratiosearch_ratio
growtimegrow_time
spawnspawn
findharvestMultiple values
scriptscriptBlock
descriptiondescriptionBlock
editorin_editor

Fields§

§id: u32

Unique numeric identifier.

§name: String

Display name.

§group: String

Group / category string (e.g. "palm", "tree", "stone", "building").

§icon: Option<String>

Path to the icon texture.

§model: Option<String>

Path to the 3D model.

§behaviour: Option<String>

Behaviour type string (e.g. "tree", "cover", "buildingsite", …).

§scale: ObjectScale

3D model scale.

§color: Option<[u8; 3]>

RGB colour tint.

§fx: Option<u32>

Blitz3D FX flags.

§alpha: f32

Alpha transparency (0–1).

§shininess: Option<f32>

Shininess / specular intensity.

§auto_fade: u32

Auto-fade distance in Blitz3D units.

§detail_tex: Option<String>

Detail texture path.

§collision_mode: CollisionMode

Collision mode.

§material: String

Material type string (e.g. "wood", "stone", "flesh").

§health: f32

Maximum hit points.

§health_change: Option<f32>

Health change per interaction tick.

§sway_speed: Option<f32>

Object sway speed (animation).

§sway_power: f32

Object sway power (animation amplitude).

§max_weight: u32

Maximum inventory weight this object can store.

§state: ObjectState

State mode (random animation offset or fixed values).

§align: u32

Alignment mode (0 = normal, 1 = water surface, 2 = water pipe).

§search_ratio: f32

Item search / find ratio.

§grow_time: u32

Days to grow to full size.

§spawn: Option<SpawnDef>

Periodic item-spawn configuration.

§harvest: Vec<HarvestDef>

Items that can be harvested from this object.

§script: Option<String>

Script code attached to this object.

§description: Option<String>

Description text for the editor / tooltip.

§in_editor: bool

Whether this object appears in the map editor.

Implementations§

Source§

impl ObjectDef

Source

pub fn from_inf_fields(fields: &HashMap<String, Vec<String>>) -> Option<Self>

Construct an ObjectDef from raw .inf fields.

Returns None if required fields (id, name) are missing.

Source

pub fn with_script(self, script: Option<String>) -> Self

Attach a script (builder-style).

Source

pub fn with_description(self, description: Option<String>) -> Self

Attach a description (builder-style).

Trait Implementations§

Source§

impl Clone for ObjectDef

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ObjectDef

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ObjectDef

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for ObjectDef

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for ObjectDef

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for ObjectDef

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.