| 132 | #include "HUDManager.h" |
| 133 | |
| 134 | void CActorCondition::UpdateCondition() |
| 135 | { |
| 136 | if (GodMode()) |
| 137 | return; |
| 138 | if (!object().g_Alive()) |
| 139 | return; |
| 140 | if (!object().Local() && m_object != Level().CurrentViewEntity()) |
| 141 | return; |
| 142 | |
| 143 | float weight = object().GetCarryWeight(); |
| 144 | float max_weight; |
| 145 | if (Core.Features.test(xrCore::Feature::condition_jump_weight_mod)) |
| 146 | max_weight = object().inventory().GetMaxWeight() + object().ArtefactsAddWeight(false); |
| 147 | else |
| 148 | max_weight = object().MaxCarryWeight(); |
| 149 | |
| 150 | float weight_coef = weight / max_weight; |
| 151 | |
| 152 | if ((object().mstate_real & mcAnyMove)) |
| 153 | { |
| 154 | ConditionWalk(weight_coef, isActorAccelerated(object().mstate_real, object().IsZoomAimingMode()), (object().mstate_real & mcSprint) != 0); |
| 155 | } |
| 156 | else |
| 157 | { |
| 158 | ConditionStand(weight_coef); |
| 159 | } |
| 160 | |
| 161 | if (m_fPowerLeakSpeed > 0.0f) |
| 162 | { |
| 163 | float k_max_power = 1.0f; |
| 164 | |
| 165 | if (true) |
| 166 | { |
| 167 | float base_w = object().MaxCarryWeight(); |
| 168 | |
| 169 | k_max_power = 1.0f + _min(weight, base_w) / base_w + _max(0.0f, (weight - base_w) / 10.0f); |
| 170 | } |
| 171 | else |
| 172 | k_max_power = 1.0f; |
| 173 | |
| 174 | SetMaxPower(GetMaxPower() - m_fPowerLeakSpeed * m_fDeltaTime * k_max_power); |
| 175 | } |
| 176 | |
| 177 | m_fAlcohol += m_fV_Alcohol * m_fDeltaTime; |
| 178 | clamp(m_fAlcohol, 0.0f, 1.0f); |
| 179 | |
| 180 | CEffectorCam* ce = Actor()->Cameras().GetCamEffector((ECamEffectorType)effAlcohol); |
| 181 | if ((m_fAlcohol > 0.0001f)) |
| 182 | { |
| 183 | if (!ce) |
| 184 | { |
| 185 | AddEffector(m_object, effAlcohol, "effector_alcohol", fastdelegate::MakeDelegate(this, &CActorCondition::GetAlcohol)); |
| 186 | } |
| 187 | } |
| 188 | else |
| 189 | { |
| 190 | if (ce) |
| 191 | RemoveEffector(m_object, effAlcohol); |
no test coverage detected