ACTOR ZombieGunner : Zombieman replaces Zombieman
{
	Speed 10
	SeeSound "zomrifle/see"
	PainSound "zomrifle/pain"
	DeathSound "zomrifle/die"
	ActiveSound "zomrifle/idle"
	Obituary "%o was gunned down by a zombie rifleman."
	+DOHARMSPECIES
	DropItem "Clip"
	States
	{
	Spawn:
		ZSEC AB 10 A_Look
		Loop
	See:
		ZSEC AABBCCDD 3 A_Chase
		Loop
	Missile:
		ZSEC E 1 A_FaceTarget
		TNT1 A 0 a_jump (80,"burstfire")
		TNT1 A 0 a_jump (70,"ConsiderGrenade")
		ZSEC E 9 A_FaceTarget
		ZSEC E 1
	Normalshot:
		TNT1 A 0
		TNT1 A 0 A_PlaySound ("zomrifle/attack")
		ZSEC F 4 bright A_CustomBulletAttack (22.5, 0, 1, random(1,5) * 3, "BulletPuff", 0, CBAF_NORANDOM)
		ZSEC E 10 
		Goto See
	burstfire:
		TNT1 A 0
		TNT1 A 0 a_playsound ("Zomrifle/Altload",0,1,0,0.6)
		ZSEC E 15 A_FaceTarget
		TNT1 A 0 A_CustomMissile("Monstercasingspawner",30,3)
		TNT1 A 0 A_PlaySound ("zomrifle/attack")
		ZSEC F 3 bright A_CustomBulletAttack (22.5, 0, 1, random(1,5) * 3, "BulletPuff", 0, CBAF_NORANDOM)
		ZSEC E 3 A_FaceTarget
		TNT1 A 0 A_CustomMissile("Monstercasingspawner",30,3)
		TNT1 A 0 A_PlaySound ("zomrifle/attack")
		ZSEC F 3 bright A_CustomBulletAttack (22.5, 0, 1, random(1,5) * 3, "BulletPuff", 0, CBAF_NORANDOM)
		ZSEC E 3 A_FaceTarget
		TNT1 A 0 A_CustomMissile("Monstercasingspawner",30,3)
		TNT1 A 0 A_PlaySound ("zomrifle/attack")
		ZSEC F 3 bright A_CustomBulletAttack (22.5, 0, 1, random(1,5) * 3, "BulletPuff", 0, CBAF_NORANDOM)
		ZSEC E 6 a_spawnitemex ("monstersmokespawner", 10,0,20,5,0,5)
		ZSEC E 6 a_spawnitemex ("monstersmokespawner", 10,0,20,5,0,5)
		ZSEC E 6 a_spawnitemex ("monstersmokespawner", 10,0,20,2,0,5)
		ZSEC E 6 a_spawnitemex ("monstersmokespawner", 10,0,20,2,0,5)
		ZSEC E 20
		Goto See
	ConsiderGrenade:
		ZSEC E 1 A_FaceTarget
		TNT1 A 0 a_jumpifcloser (220,"NormalShot") //If target's too close, don't shoot the grenade, you might blow yourself up, idiot.
		TNT1 A 0 a_playsound ("Malefactors/GrenadeReady",0,1,0,0.6)
		ZSEC E 10 A_FaceTarget
		ZSEC E 1 a_jumpifcloser (650,"FireGrenade")
		ZSEC E 10 a_playsound ("Malefactors/GrenadeCancel",0,1,0,0.6)
		ZSEC A 10 a_facetarget
		ZSEC E 9 A_FaceTarget	
		goto normalshot
	FireGrenade:
		TNT1 A 0
		ZSEC E 8 A_FaceTarget
		TNT1 A 0 a_jumpifcloser (220,"CancelGrenade") //If target's too close, don't shoot the grenade, you might blow yourself up, idiot.
		ZSEC E 15 A_FaceTarget
		TNT1 A 0 a_playsound ("Malefactors/GrenadeShot",0)
		ZSEC F 4 bright A_CustomMissile("CAZombieGrenade",30,3)
		TNT1 A 0 a_recoil (6)
		ZSEC E 10
		goto see		
	CancelGrenade:
		ZSEC G 3
		ZSEC G 3 A_Pain
		ZSEC E 10 a_playsound ("Malefactors/GrenadeCancel",0,1,0,0.6)
		Goto See		
		
	Pain:
		ZSEC G 3
		ZSEC G 3 A_Pain
		Goto See		
	Death:
		ZSDI A 5
		ZSDI B 5 A_Scream
		ZSDI C 5 A_NoBlocking
		ZSDI D 5
		ZSDI E -1
		stop
	XDeath:
		SPOS M 5 A_NoBlocking
		TNT1 A 0 a_playsound ("MaleFactors/Gib",0,1)
		TNT1 AAA 0 a_spawnitemex("CAXblood",0,0,10,random(-7,7),random(-6,6),random(10,12))
		TNT1 AAA 0 a_spawnitemex("CAXblood",0,0,10,random(-8,8),random(-10,10),random(9,14))
    	TNT1 A 0 BRIGHT a_spawnitemex("CAMonsterBlud",0,0,0,random(-3,8),random(-6,8),random(10,12))
    	TNT1 A 0 BRIGHT a_spawnitemex("CAMonsterBlud",0,0,0,random(-6,12),random(-10,10),random(10,12))
    	TNT1 A 0 BRIGHT a_spawnitemex("cs_go",0,0,0,random(-7,10),random(-9,12),random(10,12))
    	TNT1 A 0 BRIGHT a_spawnitemex("cs_go",0,0,0,random(-3,16),random(-10,16),random(10,12))
    	TNT1 A 0 BRIGHT A_PlaySound("CABsplat",0,0.30)	
		SPOS N 5 A_XScream
		SPOS O 5 
		SPOS PQRST 5
		SPOS U -1
		stop
	Death.CALinkedBomb:
	Death.CALinked:
		TNT1 A 0
		TNT1 A 0 a_scream
		TNT1 A 0 a_noblocking
		TNT1 A 0 a_changeflag ("THRUACTORS",1)
		TNT1 A 0 a_stop
		TNT1 A 0 a_playsound ("Malefactors/LinkedHurt",0,0.80)
		TNT1 A 1 a_spawnitemex ("CALinkedKill",0,0,35)
		TNT1 A 0 a_playsound ("Malefactors/LinkedDeath",0,1,0,0.90)
		TNT1 A 2
		TNT1 A 3 ThrustThingZ (0,30,0,1)
		L1ST A 2
		L1ST A -1
		wait
	Death.CABladeBeam:
		TNT1 A 0
		TNT1 A 0 a_facetarget
		TNT1 A 0 a_scream
		TNT1 A 0 a_noblocking
		TNT1 A 0 a_playsound ("Malefactors/BladeBeamDeath1",0,1,0,0.90)
		TNT1 A 0 a_spawnitemex ("MalefactorRiflemanTorso",0,0,36,random(-3,3),random(-3,3),random (1,2),0,SXF_NOCHECKPOSITION)
		8DX1 B random (45,50)
		TNT1 AAA 0 a_spawnitemex("FireDebris",0,0,random(3,8),random(-8,8),random(-7,7),random(6,7),0,SXF_NOCHECKPOSITION)
		TNT1 A 0 a_playsound ("Malefactors/BladeBeamExplosion",0,0.80,0)
		TNT1 A 1 A_SpawnItemEx("MonsterFireExplosion",0,0,30)
		stop
		
	Raise:
		TNT1 A 0
		TNT1 A 0 a_changeflag ("THRUACTORS",0)
		TNT1 A 0 a_setscale (1)
		ZSDI E 4
		ZSDI DCBA 6
		Goto See
	}
}


