13class PluginTransmissionAgents
extends PluginBase
17 bool m_IsConstructed =
false;
19 void PluginTransmissionAgents()
23 RegisterAgent(
new CholeraAgent);
24 RegisterAgent(
new SalmonellaAgent);
25 RegisterAgent(
new BrainAgent);
27 RegisterAgent(
new ChemicalAgent);
29 RegisterAgent(
new NerveAgent);
39 m_AgentList.Insert(agent.GetAgentType(), agent);
45 void ConstructSimpleAgentList()
50 for(
int i = 0; i < m_AgentList.Count();i++)
52 AgentBase agent = m_AgentList.GetElement(i);
53 agent_name = agent.GetName();
54 agent_type = agent.GetAgentType();
55 m_SimpleAgentList.Insert(agent_type, agent_name);
74 if( !m_IsConstructed )
76 ConstructSimpleAgentList();
77 m_IsConstructed =
true;
79 return m_SimpleAgentList;
87 static string GetNameByID(
int agent_id)
89 return m_AgentList.Get(agent_id).GetName();
98 target.RemoveAllAgents();
108 target.RemoveAgent(agent_id);
118 if( !m_AgentList.Get(agent_id) )
return 0;
119 return m_AgentList.Get(agent_id).GetTransferabilityIn();
124 AgentBase agent = m_AgentList.Get(agentId);
128 return agent.GrowDuringMedicalDrugsAttack(drugType, player);
136 if( !m_AgentList.Get(agent_id) )
138 return m_AgentList.Get(agent_id).GetDieOffSpeed();
149 if( !m_AgentList.Get(agent_id) )
return true;
150 return m_AgentList.Get(agent_id).GetDieOffSpeedEx(player);
158 if( !m_AgentList.Get(agent_id) )
160 return m_AgentList.Get(agent_id).GetPotency();
171 if( !m_AgentList.Get(agent_id) )
return true;
172 return m_AgentList.Get(agent_id).GetPotencyEx(player);
183 if( !m_AgentList.Get(agent_id) )
return true;
184 return m_AgentList.Get(agent_id).GetInvasibilityEx(player);
193 if( !m_AgentList.Get(agent_id) )
return 0;
194 return m_AgentList.Get(agent_id).GetAntiboticsResistance();
205 if( !m_AgentList.Get(agent_id) )
return 0;
206 return m_AgentList.Get(agent_id).GetAntibioticsResistanceEx(player);
216 if(!m_AgentList.Get(agent_id))
return 0;
217 return m_AgentList.Get(agent_id).GetTransferabilityOut();
227 if(!m_AgentList.Get(agent_id))
return 0;
228 return m_AgentList.Get(agent_id).GetTransferabilityAirOut();
238 if( !m_AgentList.Get(agent_id) )
240 return m_AgentList.Get(agent_id).GetInvasibility();
248 if( !m_AgentList.Get(agent_id) )
250 return m_AgentList.Get(agent_id).GetDigestibility();
261 if (!m_AgentList.Get(agent_id))
264 return m_AgentList.Get(agent_id).GetDigestibilityEx(player);
274 if( !m_AgentList.Get(agent_id) )
return 0;
275 return m_AgentList.Get(agent_id).GetMaxCount();
290 int sourceAgents = agents;
292 if(!sourceAgents && source) sourceAgents = source.GetAgents();
293 if(target) targetAgents = target.GetAgents();
311 if (pollution & EPollution.HEAVYMETAL)
313 sourceAgents = sourceAgents |
eAgents.HEAVYMETAL;
315 sourceAgents = sourceAgents |
eAgents.CHOLERA;
320 sourceAgents = sourceAgents |
eAgents.FOOD_POISON |
eAgents.HEAVYMETAL;
325 if (pollution & EPollution.HEAVYMETAL)
327 sourceAgents = sourceAgents |
eAgents.HEAVYMETAL;
358 float prot_level_target =
Math.Max(prot_level_mask_target, prot_level_headgear_target);
359 float prot_level_source =
Math.Max(prot_level_mask_source, prot_level_headgear_source);
360 float prot_level_combined = 1 - (1 - prot_level_target) * (1 - prot_level_source);
389 if( target.IsItemBase() )
392 ib_target.TransferAgents(agents);
406 if(target && (agents != 0) && target.IsEntityAI() )
408 int bit_count =
Math.GetNumberOfSetBits(agents);
410 for (
int i = 0; i < bit_count; i++)
412 int agent_bit =
Math.Pow(2,
Math.GetNthBitSet(agents,i));
415 target.InsertAgent(agent_bit,dose_size);
431 if(target && (agents != 0) && target.IsEntityAI() )
433 int bit_count =
Math.GetNumberOfSetBits(agents);
435 for (
int i = 0; i < bit_count; i++)
437 int agent_bit =
Math.Pow(2,
Math.GetNthBitSet(agents,i));
439 target.InsertAgent(agent_bit,count);
459 target.InsertAgent(agent, count);
473 agents_out.Insert(mask);
489 ItemBase attachment =
ItemBase.Cast(player.GetInventory().FindAttachment(slot));
494 return attachment.GetProtectionLevel(type, consider_filter, system);
521 float prot = 1 - protection;
529 else if( inject_type ==
InjectTypes.ITEM_TO_PLAYER )
533 else if( inject_type ==
InjectTypes.PLAYER_AIR_PLAYER )
540 float result = 1 * prot * transf * dose_size;
559 float prot = 1 - protection;
567 else if( inject_type ==
InjectTypes.ITEM_TO_PLAYER )
571 else if( inject_type ==
InjectTypes.PLAYER_AIR_PLAYER )
579 bool dice =
Math.RandomFloat01() < (prot * transf);
590 if (!m_AgentList.Get(agent_id))
593 return m_AgentList.Get(agent_id).GrowDuringMedicalDrugsAttack(
EMedicalDrugsType.ANTIBIOTICS, player);
provides access to slot configuration
Plugin interface for controlling of agent pool system.
float InjectAgentWithPlayerDose(EntityAI target, int agent, float protection, float dose_size, int inject_type)
Injects agent to a given target.
bool GrowDuringMedicalDrugsAttack(int agentId, EMedicalDrugsType drugType, PlayerBase player)
static int GetAgentMaxCount(int agent_id)
Returns max count attribute for given agent.
static float GetProtectionLevelEx(int type, int slot, Man player, bool consider_filter=true, int system=0)
Protection level of an attachment against enviromental hazard (mask/filters for example)
float GetAgentInvasibilityEx(int agent_id, PlayerBase player)
Returns invasibility attribute for given agent.
float CalculateAgentsToTransmit(int agent_id, float protection, int dose_size, int inject_type)
Calculates number of agents that can be transmitted (based on given dose_size)
bool DetermineChanceToTransmit(int agent_id, float protection, int inject_type)
Agent transmission chance processing.
void TransmitAgents(EntityAI source, EntityAI target, int pathway, int dose_size=1000)
Process transmission of agents between entities (for specified transmission type) (see TransmitAgents...
float GetAgentDigestibility(int agent_id)
Returns stomach digetibility attribute for given agent (see GetAgentDigestibilityEx())
float GetDieOffSpeed(int agent_id)
Returns dieOfSpeed attribute for given agent (see GetDieOffSpeedEx())
void InjectAgentsWithPlayer(EntityAI target, int agents, float protection, int dose_size, int inject_type)
Injects agents to a given target, using chance of transmission and full dose size if chance succeeds.
float GetAgentTransferabilityAirOut(int agent_id)
Returns transferabilitAiryOut attribute for given agent.
float GetAgentInvasibility(int agent_id)
Returns invasibility attribute for given agent.
EStatLevels GetPotency(int agent_id)
Returns potency attribute for given agent (see GetAgentPotencyEx())
void InjectAgentsWithPlayerCount(EntityAI target, int agents, float protection, int dose_size, int inject_type)
Injects agents to a given target, with no probability, but the dose size is modified by m_Transferabi...
void InjectAgentsWithoutPlayer(EntityAI target, int agents)
Injects specified agents directly to target.
float GetAgentDieOffSpeedEx(int agent_id, PlayerBase player)
Returns dieOfSpeed attribute for given agent.
float GetProtectionLevel(int type, int slot, Man player)
Protection level of an attachment against enviromental hazard (mask/filters for example) (see GetProt...
float GetAgentDigestibilityEx(int agent_id, PlayerBase player)
Returns stomach digetibility attribute for given agent.
bool GrowDuringAntibioticsAttack(int agent_id, PlayerBase player)
DEPRECATED.
static void BuildAgentArray(int agents, array< int > agents_out)
float GetAgentAntiboticsResistanceEx(int agent_id, PlayerBase player)
Returns antibiotics resistance attribute for given agent.
float TransmitAgentsEx(EntityAI source, EntityAI target, int pathway, int dose_size=1000, int agents=0)
Process transmission of agents between entities (for specified transmission type)
float GetAgentAntiboticsResistance(int agent_id)
Returns antibiotics resistance attribute for given agent see GetAgentAntiboticsResistanceEx()
EStatLevels GetAgentPotencyEx(int agent_id, PlayerBase player)
Returns potency attribute for given agent.
float GetAgentTransferabilityIn(int agent_id)
Returns transferabilityIn attribute for given agent.
float GetAgentTransferabilityOut(int agent_id)
Returns transferabilityOut attribute for given agent.
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto native CGame GetGame()
const int AGT_UACTION_CONSUME
const int AGT_ITEM_TO_FLESH
const int AGT_UACTION_TOUCH
const int AGT_AIRBOURNE_BIOLOGICAL
const int AGT_TRANSFER_COPY
const int AGT_WATER_HOT_SPRING
const int AGT_UACTION_TO_PLAYER
const int AGT_AIRBOURNE_CHEMICAL
const int AGT_UACTION_TO_ITEM
override void RemoveAllAgents()
override void RemoveAgent(int agent_id)