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

UTGame.UTDroppedPickup


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
//=============================================================================
// UT specific modifications to Pickup items.
//
// PickupFactory should be used to place items in the level.  This class is for dropped inventory, which should attach
// itself to this pickup, and set the appropriate mesh
//
// Copyright 1998-2008 Epic Games, Inc. All Rights Reserved.
//=============================================================================
class UTDroppedPickup extends DroppedPickup
	notplaceable
	native;

var() float YawRotationRate;
var PrimitiveComponent PickupMesh;
var ParticleSystemComponent PickupParticles;
var float StartScale;
var bool bRotatingPickup;
var bool bPickupable; // EMP forces a pickup to be unusable until it lands
var LightEnvironmentComponent MyLightEnvironment;

// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)

event PreBeginPlay()
{
	Super.PreBeginPlay();

	// if player who dropped me is still alive, prevent picking up until landing
	// to prevent that player from immediately picking us up
	bPickupable = (Instigator == None || Instigator.Health <= 0);
}

simulated event SetPickupMesh(PrimitiveComponent NewPickupMesh)
{
	if (NewPickupMesh != None && WorldInfo.NetMode != NM_DedicatedServer )
	{
		PickupMesh = new(self) NewPickupMesh.Class(NewPickupMesh);
		if ( class<UTWeapon>(InventoryClass) != None )
		{
			PickupMesh.SetScale(PickupMesh.Scale * 1.2);
		}
		PickupMesh.SetLightEnvironment(MyLightEnvironment);
		AttachComponent(PickupMesh);
	}
}

simulated event SetPickupParticles(ParticleSystemComponent NewPickupParticles)
{
	if (NewPickupParticles != None && WorldInfo.NetMode != NM_DedicatedServer )
	{
		PickupParticles = new(self) NewPickupParticles.Class(NewPickupParticles);
		AttachComponent(PickupParticles);
		PickupParticles.SetActive(true);
	}
}

simulated event Landed(vector HitNormal, Actor FloorActor)
{
	local float DotP, Offset;

	Super.Landed(HitNormal, FloorActor);

	if (PickupMesh != None)
	{
		DotP = HitNormal dot vect(0,0,1);
		if (DotP != 0.0 && DotP < 1.0)
		{
			Offset = sqrt(1.0 - square(DotP)) * CylinderComponent(CollisionComponent).CollisionRadius/DotP;
		}
		  if ( class<UTWeapon>(InventoryClass) != None )
		  {
			  Offset += class<UTWeapon>(InventoryClass).default.DroppedPickupOffsetZ;
		  }
	  
		  PickupMesh.SetTranslation(vect(0,0,-1) * Offset);
		  if(PickupParticles != None)
		  {
			  PickupParticles.SetTranslation(vect(0,0,-1) * Offset);
		  }
	}
}

auto state Pickup
{
	/*
	 Validate touch (if valid return true to let other pick me up and trigger event).
	*/
	function bool ValidTouch(Pawn Other)
	{
		return (bPickupable) ? Super.ValidTouch(Other) : false;
	}

	simulated event Landed(vector HitNormal, Actor FloorActor)
	{
		Global.Landed(HitNormal, FloorActor);
		if (Role == ROLE_Authority && !bPickupable)
		{
			bPickupable = true;
			CheckTouching();
		}
	}
}

State FadeOut
{
	simulated function BeginState(Name PreviousStateName)
	{
		bFadeOut = true;
		if ( PickupMesh != None )
		{
			StartScale = PickupMesh.Scale;
		}

		if( PickupParticles != None )
		{
			PickupParticles.DeactivateSystem();
		}

		LifeSpan = 1.0;
		YawRotationRate = 60000;
	}
}

defaultproperties
{
   YawRotationRate=32768.000000
   bPickupable=True
   Begin Object Class=DynamicLightEnvironmentComponent Name=DroppedPickupLightEnvironment ObjName=DroppedPickupLightEnvironment Archetype=DynamicLightEnvironmentComponent'Engine.Default__DynamicLightEnvironmentComponent'
      AmbientGlow=(R=0.200000,G=0.200000,B=0.200000,A=1.000000)
      bCastShadows=False
      bDynamic=False
      Name="DroppedPickupLightEnvironment"
      ObjectArchetype=DynamicLightEnvironmentComponent'Engine.Default__DynamicLightEnvironmentComponent'
   End Object
   MyLightEnvironment=DroppedPickupLightEnvironment
   Begin Object Class=SpriteComponent Name=Sprite ObjName=Sprite Archetype=SpriteComponent'Engine.Default__DroppedPickup:Sprite'
      ObjectArchetype=SpriteComponent'Engine.Default__DroppedPickup:Sprite'
   End Object
   Components(0)=Sprite
   Begin Object Class=CylinderComponent Name=CollisionCylinder ObjName=CollisionCylinder Archetype=CylinderComponent'Engine.Default__DroppedPickup:CollisionCylinder'
      ObjectArchetype=CylinderComponent'Engine.Default__DroppedPickup:CollisionCylinder'
   End Object
   Components(1)=CollisionCylinder
   Components(2)=DroppedPickupLightEnvironment
   bDestroyedByInterpActor=True
   CollisionComponent=CollisionCylinder
   Name="Default__UTDroppedPickup"
   ObjectArchetype=DroppedPickup'Engine.Default__DroppedPickup'
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: tr 31-1-2018 17:18:20.000 - Creation time: sk 18-3-2018 10:01:20.396 - Created with UnCodeX