Esempio n. 1
0
//------------------------------------------------------------------------
void CGunTurret::OnReset()
{
	if(IScriptTable *pScriptTable = GetEntity()->GetScriptTable())
	{
		SmartScriptTable props;

		if(pScriptTable->GetValue("Properties", props))
			ReadProperties(props);
	}

	CItem::OnReset();

	Matrix34 tm = GetEntity()->GetSlotLocalTM(eIGS_Aux0,false);

	tm.SetTranslation(GetSlotHelperPos(eIGS_Aux0,m_radarHelper.c_str(),false));
	GetEntity()->SetSlotLocalTM(eIGS_ThirdPerson,tm);

	if(GetEntity()->IsSlotValid(eIGS_Aux1))
	{
		tm.SetTranslation(GetSlotHelperPos(eIGS_ThirdPerson,m_barrelHelper.c_str(),false));
		GetEntity()->SetSlotLocalTM(eIGS_Aux1,tm);
	}

	m_targetId = 0;
	m_destinationId = 0;
	m_updateTargetTimer = 0.0f;
	m_abandonTargetTimer = 0.0f;
	m_goalYaw = 0.0f;
	m_goalPitch = 0.0f;
	m_burstTimer = 0.0f;
	m_pauseTimer = 0.0f;
	m_searchHint = 0;
	m_fireHint = 1;
	m_deviationPos.zero();

	m_randoms[eRV_UpdateTarget].Range(m_turretparams.update_target_time * m_fireparams.randomness);
	m_randoms[eRV_AbandonTarget].Range(m_turretparams.abandon_target_time * m_fireparams.randomness);
	m_randoms[eRV_BurstTime].Range(m_turretparams.burst_time * m_fireparams.randomness);
	m_randoms[eRV_BurstPause].Range(m_turretparams.burst_pause * m_fireparams.randomness);

	m_lightId = AttachLight(eIGS_ThirdPerson, m_lightId, false);
	StopSound(m_lightSound);
	m_lightSound = INVALID_SOUNDID;

	if(m_turretparams.light_fov > 0.f)
	{
		m_lightId = AttachLight(eIGS_ThirdPerson, 0, true, m_turretparams.mg_range, m_searchparams.light_color*m_searchparams.light_diffuse_mul, 1.f/m_searchparams.light_diffuse_mul, m_searchparams.light_texture, m_turretparams.light_fov, m_searchparams.light_helper, Vec3(0,0,0), Vec3(-1,0,0), m_searchparams.light_material, m_searchparams.light_hdr_dyn);
		m_lightSound = PlayAction(g_pItemStrings->use_light);
	}

	SetFiringLocator(this);

	if(m_fm2)
		m_fm2->Activate(true);

	EnableUpdate(true, eIUS_General);
}
void CVehicleWeaponControlled::StartFire()
{
  if (!m_FireBlocked)
  {
    Base::StartFire();

    if (!m_vehicleId && GetEntity()->GetParent())
    {
      m_vehicleId = GetEntity()->GetParent()->GetId();
    }

    m_Firing = true;
    m_FirePause = false;

    SetFiringLocator(&m_ControlledLocator);
  }
}
Esempio n. 3
0
void CJaw::OnReset()
{
	bool attachedToBack = IsAttachedToBack();

	if(!attachedToBack)
		m_auxSlotUsed = false;

	BaseClass::OnReset();

	if(!attachedToBack)
	{
		SetViewMode(eIVM_ThirdPerson);
		DrawSlot(eIGS_ThirdPerson, true);
		DrawSlot(eIGS_ThirdPersonAux, false);
	}
	else
		m_stats.first_selection = false;

	m_forcedTargetId = 0;
	m_firedRockets = 0;
	m_dropped = false;
	m_dropTime = 0.0f;
	m_zoomTriggerDown = false;
	m_fireTriggerDown = false;
	m_firePending = false;
	m_playedDropAction = false;
	m_fired = false;
	m_zoomAlreadyToggled = false;
	Hide(false);

	SetFiringLocator(this);

	m_listeners.Clear();

	m_laserGuider.TurnOffLaser();
}