LockerObject
ThaumielMapEditor.API.Blocks.ServerObjects.Lockers
Overviewβ
Propertiesβ
| Name | Type | Access | Description |
|---|---|---|---|
Base | Locker | get | The instantiated MapGeneration.Distributors.Locker component in the scene. |
Chambers | List<LockerChamber> | get | Serialized chamber definitions that describe what items and permissions each chamber should have. |
ObjectType | ObjectType | get set | Gets or sets the type of the object represented by this instance. |
Type | LockerType | get | The ThaumielMapEditor.API.Enums.LockerType variant for this locker (e.g., Medkit, RifleRack, Misc). |
Methodsβ
| Signature | Returns | Description |
|---|---|---|
GetPrefabFromType(LockerType) | Locker | Maps a ThaumielMapEditor.API.Enums.LockerType value to the corresponding locke⦠|
ParseValues(SerializableObject) | void | Parses values from a ThaumielMapEditor.API.Serialization.SerializableObject to⦠|
PopulateChambers() | void | Populates the runtime locker chambers based on the serialized `ThaumielMapEditor⦠|
SpawnObject(SchematicData, SerializableObject) | void | Spawns the specified ThaumielMapEditor.API.Blocks.ServerObject into the server⦠|
Propertiesβ
Baseβ
Type: LockerβAccess: get
The instantiated MapGeneration.Distributors.Locker component in the scene.
Chambersβ
Type: List<LockerChamber>βAccess: get
Serialized chamber definitions that describe what items and permissions each chamber should have.
ObjectTypeβ
Type: ObjectTypeβAccess: get set
Gets or sets the type of the object represented by this instance.
Typeβ
Type: LockerTypeβAccess: get
The ThaumielMapEditor.API.Enums.LockerType variant for this locker (e.g., Medkit, RifleRack, Misc).
Methodsβ
GetPrefabFromTypeβ
public Locker GetPrefabFromType(LockerType type)
Maps a ThaumielMapEditor.API.Enums.LockerType value to the corresponding locker prefab from ThaumielMapEditor.API.Helpers.PrefabHelper.
Parametersβ
| Name | Type | Description |
|---|---|---|
type | LockerType | The locker type to get a prefab for. |
Returnsβ
Locker β The matching MapGeneration.Distributors.Locker prefab, or throws for unknown types.
Exceptionsβ
- ``System.ArgumentOutOfRangeException
β Thrown when an unsupportedThaumielMapEditor.API.Enums.LockerTypeis supplied.
ParseValuesβ
public void ParseValues(SerializableObject serializable)
Parses values from a ThaumielMapEditor.API.Serialization.SerializableObject to populate this object's ThaumielMapEditor.API.Blocks.ServerObjects.Lockers.LockerObject.Type and ThaumielMapEditor.API.Blocks.ServerObjects.Lockers.LockerObject.Chambers. Validates that the supplied serializable is of ThaumielMapEditor.API.Enums.ObjectType.Locker and logs warnings on failure.
Parametersβ
| Name | Type | Description |
|---|---|---|
serializable | SerializableObject | The serializable data read from a schematic or saved map. |
PopulateChambersβ
public void PopulateChambers()
Populates the runtime locker chambers based on the serialized ThaumielMapEditor.API.Blocks.ServerObjects.Lockers.LockerObject.Chambers data. For each serialized chamber: - Matches it to the corresponding runtime chamber by index. - Applies required permissions. - Iterates configured ThaumielMapEditor.API.Blocks.ServerObjects.Lockers.ChamberData entries and spawns items based on their spawn chance and amounts. Ensures each serialized chamber only spawns once per population pass.
SpawnObjectβ
public void SpawnObject(
SchematicData schematic,
SerializableObject serializable
)
Spawns the specified ThaumielMapEditor.API.Blocks.ServerObject into the server and adds it to the provided ThaumielMapEditor.API.Data.SchematicData's ThaumielMapEditor.API.Data.SchematicData.SpawnedServerObjects list.
Parametersβ
| Name | Type | Description |
|---|---|---|
schematic | SchematicData | |
serializable | SerializableObject |