8 static vector m_LightLocalOrientation =
"0 0 0";
11 static const string SEL_REFLECTOR_COMP_U =
"reflector";
12 static const string SEL_CORD_FOLDED_U =
"cord_folded";
13 static const string SEL_CORD_PLUGGED_U =
"cord_plugged";
14 static const string SEL_CORD_PLUGGED_F =
"spotlight_folded_cord_plugged";
15 static const string SEL_CORD_FOLDED_F =
"spotlight_folded_cord_folded";
17 static const string SEL_INVENTORY =
"inventory";
18 static const string SEL_PLACING =
"placing";
19 static const string SEL_GLASS_F =
"glass_folded";
20 static const string SEL_GLASS_U =
"glass_unfolded";
21 static const string SEL_REFLECTOR_F =
"reflector_folded";
22 static const string SEL_REFLECTOR_U =
"reflector_unfolded";
24 static const int ID_GLASS_UNFOLDED = 3;
25 static const int ID_REFLECTOR_UNFOLDED = 4;
26 static const int ID_GLASS_FOLDED = 5;
27 static const int ID_REFLECTOR_FOLDED = 6;
29 static string LIGHT_OFF_GLASS =
"dz\\gear\\camping\\Data\\spotlight_glass.rvmat";
30 static string LIGHT_OFF_REFLECTOR =
"dz\\gear\\camping\\Data\\spotlight.rvmat";
31 static string LIGHT_ON_GLASS =
"dz\\gear\\camping\\Data\\spotlight_glass_on.rvmat";
32 static string LIGHT_ON_REFLECTOR =
"dz\\gear\\camping\\Data\\spotlight_glass_on.rvmat";
35 const string SOUND_TURN_ON =
"spotlight_turn_on_SoundSet";
36 const string SOUND_TURN_OFF =
"spotlight_turn_off_SoundSet";
45 m_EvaluateDeployment =
false;
47 RegisterNetSyncVariableBool(
"m_IsSoundSynchRemote");
48 RegisterNetSyncVariableBool(
"m_IsDeploySound");
49 RegisterNetSyncVariableBool(
"m_IsFolded");
65 if (GetCompEM().IsPlugged())
67 if (!GetHierarchyRoot())
83 HideSelection(SEL_CORD_FOLDED_F);
114 m_Light.AttachOnObject(
this, m_LightLocalPosition, m_LightLocalOrientation);
138 m_EvaluateDeployment =
false;
140 m_Light.AttachOnObject(
this, m_LightLocalPosition, m_LightLocalOrientation);
150 Fold(GetCompEM().IsPlugged());
161 bool isPlugged = GetCompEM().IsPlugged();
166 m_LightLocalPosition = GetSelectionPositionLS(
"beamStart");
170 HideSelection(SEL_REFLECTOR_COMP_U);
172 ShowSelection(SEL_INVENTORY);
173 ShowSelection(SEL_GLASS_F);
174 ShowSelection(SEL_REFLECTOR_F);
177 ShowSelection(SEL_CORD_PLUGGED_F);
179 ShowSelection(SEL_CORD_FOLDED_F);
183 if (GetCompEM().IsWorking())
185 SetObjectMaterial(ID_GLASS_UNFOLDED, LIGHT_ON_GLASS);
186 SetObjectMaterial(ID_REFLECTOR_UNFOLDED, LIGHT_ON_REFLECTOR);
187 SetObjectMaterial(ID_GLASS_FOLDED, LIGHT_ON_GLASS);
188 SetObjectMaterial(ID_REFLECTOR_FOLDED, LIGHT_ON_REFLECTOR);
192 SetObjectMaterial(ID_GLASS_UNFOLDED, LIGHT_OFF_GLASS);
193 SetObjectMaterial(ID_REFLECTOR_UNFOLDED, LIGHT_OFF_REFLECTOR);
194 SetObjectMaterial(ID_GLASS_FOLDED, LIGHT_OFF_GLASS);
195 SetObjectMaterial(ID_REFLECTOR_FOLDED, LIGHT_OFF_REFLECTOR);
201 ShowSelection(SEL_PLACING);
202 ShowSelection(SEL_REFLECTOR_U);
203 ShowSelection(SEL_GLASS_U);
204 ShowSelection(SEL_REFLECTOR_COMP_U);
207 ShowSelection(SEL_CORD_PLUGGED_U);
209 ShowSelection(SEL_CORD_FOLDED_U);
213 if (GetCompEM().IsWorking())
215 SetObjectMaterial(ID_GLASS_UNFOLDED, LIGHT_ON_GLASS);
216 SetObjectMaterial(ID_REFLECTOR_UNFOLDED, LIGHT_ON_REFLECTOR);
220 SetObjectMaterial(ID_GLASS_UNFOLDED, LIGHT_OFF_GLASS);
221 SetObjectMaterial(ID_REFLECTOR_UNFOLDED, LIGHT_OFF_REFLECTOR);
235 super.OnVariablesSynchronized();
252 GetCompEM().SwitchOff();
253 GetCompEM().UnplugThis();
272 ctx.Write(m_IsFolded);
277 if (!
super.OnStoreLoad(
ctx, version))
295 if (!
super.CanPutInCargo(parent))
298 return !GetCompEM().IsPlugged();
303 if (!
super.CanPutIntoHands(parent))
319 PlaySoundSet(m_SoundTurnOn, SOUND_TURN_ON, 0, 0);
324 PlaySoundSet(m_SoundTurnOff, SOUND_TURN_OFF, 0, 0);
343 playerPB.GetHologramServer().SetSelectionToRefresh(selection);
345 playerPB.GetHologramLocal().SetSelectionToRefresh(selection);
357 m_EvaluateDeployment =
true;
374 return "placeSpotlight_SoundSet";
379 return "spotlight_deploy_SoundSet";
393 if (!
GetGame().IsDedicatedServer())
402 if (MemoryPointExists(
"invView2") && !m_IsFolded)
void AddAction(typename actionName)
void RemoveAction(typename actionName)
ExplosiveLight m_Light
light
void SetIsDeploySound(bool is_deploy_sound)
bool CanPlayDeployLoopSound()
override bool IsHologram()
override bool IsBeingPlaced()
ref EffectSound m_DeployLoopSound
class JsonUndergroundAreaTriggerData GetPosition
Wrapper class for managing sound through SEffectManager.
override bool CanPutIntoHands(EntityAI player)
override void OnSwitchOn()
EffectSound m_SoundTurnOn
override void OnIsPlugged(EntityAI source_device)
override bool OnStoreLoad(ParamsReadContext ctx, int version)
EffectSound m_SoundTurnOff
override void OnWorkStart()
override int GetViewIndex()
override void OnPlacementStarted(Man player)
override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
override bool IsElectricAppliance()
void PlayDeployLoopSound()
override void SetActions()
override void OnInitEnergy()
override string GetDeploySoundset()
override void OnWorkStop()
static vector m_LightLocalPosition
override void OnStoreSave(ParamsWriteContext ctx)
override void OnPlacementCancelled(Man player)
override void OnVariablesSynchronized()
bool m_EvaluateDeployment
override void OnIsUnplugged(EntityAI last_energy_source)
EffectSound m_DeployLoopSound
override void OnSwitchOff()
override bool CanPutInCargo(EntityAI parent)
void UpdateAllSelections()
override string GetLoopDeploySoundset()
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
static const string SEL_CORD_PLUGGED_F
void Fold(bool keep_connected=false)
void StopDeployLoopSound()
override bool IsDeployable()
override void EOnInit(IEntity other, int extra)
Manager class for managing Effect (EffectParticle, EffectSound)
static EffectSound PlaySound(string sound_set, vector position, float play_fade_in=0, float stop_fade_out=0, bool loop=false)
Create and play an EffectSound.
static void DestroyEffect(Effect effect)
Unregisters, stops and frees the Effect.
Serialization general interface. Serializer API works with:
proto native CGame GetGame()