pub struct LockState {
pub locked: bool,
pub lockable: bool,
pub key_required: bool,
pub key_name: String,
pub auto_remove_key: bool,
pub open_lock_dc: u8,
pub close_lock_dc: u8,
}Expand description
Lock state shared by doors and placeables, blueprint and saved forms alike.
SecretDoorDC is not here. Only the two door types read it, so it stays a
loose door field rather than a placeable’s eighth label that never applies.
The block takes no per-consumer defaults, and that is a measured claim rather than an assumption. Five of the seven are recorded divergences on the absent axis: a door constructs its lock group and carries it over where a placeable stamps an unconditional literal. Both sides land on the same value every time, so what differs is how the default arises, not what it is, and a shared read fallback is the value all four consumers were already reading. Contrast the trap fields, which resolve to genuinely different values per consumer and so were never shared. Same test, opposite answer.
Two labels are weaker than that. Lockable and KeyName are Unexamined
on the door side against a populated placeable declaration, so those two
pairs are one opinion and one blank rather than a measured agreement. The
block does not assert them: it shares the fallback the door reader already
used, and an audit giving the door path a different value would land here.
Fields§
§locked: boolWhether the object is locked (Locked).
lockable: boolWhether it can be locked at all (Lockable).
key_required: boolWhether opening needs a key (KeyRequired).
key_name: StringTag of the key that opens it (KeyName).
auto_remove_key: boolWhether the key is consumed on use (AutoRemoveKey).
open_lock_dc: u8Difficulty of picking it open (OpenLockDC).
close_lock_dc: u8Difficulty of locking it (CloseLockDC).
Implementations§
Source§impl LockState
impl LockState
Sourcepub const PARTS: &'static [&'static [Field]]
pub const PARTS: &'static [&'static [Field]]
This type’s schema in parts, which is what a container holding it references.
Own fields first, then one part per flattened child in the order they are declared.
Sourcepub fn read_declared(root: &GffStruct) -> Self
pub fn read_declared(root: &GffStruct) -> Self
Reads every declared field off root.
Absent fields take the entry’s own answer, so a fallback is derived from the declaration rather than restated beside it.
A field declaring a hand-written read is left at that answer for the view to overwrite.
Sourcepub fn write_declared(&self, root: &mut GffStruct)
pub fn write_declared(&self, root: &mut GffStruct)
Writes every declared field onto root, leaving out the ones
their entry says the engine’s own writer leaves out.
A field declaring a hand-written write is not touched here.
Sourcepub fn read_element(structure: &GffStruct) -> Self
pub fn read_element(structure: &GffStruct) -> Self
Reads one element of a list of this type.
Sourcepub fn write_element(&self, structure: &mut GffStruct)
pub fn write_element(&self, structure: &mut GffStruct)
Writes one element of a list of this type.