entity = {
	name = "toxic_god_entity"
	pdxmesh = "locator_mesh"
	
	default_state = "idle"
	state = { name = "idle" state_time = 5 looping = no}
	state = { name = "moving" state_time = 5 looping = no}
	state = { name = "working" state_time = 5 looping = no}
	state = { name = "death" state_time = 14 looping = no
		#event = { time = 9.9 node = "part1" particle = "aquatic_01_ship_explosion_dreadnought" sound = { soundeffect = ship_destroyed } }
		chance = {
			if_current_state = {
				"idle" = 100
				"moving" = 100
				"death" = 0
				"working" = 0
			}
		}
	}
	state = { name = "death" state_time = 14 looping = no
		#event = { time = 9.90 node = "part1" particle = "aquatic_01_ship_explosion_dreadnought" sound = { soundeffect = ship_destroyed } }
		chance = {
			if_current_state = {
				"idle" = 0
				"moving" = 0
				"death" = 0
				"working" = 100
			}
		}
	}

	game_data = {
  		raytrace_projectiles = no
  		dissolve_on_death = 7.0
		ship_color = hsv { 0.27 0.80 0.60 1.0 }
 	}

	
	locator = { name = "part1" 	position = { 0 0 0 } }
}

entity = {
	name = "toxic_god_section_entity"
	pdxmesh = "toxic_god_mesh"

	attach = { "root" = "toxic_god_debris_entity" }
	
	default_state = "idle"
	# Actual idle state when being in idle/moving.
	state = { name = "idle" animation = "idle" looping = yes next_state = "idle" animation_blend_time = 4
		chance = {
			if_current_state = {
				"idle" = 100
				"moving" = 100
				"death" = 0
				"working" = 100
				"working_looping" = 0
			}
		}

		event = { trigger_once = yes sound = { soundeffect = "tox_god_idle" stop_on_state_change = no} }

	}

	# Idle state when going from opened state to idle. 
	state = { name = "idle" animation = "closing" animation_speed = 2 looping = no next_state = "idle" 
		chance = {
			if_current_state = {
				"idle" = 0
				"moving" = 0
				"death" = 0
				"working" = 100
				"working_looping" = 100
			}
		}
		
	}

	# Actual moving state if going from idle/moving.
	state = { name = "moving" animation = "moving" looping = yes next_state = "moving" animation_blend_time = 1
		chance = {
			if_current_state = {
				"idle" = 100
				"moving" = 100
				"death" = 0
				"working" = 100
				"working_looping" = 0
			}
		}
		event = { sound = { soundeffect = "tox_god_move" stop_on_state_change = no }

		}
	}

	# Moving state if going from open/working, uses closing animation.
	state = { name = "moving" animation = "closing" animation_speed = 2 looping = no next_state = "moving"
		chance = {
			if_current_state = {
				"idle" = 0
				"moving" = 0
				"death" = 0
				"working" = 0
				"working_looping" = 100
			}
		}
	}

	# Opened state, going after "kill_planet".
	state = { name = "working_looping" animation = "open" 
		event = { time = 0	id = "beam_start" }
		event = { trigger_once = yes sound = { soundeffect = "tox_god_idle" } }
		event = { time = 0.5 node = "back_scale_01" entity = "toxic_god_effect_entity" erosion_in = 0.8			erosion_out = 1 trigger_once = yes}
		event = { time = 1 node = "back_scale_02" entity = "toxic_god_effect_entity" erosion_in = 0.8			erosion_out = 1 trigger_once = yes}
		event = { time = 1.5 node = "back_scale_03" entity = "toxic_god_effect_entity" erosion_in = 0.8			erosion_out = 1 trigger_once = yes}
		event = { time = 2 node = "back_scale_04" entity = "toxic_god_effect_entity" erosion_in = 0.8			erosion_out = 1 trigger_once = yes}

	
	}

	# Opening state, goes into "working_looping" state when done.
	state = { name = "working" animation = "opening" looping = no next_state = "working_looping" 
		event = { time = 250 id = "beam_start" }
	}
	

	# Closed death state.
	state = { name = "death" animation = "closed_death" looping = no
		chance = {
			if_current_state = {
				"idle" = 100
				"moving" = 100
				"death" = 0
				"working" = 0
				"working_looping" = 0
			}
		}
	}
	# Opened death state.
	state = { name = "death" animation = "opened_death" looping = no animation_blend_time = 2
		chance = {
			if_current_state = {
				"idle" = 0
				"moving" = 0
				"death" = 0
				"working" = 100
				"working_looping" = 100
			}
		}
	}

	# Attack 
	state = { name = "attack" animation = "attack" looping = no animation_blend_time = 1 next_state = "idle"
	
		event = { time = 0.5 node = "back_scale_01" entity = "toxic_god_effect_entity" erosion_in = 0.8			erosion_out = 1 trigger_once = yes}
		event = { time = 1 node = "back_scale_02" entity = "toxic_god_effect_entity" erosion_in = 0.8			erosion_out = 1 trigger_once = yes}
		event = { time = 1.5 node = "back_scale_03" entity = "toxic_god_effect_entity" erosion_in = 0.8			erosion_out = 1 trigger_once = yes}
		event = { time = 2 node = "back_scale_04" entity = "toxic_god_effect_entity" erosion_in = 0.8			erosion_out = 1 trigger_once = yes}
	
	}

	# Moving during combat
	state = { name = "combat_moving" animation = "moving" animation_blend_time =  1}


#	game_data = {
# 		raytrace_projectiles = no
# 		dissolve_on_death = 7.0
#		ship_color = hsv { 0.3 0.50 0.70 1.0 }
#	}
	
}

