3 const int EVENT_1_INTERVAL_MIN = 3;
4 const int EVENT_1_INTERVAL_MAX = 5;
6 const float AGENTS_PER_SEC = 5;
7 protected float m_NextEvent1;
8 protected float m_Time1;
10 const int EVENT_2_INTERVAL_MIN = 13;
11 const int EVENT_2_INTERVAL_MAX = 18;
14 const float AGENT_DOSE_PER_BS_SEC = 0.33;
16 protected float m_NextEvent2;
17 protected float m_Time2;
33 override bool ActivateCondition(
PlayerBase player)
44 MiscGameplayFunctions.TeleportCheck(player, data.SafePositions);
48 float transmitted = TransmitAgents(player, 1);
50 player.GetSymptomManager().QueueUpPrimarySymptom(SymptomIDs.SYMPTOM_COUGH);
52 m_NextEvent1 =
Math.RandomFloatInclusive( EVENT_1_INTERVAL_MIN, EVENT_1_INTERVAL_MAX );
59 override bool DeactivateCondition(
PlayerBase player)
64 override void OnTick(
PlayerBase player,
float deltaT)
67 if(!player.GetCanBeDestroyed())
71 float transmitted = TransmitAgents(player, AGENTS_PER_SEC * deltaT);
78 if (m_Time1 >= m_NextEvent1 )
80 player.GetSymptomManager().QueueUpPrimarySymptom(SymptomIDs.SYMPTOM_COUGH);
82 if(
Math.RandomFloat01() < 0.25)
84 m_NextEvent1 =
Math.RandomFloatInclusive( EVENT_1_INTERVAL_MIN * 2, EVENT_1_INTERVAL_MAX * 2 );
88 m_NextEvent1 =
Math.RandomFloatInclusive( EVENT_1_INTERVAL_MIN, EVENT_1_INTERVAL_MAX );
95 if ( m_Time2 >= m_NextEvent2 )
97 BleedingSourceCreateCheck(player);
99 m_NextEvent2 =
Math.RandomFloatInclusive( EVENT_2_INTERVAL_MIN, EVENT_2_INTERVAL_MAX );
102 ApplyAgentsToBleedingSources(player, deltaT);
106 void ApplyAgentsToBleedingSources(
PlayerBase player,
float deltaT)
109 int count = player.GetBleedingSourceCount();
110 float agent_dose = count * AGENT_DOSE_PER_BS_SEC * deltaT;
111 player.InsertAgent(
eAgents.CHEMICAL_POISON, agent_dose);
115 void BleedingSourceCreateCheck(
PlayerBase player)
117 int free_bs_locations = 0;
118 set<int> list = player.GetBleedingManagerServer().GetBleedingSourcesLocations();
120 foreach(
int location: list)
122 float prot_level = PluginTransmissionAgents.GetProtectionLevelEx(
DEF_CHEMICAL, location, player,
true);
123 float dice_throw =
Math.RandomFloat01();
124 if(dice_throw > prot_level)
126 free_bs_locations = player.GetBleedingManagerServer().GetFreeBleedingSourceBitsByInvLocation(location) | free_bs_locations;
130 int num_of_free_bs =
Math.GetNumberOfSetBits(free_bs_locations);
132 if ( num_of_free_bs > 0 )
134 int random_bs_index =
Math.RandomIntInclusive(0, num_of_free_bs - 1 );
135 int random_bs_bit =
Math.Pow(2,
Math.GetNthBitSet(free_bs_locations,random_bs_index));
136 player.GetBleedingManagerServer().AttemptAddBleedingSourceDirectly(random_bs_bit,
eBleedingSourceType.CONTAMINATED);
140 float TransmitAgents(
PlayerBase player,
float count)
142 PluginTransmissionAgents plugin = PluginTransmissionAgents.Cast(
GetPlugin(PluginTransmissionAgents));