10 const int STORAGE_VERSION = 137;
14 float m_TotalAgentCount;
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)
285 int agentId = agent.GetAgentType();
288 AddAgent(agentId, agent.GetAutoinfectCount());
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)
325 for (
int i = 0; i < m_VirusPool.Count(); ++i)
327 int agentId = m_VirusPool.GetKey(i);
329 float delta = attack_value * resistance;
330 float actualAgentCount = m_VirusPool.Get(agentId);
331 float newAgentCount = actualAgentCount - delta;
349 for (
int i = 0; i < m_VirusPool.Count(); ++i)
351 int agentId = m_VirusPool.GetKey(i);
352 float actualAgentCount = m_VirusPool.Get(agentId);
353 float newAgentCount = actualAgentCount - attackValue;
385 private void ResetTemporaryResistance()
407 for (
int i = 0; i < count; i++)
410 string agentName = agent.GetName();
411 int agentId = agent.GetAgentType();
417 object_out.Insert(
new Param4<string,string, int, float>(agentName, amount, agentId, tempResistance));
420 object_out.InsertAt(
new Param1<int>(count) ,0);
427 for (
int i = 0; i < m_VirusPool.Count(); ++i)
429 Debug.Log(
"Agent: "+ m_VirusPool.GetKey(i).ToString(),
"Agents");
430 Debug.Log(
"Count: "+ m_VirusPool.GetElement(i).ToString(),
"Agents");
Keeps track of agents and their simulation.
void OnStoreSave(ParamsWriteContext ctx)
void DrugsAttack(EMedicalDrugsType drugType, float attackValue)
Drugs treatment logic.
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 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.
Serialization general interface. Serializer API works with:
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
class ModifierDebugObj STORAGE_VERSION
PluginBase GetPlugin(typename plugin_type)
bool IsPluginManagerExists()