void asw_ragdoll_marine_f()
{
	CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient());
	static CRagdollProp * s_pRagdoll = NULL;

	if (pPlayer && pPlayer->GetMarine())
	{
		CASW_Marine* pMarine = pPlayer->GetMarine();
		pMarine->SetKnockedOut(!pMarine->m_bKnockedOut);

		return;
		
		if (pMarine->IsEffectActive(EF_NODRAW) && s_pRagdoll)
		{
			//Calcs the diff between ragdoll worldspace center and victim worldspace center, moves the victim by this diff.
			//Sets the victim's angles to 0, ragdoll yaw, 0
			QAngle newAngles( 0, s_pRagdoll->GetAbsAngles()[YAW], 0 );

			Vector centerDelta = s_pRagdoll->WorldSpaceCenter() - pMarine->WorldSpaceCenter();
			centerDelta.z = 0;	// don't put us in the floor
			Vector newOrigin = pMarine->GetAbsOrigin() + centerDelta;
			pMarine->SetAbsOrigin( newOrigin );
			pMarine->SetAbsAngles( newAngles );
			//DetachAttachedRagdoll( s_pRagdoll ); 	// unnecessary since we remove it next?
			UTIL_Remove( s_pRagdoll );
			pMarine->RemoveEffects( EF_NODRAW );
			pMarine->RemoveSolidFlags( FSOLID_NOT_SOLID );
		}
		else
		{
			pMarine->InvalidateBoneCache();
			pMarine->AddSolidFlags( FSOLID_NOT_SOLID );			
			CTakeDamageInfo	info;
			info.SetDamageType( DMG_GENERIC );
			info.SetDamageForce( vec3_origin );
			info.SetDamagePosition( pMarine->WorldSpaceCenter() );
			s_pRagdoll = (CRagdollProp*) CreateServerRagdoll( pMarine, 0, info, COLLISION_GROUP_NONE );
			if ( s_pRagdoll )
			{
				s_pRagdoll->DisableAutoFade();
				s_pRagdoll->SetThink( NULL );
				s_pRagdoll->SetUnragdoll( pMarine );
			}			
			pMarine->AddEffects( EF_NODRAW );
			//pMarine->SetupBones( m_pRagdollBones, BONE_USED_BY_ANYTHING );
		}
	}
}
//------------------------------------------------------------------------
void CMelee::Update(float frameTime, uint32 frameId)
{
	FUNCTION_PROFILER( GetISystem(), PROFILE_GAME );

	bool remote = false;
	bool doMelee = false;
	bool requireUpdate = false;

	Vec3 dirToTarget(ZERO);
	if(m_pMeleeAction && s_meleeSnapTargetId && g_pGameCVars->pl_melee.mp_melee_system_camera_lock_and_turn)
	{
		m_attackTime += frameTime;

		CActor* pOwner = m_pWeapon->GetOwnerActor();
		IEntity* pTarget = gEnv->pEntitySystem->GetEntity(s_meleeSnapTargetId);
		if(pOwner && pTarget)
		{
			Vec3 targetPos = pTarget->GetWorldPos();

			if(s_bMeleeSnapTargetCrouched)
			{
				targetPos.z -= g_pGameCVars->pl_melee.mp_melee_system_camera_lock_crouch_height_offset;
			}

			dirToTarget = targetPos - pOwner->GetEntity()->GetWorldPos();
			dirToTarget.Normalize();

			static const float smooth_time = 0.1f;
			SmoothCD(m_attackTurnAmount, m_attackTurnAmountSmoothRate, frameTime, 1.f, smooth_time);
			Quat newViewRotation;
			newViewRotation.SetSlerp(pOwner->GetViewRotation(), Quat::CreateRotationVDir(dirToTarget), m_attackTurnAmount);
			Ang3 newAngles(newViewRotation);
			newAngles.y = 0.f; //No head tilting
			newViewRotation = Quat(newAngles);
			pOwner->SetViewRotation( newViewRotation );
		}

		if(m_attackTime >= g_pGameCVars->pl_melee.mp_melee_system_camera_lock_time && pOwner && pOwner->IsClient())
		{
			pOwner->GetActorParams().viewLimits.ClearViewLimit(SViewLimitParams::eVLS_Item);
		}
	}

	if (m_attacking)
	{
		MeleeDebugLog ("CMelee<%p> Update while attacking: m_attacked=%d, delay=%f", this, m_attacked, m_delayTimer);

		requireUpdate = true;
		if (m_delayTimer>0.0f)
		{
			RequestAlignmentToNearestTarget();
			m_delayTimer-=frameTime;
			if (m_delayTimer<=0.0f)
			{
				m_delayTimer=0.0f;
			}
		}
		else if (m_netAttacking)
		{
			remote = true;
			doMelee = true;
			m_attacking = false;
			m_slideKick = false;
			m_netAttacking = false;

			m_pWeapon->SetBusy(false);
		}	
		else if (!m_attacked)
		{
			doMelee = true;
			m_attacked = true;
		}

		if ( !m_collisionHelper.IsBlocked() && doMelee)
		{
			if (CActor *pActor = m_pWeapon->GetOwnerActor())
			{
				if (IMovementController * pMC = pActor->GetMovementController())
				{
					SMovementState info;
					pMC->GetMovementState(info);

					if(!dirToTarget.IsZeroFast())
					{
						PerformMelee(info.weaponPosition, dirToTarget, remote); //We know where we will be facing at the point of impact - using our current fire direction is not accurate enough
					}
					else
					{
						PerformMelee(info.weaponPosition, info.fireDirection, remote);
					}
				}
			}
		}

		if( (m_useMeleeWeaponDelay <= 0.0f && m_useMeleeWeaponDelay > -1.0f) )
		{
			m_useMeleeWeaponDelay = -1.0f;

			// Switch to the MELEE WEAPON.
			SwitchToMeleeWeaponAndAttack();

			m_attacking = false;
		}
		m_useMeleeWeaponDelay -= frameTime;
	}

	if (requireUpdate)
		m_pWeapon->RequireUpdate(eIUS_FireMode);
}