/***********************************************************************

	weapon_handgrenade.def

***********************************************************************/

export fred {
	// View Model Grenade
	options -prefix NADE_ -keep barrel -parent barrel Rhand -sourcedir models/weapons/grenades/cycles -destdir models/md5/weapons/grenade_view
	mesh	idle1.mb -dest viewgrenade
	anim	idle1.mb -xyzprecision 0.01 -quatprecision 0.00006 -dest grenade_idle
	anim	raise.mb -xyzprecision 0.01 -quatprecision 0.00006 -dest grenade_raise
	anim	lower.mb -xyzprecision 0.01 -quatprecision 0.00006 -dest grenade_lower
	//anim	fire1.mb -xyzprecision 0.01 -quatprecision 0.00006 -dest grenade_fire1
	anim	fire2.mb -xyzprecision 0.01 -quatprecision 0.00006 -dest grenade_fire2
	anim	start.mb -xyzprecision 0.01 -quatprecision 0.00006 -range 20 130 -dest grenade_start
	anim	start.mb -xyzprecision 0.01 -quatprecision 0.00006 -range 152 180 -dest grenade_throw
	//anim	models/weapons/grenades/cycles/fire2.mb -xyzprecision 0.01 -quatprecision 0.00006 -range 99 132 -dest throw
	//anim	models/weapons/grenades/cycles/fire3.mb -xyzprecision 0.01 -quatprecision 0.00006 -range 98 132 -dest grenade_lowthrow
	anim	fastthrow.mb -xyzprecision 0.01 -quatprecision 0.00006 -dest grenade_fastthrow


	// World Model Grenade	
	options -prefix PLAYER_NADE_ -keep ATTACHER barrel -parent barrel gbody -rename ATTACHER origin -clearorigin -sourcedir models/characters/player/mocap -destdir models/md5/weapons/grenade_world
	mesh	grenade_idle.mb -dest worldgrenade
	anim	grenade_idle.mb -dest grenade_idle
	anim	grenade_throw.mb -dest grenade_throw
}

entityDef weapon_handgrenade {
	"editor_color"				".3 .3 1"
	"editor_mins"				"-16 -16 0"
	"editor_maxs"				"16 16 32"
	"editor_usage"				"Hand Grenade"
	"editor_rotatable"			"1"

	"spawnclass"				"idItem"
	"size"						"32 32 32"
	"model"						"models/items/grenade_ammo/grenade.lwo"
	"model_view"				"viewmodel_grenade"
	"model_world" 				"worldmodel_handgrenade"
	"joint_attach"				"NADE_ATTACHER"
	"def_dropItem"				"moveable_item_grenades"

	"inv_name"					"#str_07013"
	"inv_weapon"				"weapon_handgrenade"
	"inv_ammo_grenades" 		"5"
	"inv_item"					"5"
	"inv_desc"					"#str_02537"
	"display_name"				"#str_02478"

	"icon"						"guis/assets/hud/wpn_4"
	"pdaIcon"					"guis/assets/hud/icons/grenade_new.tga"
	"hudIcon"					"guis/assets/hud/icons/grenadew.tga"	

	"weapon_scriptobject"		"weapon_handgrenade"
	"def_projectile"			"projectile_grenade"
	"def_explode_inhand"		"env_grenade_explodeinhand"
	"def_damage_inhand"			"damage_grenadeSplash_inhand"
	"ammoType"					"ammo_grenades"
	"ammoRequired"				"1"
	"clipSize"					"0"
	"silent_fire"				"1"

	"hide_time"					"0.3"								// time to hide weapon when talking to npcs or looking at guis
	"hide_distance"				"-15"								// distance to offset weapon when talking to npcs or looking at guis

	"snd_acquire"				"player_grenade_use"
	"snd_respawn"				"sound_weapon_respawn"
	"snd_explode"				"rocket_impact"

	// skin_invisible not defined, weapon code will call UpdateSkin on weapon script
	"skin_nade"					"skins/models/weapons/nade"
	"skin_nade_invis"			"skins/models/weapons/nade_invis"
	"skin_nonade"				"skins/models/weapons/nonade"
	"skin_nonade_invis"			"skins/models/weapons/nonade_invis"
	
	"spread"					"0"
	
	"primed_fuse"				"3"

	"controllerShakeHighMag"	"0.3"
	"controllerShakeHighTime"	"50"
	"controllerShakeLowMag"		"0.6"
	"controllerShakeLowTime"	"100"
}

entityDef env_grenade_explodeinhand {
	"spawnclass"				"idAnimatedEntity"
	"model"						"grenadeExplosion.prt"
}

entityDef moveable_item_grenades {
	"inherit"					"weapon_handgrenade"
	"spawnclass"				"idMoveableItem"
	"model"						"models/weapons/grenades/grenades_world.lwo"
	"density"					"0.05"
	"friction"					"0.2"
	"bouncyness"				"0"
	"snd_bounce"				"smallbox"
}

model worldmodel_handgrenade {
	mesh						models/md5/weapons/grenade_world/worldgrenade.md5mesh
	skin						skins/models/weapons/nade.skin

	anim idle 					models/md5/weapons/grenade_world/grenade_idle.md5anim
	anim fire					models/md5/weapons/grenade_world/grenade_throw.md5anim {
		frame 44				object_call GrenadeNoNade
		frame 69				object_call	GrenadeNade
	}
}

