Skip to main content

LockerObject

class ThaumielMapEditor.API.Blocks.ServerObjects.Lockers

Overview​

Properties​

NameTypeAccessDescription
BaseLockergetThe instantiated MapGeneration.Distributors.Locker component in the scene.
ChambersList<LockerChamber>getSerialized chamber definitions that describe what items and permissions each chamber should have.
ObjectTypeObjectTypeget setGets or sets the type of the object represented by this instance.
TypeLockerTypegetThe ThaumielMapEditor.API.Enums.LockerType variant for this locker (e.g., Medkit, RifleRack, Misc).

Methods​

SignatureReturnsDescription
GetPrefabFromType(LockerType)LockerMaps a ThaumielMapEditor.API.Enums.LockerType value to the corresponding locke…
ParseValues(SerializableObject)voidParses values from a ThaumielMapEditor.API.Serialization.SerializableObject to…
PopulateChambers()voidPopulates the runtime locker chambers based on the serialized `ThaumielMapEditor…
SpawnObject(SchematicData, SerializableObject)voidSpawns 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​

GetPrefabFromType
public Locker GetPrefabFromType(LockerType type)

Maps a ThaumielMapEditor.API.Enums.LockerType value to the corresponding locker prefab from ThaumielMapEditor.API.Helpers.PrefabHelper.

Parameters​

NameTypeDescription
typeLockerTypeThe locker type to get a prefab for.

Returns​

Locker β€” The matching MapGeneration.Distributors.Locker prefab, or throws for unknown types.

Exceptions​

warning
  • ``System.ArgumentOutOfRangeExceptionβ€” Thrown when an unsupportedThaumielMapEditor.API.Enums.LockerType is supplied.

ParseValues​

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​

NameTypeDescription
serializableSerializableObjectThe serializable data read from a schematic or saved map.

PopulateChambers​

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​

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​

NameTypeDescription
schematicSchematicData
serializableSerializableObject