1class WaterLevelSettings
6 void WaterLevelSettings(
int pWaterLevel,
float pDuration)
8 WaterLevel = pWaterLevel;
28 float RemainingDuration;
95 protected static const string WATER_LEVEL_MAX =
"water_level_max";
96 protected static const string WATER_LEVEL_AVERAGE =
"water_level_average";
97 protected static const string WATER_LEVEL_ABOVE_PIPES =
"water_level_above_pipes";
98 protected static const string WATER_LEVEL_MIN =
"water_level_min";
104 WATER_LEVEL_ABOVE_PIPES,
135 protected bool m_PipeUnderwaterSoundRunning
144 "pipe_creaking_sound_pos_1",
145 "pipe_creaking_sound_pos_2",
146 "pipe_creaking_sound_pos_3",
147 "pipe_creaking_sound_pos_4"
154 private ref
Timer m_TempHotfixTimer;
155 private const float TEMP_HOTIX_TIMESLICE = 0.01;
157 void Land_Underground_WaterReservoir()
164 void ~Land_Underground_WaterReservoir()
169 if (m_TempHotfixTimer)
171 m_TempHotfixTimer.Stop();
172 m_TempHotfixTimer = null;
176 override void EOnPostSimulate(IEntity other,
float timeSlice)
189 float waterHeight, pressureLevel;
190 WaterLevelSettings wlStageSettings, wlStageSettingsPrev;
218 if (wlStageSettings.Duration == -1.0)
228 float adjustedDuration = wlStageSettings.Duration;
237 float start = adjustedWaterHeight;
258 int allValvesStates = 0;
270 if (plStageSettings.Duration == -1.0)
310 if (allValvesStates ==
false)
319 super.OnVariablesSynchronized();
337 override bool HasTurnableValveBehavior()
389 RegisterNetSyncVariableInt(
"m_ValveStatesPacked", 0);
390 RegisterNetSyncVariableInt(
"m_ValveManipulatedIndex", -1,
VALVES_COUNT - 1);
391 RegisterNetSyncVariableInt(
"m_WaterLevelActual",
WL_MIN,
WL_MAX);
392 RegisterNetSyncVariableInt(
"m_WaterLevelPrev",
WL_MIN,
WL_MAX);
397 m_TempHotfixTimer =
new Timer();
398 m_TempHotfixTimer.Run(TEMP_HOTIX_TIMESLICE,
this,
"EOnPostSimulate", null,
true);
419 g_Game.RegisterNetworkStaticObject(
this);
483 string targetedValveName = GetActionComponentName(pComponentIndex);
562 valvePositions.Insert(posPoint);
563 valvePositions.Insert(dirPoint);
565 return valvePositions;
655 switch (pPressureLevel)
699 return wlStageSettings;
716 return wlStageSettings;
753 if (pDeanimationRequest)
756 return plStageSettings;
769 if (pDeanimationRequest)
772 return plStageSettings;
786 return plStageSettings;
796 if (pDeanimationRequest)
799 return plStageSettings;
805 if (pDeanimationRequest)
808 return plStageSettings;
815 return plStageSettings;
916 #ifdef DIAG_DEVELOPER
918 if (FeatureTimeAccel.GetFeatureTimeAccelEnabled(ETimeAccelCategories.UNDERGROUND_RESERVOIR))
920 timeAccel = FeatureTimeAccel.GetFeatureTimeAccelValue();
921 return originalTime * timeAccel;
931 if (MemoryPointExists(pMemoryPoint))
933 pos = GetMemoryPointPos(pMemoryPoint);
934 pos = ModelToWorld(pos);
938 ErrorEx(
string.Format(
"Memory point %1 not found, falling back to vector.Zero", pMemoryPoint));
997 if (drainPressureLevel >= 0.4 && drainPressureLevel < 0.8)
1011 if (drainPressureLevel < 0.4)
1024 if (fillPressureLevel >= 0.4)
1037 if (fillPressureLevel < 0.4)
1068 if (m_PipeUnderwaterSoundRunning)
1071 m_PipeUnderwaterSoundRunning =
false;
1257 for (
int i = 0; i < pStates.Count(); ++i)
1259 if (pStates[i] ==
true)
1261 packedBits |= 1 << i;
1271 for (
int i = 0; i < pArrayLength; ++i)
1273 if ((pPackedBits & 1 << i) != 0)
1275 unpackedBools.Insert(
true);
1279 unpackedBools.Insert(
false);
1283 return unpackedBools;
1289 string debug_output =
"";
1300 return debug_output;
1303 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
1310 super.GetDebugActions(outputList);
1315 if (super.OnAction(action_id, player, ctx))
1319 if (action_id ==
EActions.SPECIALIZED_ACTION1)
1327 else if (action_id ==
EActions.SPECIALIZED_ACTION2)
1336 else if (action_id ==
EActions.SPECIALIZED_ACTION3)
Param4< int, int, string, int > TSelectableActionInfoWithColor
ActionTurnValveUndergroundReservoirCB ActionTurnValveCB ActionTurnValveUndergroundReservoir()
void AddAction(typename actionName)
const int ECE_CREATEPHYSICS
Wrapper class for managing sound through SEffectManager.
Manager class for managing Effect (EffectParticle, EffectSound).
static bool DestroySound(EffectSound sound_effect)
Legacy, backwards compatibility.
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
override void OnVariablesSynchronized()
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
const int INDEX_NOT_FOUND
Serializer ParamsReadContext
EntityEvent
Entity events for event-mask, or throwing event from code.
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
const int SAT_DEBUG_ACTION
ref ParticleSourceArray m_PipeBrokenParticles
ref array< ref PressureLevelSettings > m_DrainValvePressureDeanimationSettings
float m_WaterLevelHeightActual
void RegisterValve(string pCompName, int pIndex)
const int PIPE_INDEX_BROKEN1
ref ParticleSourceArray m_ValveParticles
ref map< string, vector > m_WaterLevelsAvailable
const string SOUND_NAME_PIPE_SPRINKLING_START
void SetDefaultPressureLevelStageSettings(int pValveIndex)
bool IsValvePressureLevelGaugeAtBase(int pValveIndex)
int m_ValveManipulatedIndexPrev
void HandleSoundEffectsWaterLevelMovementSounds()
const string SOUND_NAME_PIPE_CREAKING
ref array< ref PressureLevelSettings > m_FillValvePressureStageSettings
const string ANIM_PHASE_VALVE_GAUGE_FILL
const int PARTICLE_FILL_PIPE_JET
PressureLevelSettings ActualPressureLevelStageSettings(int pValveIndex, bool pDeanimationRequest=false)
ref array< ref PressureLevelSettings > m_FillValvePressureDeanimationSettings
const string SOUND_NAME_WATER_FILL_LOOP
const int PARTICLE_FILL_PIPE_MAX_PRESSURE
ref array< ref WaterLevelSettings > m_DrainValveWaterStageSettings
valve/pipe stages for water and pressure levels
int m_DrainValvePressureLevelStageIndex
ref array< ref WaterLevelSettings > m_FillValveWaterStageSettings
for deanimation purposes
ref EffectSound m_WaterLevelMovementSound
const string VALVE_NAME_FILL
const string WATER_LEVELS[WATER_LEVELS_COUNT]
void PlayPipeCreakingSoundOnLocation()
ref array< bool > m_PressureDeanimationRequests
const string PIPE_NAME_BROKEN1
const string ANIM_PHASE_VALVE_FILL
WaterLevelSettings ActualWaterLevelStageSettings(int pValveIndex)
void OnValveManipulationStart(int pValveIndex)
void SetLastActiveValve(int pValveIndex)
void HandleSoundEffectsUnderwaterPipeSounds()
const string PIPE_NAME_LEAKING_DRAIN
const int PARTICLE_DRAIN_PIPE_MAX_PRESSURE
class WaterLevelSettings PressureLevel
const string SOUND_NAME_PIPE_SPRINKLING_LOOP2
void AdvanceToNextPressureLevelStageSettings(int pValveIndex)
bool m_ValveManipulationSoundRequested
VFX/SFX.
ref array< ref PressureLevelSettings > m_DrainValvePressureStageSettings
const string SOUND_NAME_VALVE_MANIPULATION
const int VALVE_INDEX_DRAIN
const string ANIM_PHASE_VALVE_DRAIN
PressureLevelSettings PreviousPressureLevelStageSettings(int pValveIndex, bool pDeanimationRequest=false)
const string SOUND_NAME_WATER_DRAIN_LOOP
int PackArrayOfBoolStatesIntoBits(array< bool > pStates)
void SetWaterLevelHeight(float pHeight)
void OnValveManipulationEnd(int pValveIndex)
ref array< bool > m_ValveStates
void SetValvePressureLevelGauge(int pValveIndex, float pValue)
ref array< string > m_ValveNames
array< bool > UnpackBitsToArrayOfBoolStates(int pPackedBits, int pArrayLength)
float WaterLevelToHeight(int pWaterLevel)
array< vector > GetValveAligningPointsWS(int pValveIndex)
void HandleSoundEffectsPipeCreaking()
ref EffectSound m_ValveManipulationSound
const string PIPE_NAME_LEAKING_FILL
float GetValvePressureLevelGauge(int pValveIndex)
const int PIPE_CREAKING_SOUND_LOCATIONS_COUNT
const int PIPE_INDEX_BROKEN2
main broken pipe
void OnValveManipulationCanceled(int pValveIndex)
bool m_PipeCreakingSoundRequested
ref array< float > m_PressureTimesAccumulated
WaterLevelSettings PreviousWaterLevelStageSettings(int pValveIndex)
const int WATER_LEVELS_COUNT
bool IsValveActive(int pValveIndex)
ref array< EffectSound > m_PipeSounds
override bool IsValveTurnable(int pValveIndex)
const int PARTICLE_FILL_PIPE_JET_WEAK
const string PIPE_CREAKING_SOUND_LOCATIONS[PIPE_CREAKING_SOUND_LOCATIONS_COUNT]
void AdvanceToNextWaterLevelStageSettings(int pValveIndex)
const string VALVE_NAME_DRAIN
void HandleSoundEffects()
const int PIPE_CREAKING_MIN_TIME_DELAY_MS
float PressureLevelToValue(int pPressureLevel)
const int VALVE_INDEX_FILL
void HandleSoundEffectsPipeSprinkling()
const string SOUND_NAME_PIPE_SPRINKLING_LOOP1
ref WaterLevelSnapshot m_WaterLevelSnapshot
for deanimation purposes
int m_DrainValveWaterLevelStageIndex
pointing to specific stage for each valve/pipe
const int PIPES_BROKEN_COUNT
int m_FillValveWaterLevelStageIndex
override int GetTurnableValveIndex(int pComponentIndex)
float AdjustTime(float originalTime)
const string SOUND_NAME_UPIPE_SPRINKLING_START
const string PIPE_NAME_BROKEN2
void SyncValveVariables()
const string SOUND_NAME_UPIPE_SPRINKLING_END
int m_ValveStatesPackedPrev
int HeightToWaterLevel(float pHeight)
ref array< float > m_WaterLevelTimesAccumulated
void TranslateMemoryPointsToWaterLevels()
int m_ValveManipulatedIndex
int m_FillValvePressureLevelStageIndex
Object m_SpawnedWaterObject
void AnimateValve(int pValveIndex, float pPhase)
ref EffectSound m_PipeUnderwaterSound
ref array< bool > m_PressureAnimationRequests
class WaterLevelSnapshot OBJECT_NAME_WATER_PLANE
const string SOUND_NAME_PIPE_SPRINKLING_END
const string SOUND_NAME_UPIPE_SPRINKLING_LOOP
ref EffectSound m_PipeCreakingSounds
vector m_WaterLevelDefault
const string ANIM_PHASE_VALVE_GAUGE_DRAIN
tighter broken pipe
void PlayValveManipulationSound()
void PressureLevelSettings(int pPressureLevel, float pDuration)
void CleanVisualEffects()
const int PIPE_CREAKING_MAX_TIME_DELAY_MS
void ConfigureValvesAndGaugesCourse()
vector GetMemoryPointPosition(string pMemoryPoint)
void HandleVisualEffects()
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor).
array< ParticleSource > ParticleSourceArray