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

KFMod.BoomStick


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
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
//=============================================================================
// BoomStick Inventory class
//=============================================================================
class BoomStick extends KFWeaponShotgun;

#EXEC OBJ LOAD FILE=KillingFloorHUD.utx

var     bool        bWaitingToLoadShotty;
var     float       CurrentReloadCountDown;
var()   float       ReloadCountDown;
var     int         SingleShotCount;
var     float       SingleShotReplicateCountdown;

replication
{
    reliable if(Role == ROLE_Authority)
		ClientSetSingleShotCount;
}

simulated function WeaponTick(float dt)
{
    super.WeaponTick(dt);

    if( Role == ROLE_Authority )
    {
        if( bWaitingToLoadShotty )
        {
            CurrentReloadCountDown -= dt;

            if( CurrentReloadCountDown <= 0 )
            {
                if( AmmoAmount(0) > 0 )
                {
                    MagAmmoRemaining = Min(AmmoAmount(0), 2);
                    SingleShotCount = MagAmmoRemaining;
                    ClientSetSingleShotCount(SingleShotCount);
                    NetUpdateTime = Level.TimeSeconds - 1;
    				bWaitingToLoadShotty = false;
                }
            }
        }

        if( SingleShotReplicateCountdown > 0 )
        {
            SingleShotReplicateCountdown -= dt;

            if( SingleShotReplicateCountdown <= 0 )
            {
                ClientSetSingleShotCount(SingleShotCount);
            }
        }
    }
}

// When someone holding an empty gun picks up ammo, make sure and tell the
// weapon that is has some shots it can take
function AmmoPickedUp()
{
    if( SingleShotCount == 0 )
    {
        MagAmmoRemaining = Min(AmmoAmount(0), 2);
        SingleShotCount = MagAmmoRemaining;
        ClientSetSingleShotCount(SingleShotCount);
        NetUpdateTime = Level.TimeSeconds - 1;
    }
}

simulated function SetPendingReload()
{
    bWaitingToLoadShotty = true;
    CurrentReloadCountDown = ReloadCountDown;
}

// Replicate the SingleShotCount on a slight delay. This prevents
// it from replicating from the server before the client does
// its shooting animation/sound effects which would prevent
// those from playing
function SetSingleShotReplication()
{
    SingleShotReplicateCountdown=0.05;
}

simulated function ClientSetSingleShotCount(float NewSingleShotCount)
{
    SingleShotCount = NewSingleShotCount;
}

// Overriden to support the special single firing or dual firing of the shotty
simulated function bool ConsumeAmmo( int Mode, float Load, optional bool bAmountNeededIsMax )
{
	if( super(Weapon).ConsumeAmmo(0, Load, bAmountNeededIsMax) )
	{
        MagAmmoRemaining -= Load;

        NetUpdateTime = Level.TimeSeconds - 1;
        return true;
	}
	return false;
}

//// client only ////
// Overriden to force a single shot if we only have 1 in the pipe
simulated event ClientStartFire(int Mode)
{
    if ( Pawn(Owner).Controller.IsInState('GameEnded') || Pawn(Owner).Controller.IsInState('RoundEnded') )
        return;
    if (Role < ROLE_Authority)
    {
        if( Mode == 1 && MagAmmoRemaining == 1 )
        {
            Mode = 0;
        }

        if (StartFire(Mode))
        {
            ServerStartFire(Mode);
        }
    }
    else
    {
        if( Mode == 1 && MagAmmoRemaining == 1 )
        {
            Mode = 0;
        }

        StartFire(Mode);
    }
}

// Overriden to allow switching between single/dual firing mode on the fly
simulated event ClientStopFire(int Mode)
{
    if( Mode == 0 && Instigator != none && Instigator.Controller != none )
    {
        if( Instigator.Controller.bAltFire == 1 )
            return;
    }

    if (Role < ROLE_Authority)
    {
        StopFire(Mode);
    }

    ServerStopFire(Mode);
}

