pub struct LuaRecord;Expand description
A reference to a record in the blueprint library. Records in the “my blueprints” shelf are read-only, but records in the “game blueprints” shelf are read/write.
Implementations§
Source§impl LuaRecord
impl LuaRecord
Sourcepub fn blueprint_absolute_snapping(&self) -> bool
pub fn blueprint_absolute_snapping(&self) -> bool
If absolute snapping is enabled on this blueprint.
Sourcepub fn blueprint_description(&self) -> &str
pub fn blueprint_description(&self) -> &str
The description for this blueprint or blueprint book.
Sourcepub fn blueprint_position_relative_to_grid(&self) -> TilePosition
pub fn blueprint_position_relative_to_grid(&self) -> TilePosition
The offset from the absolute grid. nil if absolute snapping is not enabled.
Sourcepub fn blueprint_snap_to_grid(&self) -> TilePosition
pub fn blueprint_snap_to_grid(&self) -> TilePosition
The snapping grid size in this blueprint. nil if snapping is not enabled.
Sourcepub fn contents(&self) -> LuaAny
pub fn contents(&self) -> LuaAny
The contents of this BlueprintBookRecord. This is sparse array - it may have gaps, so using # will not be reliable. Use LuaRecord::contents_size or pairs() to iterate this table.
Sourcepub fn contents_size(&self) -> u16
pub fn contents_size(&self) -> u16
The highest populated index in the contents of this BlueprintBookRecord.
Sourcepub fn cost_to_build(&self) -> Vec<ItemWithQualityCount>
pub fn cost_to_build(&self) -> Vec<ItemWithQualityCount>
List of raw materials required to build this blueprint.
Sourcepub fn default_icons(&self) -> Vec<BlueprintSignalIcon>
pub fn default_icons(&self) -> Vec<BlueprintSignalIcon>
The default icons for a blueprint blueprint.
Sourcepub fn entity_filter_count(&self) -> u32
pub fn entity_filter_count(&self) -> u32
The number of entity filters this deconstruction planner has.
Sourcepub fn entity_filter_mode(&self) -> &str
pub fn entity_filter_mode(&self) -> &str
The blacklist/whitelist entity filter mode for this deconstruction planner.
Sourcepub fn entity_filters(&self) -> Vec<ItemFilter>
pub fn entity_filters(&self) -> Vec<ItemFilter>
The entity filters for this deconstruction planner. The attribute is a sparse array with the keys representing the index of the filter. All prototypes in this array must not have the "not-deconstructable" flag set and are either a cliff or marked as minable.
Sourcepub fn is_preview(&self) -> bool
pub fn is_preview(&self) -> bool
Checks if this record is in a preview state.
Sourcepub fn mapper_count(&self) -> u32
pub fn mapper_count(&self) -> u32
The current count of mappers in the upgrade item.
Sourcepub fn object_name(&self) -> &str
pub fn object_name(&self) -> &str
The class name of this object. Available even when valid is false. For LuaStruct objects it may also be suffixed with a dotted path to a member of the struct.
Sourcepub fn planner_description(&self) -> &str
pub fn planner_description(&self) -> &str
The description for this deconstruction planner or upgrade planner.
Sourcepub fn preview_icons(&self) -> Vec<BlueprintSignalIcon>
pub fn preview_icons(&self) -> Vec<BlueprintSignalIcon>
The preview icons for this record.
Sourcepub fn tile_filter_count(&self) -> u32
pub fn tile_filter_count(&self) -> u32
The number of tile filters this deconstruction planner has.
Sourcepub fn tile_filter_mode(&self) -> &str
pub fn tile_filter_mode(&self) -> &str
The blacklist/whitelist tile filter mode for this deconstruction planner.
Sourcepub fn tile_filters(&self) -> Vec<LuaAny>
pub fn tile_filters(&self) -> Vec<LuaAny>
The tile filters for this deconstruction planner. The attribute is a sparse array with the keys representing the index of the filter. Reading filters always returns an array of strings which are the tile prototype names.
Sourcepub fn tile_selection_mode(&self) -> &str
pub fn tile_selection_mode(&self) -> &str
The tile selection mode for this deconstruction planner.
Sourcepub fn trees_and_rocks_only(&self) -> bool
pub fn trees_and_rocks_only(&self) -> bool
If this deconstruction planner, is set to allow trees and rocks only.
Sourcepub fn type(&self) -> LuaRecordType
pub fn type(&self) -> LuaRecordType
The type of this blueprint record.
Sourcepub fn valid(&self) -> bool
pub fn valid(&self) -> bool
Is this object valid? This Lua object holds a reference to an object within the game engine. It is possible that the game-engine object is removed whilst a mod still holds the corresponding Lua object. If that happens, the object becomes invalid, i.e. this attribute will be false. Mods are advised to check for object validity if any change to the game state might have occurred between the creation of the Lua object and its access.
Sourcepub fn valid_for_write(&self) -> bool
pub fn valid_for_write(&self) -> bool
Is this record valid for writing? A record is invalid for write if it is a BlueprintRecord preview or if it is in the “My blueprints” shelf.
Sourcepub fn build_blueprint(
&self,
params: LuaRecordBuildBlueprintParams,
) -> Vec<LuaEntity>
pub fn build_blueprint( &self, params: LuaRecordBuildBlueprintParams, ) -> Vec<LuaEntity>
Build this blueprint at the given location.
Built entities can be come invalid between the building of the blueprint and the function returning if by_player or raise_built is used and one of those events invalidates the entity.
Sourcepub fn cancel_deconstruct_area(
&self,
params: LuaRecordCancelDeconstructAreaParams,
)
pub fn cancel_deconstruct_area( &self, params: LuaRecordCancelDeconstructAreaParams, )
Cancel deconstruct the given area with this deconstruction planner.
Sourcepub fn clear_blueprint(&self)
pub fn clear_blueprint(&self)
Clears this blueprint.
Sourcepub fn clear_deconstruction_data(&self)
pub fn clear_deconstruction_data(&self)
Clears all settings/filters on this deconstruction planner, resetting it to default values.
Sourcepub fn clear_upgrade_data(&self)
pub fn clear_upgrade_data(&self)
Clears all settings/filters on this upgrade planner, resetting it to default values.
Sourcepub fn create_blueprint(&self, params: LuaRecordCreateBlueprintParams) -> LuaAny
pub fn create_blueprint(&self, params: LuaRecordCreateBlueprintParams) -> LuaAny
Sets up this blueprint using the found blueprintable entities/tiles on the surface.
Sourcepub fn deconstruct_area(&self, params: LuaRecordDeconstructAreaParams)
pub fn deconstruct_area(&self, params: LuaRecordDeconstructAreaParams)
Deconstruct the given area with this deconstruction planner.
Sourcepub fn export_record(&self) -> &str
pub fn export_record(&self) -> &str
Exports this record to a string.
Sourcepub fn get_active_index(&self, player: LuaAny) -> u32
pub fn get_active_index(&self, player: LuaAny) -> u32
The active index of this BlueprintBookRecord. For records in “my blueprints”, the result will be the same regardless of the player, but records in “game blueprints” may have different active indices per player.
Sourcepub fn get_blueprint_entities(&self) -> Option<Vec<BlueprintEntity>>
pub fn get_blueprint_entities(&self) -> Option<Vec<BlueprintEntity>>
The entities in this blueprint.
Sourcepub fn get_blueprint_entity_count(&self) -> u32
pub fn get_blueprint_entity_count(&self) -> u32
Gets the number of entities in this blueprint blueprint.
Sourcepub fn get_blueprint_entity_tag(&self, index: u32, tag: &str) -> Option<LuaAny>
pub fn get_blueprint_entity_tag(&self, index: u32, tag: &str) -> Option<LuaAny>
Gets the given tag on the given blueprint entity index in this blueprint.
Gets the tags for the given blueprint entity index in this blueprint.
Sourcepub fn get_blueprint_tiles(&self) -> Option<Vec<Tile>>
pub fn get_blueprint_tiles(&self) -> Option<Vec<Tile>>
A list of the tiles in this blueprint.
Sourcepub fn get_entity_filter(&self, index: u32) -> Option<ItemFilter>
pub fn get_entity_filter(&self, index: u32) -> Option<ItemFilter>
Gets the entity filter at the given index for this deconstruction planner.
Sourcepub fn get_mapper(&self, index: u32, type: LuaItemCommonType) -> LuaAny
pub fn get_mapper(&self, index: u32, type: LuaItemCommonType) -> LuaAny
Gets the filter at the given index for this upgrade item. Note that sources ("from" type) that are undefined will read as {type = "item"}, while destinations ("to" type) that are undefined will read as nil.
In contrast to LuaRecord::set_mapper, indices past the upgrade item’s current size are considered to be out of bounds.
Sourcepub fn get_selected_record(&self, player: LuaAny) -> Option<LuaRecord>
pub fn get_selected_record(&self, player: LuaAny) -> Option<LuaRecord>
Gets the currently selected record of the book for the given player.
Note: this will return a record even if the book is in a preview state.
Sourcepub fn get_tile_filter(&self, index: u32) -> Option<&str>
pub fn get_tile_filter(&self, index: u32) -> Option<&str>
Gets the tile filter at the given index for this deconstruction planner.
Sourcepub fn is_blueprint_setup(&self) -> bool
pub fn is_blueprint_setup(&self) -> bool
Is this blueprint setup? I.e. is it a non-empty blueprint?
Sourcepub fn set_blueprint_entities(&self, entities: Vec<BlueprintEntity>)
pub fn set_blueprint_entities(&self, entities: Vec<BlueprintEntity>)
Set new entities to be a part of this blueprint.
Sourcepub fn set_blueprint_entity_tag(&self, index: u32, tag: &str, value: LuaAny)
pub fn set_blueprint_entity_tag(&self, index: u32, tag: &str, value: LuaAny)
Sets the given tag on the given blueprint entity index in this blueprint.
Sets the tags on the given blueprint entity index in this blueprint.
Sourcepub fn set_blueprint_tiles(&self, tiles: Vec<Tile>)
pub fn set_blueprint_tiles(&self, tiles: Vec<Tile>)
Set specific tiles in this blueprint.
Sourcepub fn set_entity_filter(&self, filter: Option<ItemFilter>, index: u32) -> bool
pub fn set_entity_filter(&self, filter: Option<ItemFilter>, index: u32) -> bool
Sets the entity filter at the given index for this deconstruction planner.
Sourcepub fn set_mapper(&self, index: u32, mapper: LuaAny, type: LuaItemCommonType)
pub fn set_mapper(&self, index: u32, mapper: LuaAny, type: LuaItemCommonType)
Sets the module filter at the given index for this upgrade item.
In contrast to LuaRecord::get_mapper, indices past the upgrade item’s current size are valid and expand the list of mappings accordingly, if within reasonable bounds.
Sourcepub fn set_tile_filter(&self, filter: LuaAny, index: u32) -> bool
pub fn set_tile_filter(&self, filter: LuaAny, index: u32) -> bool
Sets the tile filter at the given index for this deconstruction planner.