2021-03-22 23:41:58 +01:00
|
|
|
tool
|
2021-04-19 22:30:51 +02:00
|
|
|
extends Building
|
2020-09-12 01:01:43 +02:00
|
|
|
|
|
|
|
export (EntityData) var trainer : EntityData
|
2020-09-13 17:08:52 +02:00
|
|
|
export (EntityData) var vendor : EntityData
|
2020-09-12 01:01:43 +02:00
|
|
|
|
|
|
|
func _instance(p_seed, p_instance):
|
|
|
|
._instance(p_seed, p_instance)
|
|
|
|
|
|
|
|
p_instance.trainer = trainer
|
2020-09-13 17:08:52 +02:00
|
|
|
p_instance.vendor = vendor
|
2020-09-12 01:01:43 +02:00
|
|
|
|
|
|
|
return p_instance
|
|
|
|
|
2021-04-18 23:56:44 +02:00
|
|
|
func _generate_terra_chunk(chunk : TerraChunk, spawn_mobs : bool):
|
2021-08-29 23:38:15 +02:00
|
|
|
if !spawn_mobs:
|
|
|
|
return
|
|
|
|
|
2021-04-18 23:56:44 +02:00
|
|
|
if trainer == null || vendor == null:
|
|
|
|
return
|
|
|
|
|
|
|
|
if chunk.position_x == 0 && chunk.position_z == 0:
|
|
|
|
var pos : Vector3 = Vector3(4 * chunk.voxel_scale, 8 * chunk.voxel_scale, 4 * chunk.voxel_scale)
|
|
|
|
|
|
|
|
ESS.entity_spawner.spawn_mob(trainer.id, 1, pos)
|
|
|
|
|
|
|
|
pos = Vector3(2 * chunk.voxel_scale, 8 * chunk.voxel_scale, 2 * chunk.voxel_scale)
|
|
|
|
|
|
|
|
ESS.entity_spawner.spawn_mob(vendor.id, 1, pos)
|