Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • Need help?

    Create a topic in the appropriate section
    Don't write everything in the chat!
  • Take a look at the marketplace

    There you can buy
    everything related to game servers
  • Don't want a ban?

    Please read our rules
    Don't disturb the order!
  • Sell or buy?

    Use services of the guarantor
    We will make your deal safe
  • 0
Sign in to follow this  
FreddyCruger

Оптимизация кода

Прошу помощи, так как только только начал осваивать колдунство скриптов, и что-то намутил с этим кодом, После запуска сервера, при онлайне 20+ с большим количеством модов, сервер выдает приемлемые 2000 фпс, но спустя минут 30-40, он падает до 60. Явно, в этом коде дело, потому что ничего другого не делал в принципе.
 

modded class ActionEatBig: ActionConsume
{
	override void OnEndServer( ActionData action_data )
	{	
		super.OnEndServer(action_data);
		
		if ( action_data.m_Player.HasBloodyHandsEx() == eBloodyHandsTypes.SALMONELA)
		{
			action_data.m_Player.InsertAgent(RageAgents.RAGEVIRUS,200);
		}
	}
};

modded class ActionForceFeed: ActionForceConsume
{
	override void OnEndServer( ActionData action_data )
	{	
		super.OnEndServer(action_data);
		if ( action_data.m_Player.HasBloodyHands())
		{
			Object targetPlayer = action_data.m_Target.GetObject();
			PlayerBase target = PlayerBase.Cast( targetPlayer );
			if ( target )
			{
				action_data.m_Player.InsertAgent(RageAgents.RAGEVIRUS,200);
			}
		}
	}
	
};

modded class ActionDrinkPondContinuous: ActionContinuousBase
{
	override void OnEndAnimationLoopServer( ActionData action_data )
	{
		//Print("OnEndAnimationLoopServer");
		if ( action_data.m_Player.HasBloodyHands())
		{
			action_data.m_Player.InsertAgent(RageAgents.RAGEVIRUS,200);
		}
	}
};

modded class ActionDrinkWellContinuous: ActionContinuousBase
{	
	override void OnFinishProgressServer( ActionData action_data )
	{
		//Print("OnFinishProgressServer");
		Param1<float> nacdata = Param1<float>.Cast( action_data.m_ActionComponent.GetACData() );
		if(nacdata)
		{
			float amount = UAQuantityConsumed.DRINK;
			action_data.m_Player.Consume(NULL,amount, EConsumeType.ENVIRO_WELL);
		}
		
		if ( action_data.m_Player.HasBloodyHands())
		{
			action_data.m_Player.InsertAgent(RageAgents.RAGEVIRUS,200);
		}
	}
};

modded class ActionConsumeSingle: ActionSingleUseBase
{
	override void OnEndServer( ActionData action_data )
	{
		if ( action_data.m_MainItem && ( action_data.m_MainItem.GetQuantity() <= 0 ) )
		{
			action_data.m_MainItem.SetQuantity( 0 );
		}
		
		if ( action_data.m_Player.HasBloodyHandsEx() == eBloodyHandsTypes.SALMONELA)
		{
			action_data.m_Player.InsertAgent(RageAgents.RAGEVIRUS,200);
		}
	}
};

modded class ActionForceConsumeSingle: ActionSingleUseBase
{
	override void OnEndServer( ActionData action_data )
	{
		if ( action_data.m_MainItem && action_data.m_MainItem.GetQuantity() <= 0 ) 
		{
			action_data.m_MainItem.SetQuantity(0);
		}
		
		if ( action_data.m_Player.HasBloodyHands())
		{
			Object targetPlayer = action_data.m_Target.GetObject();
			PlayerBase target = PlayerBase.Cast( targetPlayer );
			if ( target )
			{
				action_data.m_Player.InsertAgent(RageAgents.RAGEVIRUS,200);
			}
		}
	}
};
modded class ActionDrink: ActionConsume
{
	override void OnEndServer( ActionData action_data )
	{	
		super.OnEndServer(action_data);
		
		if ( action_data.m_Player.HasBloodyHandsEx() == eBloodyHandsTypes.SALMONELA)
		{
			action_data.m_Player.InsertAgent(RageAgents.RAGEVIRUS,200);
		}
	}
};

modded class ActionBandageBase: ActionContinuousBase
{	
	override void OnEndServer( ActionData action_data )
	{	
		super.OnEndServer(action_data);
		
		if ( action_data.m_Player.HasBloodyHandsEx() == eBloodyHandsTypes.SALMONELA)
		{
			action_data.m_Player.InsertAgent(RageAgents.RAGEVIRUS,200);
		}
	}
	
};

 

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Странно, что вы вообще указываете InsertAgent(RageAgents.RAGEVIRUS, 200); 200 штук агентов? агент один же может быть добавлен?

 

Тем более в PlayerBase есть такая функция как BloodyHandsPenallty

 

Можно было бы ее один раз оверрайдить и все

Share this post


Link to post
Share on other sites



  • 0
10 часов назад, SharkAttack сказал:

Можно было бы ее один раз оверрайдить и все

вот, это и надо, 200 агентов надо потому что критическое состояние наступает когда их 500, и растут они по 0.5 в секунду, по сути у игрока есть 10 минут. В PlayerBase эта функция просто означает кровавые руки, а я хотел бы чтобы агенты заносились при бинтовании и еде\питье с кровавыми руками

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you automaticly agree to our Guidelines and Privacy Policy.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.