entity = {
	name = "toxic_god_debris_entity"
	pdxmesh = "toxic_god_debris_mesh"

	default_state = "idle"
	state = { name = "idle" animation = "idle" looping = yes next_state = "idle" animation_blend_time = 4
		chance = {
			if_current_state = {
				"idle" = 100
				"moving" = 100
				"death" = 0
				"working" = 100
				"working_looping" = 0
			}
		}
	}
		# Idle state when going from opened state to idle. 
		state = { name = "idle" animation = "closing" animation_speed = 2 looping = no next_state = "idle" 
		chance = {
			if_current_state = {
				"idle" = 0
				"moving" = 0
				"death" = 0
				"working" = 100
				"working_looping" = 100
			}
		}
	}
		# Actual moving state if going from idle/moving.
		state = { name = "moving" animation = "idle" looping = yes next_state = "moving" animation_blend_time = 1
		chance = {
			if_current_state = {
				"idle" = 100
				"moving" = 100
				"death" = 0
				"working" = 100
				"working_looping" = 0
			}
		}
	}
		# Moving state if going from open/working, uses closing animation.
		state = { name = "moving" animation = "closing" animation_speed = 2 looping = no next_state = "moving"
		chance = {
			if_current_state = {
				"idle" = 0
				"moving" = 0
				"death" = 0
				"working" = 0
				"working_looping" = 100
			}
		}
	}
	# Opened state, going after "kill_planet".
	state = { name = "working_looping" animation = "open" }

	# Opening state, goes into "working_looping" state when done.
	state = { name = "working" animation = "opening" looping = no next_state = "working_looping" }
	
	# Closed death state.
	state = { name = "death" animation = "idle" looping = no
		chance = {
			if_current_state = {
				"idle" = 100
				"moving" = 100
				"death" = 0
				"working" = 0
				"working_looping" = 0
			}
		}
	}
	# Opened death state.
	state = { name = "death" animation = "idle" looping = no animation_blend_time = 2
		chance = {
			if_current_state = {
				"idle" = 0
				"moving" = 0
				"death" = 0
				"working" = 100
				"working_looping" = 100
			}
		}
	}

#	game_data = {
#  		raytrace_projectiles = no
#  		dissolve_on_death = 7.0
#		ship_color = hsv { 0.3 0.50 0.70 1.0 }
# 	}
}

entity = {
	name = "toxic_god_effect_entity"
	pdxmesh = "toxic_god_effect_mesh"
	
		game_data = {
		bloom_factor			= 1
		uv_animation_speed 		= 0.6
		uv_animation_direction 	= { 0.4 1.0 }
		}
}


##### Toxic god weapons


####### Projectile

