DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ EOnPostSimulate()

override void EOnPostSimulate ( IEntity other,
float timeSlice )
private

In case where one of the valves is already running

  • snapshot values; stop animation of that valve and continue with newly requested

will force that valve to start deanimation of gauge

water level course and animation

stay on the same level

pressure course and animation

stay on the same level

end of deanimation - overlapped activation of valves

См. определение в файле Land_Underground_WaterReservoir.c строка 176

177 {
178 #ifndef SERVER
179 #ifndef NO_GUI
182 #endif
183 #endif
184
185 if (!g_Game.IsServer())
186 {
187 return;
188 }
189
190 int valve;
191 float waterHeight, pressureLevel;
192 WaterLevelSettings wlStageSettings, wlStageSettingsPrev;
193 PressureLevelSettings plStageSettings, plStageSettingsPrev;
194
197 for (valve = 0; valve < VALVES_COUNT; ++valve)
198 {
199 if (m_LastActiveValve != INDEX_NOT_FOUND && m_LastActiveValve != valve && m_ValveStates[valve] == true)
200 {
201 wlStageSettings = ActualWaterLevelStageSettings(valve);
204 m_WaterLevelSnapshot.RemainingDuration = Math.Clamp(wlStageSettings.Duration - m_WaterLevelTimesAccumulated[valve], 0, wlStageSettings.Duration);
205 m_ValveStates[valve] = false;
206 m_PressureDeanimationRequests[valve] = true;
207 break;
208 }
209 }
210
212 for (valve = 0; valve < VALVES_COUNT; ++valve)
213 {
214 if (m_ValveStates[valve] == true)
215 {
216 wlStageSettingsPrev = PreviousWaterLevelStageSettings(valve);
217 wlStageSettings = ActualWaterLevelStageSettings(valve);
218
220 if (wlStageSettings.Duration == -1.0)
221 {
222 m_ValveStates[valve] = false;
226 return;
227 }
228
229 float adjustedWaterHeight = WaterLevelToHeight(wlStageSettingsPrev.WaterLevel);
230 float adjustedDuration = wlStageSettings.Duration;
232 {
233 adjustedWaterHeight = m_WaterLevelSnapshot.WaterHeight;
234 adjustedDuration = wlStageSettings.Duration + m_WaterLevelSnapshot.RemainingDuration;
235 }
236
237 if (m_WaterLevelTimesAccumulated[valve] <= adjustedDuration)
238 {
239 float start = adjustedWaterHeight;
240 float target = WaterLevelToHeight(wlStageSettings.WaterLevel);
241 waterHeight = Math.Lerp(start, target, Easing.EaseInOutSine(m_WaterLevelTimesAccumulated[valve] / adjustedDuration));
242 SetWaterLevelHeight(waterHeight);
243 }
244 else
245 {
249 SetSynchDirty();
250 }
252 }
253 else
254 {
257 }
258 }
259
260 int allValvesStates = 0;
261
263 for (valve = 0; valve < VALVES_COUNT; ++valve)
264 {
265 if (m_PressureAnimationRequests[valve] == true)
266 {
267 bool hasToBeDeanimated = m_PressureAnimationRequests[valve] == m_PressureDeanimationRequests[valve];
268 plStageSettingsPrev = PreviousPressureLevelStageSettings(valve, hasToBeDeanimated);
269 plStageSettings = ActualPressureLevelStageSettings(valve, hasToBeDeanimated);
270
272 if (plStageSettings.Duration == -1.0)
273 {
275 m_PressureAnimationRequests[valve] = false;
277 return;
278 }
279
280 if (m_PressureTimesAccumulated[valve] <= plStageSettings.Duration)
281 {
282 float plStart = PressureLevelToValue(plStageSettingsPrev.PressureLevel);
283 float plTarget = PressureLevelToValue(plStageSettings.PressureLevel);
284 pressureLevel = Math.Lerp(plStart, plTarget, m_PressureTimesAccumulated[valve] / plStageSettings.Duration);
285 SetValvePressureLevelGauge(valve, pressureLevel);
286 }
287 else
288 {
291 if (hasToBeDeanimated && IsValvePressureLevelGaugeAtBase(valve))
292 {
293 m_PressureDeanimationRequests[valve] = false;
295 }
296 else
297 {
299 SetSynchDirty();
300 }
301 }
302
304 }
305 else
306 {
308 }
309
310
311 allValvesStates += m_PressureAnimationRequests[valve];
312 if (allValvesStates == false)
313 {
315 }
316 }
317 }
DayZGame g_Game
Определения DayZGame.c:4074
float m_WaterLevelHeightActual
void SetDefaultPressureLevelStageSettings(int pValveIndex)
bool IsValvePressureLevelGaugeAtBase(int pValveIndex)
PressureLevelSettings ActualPressureLevelStageSettings(int pValveIndex, bool pDeanimationRequest=false)
ref array< bool > m_PressureDeanimationRequests
WaterLevelSettings ActualWaterLevelStageSettings(int pValveIndex)
const int VALVES_COUNT
void AdvanceToNextPressureLevelStageSettings(int pValveIndex)
PressureLevelSettings PreviousPressureLevelStageSettings(int pValveIndex, bool pDeanimationRequest=false)
void SetWaterLevelHeight(float pHeight)
ref array< bool > m_ValveStates
void SetValvePressureLevelGauge(int pValveIndex, float pValue)
float WaterLevelToHeight(int pWaterLevel)
ref array< float > m_PressureTimesAccumulated
WaterLevelSettings PreviousWaterLevelStageSettings(int pValveIndex)
void AdvanceToNextWaterLevelStageSettings(int pValveIndex)
void HandleSoundEffects()
float PressureLevelToValue(int pPressureLevel)
ref WaterLevelSnapshot m_WaterLevelSnapshot
for deanimation purposes
float AdjustTime(float originalTime)
void SyncValveVariables()
ref array< float > m_WaterLevelTimesAccumulated
ref array< bool > m_PressureAnimationRequests
int m_LastActiveValve
void PressureLevelSettings(int pPressureLevel, float pDuration)
const float TEMP_HOTIX_TIMESLICE
void HandleVisualEffects()
static float EaseInOutSine(float t)
Определения Easing.c:14
Input value between 0 and 1, returns value adjusted by easing, no automatic clamping of input(do your...
Определения Easing.c:3
Определения EnMath.c:7
const int INDEX_NOT_FOUND
Определения gameplay.c:13
static proto float Lerp(float a, float b, float time)
Linearly interpolates between 'a' and 'b' given 'time'.
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.

Перекрестные ссылки ActualPressureLevelStageSettings(), ActualWaterLevelStageSettings(), AdjustTime(), AdvanceToNextPressureLevelStageSettings(), AdvanceToNextWaterLevelStageSettings(), Math::Clamp(), WaterLevelSettings::Duration, Easing::EaseInOutSine(), g_Game, HandleSoundEffects(), HandleVisualEffects(), INDEX_NOT_FOUND, IsValvePressureLevelGaugeAtBase(), Math::Lerp(), m_LastActiveValve, m_PressureAnimationRequests, m_PressureDeanimationRequests, m_PressureTimesAccumulated, m_ValveStates, m_WaterLevelHeightActual, m_WaterLevelSnapshot, m_WaterLevelTimesAccumulated, PressureLevelSettings(), PressureLevelToValue(), PreviousPressureLevelStageSettings(), PreviousWaterLevelStageSettings(), SetDefaultPressureLevelStageSettings(), SetValvePressureLevelGauge(), SetWaterLevelHeight(), SyncValveVariables(), TEMP_HOTIX_TIMESLICE, VALVES_COUNT, WaterLevelSettings::WaterLevel и WaterLevelToHeight().