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 field | Struct field | Notes |
|---|---|---|
id | id | Required |
name | name | Required |
group | group | |
icon | icon | |
model | model | |
behaviour | behaviour | |
col | collision_mode | 0–3 |
health | health | |
healthchange | health_change | |
mat | material | |
fx | fx | Blitz3D FX flags |
scale / x / y / z | scale | |
color / r / g / b | color | |
alpha | alpha | |
shine | shininess | |
swayspeed | sway_speed | |
swaypower | sway_power | |
maxweight | max_weight | |
state | state | |
align | align | |
autofade | auto_fade | |
detailtex | detail_tex | |
searchratio / findratio | search_ratio | |
growtime | grow_time | |
spawn | spawn | |
find | harvest | Multiple values |
script | script | Block |
description | description | Block |
editor | in_editor |
Fields§
§id: u32Unique numeric identifier.
name: StringDisplay name.
group: StringGroup / 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: ObjectScale3D model scale.
color: Option<[u8; 3]>RGB colour tint.
fx: Option<u32>Blitz3D FX flags.
alpha: f32Alpha transparency (0–1).
shininess: Option<f32>Shininess / specular intensity.
auto_fade: u32Auto-fade distance in Blitz3D units.
detail_tex: Option<String>Detail texture path.
collision_mode: CollisionModeCollision mode.
material: StringMaterial type string (e.g. "wood", "stone", "flesh").
health: f32Maximum hit points.
health_change: Option<f32>Health change per interaction tick.
sway_speed: Option<f32>Object sway speed (animation).
sway_power: f32Object sway power (animation amplitude).
max_weight: u32Maximum inventory weight this object can store.
state: ObjectStateState mode (random animation offset or fixed values).
align: u32Alignment mode (0 = normal, 1 = water surface, 2 = water pipe).
search_ratio: f32Item search / find ratio.
grow_time: u32Days 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: boolWhether this object appears in the map editor.
Implementations§
Source§impl ObjectDef
impl ObjectDef
Sourcepub fn from_inf_fields(fields: &HashMap<String, Vec<String>>) -> Option<Self>
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.
Sourcepub fn with_script(self, script: Option<String>) -> Self
pub fn with_script(self, script: Option<String>) -> Self
Attach a script (builder-style).
Sourcepub fn with_description(self, description: Option<String>) -> Self
pub fn with_description(self, description: Option<String>) -> Self
Attach a description (builder-style).