Skip to main content

TargetDummyObject

class ThaumielMapEditor.API.Blocks.ServerObjects

Overview​

Properties​

NameTypeAccessDescription
BaseShootingTargetgetThe instantiated AdminToys.ShootingTarget component for the spawned object. This value is null until ThaumielMapEditor.API.Blocks.ServerObjects.TargetDummyObject.SpawnObject(ThaumielMapEditor.API.Data.SchematicData,ThaumielMapEditor.API.Serialization.SerializableObject) is called.
ObjectTypeObjectTypeget setGets or sets the type of the object represented by this instance.
TypeTargetTypegetThe configured ThaumielMapEditor.API.Enums.TargetType for this target. Determined by parsing serialized data before spawning.

Methods​

SignatureReturnsDescription
GetPrefab(TargetType)ShootingTargetReturns the prefab AdminToys.ShootingTarget that corresponds to the provided `…
ParseValues(SerializableObject)voidParses and applies values from a `ThaumielMapEditor.API.Serialization.Serializab…
SpawnObject(SchematicData, SerializableObject)voidSpawns the specified ThaumielMapEditor.API.Blocks.ServerObject into the server…

Properties​

Base​

Type: ShootingTarget Access: get

The instantiated AdminToys.ShootingTarget component for the spawned object. This value is null until ThaumielMapEditor.API.Blocks.ServerObjects.TargetDummyObject.SpawnObject(ThaumielMapEditor.API.Data.SchematicData,ThaumielMapEditor.API.Serialization.SerializableObject) is called.


ObjectType​

Type: ObjectType Access: get set

Gets or sets the type of the object represented by this instance.


Type​

Type: TargetType Access: get

The configured ThaumielMapEditor.API.Enums.TargetType for this target. Determined by parsing serialized data before spawning.


Methods​

GetPrefab​

GetPrefab
public ShootingTarget GetPrefab(TargetType type)

Returns the prefab AdminToys.ShootingTarget that corresponds to the provided type.

Parameters​

NameTypeDescription
typeTargetTypeThe target variant to resolve a prefab for.

Returns​

ShootingTarget β€” The matching AdminToys.ShootingTarget prefab.

Exceptions​

warning
  • ``System.InvalidOperationExceptionβ€” Thrown when an unsupportedtype is provided.

ParseValues​

ParseValues
public void ParseValues(SerializableObject serializable)

Parses and applies values from a ThaumielMapEditor.API.Serialization.SerializableObject to this instance. Validates that the serializable represents a target and extracts the ThaumielMapEditor.API.Enums.TargetType. Logs warnings when parsing fails or the object type does not match.

Parameters​

NameTypeDescription
serializableSerializableObjectThe serialized object data to parse.

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