10 const int STORAGE_VERSION = 137;
14 float m_TotalAgentCount;
34 return STORAGE_VERSION;
60 EStatLevels immunityLevel = m_Player.GetImmunityLevel();
62 m_TotalAgentCount = 0;
63 for (
int i = 0; i < m_VirusPool.Count(); i++)
65 int agentId = m_VirusPool.GetKey(i);
72 if (agentPotency <= immunityLevel)
75 if (temporaryResistance > 1.0)
85 growDelta = invasibility * deltaT;
90 growDelta = -dieOffSpeed * deltaT;
93 float oldCount = m_VirusPool.Get(agentId);
94 float newCount = oldCount + growDelta;
95 newCount =
Math.Clamp(newCount, 0, maxCount);
97 m_TotalAgentCount += newCount;
111 if (temporaryResistance > 1.0)
113 float newResistanceValue = temporaryResistance - deltaTime;
125 foreach (
int agentId : agentList)
142 if (!ctx.Read(count))
147 for (
int i = 0; i < count; ++i)
150 if (!ctx.Read(agentId))
154 if (!ctx.Read(agentCount))
159 float agentTemporaryResistanceTime;
160 if (!ctx.Read(agentTemporaryResistanceTime))
194 if (!m_VirusPool.Contains(agent_id) && count > 0)
200 float newValue = m_VirusPool.Get(agent_id) + count;
223 ResetTemporaryResistance();
233 percent =
Math.Clamp(percent, 0, 100);
234 float reduction = percent * 0.01;
237 agentCount -= agentCount * reduction;
256 if (m_VirusPool.Contains(agent_id))
257 return m_VirusPool.Get(agent_id);
269 for (
int i = 0; i < m_VirusPool.Count(); i++)
270 agentCount += m_VirusPool.GetElement(i);
282 for (
int i = 0; i < count; ++i)
302 m_VirusPool.Set(agent_id, count);
303 m_AgentMask = m_AgentMask | agent_id;
308 m_VirusPool.Remove(agent_id);
309 m_AgentMask = m_AgentMask & ~agent_id;
312 if (m_Player.m_Agents != m_AgentMask)
314 m_Player.m_Agents = m_AgentMask;
315 m_Player.SetSynchDirty();
330 for (
int i = 0; i < m_VirusPool.Count(); ++i)
332 int agentId = m_VirusPool.GetKey(i);
334 float delta = attack_value * resistance;
335 float actualAgentCount = m_VirusPool.Get(agentId);
336 float newAgentCount = actualAgentCount - delta;
348 for (
int i = 0; i < m_VirusPool.Count(); ++i)
351 int agentId = m_VirusPool.GetKey(i);
353 float delta = attackValue * resistance;
354 float actualAgentCount = m_VirusPool.Get(agentId);
355 float newAgentCount = actualAgentCount - delta;
386 private void ResetTemporaryResistance()
394 ctx.Read(CachedObjectsParams.PARAM1_INT);
395 int id = CachedObjectsParams.PARAM1_INT.param1;
405 void GetDebugObject(array<ref Param> object_out)
408 for (
int i = 0; i < count; i++)
411 string agentName = agent.
GetName();
418 object_out.Insert(
new Param4<string,string, int, float>(agentName, amount, agentId, tempResistance));
421 object_out.InsertAt(
new Param1<int>(count) ,0);
428 for (
int i = 0; i < m_VirusPool.Count(); ++i)
430 Debug.Log(
"Agent: "+ m_VirusPool.GetKey(i).ToString(),
"Agents");
431 Debug.Log(
"Count: "+ m_VirusPool.GetElement(i).ToString(),
"Agents");
437 ref array<int> m_VirusPoolArray =
new array<int>();
bool AutoinfectCheck(float deltaT, PlayerBase player)
void OnStoreSave(ParamsWriteContext ctx)
void DrugsAttack(EMedicalDrugsType drugType, float attackValue)
Drugs attack calculation.
void RemoveAllAgents()
Remove all agents from Agent Pool.
float GetTotalAgentCount()
Total number of agents active.
void SetTemporaryResistance(int agentId, float time)
Sets temporary resistance time against specified agent contraction.
void PlayerAgentPool(PlayerBase player)
PluginTransmissionAgents m_PluginTransmissionAgents
void RemoveAgent(int agent_id)
Remove agent from Agent Pool.
void AddAgent(int agent_id, float count)
Add agent into Agent Pool.
ref map< int, float > m_AgentTemporaryResistance
int GetAgents()
Reduce bitmask of currently active agents.
float GetTemporaryResistance(int agentId)
Returns remaining temporary resistance time for specified agent.
void AntibioticsAttackEx(float attack_value, EMedicalDrugsType drugType)
void ImmuneSystemTick(float value, float deltaT)
Agent pool simulation entry point.
void AntibioticsAttack(float attack_value)
Antibiotics treatment agains agents which are not resistent to it (see agent attributes).
void ProcessTemporaryResistance(float deltaTime)
Temporary resistance simulation.
void ReduceAgent(int id, float percent)
Reduce count of specified agent by a given percentage from Agent Pool.
bool OnStoreLoad(ParamsReadContext ctx, int version)
void DigestAgent(int agent_id, float count)
Digest (add) agent from food/drink in PlayerStomach into Agent Pool.
void SetAgentCount(int agent_id, float count)
Directly set the count of agents for give id in pool.
int GetSingleAgentCount(int agent_id)
Number of agents of specified id.
void SpawnAgents(float deltaT)
Autoinfection mechanism for agents with that attribute enabled.
void GrowAgents(float deltaT)
Agent's growth/death simulation.
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Serializer ParamsReadContext
Serializer ParamsWriteContext
PluginBase GetPlugin(typename plugin_type)
bool IsPluginManagerExists()