model viewmodel_grenade {
	mesh						models/md5/weapons/grenade_view/viewgrenade.md5mesh
	offset						( 6 3 -3 )

	anim raise 					models/md5/weapons/grenade_view/grenade_raise.md5anim {
		frame	1				sound_weapon player_grenade_use
	}
	anim idle 					models/md5/weapons/grenade_view/grenade_idle.md5anim {
		frame 1					object_call GrenadeNade
	}
	anim putaway 				models/md5/weapons/grenade_view/grenade_lower.md5anim
	anim fire 					models/md5/weapons/grenade_view/grenade_fire2.md5anim 
	anim throw_start 			models/md5/weapons/grenade_view/grenade_start.md5anim {
		// frame 1 				sound_body player_handgrenade_throw
		// Was frame 6 -Xian
	}		
	anim throw 					models/md5/weapons/grenade_view/grenade_throw.md5anim {
		frame 1					object_call GrenadeNade
		frame 8					object_call GrenadeNoNade
	}

	anim throw_quick 			models/md5/weapons/grenade_view/grenade_fastthrow.md5anim {
		frame 1					object_call GrenadeNade
		frame 14				object_call GrenadeNoNade
	}
}

entityDef damage_grenadeDirect {
	"damage"					"150"
	"push"						"1000"
	"mtr_wound_flesh"			"textures/decals/hurt02"
	"mtr_splat_flesh"			""
	"gib"						"1"
	"smoke_wound_flesh"			"bloodwound.prt"
}

entityDef damage_grenadeSplash {
	"damage"					"150"
	"radius"					"175"
	"knockback"					"80"
	"push"						"10000"
	"attackerDamageScale"		"0.2"
	"attackerPushScale"			"0.2"
	"gib"						"1"
}

entityDef damage_grenadeSplash_inhand {
	"inherit"					"damage_grenadeSplash"
	"selfDamageScale"			"20"
}

entityDef projectile_grenade {
	"spawnclass"				"idProjectile"
	"mins"						"-3 -3 0"
	"maxs"						"3 3 11"
	"cylinder"					"6"
	"model" 					"models/weapons/grenades/grenades_world.lwo"
	"offsetModel"				"0 0 -5"

	"def_damage"				"damage_grenadeDirect"
	"def_splash_damage"			"damage_grenadeSplash"
								
	"launchFromBarrel"			"1"
	"health"					"0"					// amount of damage projectile can take if damaged (0 means it can't be destroyed)
	"velocity"					"300 0 40"			// how fast the projectile leaves the gun (or distance if fuse is 0)
	"angular_velocity"			"10 -10 10"			// how the projectile is rotating when it leaves the gun
	"thrust"					"0"					// the rate of acceleration (always in the direction of the projectiles model)
	"thrust_start"				"0"					// when to start accelerating
	"thrust_end"				"0"					// when to stop accelerating
	"linear_friction"			"0.6"				// "air" friction
	"angular_friction"			"0.4"
	"contact_friction"			"0.1"
	"bounce"					"0.9"				// how much speed a projectile retains when it bounces off of objects (coefficient of restitution).  0 means no bounce.
	"mass"						"10"
	"gravity"					"1066"				// how much gravity affects the trajectory.  gravity direction is same as the entity that fired it.
	"fuse"						"3"					// how long before the projectile is removed or self-detonates.  Use 0 for beam weapons (velocity == distance).
						
	"detonate_on_fuse"			"1"					// whether projectile should detonate when it's fuse runs out
	"detonate_on_death"			"0"					// whether projectile should detonate when it's "killed" (health runs out)
	"detonate_on_world"			"0"					// whether projectile should detonate when it hits an obstacle
	"detonate_on_actor"			"1"					// whether projectile should detonate when it hits a character in the game
	"detonate_on_trigger"		"1"					// whether projectile should detonate when triggered by a character in the game
								
	"impact_damage_effect"		"1"					// whether projectile causes blood splats from characters that bleed
	"impact_gib"				"1"					// whether projectile can gib a character or not (for example: bullets don't gib, but rockets do)

	"mtr_detonate"				"textures/decals/ballburn01"
	"decal_size"				"300" 

	"model_detonate"			"grenadeExplosion.prt"			// parametric particles -- temp

	"smoke_fly"					"grenadetrail.prt"			// particle effect while in the air
	"smoke_detonate"			""								// particle effect when detonates
	"smoke_residue"				""								// particle effect while in the air
	"smoke_fuse"				""
	"smoke_bounce"				"bulletricochet.prt"

	"debris_count"				"6"
	"def_debris"				"debris_largeshrapnel"
	"def_shrapnel"				"debris_shrapnel"

	"mtr_light_shader"			""
	"light_color"				""
	"light_radius"				""
	"light_offset"				""

	"mtr_explode_light_shader"	"muzzleflash"
	"explode_light_color"		"1 0.8 0.4"
	"explode_light_radius"		"200"
	"explode_light_fadetime"	"0.25"
	
	"detonation_axis"			"0 0 1"

	"snd_impact"				"player_handgrenade_bounce"
	"snd_bounce"				"player_handgrenade_bounce"
	"snd_explode"				"rocket_impact"
	"snd_throw"					"player_handgrenade_throw"	// For precache -- referenced in the script
}
