コード例 #1
0
void CCustomReactionFunctions::ReactionDoNothing(CActor& actor, const SReactionParams& reactionParams, const HitInfo& hitInfo)
{
	CHitDeathReactionsPtr pHitDeathReactions = GetActorHitDeathReactions(actor);
	if (pHitDeathReactions)
	{
		pHitDeathReactions->EndCurrentReaction();
	}
}
コード例 #2
0
int CScriptBind_HitDeathReactions::ExecuteHitReaction (IFunctionHandler *pH, SmartScriptTable reactionParams)
{
	CHitDeathReactionsPtr pHitDeathReactions = GetHitDeathReactions(pH);
	if (pHitDeathReactions)
		pHitDeathReactions->ExecuteHitReaction(reactionParams);

	return pH->EndFunction();
}
コード例 #3
0
int CScriptBind_HitDeathReactions::EndCurrentReaction(IFunctionHandler *pH)
{
	bool bSuccess = false;

	CHitDeathReactionsPtr pHitDeathReactions = GetHitDeathReactions(pH);
	if (pHitDeathReactions)
		bSuccess = pHitDeathReactions->EndCurrentReaction();

	return pH->EndFunction(bSuccess);
}
コード例 #4
0
int CScriptBind_HitDeathReactions::EndReactionAnim(IFunctionHandler *pH)
{
	CHitDeathReactionsPtr pHitDeathReactions = GetHitDeathReactions(pH);
	if (pHitDeathReactions)
	{
		pHitDeathReactions->EndReactionAnim();
	}

	return pH->EndFunction();
}
int CScriptBind_HitDeathReactions::StartReactionAnim(IFunctionHandler *pH)
{
	bool bResult = false;
	CHitDeathReactionsPtr pHitDeathReactions = GetHitDeathReactions(pH);

	if (pHitDeathReactions)
	{
		const char *szAnimName = NULL;
		bool bLoop = false;
		float fBlendTime = 0.2f;
		int iSlot = 0;
		int iLayer = 0;
		float fAniSpeed = 1.0f;
		uint32 animFlags = 0;

		if (!pH->GetParam(1, szAnimName))
		{
			CryWarning(VALIDATOR_MODULE_GAME, VALIDATOR_WARNING, "CScriptBind_HitDeathReactions::StartReactionAnim, animation name not specified");
		}
		else if (pH->GetParamCount() > 1)
		{
			pH->GetParam(2, bLoop);

			if (pH->GetParamCount() > 2)
			{
				pH->GetParam(3, fBlendTime);

				if (pH->GetParamCount() > 3)
				{
					pH->GetParam(4, iSlot);

					if (pH->GetParamCount() > 4)
					{
						pH->GetParam(5, iLayer);

						if (pH->GetParamCount() > 5)
						{
							pH->GetParam(5, fAniSpeed);

							if (pH->GetParamCount() > 6)
							{
								pH->GetParam(6, animFlags);
							}
						}
					}
				}
			}
		}

		bResult = pHitDeathReactions->StartReactionAnim(szAnimName, bLoop, fBlendTime, iSlot, iLayer, animFlags, fAniSpeed);
	}

	return pH->EndFunction(bResult);
}
int	CScriptBind_HitDeathReactions::OnHit(IFunctionHandler *pH, SmartScriptTable scriptHitInfo, float fCausedDamage)
{
	bool bRet = false;
	CHitDeathReactionsPtr pHitDeathReactions = GetHitDeathReactions(pH);

	if (pHitDeathReactions)
	{
		HitInfo hitInfo;
		CGameRules::CreateHitInfoFromScript(scriptHitInfo, hitInfo);
		bRet = pHitDeathReactions->OnHit(hitInfo, fCausedDamage);
	}

	return pH->EndFunction(bRet);
}
コード例 #7
0
void CCustomReactionFunctions::MeleeDeath_Reaction(CActor& actor, const SReactionParams& reactionParams, const HitInfo& hitInfo)
{
	CHitDeathReactionsPtr pHitDeathReactions = GetActorHitDeathReactions(actor);
	if (pHitDeathReactions)
	{
			if (!reactionParams.reactionAnim->animCRCs.empty())
			{
					// If an animation is present, execute the default reaction code
					pHitDeathReactions->ExecuteDeathReaction(reactionParams);
			}
			else
			{
					// Apply Death impulses
					DeathImpulse_Reaction(actor, reactionParams, hitInfo);
			}
	}
}
コード例 #8
0
void CGameRules::ProcessLocalHit( const HitInfo& hitInfo, float fCausedDamage /*= 0.0f*/ )
{
		//Place the code that should be invoked in both server and client sides here
		IActor* pActor = g_pGame->GetIGameFramework()->GetIActorSystem()->GetActor(hitInfo.targetId);
		if (pActor != NULL && (pActor->GetActorClass() == CPlayer::GetActorClassType()))
		{

				// Clients sometimes want to force a hit death reaction to play (when the victim isnt actually dead.. but will be when the server responds to a hit req)
				CHitDeathReactionsPtr pHitDeathReactions = static_cast<CPlayer*>(pActor)->GetHitDeathReactions();
				if (pHitDeathReactions)
				{
						// If the user has requested the player be force killed, then we need to *react* like this was a kill
						if(hitInfo.forceLocalKill)
						{
								// Force the hit death reaction to react as if was a kill 
								CActor::KillParams params;
								params.shooterId					= hitInfo.shooterId;
								params.targetId						= hitInfo.targetId;
								params.weaponId						= hitInfo.weaponId;
								params.projectileId				= hitInfo.projectileId;
								params.itemIdToDrop				= -1;
								params.weaponClassId			= hitInfo.weaponClassId;
								params.damage							= hitInfo.damage;
								params.material						= -1;
								params.hit_type						= hitInfo.type;
								params.hit_joint					= hitInfo.partId;
								params.projectileClassId	= hitInfo.projectileClassId;
								params.penetration				= hitInfo.penetrationCount;
								params.firstKill					= false;
								params.killViaProxy				= hitInfo.hitViaProxy;
								params.impulseScale				= hitInfo.impulseScale; 
								params.forceLocalKill			= hitInfo.forceLocalKill; 

								pHitDeathReactions->OnKill(params);
						}
						else
						{
								// Proceed as normal
								pHitDeathReactions->OnHit(hitInfo, fCausedDamage);
						}
				}
		}
}
コード例 #9
0
int	CScriptBind_HitDeathReactions::IsValidReaction(IFunctionHandler *pH, SmartScriptTable validationParams, SmartScriptTable scriptHitInfo)
{
	bool bResult = false;

	CHitDeathReactionsPtr pHitDeathReactions = GetHitDeathReactions(pH);
	if (pHitDeathReactions)
	{
		HitInfo hitInfo;
		CGameRules::CreateHitInfoFromScript(scriptHitInfo, hitInfo);

		float fCausedDamage = 0.0f;
		if (pH->GetParamCount() > 2)
			pH->GetParam(3, fCausedDamage);

		bResult = pHitDeathReactions->IsValidReaction(hitInfo, validationParams, fCausedDamage);
	}

	return pH->EndFunction(bResult);
}