Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Class DestructibleSedan : DestructibleVehicleBase
- {
- Default
- {
- //$Title Sedan
- //$Category Obstacles/Vehicles
- //$Angled
- Health 500;
- Radius 64;
- Height 48;
- DeathHeight 48;
- Mass 1500;
- Obituary "%o was killed by a car explosion.";
- DamageFactor "TankCrush", 32767;
- DestructibleVehicleBase.VehicleCrashVolume 0.5;
- DestructibleVehicleBase.VehicleFallThreshold 32;
- }
- Bool User_DisableFireParticles;
- Bool User_NoCarAlarm;
- Bool User_Indestructible;
- Bool GlassBroken;
- Void A_RandomizeSedanParticleValues()
- {
- RNGXOfs = FRandom (64,48);
- RNGYOfs = FRandom (-16,16);
- RNGVel = FRandom (2,8);
- RNGSize = FRandom (2,6);
- RNGLife = Random (35/2,35);
- }
- Override Void Tick()
- {
- Super.Tick();
- //These user variables are checked here so they can be changed at runtime.
- If (User_Indestructible) {bInvulnerable = True;}
- Else {bInvulnerable = False;}
- If (User_NoCarAlarm) {bNoPain = True;}
- Else {bNoPain = False;}
- }
- Void A_BreakSedanWindows(Double voffset = 40)
- {
- //Glass spawn points (In relation to the front of the car.)
- A_SpawnItemEx ("GlassShardSpawner",16,24,voffset); //Front right door window.
- A_SpawnItemEx ("GlassShardSpawner",16,-24,voffset); //Front left door window.
- A_SpawnItemEx ("GlassShardSpawner",-32,24,voffset); //Back right door window.
- A_SpawnItemEx ("GlassShardSpawner",-32,-24,voffset); //Back left door window.
- A_SpawnItemEx ("GlassShardSpawner",32,0,voffset); //Front car windshield.
- A_SpawnItemEx ("GlassShardSpawner",-64,0,voffset); //Back car windshield.
- }
- States
- {
- Spawn:
- RCND A 0
- {
- If (Health < 400)
- {
- SetStateLabel ("MinorDamage");
- }
- }
- RCND A 1;
- Loop;
- MinorDamage:
- RCBW A 0
- {
- If (GlassBroken == False)
- {
- A_StartSound ("DestVeh/Generic/GlassBreaking");
- A_BreakSedanWindows();
- GlassBroken = True;
- }
- Else {}
- }
- RCBW A 0
- {
- If (Health < 200)
- {
- SetStateLabel ("ExtraDamage");
- }
- }
- RCBW A 1;
- Goto MinorDamage+1;
- ExtraDamage:
- RCCW A 1;
- Loop;
- Death:
- RCBU A 4 Bright
- {
- A_StopSound (CHAN_ALARM);
- A_StartSound ("DestVeh/Generic/CarExplosion");
- A_Explode (128,256,XF_NOTMISSILE,True,96);
- A_QuakeEx (1,1,1,35,0,512+128,flags:QF_SCALEDOWN);
- bSolid = True;
- bShootable = True;
- bNoDamage = True;
- bNeverTarget = True;
- bNotAutoAimed = True;
- }
- RCBU BCDEFGH 4 Bright;
- RCBR ABCD 4 Bright
- {
- If (User_DisableFireParticles == False)
- {
- A_SpawnParticle ("FFE50B",SPF_FULLBRIGHT|SPF_RELATIVE,lifetime:RNGLife,size:RNGSize,xoff:RNGXOfs,yoff:RNGYOfs,zoff:38,velz:RNGVel,accelz:0.1,sizestep:0.1);
- A_RandomizeSedanParticleValues();
- A_SpawnParticle ("FFE50B",SPF_FULLBRIGHT|SPF_RELATIVE,lifetime:RNGLife,size:RNGSize,xoff:RNGXOfs,yoff:RNGYOfs,zoff:38,velz:RNGVel,accelz:0.1,sizestep:0.1);
- A_RandomizeSedanParticleValues();
- }
- }
- Goto Death+8;
- Crush:
- TNT1 A 0;
- Goto Death.TankCrush;
- Death.TankCrush:
- RCCR A 1
- {
- A_BreakSedanWindows(8);
- A_StartSound ("DestVeh/Generic/GlassBreakingLoud");
- A_StartSound ("DestVeh/Generic/CarCrush");
- }
- RCCR A -1;
- Stop;
- }
- }
- Class SedanGlassShard : Actor
- {
- Default
- {
- Mass 1;
- BounceType "Classic";
- BounceFactor 0.2;
- -NoGravity;
- }
- States
- {
- Spawn:
- CSHR ABCDE 0 A_Jump (256/5,"DoGlassStuff");
- Goto DoGlassStuff;
- DoGlassStuff:
- CSHR "#"
- {
- A_SetAngle (FRandom(90,-90));
- A_ChangeVelocity (FRandom(2.0,8.0),FRandom(4.0,-4.0),FRandom(0.0,8.0));
- }
- CSHR "##########" 35;
- Stop;
- }
- }
- Class GlassShardSpawner : Actor
- {
- Default {+NoInteraction;}
- Override PostBeginPlay()
- {
- Super.PostBeginplay();
- A_SpawnItemEx ("SedanGlassShard");
- A_SpawnItemEx ("SedanGlassShard");
- A_SpawnItemEx ("SedanGlassShard");
- A_SpawnItemEx ("SedanGlassShard");
- A_SpawnItemEx ("SedanGlassShard");
- Self.Destroy();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement