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

DeusEx.ShowerFaucet


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
//=============================================================================
// ShowerFaucet.
//=============================================================================
class ShowerFaucet extends DeusExDecoration;

#exec OBJ LOAD FILE=Ambient
#exec OBJ LOAD FILE=MoverSFX
#exec OBJ LOAD FILE=Effects

var() bool              bOpen;
var ParticleGenerator   waterGen[4];
var Vector              sprayOffsets[4];

function Destroyed()
{
    local int i;

    for (i=0; i<4; i++)
        if (waterGen[i] != None)
            waterGen[i].DelayedDestroy();

    Super.Destroyed();
}

function Frob(actor Frobber, Inventory frobWith)
{
    local int i;

    Super.Frob(Frobber, frobWith);

    bOpen = !bOpen;
    if (bOpen)
    {
        PlaySound(sound'ValveOpen',,,, 256, 2.0);
        PlayAnim('On');

        for (i=0; i<4; i++)
            if (waterGen[i] != None)
                waterGen[i].Trigger(Frobber, Pawn(Frobber));

        // extinguish the player if he frobbed this
        if (DeusExPlayer(Frobber) != None)
            if (DeusExPlayer(Frobber).bOnFire)
                DeusExPlayer(Frobber).ExtinguishFire();
    }
    else
    {
        PlaySound(sound'ValveClose',,,, 256, 2.0);
        PlayAnim('Off');

        for (i=0; i<4; i++)
            if (waterGen[i] != None)
                waterGen[i].UnTrigger(Frobber, Pawn(Frobber));
    }
}

function PostBeginPlay()
{
    local ShowerHead head, linkedHead;
    local Vector loc;
    local int i;

    Super.PostBeginPlay();

    // find the matching shower head
    linkedHead = None;
    if (Tag != '')
        foreach AllActors(class'ShowerHead', head, Tag)
            linkedHead = head;

    // spawn a particle generator
    if (linkedHead != None)
    {
        for (i=0; i<4; i++)
        {
            // rotate the spray offsets into object coordinate space
            loc = sprayOffsets[i];
            loc.X += linkedHead.CollisionRadius * 0.7;
            loc.Z -= linkedHead.CollisionHeight * 0.85;
            loc = loc >> linkedHead.Rotation;
            loc += linkedHead.Location;

            waterGen[i] = Spawn(class'ParticleGenerator', linkedHead,, loc, linkedHead.Rotation-rot(8192,0,0));
            if (waterGen[i] != None)
            {
                waterGen[i].particleDrawScale = 0.05;
                waterGen[i].checkTime = 0.05;
                waterGen[i].frequency = 1.0;
                waterGen[i].bGravity = True;
                waterGen[i].bScale = False;
                waterGen[i].bFade = True;
                waterGen[i].ejectSpeed = 100.0;
                waterGen[i].particleLifeSpan = 1.5;
                waterGen[i].numPerSpawn = 3;
                waterGen[i].bRandomEject = True;
                waterGen[i].particleTexture = Texture'Effects.Generated.WtrDrpSmall';
                waterGen[i].bTriggered = True;
                waterGen[i].bInitiallyOn = bOpen;
                waterGen[i].SetBase(linkedHead);

                // only have sound on one of them
                if (i == 0)
                {
                    waterGen[i].bAmbientSound = True;
                    waterGen[i].AmbientSound = Sound'Shower';
                    waterGen[i].SoundRadius = 16;
                }
            }
        }
    }

    // play the correct startup animation
    if (bOpen)
        PlayAnim('On', 10.0, 0.001);
    else
        PlayAnim('Off', 10.0, 0.001);
}

defaultproperties
{
     sprayOffsets(0)=(X=2.000000,Z=2.000000)
     sprayOffsets(1)=(Y=-2.000000)
     sprayOffsets(2)=(X=-2.000000,Z=-2.000000)
     sprayOffsets(3)=(Y=2.000000)
     bInvincible=True
     ItemName="Shower Faucet"
     bPushable=False
     Physics=PHYS_None
     Mesh=LodMesh'DeusExDeco.ShowerFaucet'
     CollisionRadius=6.800000
     CollisionHeight=6.410000
     Mass=20.000000
     Buoyancy=10.000000
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Mon 8/11/2021 16:22:50.000 - Creation time: Mon 8/11/2021 16:31:32.530 - Created with UnCodeX