DayZ 1.29
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ InjectAgentsWithPlayer()

void PluginBase::InjectAgentsWithPlayer ( EntityAI target,
int agents,
float protection,
int dose_size,
int inject_type )
inlineprotected

Injects agents to a given target, using chance of transmission and full dose size if chance succeeds.

Аргументы
targetEntity to inject agents to
agentsBit mask with information about agents
protectionProtection size used for chance generation <0.0; 1.0>
dose_sizeNumber of agents to be transmitted
inject_typeType of transmission

См. определение в файле PluginTransmissionAgents.c строка 421

422 {
423 if(target && (agents != 0) && target.IsEntityAI() )
424 {
425 int bit_count = Math.GetNumberOfSetBits(agents);
426
427 for (int i = 0; i < bit_count; i++)
428 {
429 int agent_bit = Math.Pow(2,Math.GetNthBitSet(agents,i));
430 if( DetermineChanceToTransmit(agent_bit, protection, inject_type))
431 {
432 target.InsertAgent(agent_bit,dose_size);
433 }
434 }
435 }
436 }
bool DetermineChanceToTransmit(int agent_id, float protection, int inject_type)
Agent transmission chance processing.
Определения PluginTransmissionAgents.c:571

Перекрестные ссылки DetermineChanceToTransmit(), Math::GetNthBitSet(), Math::GetNumberOfSetBits() и Math::Pow().

Используется в TransmitAgentsEx().