Advertisement
Guest User

IzarianCarcass

a guest
Jul 5th, 2014
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //=============================================================================
  2. // IzarianCarcass.
  3. //=============================================================================
  4. class IzarianCarcass extends CreatureCarcass;
  5.  
  6. function ForceMeshToExist()
  7. {
  8.     //never called
  9.     Spawn(class 'SkCampClasses.Izarian');
  10. }
  11.  
  12. function TakeDamage( int Damage, Pawn InstigatedBy, Vector Hitlocation,
  13.                      Vector Momentum, name DamageType)
  14. {
  15.     local BloodSpurtBlue b;
  16.     //local BloodSpray2Blue BB; //UnrealBlood
  17.     //local int I;
  18.     //local int RadNum;
  19.     local vector Momentum2;
  20.     local String DmgCompare;
  21.     if ( bDeleteMe)
  22.         return;
  23.     b = Spawn(class'BloodSpurtBlue',,,HitLocation,rot(16384,0,0));
  24.     if ( bGreenBlood)
  25.         b.GreenBlood();
  26.  
  27.  
  28.     if (!bDeleteMe)
  29.     {
  30.         DmgCompare=Caps(String(DamageType));
  31.         Momentum2=(Momentum/mass)*3.0;
  32.         if (DmgCompare == "SHREDDED")
  33.             Momentum2 = vect(0,0,0);
  34.         if (DmgCompare == "SHOT")
  35.             Momentum2 = Momentum2*2;
  36.  
  37.         /*RadNum = Rand(4);
  38.         for (i = 0; i< RadNum; i++)
  39.         {
  40.             BB=Spawn(Class'BloodSpray2Blue',Self,'',hitlocation,rotator(location-hitlocation));
  41.             if (BB != none)
  42.             {
  43.                 if ( bGreenBlood)
  44.                     BB.Green();
  45.                 BB.Velocity=momentum2+Vrand()*100;
  46.             }
  47.             BB=none;
  48.         }*/
  49.     }
  50.  
  51.     if ( !bPermanent )
  52.     {
  53.         if ( (DamageType == 'Corroded') && (CumulativeDamage >= 100) && Region.Zone.bWaterZone && (Region.Zone.bDestructive || Region.Zone.bPainZone) && region.zone.DamageType==DamageType)
  54.         { /*-C go to previously unused state */
  55.             bCorroding = true;
  56.             GotoState('Corroding');
  57.         }
  58.         else
  59.         {
  60.             //Super.TakeDamage(Damage, instigatedBy, HitLocation, Momentum, DamageType);
  61.             if ( !bDecorative )
  62.             {
  63.                 bBobbing = false;
  64.                 SetPhysics(PHYS_Falling);
  65.             }
  66.             if ( (Physics == PHYS_None) && (Momentum.Z < 0) )
  67.                 Momentum.Z *= -1;
  68.             Velocity += 3 * momentum/(Mass + 200);
  69.             if ( DamageType == 'shot' )
  70.                 Damage *= 0.4;
  71.             CumulativeDamage += Damage;
  72.             if ( (((Damage > 30) || !IsAnimating()) && (CumulativeDamage > 0.8 * Mass)) || (Damage > 0.4 * Mass)
  73.                     || ((Velocity.Z > 150) && !IsAnimating()) )
  74.                 ChunkUp(Damage);
  75.             if ( bDecorative )
  76.                 Velocity = vect(0,0,0);
  77.         }
  78.     }
  79. }
  80.  
  81. function CreateReplacement()
  82. {
  83.     local IzarianChunks carc;
  84.  
  85.     if (bHidden)
  86.         return;
  87.     if ( bodyparts[0] != None )
  88.         carc = Spawn(class 'IzarianChunks');//,,, Location + ZOffset[0] * CollisionHeight * vect(0,0,1));,IzarianMasterChunk
  89.     if (carc != None)
  90.     {
  91.         carc.TrailSize = Trails[0];
  92.         carc.Mesh = bodyparts[0];
  93.         carc.bMasterChunk = true;
  94.         carc.Initfor(self);
  95.         carc.Bugs = Bugs;
  96.         if ( Bugs != None )
  97.             Bugs.SetBase(carc);
  98.         Bugs = None;
  99.     }
  100.     else if ( Bugs != None )
  101.         Bugs.Destroy();
  102. }
  103.  
  104. function ChunkUp(int Damage)
  105. {
  106.     if ( bPermanent )
  107.         return;
  108.     if ( Region.Zone.bPainZone && (Region.Zone.DamagePerSec > 0) )
  109.     {
  110.         if ( Bugs != None )
  111.             Bugs.Destroy();
  112.     }
  113.     else
  114.         CreateReplacement();
  115.     SetPhysics(PHYS_None);
  116.     bHidden = true;
  117.     SetCollision(false,false,false);
  118.     bProjTarget = false;
  119.     GotoState('Gibbing');
  120. }
  121.  
  122. function Landed(vector HitNormal)
  123. {
  124.     local rotator finalRot;
  125.  
  126.     if ( (Velocity.Z < -1000) && !bPermanent )
  127.     {
  128.         ChunkUp(200);
  129.         return;
  130.     }
  131.  
  132.     finalRot = Rotation;
  133.     finalRot.Roll = 0;
  134.     finalRot.Pitch = 0;
  135.     setRotation(finalRot);
  136.     SetPhysics(PHYS_None);
  137.     SetCollision(bCollideActors, false, false);
  138.     if ( HitNormal.Z < 0.99 )
  139.         ReducedHeightFactor = 0.1;
  140.     if ( HitNormal.Z < 0.93 )
  141.         ReducedHeightFactor = 0.0;
  142.     if ( !IsAnimating() )
  143.         LieStill();
  144. }
  145.  
  146. function AnimEnd()
  147. {
  148.     if ( Physics == PHYS_None )
  149.         LieStill();
  150.     else if ( Region.Zone.bWaterZone )
  151.     {
  152.         bThumped = true;
  153.         LieStill();
  154.     }
  155. }
  156.  
  157. function LieStill()
  158. {
  159.     SimAnim.X = 10000 * AnimFrame;
  160.     SimAnim.Y = 5000 * AnimRate;
  161.     if ( !bThumped && !bDecorative )
  162.         LandThump();
  163.     if ( !bReducedHeight )
  164.         ReduceCylinder();
  165. }
  166.  
  167. function ThrowOthers()
  168. {
  169.     local float dist, shake;
  170.     local pawn Thrown;
  171.     local PlayerPawn aPlayer;
  172.     local vector Momentum;
  173.  
  174.     Thrown = Level.PawnList;
  175.     While ( Thrown != None )
  176.     {
  177.         aPlayer = PlayerPawn(Thrown);
  178.         if ( aPlayer != None )
  179.         {
  180.             dist = VSize(Location - aPlayer.Location);
  181.             shake = FMax(500, 1500 - dist);
  182.             aPlayer.ShakeView( FMax(0, 0.35 - dist/20000),shake, 0.015 * shake );
  183.             if ( (aPlayer.Physics == PHYS_Walking) && (dist < 1500) )
  184.             {
  185.                 Momentum = -0.5 * aPlayer.Velocity + 100 * VRand();
  186.                 Momentum.Z =  7000000.0/((0.4 * dist + 350) * aPlayer.Mass);
  187.                 aPlayer.AddVelocity(Momentum);
  188.             }
  189.         }
  190.         Thrown = Thrown.nextPawn;
  191.     }
  192. }
  193.  
  194. function LandThump()
  195. {
  196.     local float impact;
  197.     //local UnrealBlood BP;
  198.  
  199.     if ( Physics == PHYS_None)
  200.     {
  201.         bThumped = true;
  202.         if ( Role == ROLE_Authority )
  203.         {
  204.             impact = 0.75 + Velocity.Z * 0.004;
  205.             impact = Mass * impact * impact * 0.015;
  206.             PlaySound(LandedSound,, impact);
  207.             if ( Mass >= 500 )
  208.                 ThrowOthers();
  209.         }
  210.         /*if (!bGreenBlood)
  211.             Spawn(Class'BloodPoolSpawnerBlue',Self,'',Location);
  212.         else
  213.         {
  214.             BP=spawn(Class'BloodPoolSpawnerBlue',self,'',Location);
  215.             if (BP != none)
  216.                 BP.Green();
  217.         }*/
  218.  
  219.     }
  220. }
  221.  
  222.  
  223.  
  224. simulated function HitWall(vector HitNormal, actor Wall)
  225. {
  226.     local BloodSpurtBlue b;
  227.  
  228.     b = Spawn(class 'BloodSpurtBlue',,,,Rotator(HitNormal));
  229.     if ( bGreenBlood )
  230.         b.GreenBlood();
  231.     b.RemoteRole = ROLE_None;
  232.     Velocity = 0.7 * (Velocity - 2 * HitNormal * (Velocity Dot HitNormal));
  233.     Velocity.Z *= 0.9;
  234.     if ( Abs(Velocity.Z) < 120 )
  235.     {
  236.         bBounce = false;
  237.         Disable('HitWall');
  238.     }
  239. }
  240.  
  241.  
  242. state Corroding
  243. {
  244.     ignores Landed, HitWall, AnimEnd, TakeDamage, ZoneChange;
  245.  
  246.     function Tick( float DeltaTime )
  247.     {
  248.         local int NewFatness;
  249.         local float splashSize;
  250.         local actor splash;
  251.  
  252.         NewFatness = fatness - 80 * DeltaTime;
  253.         if ( NewFatness < 85 )
  254.         {
  255.             if ( Region.Zone.bWaterZone && Region.Zone.bDestructive )
  256.             {
  257.                 splashSize = FClamp(0.0002 * Mass * (250 - 0.5 * FMax(-600,Velocity.Z)), 1.0, 4.0 );
  258.                 if ( Region.Zone.ExitSound != None )
  259.                     PlaySound(Region.Zone.ExitSound, SLOT_Interact, splashSize);
  260.                 if ( Region.Zone.ExitActor != None )
  261.                 {
  262.                     splash = Spawn(Region.Zone.ExitActor);
  263.                     if ( splash != None )
  264.                         splash.DrawScale = splashSize;
  265.                 }
  266.             }
  267.             Destroy();
  268.         }
  269.         fatness = Clamp(NewFatness, 0, 255);
  270.     }
  271.  
  272.     function BeginState()
  273.     {
  274.         Disable('Tick');
  275.     }
  276.  
  277. Begin:
  278.     Sleep(0.5);
  279.     Enable('Tick');
  280. }
  281.  
  282. function ReduceCylinder()
  283. {
  284.     local float OldHeight;
  285.  
  286.     RemoteRole=ROLE_DumbProxy;
  287.     bReducedHeight = true;
  288.     SetCollision(bCollideActors,False,False);
  289.     OldHeight = CollisionHeight;
  290.     if ( ReducedHeightFactor < Default.ReducedHeightFactor )
  291.         SetCollisionSize(CollisionRadius, CollisionHeight * ReducedHeightFactor);
  292.     else
  293.         SetCollisionSize(CollisionRadius + 4, CollisionHeight * ReducedHeightFactor);
  294.     //PrePivot = vect(0,0,1) * (OldHeight - CollisionHeight);
  295.     if ( !SetLocation(Location - PrePivot) )
  296.     {
  297.         SetCollisionSize(CollisionRadius - 4, CollisionHeight);
  298.         if ( !SetLocation(Location - PrePivot) )
  299.         {
  300.             SetCollisionSize(CollisionRadius, OldHeight);
  301.             SetCollision(false, false, false);
  302.             PrePivot = vect(0,0,0);
  303.         }
  304.     }
  305.     //PrePivot = PrePivot + vect(0,0,2);
  306.     Mass = Mass * 0.8;
  307.     Buoyancy = Buoyancy * 0.8;
  308. }
  309.  
  310.  
  311. defaultproperties
  312. {
  313.      Mesh=SkeletalMesh'SkCampMeshes.IzarianMesh'
  314.      AnimSequence=DeathMidHitDieF01
  315.      CollisionHeight=20
  316.      CollisionRadius=35
  317.      PrePivot=(Z=30.000000)
  318.      bodyparts(0)=LodMesh'SkCampMeshes.IzarianGib1M'
  319.      bodyparts(1)=LodMesh'SkCampMeshes.IzarianGib2M'
  320.      bodyparts(2)=LodMesh'SkCampMeshes.IzarianGib3M'
  321.      bodyparts(3)=LodMesh'SkCampMeshes.IzarianGib4M'
  322.      bodyparts(4)=LodMesh'SkCampMeshes.IzarianGib5M'
  323.      bodyparts(5)=LodMesh'SkCampMeshes.IzarianGib6M'
  324.      bodyparts(6)=LodMesh'SkCampMeshes.IzarianGib7M'
  325.      bodyparts(7)=LodMesh'SkCampMeshes.IzarianGib8M'
  326. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement