importonly class HitShapeUserData extends IScriptable
{
}

importonly struct HitShapeResult
{
	import var hitPositionEnter : Vector4;
	import var hitPositionExit : Vector4;
	import var enterDistanceFromOriginSq : Float;
}

importonly struct HitShapeData
{
	import var result : HitShapeResult;
	import var userData : HitShapeUserData;
	import var physicsMaterial : CName;
	import var hitShapeName : CName;
}

importonly struct HitRepresentationQueryResult
{
	import var hitShapes : array< HitShapeData >;
}

importonly class HitRepresentation_SetSingleScaleMultiplier_AllShapes extends Event
{
	import var scaleMultiplier : Vector4;
}

importonly final class HitRepresentation_SetSingleScaleMultiplier_SingleShape extends HitRepresentation_SetSingleScaleMultiplier_AllShapes
{
	import var shapeName : CName;
}

importonly final class HitRepresentation_SetSingleScaleMultiplier_MultipleShapes extends HitRepresentation_SetSingleScaleMultiplier_AllShapes
{
	import var shapeNames : array< CName >;
}

importonly final class HitRepresentation_SetMultipleScaleMultipliers_MultipleShapes extends Event
{
	import var scaleMultipliers : array< Vector4 >;
	import var shapeNames : array< CName >;
}

importonly final class HitRepresentation_ResetSingleScaleMultiplier extends Event
{
	import var shapeName : CName;
}

importonly final class HitRepresentation_ResetMultipleScaleMultipliers extends Event
{
	import var shapeNames : array< CName >;
}

importonly final class HitRepresentation_ResetAllScaleMultipliers extends Event
{
}

importonly final class ToggleHitShapeEvent extends Event
{
	import var enable : Bool;
	import var hitShapeName : CName;
	import var hierarchical : Bool;
}

enum EAIHitIntensity
{
	None = -1,
	Light = 0,
	Medium = 1,
	Heavy = 2,
	Explosion = 3,
}

enum EAIHitSource
{
	None = -1,
	Ranged = 0,
	MeleeSharp = 1,
	MeleeBlunt = 2,
	QuickMelee = 3,
}

enum EAILastHitReactionPlayed
{
	None = -1,
	Twitch = 0,
	Impact = 1,
	Stagger = 2,
	Knockdown = 3,
}

enum EAIHitDirection
{
	None = -1,
	Left = 0,
	Back = 1,
	Right = 2,
	Front = 3,
}

enum EAIHitBodyPart
{
	None = -1,
	Head = 1,
	LeftTorso = 2,
	RightTorso = 3,
	Belly = 4,
	LeftLeg = 5,
	RightLeg = 6,
}

enum EAIDismembermentBodyPart
{
	NONE = -1,
	LEFT_ARM = 0,
	RIGHT_ARM = 1,
	LEFT_LEG = 2,
	RIGHT_LEG = 3,
	HEAD = 4,
	BODY = 5,
}

enum ReactionZones_Humanoid_Side
{
	Head = 0,
	ChestLeft = 1,
	ArmLeft = 2,
	HandLeft = 3,
	ChestRight = 4,
	ArmRight = 5,
	HandRight = 6,
	Abdomen = 7,
	LegLeft = 8,
	LegRight = 9,
}

enum HitShape_Type
{
	Normal = 0,
	InternalWeakSpot = 1,
	ExternalWeakSpot = 2,
	ProtectionLayer = 3,
}

enum EHitReactionZone
{
	Head = 0,
	ChestLeft = 1,
	ArmLeft = 2,
	HandLeft = 3,
	ChestRight = 4,
	ArmRight = 5,
	HandRight = 6,
	Abdomen = 7,
	LegLeft = 8,
	LegRight = 9,
	Special = 10,
}

enum EHitShapeType
{
	None = -1,
	Flesh = 0,
	Metal = 1,
	Cyberware = 2,
	Armor = 3,
}

class HitData_Humanoid extends HitData_Base
{
	editable var m_reactionZonesSide : ReactionZones_Humanoid_Side;
}

class HitData_Base extends HitShapeUserData
{
	editable var m_hitShapeTag : CName;
	editable var m_bodyPartStatPoolName : CName;
	editable var m_hitShapeType : HitShape_Type;

	public const function IsWeakspot() : Bool
	{
		return m_hitShapeType == HitShape_Type.InternalWeakSpot || m_hitShapeType == HitShape_Type.ExternalWeakSpot;
	}

}

class HitShapeUserDataBase extends HitShapeUserData
{
	editable var m_hitShapeTag : CName;
	editable var m_hitShapeType : EHitShapeType;
	editable var m_hitReactionZone : EHitReactionZone;
	editable var m_dismembermentPart : EAIDismembermentBodyPart;
	editable var m_isProtectionLayer : Bool;
	editable var m_quickHacksPierceProtection : Bool;
	editable var m_isInternalWeakspot : Bool;
	editable var m_hitShapeDamageMod : Float;

	public static function GetHitShapeDamageMod( userData : HitShapeUserDataBase ) : Float
	{
		return userData.m_hitShapeDamageMod;
	}

	public static function IsProtectionLayer( userData : HitShapeUserDataBase ) : Bool
	{
		return userData.m_isProtectionLayer;
	}

	public static function DoQuickHacksPierceProtection( userData : HitShapeUserDataBase ) : Bool
	{
		return userData.m_quickHacksPierceProtection;
	}

	public static function IsInternalWeakspot( userData : HitShapeUserDataBase ) : Bool
	{
		return userData.m_isInternalWeakspot;
	}

	public const function IsHead() : Bool
	{
		return m_hitShapeTag == 'Head';
	}

	public const function GetShapeType() : EHitShapeType
	{
		return m_hitShapeType;
	}

	public static function DisableHitShape( gameObj : weak< GameObject >, shapeName : CName, hierarchical : Bool )
	{
		var hitShapeEvent : ToggleHitShapeEvent;
		hitShapeEvent = new ToggleHitShapeEvent;
		hitShapeEvent.enable = false;
		hitShapeEvent.hitShapeName = shapeName;
		hitShapeEvent.hierarchical = hierarchical;
		gameObj.QueueEvent( hitShapeEvent );
	}

	public static function EnableHitShape( gameObj : weak< GameObject >, shapeName : CName, hierarchical : Bool )
	{
		var hitShapeEvent : ToggleHitShapeEvent;
		hitShapeEvent = new ToggleHitShapeEvent;
		hitShapeEvent.enable = true;
		hitShapeEvent.hitShapeName = shapeName;
		hitShapeEvent.hierarchical = hierarchical;
		gameObj.QueueEvent( hitShapeEvent );
	}

	public static function GetHitReactionZone( userData : HitShapeUserDataBase ) : EHitReactionZone
	{
		return userData.m_hitReactionZone;
	}

	public static function GetDismembermentBodyPart( userData : HitShapeUserDataBase ) : gameDismBodyPart
	{
		var str : String;
		var dismBodyPart : gameDismBodyPart;
		str = EnumValueToString( "EAIDismembermentBodyPart", ( ( Int32 )( userData.m_dismembermentPart ) ) );
		dismBodyPart = ( ( gameDismBodyPart )( ( ( Int32 )( EnumValueFromString( "gameDismBodyPart", str ) ) ) ) );
		return dismBodyPart;
	}

	public static function IsHitReactionZoneHead( userData : HitShapeUserDataBase ) : Bool
	{
		return userData.m_hitReactionZone == EHitReactionZone.Head;
	}

	public static function IsHitReactionZoneTorso( userData : HitShapeUserDataBase ) : Bool
	{
		return ( userData.m_hitReactionZone == EHitReactionZone.Abdomen || userData.m_hitReactionZone == EHitReactionZone.ChestLeft ) || userData.m_hitReactionZone == EHitReactionZone.ChestRight;
	}

	public static function IsHitReactionZoneLeftArm( userData : HitShapeUserDataBase ) : Bool
	{
		return userData.m_hitReactionZone == EHitReactionZone.ArmLeft || userData.m_hitReactionZone == EHitReactionZone.HandLeft;
	}

	public static function IsHitReactionZoneRightArm( userData : HitShapeUserDataBase ) : Bool
	{
		return userData.m_hitReactionZone == EHitReactionZone.ArmRight || userData.m_hitReactionZone == EHitReactionZone.HandRight;
	}

	public static function IsHitReactionZoneArm( userData : HitShapeUserDataBase ) : Bool
	{
		return ( ( userData.m_hitReactionZone == EHitReactionZone.ArmRight || userData.m_hitReactionZone == EHitReactionZone.HandRight ) || userData.m_hitReactionZone == EHitReactionZone.ArmLeft ) || userData.m_hitReactionZone == EHitReactionZone.HandLeft;
	}

	public static function IsHitReactionZoneRightLeg( userData : HitShapeUserDataBase ) : Bool
	{
		return userData.m_hitReactionZone == EHitReactionZone.LegRight;
	}

	public static function IsHitReactionZoneLeftLeg( userData : HitShapeUserDataBase ) : Bool
	{
		return userData.m_hitReactionZone == EHitReactionZone.LegLeft;
	}

	public static function IsHitReactionZoneLeg( userData : HitShapeUserDataBase ) : Bool
	{
		return userData.m_hitReactionZone == EHitReactionZone.LegLeft || userData.m_hitReactionZone == EHitReactionZone.LegRight;
	}

	public static function IsHitReactionZoneLimb( userData : HitShapeUserDataBase ) : Bool
	{
		return ( ( HitShapeUserDataBase.IsHitReactionZoneLeftArm( userData ) || HitShapeUserDataBase.IsHitReactionZoneRightArm( userData ) ) || HitShapeUserDataBase.IsHitReactionZoneRightLeg( userData ) ) || HitShapeUserDataBase.IsHitReactionZoneLeftLeg( userData );
	}

}

