1
0
KF2-Dev-Scripts/KFGameContent/Classes/KFPickupFactory_Ammo.uc

111 lines
2.7 KiB
Ucode
Raw Normal View History

2020-12-13 15:01:13 +00:00
//=============================================================================
// KFPickupFactory_Ammo
//=============================================================================
// Pickup that gives some ammo for all weapons in inventory
//=============================================================================
// Killing Floor 2
// Copyright (C) 2015 Tripwire Interactive LLC
// - Andrew "Strago" Ladenberger
//=============================================================================
class KFPickupFactory_Ammo extends KFPickupFactory;
/** Sound to play when picking up ammo */
var() AkEvent AmmoPickupSound;
/** Overloaded to add this pickup to its proper list in the gameinfo */
simulated function InitializePickup()
{
local KFGameInfo KFGI;
if( bKismetDriven )
{
return;
}
KFGI = KFGameInfo( WorldInfo.Game );
if ( KFGI != none )
{
KFGI.AmmoPickups.AddItem( self );
}
}
/** Bypass PickupFactory implementation. This class doesn't use InventoryType. */
simulated event SetInitialState()
{
super.SetInitialState();
bScriptInitialized = true;
}
/** give pickup to player */
function GiveTo( Pawn P )
{
local KFInventoryManager KFIM;
2021-11-16 17:03:42 +00:00
local KFGameReplicationInfo KFGRI;
KFGRI = KFGameReplicationInfo(WorldInfo.GRI);
if(KFGRI != none && KFGRI.bIsEndlessPaused)
{
return;
}
2020-12-13 15:01:13 +00:00
KFIM = KFInventoryManager(P.InvManager);
if ( KFIM != None )
{
if( KFIM.GiveWeaponsAmmo( true ) )
{
`BalanceLog(class'KFGameInfo'.const.GBE_Pickup, P.PlayerReplicationInfo, "Ammo");
`AnalyticsLog(( "pickup", P.PlayerReplicationInfo, "ammo"));
PickedUpBy( P );
}
}
}
/** Activate a different pickup after the 'RespawnDelay' has finished */
function PickedUpBy(Pawn P)
{
local KFGameInfo KFGI;
if( bKismetDriven )
{
super.PickedUpBy( P );
return;
}
KFGI = KFGameInfo( WorldInfo.Game );
if ( KFGI != none )
{
KFGI.EnableNewPickup( KFGI.AmmoPickups, KFGI.DifficultyInfo.GetAmmoPickupInterval(KFGI.GetLivingPlayerCount()), self );
}
}
/** Determine what kind of pickup is visible. Used for dialog. */
function bool CurrentPickupIsAmmo()
{
return true;
}
defaultproperties
{
AmmoPickupSound=AkEvent'WW_UI_PlayerCharacter.Play_UI_Pickup_Ammo'
Begin Object Class=StaticMeshComponent Name=StaticMeshComponent0
StaticMesh=StaticMesh'ENV_Horzine_MESH.crates.ENV_Horzine_Equiptment_Crate_02'
Materials(0)=MaterialInstanceConstant'GP_Mat_Lib.GP_Ammo_MIC'
Scale=0.5f
bCastDynamicShadow=FALSE
CollideActors=FALSE
Translation=(Z=-50)
End Object
PickupMesh=StaticMeshComponent0
Components.Add(StaticMeshComponent0)
Begin Object NAME=CollisionCylinder
CollisionRadius=100.f
CollisionHeight=50.f
End Object
bNotBased=TRUE
}