// - This is not a weapon, there's no use to place this in any map
// - This is only a piece of paper spawned by the MegaTon containning its password
// - This password paper is given to the Instigator of the bomb
// - When the Instigator dies, this password is dropped
// - There's no use to drop it into a damage zone, since it will respawn at the bomb location
// - It will be only destroyed when the bomb destroys itself, by exploding or by disarming

class PassCard expands NaliWeapons;

#exec MESH IMPORT MESH=PassCard ANIVFILE=MODELS\PassCard_a.3d DATAFILE=MODELS\PassCard_d.3d X=0 Y=0 Z=0 UNMIRROR=1
#exec MESH LODPARAMS MESH=PassCard STRENGTH=0
#exec MESH ORIGIN MESH=PassCard X=0 Y=0 Z=0

#exec MESH SEQUENCE MESH=PassCard SEQ=All STARTFRAME=0 NUMFRAMES=1
#exec MESH SEQUENCE MESH=PassCard SEQ=Still STARTFRAME=0 NUMFRAMES=1

#exec MESHMAP NEW MESHMAP=PassCard MESH=PassCard
#exec MESHMAP SCALE MESHMAP=PassCard X=0.1 Y=0.1 Z=0.2

#exec TEXTURE IMPORT NAME=PassTrim FILE=SKINS\PassTrim.bmp GROUP=Skins FLAGS=2 LODSET=2
#exec MESHMAP SETTEXTURE MESHMAP=PassCard NUM=1 TEXTURE=PassTrim

#exec TEXTURE IMPORT NAME=Pass0 FILE=SKINS\Pass0.bmp GROUP=Skins FLAGS=2 LODSET=2
#exec MESHMAP SETTEXTURE MESHMAP=PassCard NUM=2 TEXTURE=Pass0
#exec MESHMAP SETTEXTURE MESHMAP=PassCard NUM=3 TEXTURE=Pass0
#exec MESHMAP SETTEXTURE MESHMAP=PassCard NUM=4 TEXTURE=Pass0

//Numbers import
#exec TEXTURE IMPORT NAME=Pass1 FILE=SKINS\Pass1.bmp GROUP=Skins FLAGS=2 LODSET=2
#exec TEXTURE IMPORT NAME=Pass2 FILE=SKINS\Pass2.bmp GROUP=Skins FLAGS=2 LODSET=2
#exec TEXTURE IMPORT NAME=Pass3 FILE=SKINS\Pass3.bmp GROUP=Skins FLAGS=2 LODSET=2
#exec TEXTURE IMPORT NAME=Pass4 FILE=SKINS\Pass4.bmp GROUP=Skins FLAGS=2 LODSET=2
#exec TEXTURE IMPORT NAME=Pass5 FILE=SKINS\Pass5.bmp GROUP=Skins FLAGS=2 LODSET=2
#exec TEXTURE IMPORT NAME=Pass6 FILE=SKINS\Pass6.bmp GROUP=Skins FLAGS=2 LODSET=2
#exec TEXTURE IMPORT NAME=Pass7 FILE=SKINS\Pass7.bmp GROUP=Skins FLAGS=2 LODSET=2
#exec TEXTURE IMPORT NAME=Pass8 FILE=SKINS\Pass8.bmp GROUP=Skins FLAGS=2 LODSET=2
#exec TEXTURE IMPORT NAME=Pass9 FILE=SKINS\Pass9.bmp GROUP=Skins FLAGS=2 LODSET=2

//Icons
#exec TEXTURE IMPORT NAME=PassIcon FILE=ICONS\PassIcon.bmp GROUP=Icons MIPS=OFF


var() texture NumbersTex[10];
var bool bAMasterOrder;
var MegaTonOMFG MegaO;

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

simulated function PostBeginPlay()
{
	bOwnsCrossHair = True;
	bCanThrow = True;
}


//Don't let grab other pieces of paper while this is on
function bool HandlePickupQuery( inventory Item )
{
    if ( Inventory == None || Item.Class == Class)
        return false;

    return Inventory.HandlePickupQuery(Item);
}


simulated function Destroyed()
{
	if (!bAMasterOrder)
		SpawnOther();
	Super.Destroyed();
}

function SpawnOther()
{
local PassCard pcardx;

	pcardx = Spawn(Class'PassCard');
	pcardx.MultiSkins[2] = MultiSkins[2];
	pcardx.MultiSkins[3] = MultiSkins[3];
	pcardx.MultiSkins[4] = MultiSkins[4];
	pcardx.MegaO = MegaO;
	MegaO.PCard = pcardx;
	pcardx.DropFrom(Location);
}

simulated function DestroyByMaster()
{
	bAMasterOrder = True;

	if ( Pawn(Owner) != None )
        Pawn(Owner).DeleteInventory(self);
    	Inventory = None;

	Destroy();
}

simulated function Tick( float DeltaTime)
{
	if ((Region.Zone.DamagePerSec > 0 || Region.Zone.bKillZone || Region.Zone.bPainZone) && Pawn(Owner) == None)
		SetLocation(MegaO.Location + 22*vect(0,0,1));
}


//Cancel firing functions
function Fire( float Value );
function AltFire( float Value );


defaultproperties
{
	DrawType=DT_Mesh
	Mesh=PassCard
	CollisionRadius=5.000000
	CollisionHeight=5.000000
	AutoSwitchPriority=1
	Icon=PassIcon
	InventoryGroup=1
	ItemArticle="a"
	ItemName="MegaTon Password Paper"
	MaxDesireability=0.500000
	PickupMessage="You got the MegaTon password."
	PickupSound=None
	PickupViewMesh=PassCard
	PickupViewScale=1.000000
	PlayerViewMesh=PassCard
	PlayerViewOffset=(X=20.000000,Y=-12.000000,Z=-11.000000)
	PlayerViewScale=0.500000
	RespawnTime=300.000000
	StatusIcon=PassIcon
	ThirdPersonMesh=PassCard
	ThirdPersonScale=0.700000
	AltDamageType=None
	AltFireSound=None
	AltProjectileClass=None
	bInstantHit=False
	AmmoName=Class'PassAmmo'
	DeathMessage="-"
	FireOffset=(X=0.000000,Y=0.000000,Z=0.000000)
	FireSound=None
	FiringSpeed=1.000000
	MaxTargetRange=4096.000000
	MyDamageType=None
	NameColor=(R=0,G=0,B=0)
	PickupAmmoCount=1
	ProjectileClass=None
	SelectSound=None
	shakemag=0.000000
	shaketime=0.200000
	shakevert=0.000000
	AIRating=0.000000
	AltRefireRate=1.000000
	bAltWarnTarget=False
	bRecommendAltSplashDamage=False
	bRecommendSplashDamage=False
	bSplashDamage=False
	bWarnTarget=False
	RefireRate=1.200000
	Mass=5.000000
	bNoSmooth=False
	bOwnsCrossHair=True
	CustomCross=None
	CrossHairSize=64
	bMegaWeapon=True
	NumbersTex(0)=Pass0
	NumbersTex(1)=Pass1
	NumbersTex(2)=Pass2
	NumbersTex(3)=Pass3
	NumbersTex(4)=Pass4
	NumbersTex(5)=Pass5
	NumbersTex(6)=Pass6
	NumbersTex(7)=Pass7
	NumbersTex(8)=Pass8
	NumbersTex(9)=Pass9
	bUnlit=True
}