entity = {
	name = "toxic_god_01_projectile_entity"

	cull_radius = 1.0
	
	default_state = "idle"
	state = { name = "idle" state_time = 5
		event = { time = 0 particle = "tox_01_projectile_effect" keep_particle = yes trigger_once = yes}

	}
	state = { name = "stop"
		looping = no
		#state_time = 2.0
	}
	
		
	scale = 1.0
	
}

entity = {
	name = "toxic_god_01_projectile_hit_entity"
	cull_radius = 1.0
	default_state = "idle"
	state = { name = "idle"
		start_event = { particle = "tox_01_projectile_hit_effect" }
	}
	state = { name = "stop" state_time = 0.5 looping = no }
}

entity = {
	name = "toxic_god_01_projectile_shield_hit_entity"
	cull_radius = 1.0
	default_state = "idle"
	state = { name = "idle"
		event = { time = 0.0 particle = "tox_01_projectile_hit_effect" }
		start_event = { particle = projectile_large_shield_hit_effect sound = { soundeffect = shield_hit } }
		start_event = { trigger_once = yes sound = { soundeffect = "distance_shield_hit" } }
	}
	state = { name = "stop" state_time = 0.5 looping = no }
}

entity = {
	name = "toxic_god_01_projectile_muzzle_entity"
	pdxmesh = "locator_mesh"

	default_state = "idle"
	state = { name = "idle" state_time = 3 looping = no
		event = { time = 0 particle = "tox_01_projectile_muzzle_effect" keep_particle = yes sound = { soundeffect = dragon_wing_attack } } 
		event = { trigger_once = yes sound = { soundeffect = "distance_dragon_wing_attack" } }
	}
}


##### Poiint defense

entity = {
	name = "toxic_god_proj_pd_muzzle_entity"
	pdxmesh = "locator_mesh"
	
	default_state = "idle"
	state = { name = "idle" state_time = 7 looping = no
		event = { time = 0 particle = "tox_01_proj_pd_muzzle_effect" keep_particle = yes }
	}
}

entity = {
	name = "toxic_god_proj_pd_entity"
	pdxmesh = "locator_mesh"
	
	default_state = idle
	state = { name = "idle"
		event = { time = 0 particle = "tox_01_proj_pd_idle_effect" keep_particle = yes }
	}
}


# HIT EFFECT

entity = {
	name = "toxic_god_proj_pd_hit_entity"
	pdxmesh = "locator_mesh"
	
	state = { name = "explode_med_hp" state_time = 5.0 looping = no
		event = { time = 0.0 particle = "tox_01_proj_pd_hit_effect" }
	}

	default_state = "explode_med_hp"
}



####### Striker

# MUZZLE FLASH

entity = {
	name = "toxic_god_strike_craft_muzzle_entity"
	cull_radius = 1.0
	
	default_state = "idle"
	state = { name = "idle" state_time = 7 looping = no
		event = { time = 0 particle = "toxic_god_strike_craft_muzzle_effect" keep_particle = yes sound = { soundeffect = "space_amoeba_fire" } }
		event = { trigger_once = yes sound = { soundeffect = "distance_space_amoeba_fire" } } 
	}
}


entity = {
	name = "toxic_god_strike_craft_projectile_entity"
	pdxmesh = "space_amoeba_projectile_mesh"
	
	default_state = "attack"
	state = { name = "attack" animation = "attack"
		event = { time = 0 node = "effect_point" particle = "toxic_god_strike_craft_projectile_effect" keep_particle = yes trigger_once = yes }
	}
	state = { name = "stop" animation = "stop"
		looping = no
		state_time = 2.0
	}
}


entity = {
	name = "toxic_god_strike_craft_hit_entity"
	cull_radius = 1.0
	
	state = { name = "explode_med_hp" state_time = 5 looping = no
		event = { time = 0.0 particle = "toxic_god_strike_craft_hit_effect" sound = { soundeffect = "space_amoeba_hit" } }
		event = { trigger_once = yes sound = { soundeffect = "distance_space_amoeba_hit" } }  
	}

	default_state = "explode_med_hp"
}

