示例#1
0
int main(int argc, char *argv[]) {
	ServerConfig config;

	if (!load_args(argc, argv, config))
		return -1;

	ServerStart(config);

	while (1) {
		ServerUpdate();
	}
}
示例#2
0
//------------------------------------------------------------------------
void CGunTurret::Update(SEntityUpdateContext &ctx, int update)
{
	FUNCTION_PROFILER(gEnv->pSystem, PROFILE_GAME);

	if(m_frozen)
		return;

	CWeapon::Update(ctx, update);

	if(update==eIUS_FireMode && m_fm2)
		m_fm2->Update(ctx.fFrameTime, ctx.nFrameID);

	if(update!=eIUS_General)
		return;

	if(IsServer())
		ServerUpdate(ctx,update);

	UpdateOrientation(ctx.fFrameTime);	// rotate turret towards target, adhering to angle limits

	if(g_pGameCVars->i_debug_turrets == eGTD_Search)
	{
		DrawCircle(GetEntity()->GetWorldPos(), m_turretparams.mg_range);
	}

	//
	/*
	if(InternalIsFiring(false))
	{
	IEntity* pCurrentTarget = gEnv->pEntitySystem->GetEntity(m_targetId);
	if(!pCurrentTarget)
	return;
	CSingle* pFM = (CSingle*)GetFireMode(0);
	Vec3 hit = pFM->GetProbableHit(2000.0f);
	Vec3 dir = pFM->NetGetFiringDir(hit, pFM->NetGetFiringPos(hit));
	Vec3 pos = GetTargetPos(pCurrentTarget);
	Vec3 wpos = GetWeaponPos();
	Vec3 tdir = (pos-wpos).normalized();
	float angcos = tdir*dir;
	float ang = RAD2DEG(cry_acosf(angcos));
	if(ang>2.0f)
	{
	CryLog("%X Shooting while not in cone, %.3f",GetEntity()->GetId(),ang);
	}
	float yaw, pitch;
	GetTargetAngles(pos,yaw,pitch);
	if(!IsAiming(pos,5.0f))
	{
	CryLog("Turret %X firing at %X. Goal %.2f %.2f, target %.2f %.2f, diff %.2f %.2f",GetEntity()->GetId(),m_targetId,m_goalYaw,m_goalPitch,yaw,pitch,cry_fabsf(m_goalYaw-yaw),cry_fabsf(m_goalPitch-pitch));
	}
	}*/
}