Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

KFMod.KFBreakableSM


00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
class KFBreakableSM extends StaticMeshActor;
/*

var () StaticMesh SmashedMesh;
var () int Health,ExplodeDamage,ExplodeRadius,ExplodeForce;
var () bool bExplosiveAffectedOnly;
var () class <DamageType> ExplodeDamageType;
var ()  class<Projector> ExplosionDecal;
var ()  sound    ExplosionSound;
var () class <emitter> ExplosionEffect;

var() vector RotMag;            // how far to rot view
var() vector RotRate;           // how fast to rot view
var() float  RotTime;           // how much time to rot the instigator's view
var() vector OffsetMag;         // max view offset vertically
var() vector OffsetRate;        // how fast to offset view vertically
var() float  OffsetTime;        // how much time to offset view

var bool bPlayedSmash;

replication
{
  reliable if ( bNetInitial && (Role==ROLE_Authority) )
    SmashedMesh;
}

function TakeDamage(int Damage, Pawn EventInstigator, vector HitLocation, vector Momentum, class<DamageType> DamageType)
{
 local Controller        C;
 local PlayerController  LocalPlayer;


if (bExplosiveAffectedOnly && DamageType != class 'DamTypeFrag')
 return;

 if (Damage >= Health && Health > 0 )
 {
  SetStaticMesh(SmashedMesh);
  log("KFBreakableSM SM = "$StaticMesh);
  HurtRadius(ExplodeDamage ,ExplodeRadius, ExplodeDamageType, ExplodeForce, Location) ;
  
  // Shake nearby players screens

     LocalPlayer = Level.GetLocalPlayerController();
    if ( (LocalPlayer != None) && (VSize(Location - LocalPlayer.ViewTarget.Location) < (ExplodeRadius * 2 )) )
        LocalPlayer.ShakeView(RotMag, RotRate, RotTime, OffsetMag, OffsetRate, OffsetTime);

    for ( C=Level.ControllerList; C!=None; C=C.NextController )
        if ( (PlayerController(C) != None) && (C != LocalPlayer)
            && (VSize(Location - PlayerController(C).ViewTarget.Location) < (ExplodeRadius * 2 )) )
            C.ShakeView(RotMag, RotRate, RotTime, OffsetMag, OffsetRate, OffsetTime);

  if (Level.NetMode == NM_ListenServer || Level.NetMode == NM_StandAlone)
  {
    SpawnEffects(HitLocation, vect(0,0,0));
  }
 }
 //else
  Health -= Damage;
}


simulated function SpawnEffects( vector HitLocation, vector HitNormal )
{
    local PlayerController PC;

    PlaySound (ExplosionSound,,3*TransientSoundVolume);

    //log("KFBreakableSM EffectIsRelevant(Location,false) = "$EffectIsRelevant(Location,false));

    if ( EffectIsRelevant(Location,false) )
    {
        PC = Level.GetLocalPlayerController();
        if ( (PC.ViewTarget != None) && VSize(PC.ViewTarget.Location - Location) < 3000 )
            spawn(class'FlakExplosion',,,HitLocation + HitNormal*16 );
        spawn(class'FlashExplosion',,,HitLocation + HitNormal*16 );
        spawn(ExplosionEffect,,,HitLocation + HitNormal*16, rotator(HitNormal) );
        if ( (ExplosionDecal != None) && (Level.NetMode != NM_DedicatedServer) )
            Spawn(ExplosionDecal,self,,HitLocation, rotator(-HitNormal));
    }
}

simulated function PostNetReceive()
{

	log("POSTNETRECIEVE! - StaticMesh = "$StaticMesh);
	log("SmashedMesh = "$SmashedMesh);
	log("bPlayedSmash = "$bPlayedSmash);
	log("StaticMesh==SmashedMesh && !bPlayedSmash = "$(StaticMesh==SmashedMesh && !bPlayedSmash) );

    if ( StaticMesh==SmashedMesh && !bPlayedSmash )
	{
	  //log("BOOM!");
      bPlayedSmash = true;
	  SpawnEffects(Location, vect(0,0,0));
    }
}
  */



/*
defaultproperties
{

 ExplodeForce = 50000
 ExplodeRadius = 200
 ExplodeDamage = 50
 Health = 100
 StaticMesh = StaticMesh'KillingFloorStatics.LookTargetMoverDummy'


 bStatic = false;
 bStasis = false;
 ExplodeDamageType = class 'Gameplay.Burned'
 //bWorldGeometry=False
 bAcceptsProjectors = True
 ExplosionDecal=class'RocketMark'
 ExplosionSound = Sound'WeaponSounds.BExplosion1'
 ExplosionEffect = class 'KFMod.KFVehicleExplosion'
 bNetNotify=True
 
 RotMag=(X=100.000000,Y=100.000000,Z=100.000000)
 RotRate=(X=500.000000,Y=500.000000,Z=500.000000)
 RotTime=3.000000
 OffsetMag=(X=40.000000,Y=40.000000,Z=40.000000)
 OffsetRate=(X=500.000000,Y=500.000000,Z=500.000000)
 OffsetTime=3.000000

}
*/

defaultproperties
{
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Fri 13-10-2023 03:17:26.000 - Creation time: Fri 13-10-2023 03:19:03.113 - Created with UnCodeX