simulated function bool StartFire(int Mode)
{
	if ( super.StartFire(Mode) )
	{
        if ( Instigator != none && PlayerController(Instigator.Controller) != none &&
			 KFSteamStatsAndAchievements(PlayerController(Instigator.Controller).SteamStatsAndAchievements) != none )
		{
			KFSteamStatsAndAchievements(PlayerController(Instigator.Controller).SteamStatsAndAchievements).OnShotHuntingShotgun();
		}

		return true;
	}

	return false;
}

simulated function int AmmoAmount(int mode)
{
	if ( bNoAmmoInstances )
	{
		if ( AmmoClass[0] == AmmoClass[mode] )
			return AmmoCharge[0];
		return AmmoCharge[mode];
	}
	if ( Ammo[0] != None )
		return Ammo[0].AmmoAmount;

	return 0;
}

function bool AllowReload()
{
	if ( MagAmmoRemaining == 1 )
	{
		return false;
	}

	return super.AllowReload();
}

function GiveAmmo(int m, WeaponPickup WP, bool bJustSpawned)
{
    super.GiveAmmo(m,WP,bJustSpawned);

    // Update the singleshotcount if we pick this weapon up
    if( WP != none )
    {
        if( m == 0 && AmmoAmount(0) < 2 )
        {
            SingleShotCount = AmmoAmount(0);
            ClientSetSingleShotCount(SingleShotCount);
        }
        else if( BoomStickPickup(WP) != none )
        {
            SingleShotCount = BoomStickPickup(WP).SingleShotCount;
            ClientSetSingleShotCount(SingleShotCount);
        }
    }
}

function GiveTo( pawn Other, optional Pickup Pickup )
{
	super.GiveTo( Other, Pickup );

	if( MagAmmoRemaining == 0 && AmmoAmount(0) > 0 )
	{
	    MagAmmoRemaining = Min(AmmoAmount(0), 2);
        SingleShotCount = MagAmmoRemaining;
        ClientSetSingleShotCount(SingleShotCount);
        NetUpdateTime = Level.TimeSeconds - 1;
		bWaitingToLoadShotty = false;
	}
}

defaultproperties
{
     ReloadCountDown=2.500000
     SingleShotCount=2
     ForceZoomOutOnFireTime=0.010000
     ForceZoomOutOnAltFireTime=0.010000
     MagCapacity=2
     ReloadRate=0.010000
     ReloadAnim="Reload"
     ReloadAnimRate=0.900000
     WeaponReloadAnim="Reload_HuntingShotgun"
     bHasAimingMode=True
     IdleAimAnim="Idle_Iron"
     StandardDisplayFOV=55.000000
     TraderInfoTexture=Texture'KillingFloorHUD.Trader_Weapon_Images.Trader_Hunting_Shotgun'
     bIsTier2Weapon=True
     MeshRef="KF_Weapons_Trip.BoomStick_Trip"
     SkinRefs(0)="KF_Weapons_Trip_T.Shotguns.boomstick_cmb"
     SelectSoundRef="KF_DoubleSGSnd.2Barrel_Select"
     HudImageRef="KillingFloorHUD.WeaponSelect.BoomStic_unselected"
     SelectedHudImageRef="KillingFloorHUD.WeaponSelect.BoomStick"
     PlayerIronSightFOV=70.000000
     ZoomedDisplayFOV=40.000000
     FireModeClass(0)=Class'KFMod.BoomStickAltFire'
     FireModeClass(1)=Class'KFMod.BoomStickFire'
     PutDownAnim="PutDown"
     AIRating=0.900000
     CurrentRating=0.900000
     bSniping=False
     Description="A double barreled shotgun used by big game hunters. It fires two slugs simultaneously and can bring down even the largest targets, quickly."
     DisplayFOV=55.000000
     Priority=160
     InventoryGroup=4
     GroupOffset=2
     PickupClass=Class'KFMod.BoomStickPickup'
     PlayerViewOffset=(X=8.000000,Y=14.000000,Z=-8.000000)
     BobDamping=6.000000
     AttachmentClass=Class'KFMod.BoomStickAttachment'
     ItemName="Hunting Shotgun"
     bUseDynamicLights=True
     TransientSoundVolume=1.000000
}

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:00.295 - Created with UnCodeX