
--base part
-- leave me
	local actor = ACTOR_preload()
-- leave me

	actor[cp_actor_name]		= "turret-base"
	actor[cp_model_dir]			= "beasties"
	actor[cp_model_name]		= "turret-base"

	actor[cp_actor_type]			= cat_block
	actor[cp_these_collide_with_me]	= cat_player + cat_bullet + cat_crystal + cat_webblob + cat_geopus + cat_mergeblob

	actor[cp_health_percent]		= 100.0
	actor[cp_geopus_style]			= 16

	actor[cp_launch_scale_min]		= 180.0
	actor[cp_launch_scale_max]		= 180.0

	actor[cp_hit_delay]				= 5.0
	actor[cp_mutate_hit_delay]		= 5.0
	actor[cp_hit_power]			= 5.0

	actor[cp_score]				= 1000

	actor[cp_launch_hue_shift] = color

-- leave me
	c_preload_model( actor )
-- leave me

	c_set_random_anim( "shaftspin", 50.0, 50.0, 0.0, 0.0 )
	c_set_random_anim( "gen1spin", 100.0, 100.0, 0.0, 0.0 )
	c_set_random_anim( "gen2spin", 100.0, 100.0, 0.0, 0.0 )
	c_set_random_anim( "gen3spin", 100.0, 100.0, 0.0, 0.0 )
	c_set_random_anim( "tpulse", 50.0, 200.0, 0.0, 0.0 )

	c_add_particle_to_anim( "shaftspin", "tipglow", "turretbase-tip" )
--	c_add_sound_to_event( "hit_active_bone", "chunk_hit" )
	c_add_sound_to_anim( "emerge", "turret-base-emerge" )
	local seq = { 0.0, 0.1, 0.2, 0.4 }
	c_set_use_explosion_for( "bye_bye", "turret-base-flash", exp_no_align, 0.0, 0.0, 5000.0, 5000.0, seq )
	c_add_particle_to_explosion( "turret-base-flash", "explode", "", "turret-base-flash" )
	c_add_sound_to_explosion( "turret-base-flash", "explode", "turret-base-exp" )


--blob part
-- leave me
	local actor = ACTOR_preload()
-- leave me

	actor[cp_actor_name]		= "turret-base-blob"
	actor[cp_model_dir]			= "beasties"
	actor[cp_model_name]		= "turret-base-gens"

	actor[cp_health_percent]		= 70.0

	actor[cp_launch_scale_min]		= 180.0
	actor[cp_launch_scale_max]		= 180.0

	actor[cp_hit_delay]				= 5.0
	actor[cp_mutate_hit_delay]		= 5.0
	actor[cp_hit_power]			= 5.0

	actor[cp_score]				= 400

	actor[cp_launch_hue_shift] = color

-- leave me
	c_preload_model( actor )
-- leave me

-- add exps
	c_set_use_explosion_for( "bye_bye", "turret-flash", exp_no_align, 0.0, 0.0, 3000.0, 3000.0, {0.0} )
	c_add_particle_to_explosion( "turret-flash", "explode", "", "turret-flash" )
	c_add_sound_to_explosion( "turret-flash", "explode", "turret-exp" )
	c_add_sound_to_event( "hit_active_bone", "turret-hit" )

dofile_lua( "turret_fizz" )

turret_base_emerge_actor_name = "turret-bigemerge"
dofile_lua( turret_base_emerge_actor_name )


function turret_base_plop( act, posx, posy, posz, rot, siz, hue, launch_delay, path )
	local unique_name = nil
	if path ~= nil then
		unique_name = format( "%s_%s", act, path )
	else
		unique_name = format( "%s_%d", act, actor_unique_id )
	end

	local apo = ACTOR_PreLaunch( act, unique_name )
	apo:setall( posy, posz, -posx, rot, siz, hue, launch_delay )
	apo:launch()

	local act_name_part = format( "%s-blob", act )
	for c = 1, 3, 1 do
		apo = ACTOR_PreLaunch( act_name_part )
		apo:setall( 0.0, 0.0, 0.0, 90.0, siz, hue, launch_delay )
		apo:launch()

		local bone_name = format( "plug%d", c )
		c_link_to_parent( unique_name, bone_name, unique_name )
	end

	apo = ACTOR_PreLaunch( turret_base_emerge_actor_name )
	apo:setall( posy, posz, -posx, rot, siz, hue, launch_delay )
	apo:launch()
end

