DayZ 1.29
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
181 #endif
182
183 if (!g_Game.IsServer())
184 {
185 return;
186 }
187
188 int valve;
189 float waterHeight, pressureLevel;
190 WaterLevelSettings wlStageSettings, wlStageSettingsPrev;
191 PressureLevelSettings plStageSettings, plStageSettingsPrev;
192
195 for (valve = 0; valve < VALVES_COUNT; ++valve)
196 {
197 if (m_LastActiveValve != INDEX_NOT_FOUND && m_LastActiveValve != valve && m_ValveStates[valve] == true)
198 {
199 wlStageSettings = ActualWaterLevelStageSettings(valve);
202 m_WaterLevelSnapshot.RemainingDuration = Math.Clamp(wlStageSettings.Duration - m_WaterLevelTimesAccumulated[valve], 0, wlStageSettings.Duration);
203 m_ValveStates[valve] = false;
204 m_PressureDeanimationRequests[valve] = true;
205 break;
206 }
207 }
208
210 for (valve = 0; valve < VALVES_COUNT; ++valve)
211 {
212 if (m_ValveStates[valve] == true)
213 {
214 wlStageSettingsPrev = PreviousWaterLevelStageSettings(valve);
215 wlStageSettings = ActualWaterLevelStageSettings(valve);
216
218 if (wlStageSettings.Duration == -1.0)
219 {
220 m_ValveStates[valve] = false;
224 return;
225 }
226
227 float adjustedWaterHeight = WaterLevelToHeight(wlStageSettingsPrev.WaterLevel);
228 float adjustedDuration = wlStageSettings.Duration;
230 {
231 adjustedWaterHeight = m_WaterLevelSnapshot.WaterHeight;
232 adjustedDuration = wlStageSettings.Duration + m_WaterLevelSnapshot.RemainingDuration;
233 }
234
235 if (m_WaterLevelTimesAccumulated[valve] <= adjustedDuration)
236 {
237 float start = adjustedWaterHeight;
238 float target = WaterLevelToHeight(wlStageSettings.WaterLevel);
239 waterHeight = Math.Lerp(start, target, Easing.EaseInOutSine(m_WaterLevelTimesAccumulated[valve] / adjustedDuration));
240 SetWaterLevelHeight(waterHeight);
241 }
242 else
243 {
247 SetSynchDirty();
248 }
250 }
251 else
252 {
255 }
256 }
257
258 int allValvesStates = 0;
259
261 for (valve = 0; valve < VALVES_COUNT; ++valve)
262 {
263 if (m_PressureAnimationRequests[valve] == true)
264 {
265 bool hasToBeDeanimated = m_PressureAnimationRequests[valve] == m_PressureDeanimationRequests[valve];
266 plStageSettingsPrev = PreviousPressureLevelStageSettings(valve, hasToBeDeanimated);
267 plStageSettings = ActualPressureLevelStageSettings(valve, hasToBeDeanimated);
268
270 if (plStageSettings.Duration == -1.0)
271 {
273 m_PressureAnimationRequests[valve] = false;
275 return;
276 }
277
278 if (m_PressureTimesAccumulated[valve] <= plStageSettings.Duration)
279 {
280 float plStart = PressureLevelToValue(plStageSettingsPrev.PressureLevel);
281 float plTarget = PressureLevelToValue(plStageSettings.PressureLevel);
282 pressureLevel = Math.Lerp(plStart, plTarget, m_PressureTimesAccumulated[valve] / plStageSettings.Duration);
283 SetValvePressureLevelGauge(valve, pressureLevel);
284 }
285 else
286 {
289 if (hasToBeDeanimated && IsValvePressureLevelGaugeAtBase(valve))
290 {
291 m_PressureDeanimationRequests[valve] = false;
293 }
294 else
295 {
297 SetSynchDirty();
298 }
299 }
300
302 }
303 else
304 {
306 }
307
308
309 allValvesStates += m_PressureAnimationRequests[valve];
310 if (allValvesStates == false)
311 {
313 }
314 }
315 }
DayZGame g_Game
Определения DayZGame.c:3942
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().