// This script is called by any entity like the rocket, bio-growth
// or whatever which does nothing apart from get blown up. Saves on
// duplication of code.

#define extra_sound_effect	v26
#define sound_frequency		v25

	let draw_mode = draw_mode_sprite
	let current_frame = base_frame
	let draw_mode = DRAW_MODE_SPRITE

	let COLLIDE_TYPE = ENT_TYPE_ENEMY_EMPLACEMENT
	let COLLIDE_wITH = ENT_TYPE_PLAYER_SUPER_BULLET

	let COLLISION_SHAPE = RECTANGLE

	entity_hitline gosub destroyed

// This uses the graphic size and pivot to set the collision profile of the object.

start
	// Does feck all.
end

.destroyed
	REMOVE_FROM_COLLISION_LIST
	let collide_type = 0

	play_sound large_object_explosion 255 34000 128

	spawn_entity ex_small_shaker_explosion 0 0 process_next
	let last_child.draw_order = last_child.draw_order + 1

	wait 15

	if extra_sound_effect != CONST_UNSET then
		let sound_frequency = rand 18000 25000
		play_sound extra_sound_effect 255 sound_frequency 128
	end_if

	spawn_entity ex_big_explosion 0 lower_height process_next
	let last_child.PASSED_PARAM_1 = temp_1
	let last_child.draw_order = last_child.draw_order + 1

	wait 10

	let upper_width = upper_width + temp_2
	SET_COLLISION_BY_SIZE 0
	let upper_width = upper_width - temp_2

	spawn_entity ex_debris 0 lower_height process_next
	let last_child.base_frame = DROP_ITEM

	let temp_1 = lower_height / 2
	spawn_entity ex_display_score 0 temp_1 PROCESS_NEXT
	let last_child.passed_param_1 = 4
	let last_child.passed_param_2 = 0

	kill_entity own_id
