actor SSTChaingunGuy : ChaingunGuy //replaces ChaingunGuy
{
damagefactor "RedPaint", 0.3
damagefactor "OrangePaint", 0.3
damagefactor "YellowPaint", 0.3
damagefactor "GreenPaint", 0.3
damagefactor "BluePaint", 0.3
damagefactor "PurplePaint", 0.3
damagefactor "WhitePaint", 0.3
damagefactor "BlackPaint", 0.3
  PainChance "ShotgunWeak", 42

maxtargetrange 2200
dropitem "Stimpack" 12
  spawnid 2
  obituary "%o was gunned down by a chaingunner."
  health 70
  radius 20
  height 56
  mass 100
  speed 8
  painchance 170
  seesound "chainguy/sight"
  attacksound "chainguy/attack"
  painsound "chainguy/pain"
  deathsound "chainguy/death"
  activesound "chainguy/active"
  dropitem "SSTChaingun" 256
  MONSTER
  +FLOORCLIP
  +MISSILEMORE
  states
  {
  Spawn:
    CPOS AB 10 A_Look
    loop
  See:
    CPOS AABBCCDD 3 A_Chase
    loop
  Missile:
    CPOS E 10 A_FaceTarget
	TNT1 A 0 A_JumpIfTargetInLOS (2)
	CPOS E 1
    Goto See
    NULL A 0 A_SpawnItemEx ("ChaingunEcho", 0,0,0, 0,0,0, 0, 160)
    CPOS E 0 bright A_playsound("weapons/chngun")
    CPOS F 2 bright A_CustomMissile ("TracerChain", 32, 8, random(-2,2), CMF_OFFSETPITCH, random(-2,2))
    CPOS F 2 bright A_CustomMissile ("BulletCasingSpawner", 32, 8, 0, 0, 0)
    NULL A 0 A_SpawnItemEx ("ChaingunEcho", 0,0,0, 0,0,0, 0, 160)
    CPOS E 0 bright A_playsound("weapons/chngun")
    CPOS F 2 bright A_CustomMissile ("TracerChain", 32, 8, random(-2,2), CMF_OFFSETPITCH, random(-2,2))
    CPOS F 2 bright A_CustomMissile ("BulletCasingSpawner", 32, 8, 0, 0, 0)
    CPOS F 0 A_CPosRefire
    goto Missile+1
  Pain.Fire:
  	TNT1 AAAA 0 A_SpawnItemEx("imonfire", random(-8,-2),Random(-8,8),random(20, 38), 0, random(-30,30)*0.1, random(10,30)*0.1, 0, 160)
	Goto Pain
  Pain:
    CPOS G 3
    CPOS G 3 A_Pain
    goto See
  Death.Plasma:
	TNT1 A 0 A_Stop
    TNT1 A 0 ACS_ExecuteAlways(926,0, 10,0,0)
	NULL O 0 A_SpawnItemEx ("PlasmaDeathFX", 0,0,0, momx,momy,momz, 0, SXF_NOCHECKPOSITION|SXF_CLIENTSIDE|SXF_ABSOLUTEMOMENTUM)
    TROO H 0 A_JumpIfHealthLower(-35,"XDeath")
	goto Death
  Death.Fire:
	TNT1 A 0 A_Stop
    TNT1 A 0 ACS_ExecuteAlways(926,0, 10,0,0)
	NULL O 0 A_SpawnItemEx ("BurnDeathFX", 0,0,0, momx,momy,momz, 0, SXF_NOCHECKPOSITION|SXF_CLIENTSIDE|SXF_ABSOLUTEMOMENTUM)
	Goto Death
  XDeath.NewBullet:
    CPOS H 1
  Death:
    CPOS H 5
    CPOS I 5 A_Scream
    CPOS J 5 A_NoBlocking
    CPOS KLM 5
    CPOS N -1
    stop
  Death.Chainsaw:
    CPOS OOOO 0 A_DropItem("SSTHealthBonus",1,127)
  XDeathB:
    CPOS O 3
    CPOS P 3 A_XScream
	NULL A 0 A_SpawnItemEx ("BloodFXSpawner", 0, 0, 0, 0, 0, 0, 0, 160) 
    CPOS Q 3 A_NoBlocking
    NULL A 0 A_SpawnDebris ("BloodSpotSilent")
    CPOS RRRRSSSS 1 A_SpawnItemEx ("BloodFXSpawner", 0,0,random(0,40), 0,0,0, 0, 160,127) 
    CPOS T -1
    stop
	
  XDeath.Plasma:
    TNT1 A 0 ACS_ExecuteAlways(926,0, 10,0,0)
	CPOS O 1 BRIGHT
  XDeath:
    NULL A 0
	NULL A 0 A_FaceTarget
    NULL A 0 A_Jump(32, "XDeathB")
	NULL O 0 A_SpawnItemEx ("ChaingunnerGibSpawner", 0,0,0, momx,momy,momz, 0, SXF_NOCHECKPOSITION|SXF_CLIENTSIDE|SXF_TRANSFERTRANSLATION|SXF_ABSOLUTEMOMENTUM)
	NULL A 0 A_Stop
    CEX1 A 2 A_SpawnItemEx ("BloodFXSpawner", 0,0,random(0,40), 0,0,0, 0, 160,127) 
	CEX1 A 2 A_SpawnItemEx ("BloodFXSpawner", 0,0,random(0,40), 0,0,0, 0, 160,127) 
	CEX1 A 2 A_SpawnItemEx ("BloodFXSpawner", 0,0,random(0,40), 0,0,0, 0, 160,127) 
    NULL A 0 A_SpawnDebris ("BloodSpotSilent")
    CEX1 A 3 A_SpawnItemEx ("BloodFXSpawner", 0,0,random(0,40), 0,0,0, 0, 160)
    NULL A 0 A_SpawnDebris ("BloodSpotSilent")
    CEX1 A 3 A_SpawnItemEx ("BloodFXSpawner", 0,0,random(0,40), 0,0,0, 0, 160)
    NULL A 0 A_SpawnDebris ("BloodSpotSilent")
    CEX1 A 6
    CEX1 A 6 A_NoBlocking
    CEX1 AAAABC 6
    CEX1 D -1
    stop
	
  Death.Shotgun:
    TROO H 0 A_JumpIfCloser(56,1)//41
	Goto Death
  Death.Rocket:
    TROO H 0 A_JumpIfHealthLower(-35,"XDeath")
    TROO H 0 A_NoBlocking
	TNT1 A 0 Bright A_SpawnItemEx ("leftshouldergib", 0,8,32, momx*1.01,momy*1.01,0, random(0,90), SXF_NOCHECKPOSITION|SXF_CLIENTSIDE|SXF_TRANSFERTRANSLATION|SXF_ABSOLUTEMOMENTUM)
	TNT1 A 0 Bright A_SpawnItemEx ("leftfootgib", 0,12,0, 0,0,0, 0, SXF_NOCHECKPOSITION|SXF_CLIENTSIDE|SXF_TRANSFERTRANSLATION)
    TROO H 0 A_SpawnItemEx ("ChainguyRagdoll", 0,0,0, momx*random(1.25,1.75),momy*random(1.25,1.75),momz*3.0, 0, SXF_ABSOLUTEMOMENTUM|SXF_NOCHECKPOSITION|SXF_TRANSFERTRANSLATION) 
	//NULL O 0 A_SpawnItemEx ("ChaingunnerGibSpawner", 0,0,0, momx,momy,momz, 0, SXF_NOCHECKPOSITION|SXF_CLIENTSIDE|SXF_TRANSFERTRANSLATION)//|SXF_ABSOLUTEMOMENTUM
	CLEF ABCDEF 6 A_SpawnItemEx ("BloodFXSpawner", random(-2,2),random(-2,2),random(8,32), 0,0,0, 0, 160) 
	CLEF F -1
	Stop
  Raise:
    CPOS NMLKJIH 5
    goto See
    Crush:
	TNT1 A 0 A_SpawnItemEx ("Gibs", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION|SXF_USEBLOODCOLOR|SXF_CLIENTSIDE)
	TNT1 AAAAAAAA 0 A_SpawnItemEx ("SuperDuperClientsideBloodSpotSpawner", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION|SXF_USEBLOODCOLOR|SXF_CLIENTSIDE)
    TNT1 AAAAAAAA 1 A_SpawnItemEx ("Bloodsquirt3", 0,0,0, 0,0,0, random(-180,180), SXF_USEBLOODCOLOR|SXF_CLIENTSIDE|SXF_NOCHECKPOSITION)
    TNT1 A -1
    Stop
	  Pain.GreenPaint:
    TNT1 A 0 ACS_ExecuteAlways(926,0, 0,0,0)
	Goto Pain
  Pain.BluePaint:
    TNT1 A 0 ACS_ExecuteAlways(926,0, 1,0,0)
	Goto Pain
  Pain.RedPaint:
    TNT1 A 0 ACS_ExecuteAlways(926,0, 2,0,0)
	Goto Pain
  Pain.OrangePaint:
    TNT1 A 0 ACS_ExecuteAlways(926,0, 3,0,0)
	Goto Pain
  Pain.PurplePaint:
    TNT1 A 0 ACS_ExecuteAlways(926,0, 4,0,0)
	Goto Pain
  Pain.WhitePaint:
    TNT1 A 0 ACS_ExecuteAlways(926,0, 5,0,0)
	Goto Pain
  Pain.YellowPaint:
    TNT1 A 0 ACS_ExecuteAlways(926,0, 6,0,0)
	Goto Pain
  Pain.BlackPaint:
    TNT1 A 0 ACS_ExecuteAlways(926,0, 7,0,0)
	Goto Pain
  }
}