entity = {
	name = "toxic_god_strike_craft_shield_hit_entity"
	cull_radius = 1.0
	
	state = { name = "explode_med_hp" state_time = 5 looping = no
		event = { time = 0.0 particle = "toxic_god_strike_craft_hit_effect" }
		event = { time = 0.0 particle = "projectile_small_shield_hit_effect" }
		event = { trigger_once = yes sound = { soundeffect = "distance_shield_hit" } } 
	}

	default_state = "explode_med_hp"
}

######## Beam

entity = {
	name = "toxic_god_perdition_beam_windup_entity"
	locator = { name = "root" position = { 0 0 0 } }
	scale = 1
	default_state = "attack"
	get_state_from_parent = no
	state = {
		name = "attack" looping = yes state_time = 2
		event = { trigger_once = yes sound = { soundeffect = "perdition_beam_windup_layer_01" } }
		event = { trigger_once = yes sound = { soundeffect = "perdition_beam_windup_layer_02" } }
#		
		event = { time = 0 node = "root" particle = "toxic_god_beam_windup_effect" trigger_once = yes keep_particle = yes }

	}
	
#	attach = { root = "perdition_beam_muzzle_windup_entity" }
}


entity = {
	name = "toxic_god_perdition_beam_muzzle_entity"
	cull_radius = 1.0
	
	default_state = "idle"
	state = { name = "idle" state_time = 7.0 looping = no
		event = { time = 0 particle = "toxic_god_beam_muzzle_effect" keep_particle = yes }
		
		event = { trigger_once = yes sound = { soundeffect = "perdition_beam_fire_layer_01" } }
		event = { trigger_once = yes sound = { soundeffect = "distance_perdition_beam_fire_layer_01" } }
		
		event = { trigger_once = yes sound = { soundeffect = "perdition_beam_fire_layer_02" } }
		event = { trigger_once = yes sound = { soundeffect = "distance_perdition_beam_fire_layer_02" } }
		
		event = { trigger_once = yes sound = { soundeffect = "perdition_beam_fire_layer_03" } }
		event = { trigger_once = yes sound = { soundeffect = "distance_perdition_beam_fire_layer_03" } }
	}
}



entity = {
	name = "toxic_god_perdition_beam_hit_entity"
	cull_radius = 1.0
	
	default_state = "idle"
	state = { name = "idle" state_time = 2 looping = no
		event = { time = 0.15 particle = "toxic_god_beam_hit_effect" keep_particle = yes sound = { soundeffect = "perdition_beam_hit" } }
		start_event = { trigger_once = yes sound = { soundeffect = "distance_perdition_beam_hit" } }
	}
	state = { name = "stop" state_time = 0.5 looping = no }
}

entity = {
	name = "toxic_god_perdition_beam_shield_hit_entity"
	cull_radius = 1.0
	
	default_state = "idle"
	state = { name = "idle" 
		event = { time = 0.15 particle = "toxic_god_beam_hit_effect" sound = { soundeffect = "shield_hit" } }
		event = { time = 0.15 particle = "titan_laser_shield_hit_effect" }
		start_event = { trigger_once = yes sound = { soundeffect = "distance_shield_hit" } } 
	}
	state = { name = "stop" state_time = 0.5 looping = no }
}




# Animation
animation = {
	name = "toxic_god_idle_animation"
	file = "toxic_god_idle.anim"
}
animation = {
	name = "toxic_god_moving_animation"
	file = "toxic_god_moving.anim"
}
animation = {
	name = "toxic_god_opening_animation"
	file = "toxic_god_opening.anim"
}
animation = {
	name = "toxic_god_open_animation"
	file = "toxic_god_open.anim"
}
animation = {
	name = "toxic_god_closing_animation"
	file = "toxic_god_closing.anim"
}
animation = {
	name = "toxic_god_attack_animation"
	file = "toxic_god_attack.anim"
}
animation = {
	name = "toxic_god_death_animation"
	file = "toxic_god_death.anim"
}
animation = {
	name = "toxic_god_debris_idle_animation"
	file = "toxic_god_debris_idle.anim"
}
animation = {
	name = "toxic_god_debris_opening_animation"
	file = "toxic_god_debris_opening.anim"
}
animation = {
	name = "toxic_god_debris_open_animation"
	file = "toxic_god_debris_open.anim"
}
animation = {
	name = "toxic_god_debris_closing_animation"
	file = "toxic_god_debris_closing.anim"
}