actor CAZombieGrenade
{
	projectile
	+bloodlessimpact
	+bright
	damage (0)
	speed 25
	+thruactors
	+FORCEXYBILLBOARD
	+hexenbounce
	+SEEKERMISSILE
	-NOGRAVITY
	seesound "Malefactors/GrenadeBounce"
	radius 10
	height 12
	reactiontime 15
	bouncefactor 0.50
	scale 1
	Gravity 0.25
	bouncecount 3
	states
	{
	spawn:
		TNT1 A 0 
		TNT1 A 0 A_PlaySound("silence", CHAN_VOICE)
		TNT1 A 0 thrustthingz (0,18,0,0)
	flight:
		8FG1 A 1 A_JumpIfTracerCloser (150, "FallDown")
		8FG1 B 1 A_JumpIfTracerCloser (150, "FallDown")
		TNT1 A 0 A_SpawnItemEx("monstersmokespawner",0,0,2,0,0,frandom(2,5))
		8FG1 C 1 A_JumpIfTracerCloser (150, "FallDown")
		8FG1 D 1 A_JumpIfTracerCloser (150, "FallDown")
		TNT1 A 0 A_SpawnItemEx("monstersmokespawner",0,0,2,0,0,frandom(2,5))
		8FG1 E 1 A_JumpIfTracerCloser (150, "FallDown")
		8FG1 F 1 A_JumpIfTracerCloser (150, "FallDown")
		TNT1 A 0 A_SpawnItemEx("monstersmokespawner",0,0,2,0,0,frandom(2,5))
		8FG1 G 1 A_JumpIfTracerCloser (150, "FallDown")
		8FG1 H 1 A_JumpIfTracerCloser (150, "FallDown")
		TNT1 A 0 A_SpawnItemEx("monstersmokespawner",0,0,2,0,0,frandom(2,5))
		TNT1 A 0 a_countdown
		loop
	FallDown:
		8FG2 A 1 a_setgravity (1.15)
		TNT1 A 0 thrustthingz (0,10,1,0) 
		8FG2 A 1 a_scalevelocity (0.50)
		8FG2 A 10 A_JumpIfTracerCloser (50, "Armed")
		8FG2 A 10 A_JumpIfTracerCloser (50, "Armed")
		Goto Death
	Armed:
		TNT1 A 0
		8FG2 A 1 a_stop		
	death:
		8FG2 A 1 a_setgravity (1.25)
		8FG2 A 10
		8FG2 A 1 a_scalevelocity (0.20)
		8FG2 A random (25,45)
		TNT1 A 0 a_stop
		TNT1 A 0 a_playsound ("Malefactors/GrenadeOpen",0,1,0,0.90)
		8FG2 ABCDE 1
		8FG2 E 15
		8FG2 E 2 a_setscale (0.95)
		TNT1 A 0 a_playsound ("Malefactors/GrenadeBeep",CHAN_VOICE,1,0,0.90)
		8FG2 E 2 a_setscale (1.05)
		8FG2 E 6 a_setscale (1)
		8FG2 E 2 a_setscale (1.05)
		TNT1 A 0 a_playsound ("Malefactors/GrenadeBeep",CHAN_VOICE,1,0,0.90)
		8FG2 E 2 a_setscale (1.05)
		8FG2 E 6 a_setscale (1)
		8FG2 E 2 a_setscale (0.95)
		TNT1 A 0 a_playsound ("Malefactors/GrenadeBeep",CHAN_VOICE,1,0,0.90)
		8FG2 E 2 a_setscale (1.05)
		8FG2 E 2 a_setscale (1)
		TNT1 A 0 a_playsound ("Malefactors/GrenadeWarn",CHAN_VOICE,1,0,0.90)



		8FG2 F 1 a_setscale (1.10)
		TNT1 A 0 a_playsound ("Malefactors/GrenadeClose",0,1,0,0.90)
		8FG2 G 1 a_setscale (1.20,1.10)
		8FG2 H 1 a_setscale (1.40,1.20)
		8FG2 H 1 a_setscale (1.30,1.15)
		8FG2 I 1 a_setscale (1.50,1.25)
		8FG2 I 1 
		TNT1 A 0 Radius_Quake (2,6,0,10,0)
		TNT1 A 0 a_playsound ("Malefactors/GrenadeExplode",CHAN_VOICE)
		TNT1 A 0 a_explode (20,180,0,1,50)
		TNT1 A 0 A_SpawnItemEx("MonsterFireExplosion",0,0,30)
		TNT1 AAAAAAAAAAAA 0 Bright A_SpawnItemEx("MonsterFireTrail",frandom(-21,21),frandom(-21,21),frandom(-21,21),frandom(-1,1),frandom(-1,1),frandom(0,1))
		TNT1 AAAAAAAAAAA 0 Bright A_SpawnItemEx("MonsterFireEmber2",frandom(-16,16),frandom(-16,16),frandom(-16,16),frandom(-1,1),frandom(-1,1),frandom(0,1))
		TNT1 AAAAAAAAAAA 0 Bright A_SpawnItemEx("MonsterFireSmoke2",frandom(-4,4),frandom(-4,4),frandom(-4,4),frandom(-1,1),frandom(-1,1),frandom(0,1))
		TNT1 AAAAAAAAA 0 Bright A_SpawnItemEx("MonsterFireSmoke",frandom(-4,4),frandom(-4,4),frandom(-4,4),0,0,frandom(1,2))
		TNT1 A 3 bright
		stop
	}
}


actor MalefactorRiflemanTorso
{
 	+THRUACTORS
	+NOGRAVITY
	+Missile
	+Hexenbounce
	Speed 5
	gravity 0.80
    States
    {
    Spawn:
		TNT1 A 0
		8DX1 A 6
		TNT1 A 0 a_scalevelocity (0.30)
		8DX1 A 6
		TNT1 A 0 a_scalevelocity (0.50)
		8DX1 A 6
		TNT1 A 0 a_stop
		8DX1 A 10
		TNT1 A 0 a_changeflag ("NOGRAVITY",0)
		TNT1 A 0 a_changeflag ("HEXENBOUNCE",0)
	Falling:
		8DX1 A 1
		TNT1 A 0 A_CheckFloor ("Death")
		loop
	Death:
		TNT1 A 0
		TNT1 AAA 0 a_spawnitemex("FireDebris",0,0,random(3,8),random(-8,8),random(-7,7),random(6,7),0,SXF_NOCHECKPOSITION)
		TNT1 A 0 a_playsound ("Malefactors/BladeBeamExplosion",0,1,0,0.90)
		TNT1 A 1 A_SpawnItemEx("MonsterFireExplosion",0,0,30)
        Stop
    }
}
	