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

Engine.Carcass


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
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
//=============================================================================
// Carcass.
//=============================================================================
class Carcass extends Decoration
    native;

// Sprite.
#exec Texture Import File=Textures\Corpse.pcx Name=S_Corpse Mips=Off Flags=2

// Variables.
var bool bPlayerCarcass;
var() byte flies;
var() byte rats;
var() bool bReducedHeight;
var bool bDecorative;
var bool bSlidingCarcass;
var int CumulativeDamage;
var PlayerReplicationInfo PlayerOwner;

var Pawn Bugs;

    function CreateReplacement()
    {
        if (Bugs != None)
            Bugs.Destroy();
    }

    function Destroyed()
    {
        local Actor A;

        if (Bugs != None)
            Bugs.Destroy();
                
        Super.Destroyed();
    }

    function Initfor(actor Other)
    {
        //implemented in subclasses
    }
            
    function ChunkUp(int Damage)
    {
        destroy();
    }
    
    static simulated function bool AllowChunk(int N, name A)
    {
        return true;
    }

    function TakeDamage( int Damage, Pawn instigatedBy, Vector hitlocation, 
                            Vector momentum, name damageType)
    {
        if ( !bDecorative )
        {
            bBobbing = false;
            SetPhysics(PHYS_Falling);
        }
        if ( (Physics == PHYS_None) && (Momentum.Z < 0) )
            Momentum.Z *= -1;
        Velocity += 3 * momentum/(Mass + 200);
        if ( DamageType == 'shot' )
            Damage *= 0.4;
        CumulativeDamage += Damage;
        if ( (((Damage > 30) || !IsAnimating()) && (CumulativeDamage > 0.8 * Mass)) || (Damage > 0.4 * Mass) 
            || ((Velocity.Z > 150) && !IsAnimating()) )
            ChunkUp(Damage);
        if ( bDecorative )
            Velocity = vect(0,0,0);
    }

auto state Dying
{
    ignores TakeDamage;

Begin:
    Sleep(0.2);
    GotoState('Dead');
}
    
state Dead 
{
    function Timer()
    {
        local bool bSeen;
        local Pawn aPawn;
        local float dist;

        if ( Region.Zone.NumCarcasses <= Region.Zone.MaxCarcasses )
        {
            if ( !PlayerCanSeeMe() )
                Destroy();
            else
                SetTimer(2.0, false);   
        }
        else
            Destroy();
    }
    
    function AddFliesAndRats()
    {
    }

    function CheckZoneCarcasses()
    {
    }
    
    function BeginState()
    {
        if ( bDecorative )
            lifespan = 0.0;
        else
            SetTimer(18.0, false);
    }
            
Begin:
    FinishAnim();
    Sleep(5.0);
    CheckZoneCarcasses();
    Sleep(7.0);
    if ( !bDecorative && !bHidden && !Region.Zone.bWaterZone && !Region.Zone.bPainZone )
        AddFliesAndRats();  
}

defaultproperties
{
     bDecorative=True
     bStatic=False
     bStasis=False
     Physics=PHYS_Falling
     LifeSpan=180.000000
     AnimSequence=Dead
     AnimFrame=0.900000
     DrawType=DT_Mesh
     Texture=Texture'Engine.S_Corpse'
     CollisionRadius=18.000000
     CollisionHeight=4.000000
     bCollideActors=True
     bCollideWorld=True
     bProjTarget=True
     Mass=180.000000
     Buoyancy=105.000000
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: za 22-4-2006 13:27:48.000 - Creation time: za 22-4-2006 13:29:26.953 - Created with UnCodeX