UniqueSpawnerData ​
Inherits: DatabaseResource < Resource
A placed spawner: what the world keeps about one Spawner node in one world. It holds the world, the position, the spawn table and the rules (how many at once, how soon things come back, near whom it works). It is made by the Spawner node when the node is placed in a world scene and deleted with it, like the data of a trigger area. The state of the spawner while the game is played (what stands there, the timers) is saved with the game by the object registry, not here. See docs: World > Spawners.
Properties ​
int | map_id | 0 |
Vector3 | world_position | Vector3.ZERO |
Vector3 | world_rotation | Vector3.ZERO |
String | spawner_name | "Spawner" |
bool | is_active | true |
Mode | mode | Mode.POINT |
int | spawn_table_id | 0 |
float | max_slope | 45.0 |
bool | only_walkable | true |
Color | paint_color | Color(1.0, 0.55, 0.2, 1.0) |
int | max_alive | 1 |
float | respawn_min | 60.0 |
float | respawn_max | 60.0 |
bool | spawn_at_start | true |
float | density | 4.0 |
bool | only_between_hours | false |
float | from_hour | 20.0 |
float | to_hour | 6.0 |
WeatherRule | weather_rule | WeatherRule.ANY |
String | weather_name | "" |
int | condition_event_id | 0 |
bool | leave_when_unmet | false |
float | activation_radius | 80.0 |
float | min_player_distance | 12.0 |
float | despawn_radius | 0.0 |
Methods ​
void | update_position_from_node( node: Node3D ) |
bool | save_to_disk() |
float | pick_respawn_time( rng: RandomNumberGenerator = null ) |
int | get_slot_count() |
Enumerations ​
enum WeatherRule ​
What the weather has to be for a spawner to work
- ANY =
0- The weather does not matter - ONLY_IN =
1- Only while the weather is the one named below - NOT_IN =
2- Never while the weather is the one named below
enum Mode ​
How the spawner chooses its places
- POINT =
0- One place (the spawner itself), one thing at a time - VOLUME =
1- Random places inside the shape of the node (a cave, a room), snapped down to the floor, up to Max alive things at once - PAINTED =
2- Random places on the ground painted for this spawner with the Paint spawner tool of the terrain, filled round the players
Property descriptions ​
int map_id = 0 ​
The id of the world the spawner is in.
Vector3 world_position = Vector3.ZERO ​
Position in world space (the place of the spawner; kept up to date when the scene is saved).
Vector3 world_rotation = Vector3.ZERO ​
Rotation in world space
What and where
String spawner_name = "Spawner" ​
A name for you (the Uniques list and the debug tools show it)
bool is_active = true ​
Whether the spawner works. An event can switch it on and off
Mode mode = Mode.POINT ​
How the spawner chooses its places: Point = the spawner itself, Volume = inside its shape, Painted = on the ground painted for it
int spawn_table_id = 0 ​
The spawn table the spawner rolls every time it makes something (Database > World > Spawn Tables)
float max_slope = 45.0 ​
The steepest ground (degrees) a thing may appear on (Volume and Painted)
bool only_walkable = true ​
NPCs only appear where they can walk (there is baked navigation there). A world with no baked navigation ignores this
Color paint_color = Color(1.0, 0.55, 0.2, 1.0) ​
The colour of the spawner on the ground while you paint it (a Painted spawner only)
How often
int max_alive = 1 ​
How many things a Volume spawner keeps alive at once (a Point spawner always keeps one, a Painted spawner keeps as many as its density asks: a group of NPCs from one line counts as one)
float respawn_min = 60.0 ​
The fewest seconds between what a spawner made going away (killed, taken, used up) and the next one coming
float respawn_max = 60.0 ​
The most seconds before the next one comes (the time is chosen between the two numbers)
bool spawn_at_start = true ​
Whether the first thing appears at once when the spawner starts working (a player comes near), instead of waiting a respawn time
float density = 4.0 ​
For a Painted spawner: how many things stand on every 1000 square metres of painted ground (a chunk of 16 m by 16 m that is all painted is 256 square metres). Less than one means some chunks have none
Only when
bool only_between_hours = false ​
The spawner only makes things between two hours of the game clock (a night spawner for undead). The window may cross midnight (from 20 to 6)
float from_hour = 20.0 ​
The hour (0 to 24, 0.5 is half past midnight) the window starts
float to_hour = 6.0 ​
The hour the window ends
WeatherRule weather_rule = WeatherRule.ANY ​
Whether the weather decides: only in a weather, or never in it
String weather_name = "" ​
The weather the rule is about: the name of a weather of the VFX database ("rain"), or "clear" for no weather at all
int condition_event_id = 0 ​
The conditions of this Event (Database > Events) must all be met: the same conditions events use (a quest is running, a switch is on, a variable is high). The event itself is not run
bool leave_when_unmet = false ​
What the spawner made leaves (when nothing is fighting) as soon as the conditions are no longer met, instead of staying until it is killed
Near the player
float activation_radius = 80.0 ​
The spawner only works while a player of the party is this close (metres; for a Volume spawner counted from its shape, for a Painted one from each chunk). 0 = it works everywhere, always (a Painted spawner then works 80 m round the players)
float min_player_distance = 12.0 ​
Nothing appears this close to a player (metres): it does not pop up in front of the party
float despawn_radius = 0.0 ​
What stands there when no player is within this distance (metres) leaves again, so a world full of spawners costs nothing while nobody is there. Things in a fight stay. 0 = they stay
Method descriptions ​
void update_position_from_node( node: Node3D ) ​
Keeps the place of the spawner
bool save_to_disk() ​
Save this data to disk
float pick_respawn_time( rng: RandomNumberGenerator = null ) ​
The seconds a thing takes to come back this time (between the two numbers).
int get_slot_count() ​
How many places the spawner keeps at the start (a Point spawner has one, a Volume spawner its Max alive; a Painted spawner makes its places per chunk near the players).