Begin A1_DAT_SRT_Dummy

Short OnPCDrop
Short ValidSpot
Short ValidCell
Float TentDummyDelTimer

If ( GetDisabled == 1 )
		Set TentDummyDelTimer To ( TentDummyDelTimer + GetSecondsPassed )
	If ( TentDummyDelTimer > 0.5 )
		Set TentDummyDelTimer To 0
		SetDelete 1
	EndIf
EndIf

Set ValidCell to 0
Set ValidSpot to 0

If ( GetInterior == 0 )
	Set A1_DAT_SRT_TeleCell to 0
	Set ValidCell to 1
Endif
	
If ( GetInterior == 1 )
	If ( GetPCCell, "Mournhold, Plaza Brindisi Dorom" == 1 )
		Set ValidCell to 1
		Set A1_DAT_SRT_TeleCell to 1
	ElseIf ( GetPCCell, "Mournhold, Temple Courtyard" == 1 )
		Set ValidCell to 1
		Set A1_DAT_SRT_TeleCell to 2
	Else
		Set ValidCell to -1
	Endif
Endif

If ( OnPCDrop == 1 )
	If ( ValidCell < 0 )
		Set ValidSpot to -1
		Set A1_DAT_SRT_TeleCell to 0
	ElseIf ( Player -> GetPos, Z <= 0 )
		Set ValidSpot to -1
	ElseIf ( Player -> GetEffect, sEffectLevitate == 1 )
		Set ValidSpot to -1
	ElseIf ( PCGet3rdPerson == 1 )
		Set ValidSpot to -1
	ElseIf ( GetPCJumping == 1 )
		Set ValidSpot to -1
	ElseIf ( GetPCRunning == 1 )
		Set ValidSpot to -1
	Else
		Set ValidSpot to 1
					Endif
				Endif
			EndIf
		Endif
	Endif
EndIf

If ( ValidSpot < 0 )
	MessageBox, "You cannot pitch your tent because you are: Inside, Running, Jumping, Levitating, Underwater, or are in Third Person View." 
	Player -> AddItem, "A1_DAT_SRT_Pack", 1
	Set OnPCDrop To 0
	Disable
ElseIf ( ValidSpot == 1 )
		PlaceAtPC, "A1_DAT_SRT_Ext", 1, 512, 0
		Player -> AddItem, "A1_DAT_SRT_Light_01", 1
		Set OnPCDrop To 2
	EndIf
EndIf

If ( OnPCDrop == 2 )
	Set "A1_DAT_SRT_RecPosX" To ( Player -> GetPos, X )
	Set "A1_DAT_SRT_RecPosY" To ( Player -> GetPos, Y )
	Set "A1_DAT_SRT_RecPosZ" To ( Player -> GetPos, Z )
	Set "A1_DAT_SRT_TeleAngle" To ( Player -> GetAngle, Z + 180 )
	Set "A1_DAT_SRT_TentPitched" To 1
	Set "A1_DAT_SRT_TentStrike" To 0
	Set OnPCDrop To 3
EndIf


If ( OnPCDrop == 3 )
	Player -> Drop, A1_DAT_SRT_Light_01, 1
	Set OnPCDrop To 0
	Disable
EndIf

End