4 const static int SOUNDS_SPARK_COUNT = 4;
5 const static int SOUNDS_CUT_COUNT = 3;
6 const static int SOUNDS_COLLISION_COUNT = 4;
7 const static int SOUNDS_SHOCK_COUNT = 4;
8 const static float RANDOM_SPARK_INTERVAL = 5.0;
10 const static string m_SoundsSpark[
SOUNDS_SPARK_COUNT] = {
"electricFenceSpark1",
"electricFenceSpark2",
"electricFenceSpark3",
"electricFenceSpark4"};
11 const static string m_SoundsCut[
SOUNDS_CUT_COUNT] = {
"barbedFenceCut1",
"barbedFenceCut2",
"barbedFenceCut3"};
12 const static string m_SoundsCollision[
SOUNDS_COLLISION_COUNT] = {
"barbedFenceCollision1",
"barbedFenceCollision2",
"barbedFenceCollision3",
"barbedFenceCollision4"};
13 const static string m_SoundsShock[
SOUNDS_SHOCK_COUNT] = {
"electricFenceShock1",
"electricFenceShock2",
"electricFenceShock3",
"electricFenceShock4"};
14 const static string m_SoundBuzzLoop =
"electricFenceBuzzLoop1";
28 const string SOUND_MOUNT =
"putDown_BarbedWire_SoundSet";
35 m_TriggerActive =
false;
39 RegisterNetSyncVariableBool(
"m_IsSoundSynchRemote" );
40 RegisterNetSyncVariableBool(
"m_IsDeploySound" );
41 RegisterNetSyncVariableBool(
"m_IsMounted" );
67 GetInventory().GetCurrentInventoryLocation( inventory_location );
68 return base_building.GetInventory().GetSlotLock( inventory_location.
GetSlot() );
79 m_IsMounted = is_mounted;
93 GetInventory().GetCurrentInventoryLocation( inventory_location );
94 bool is_mounted = base_building.GetInventory().GetSlotLock( inventory_location.
GetSlot() );
97 base_building.UpdateAttachmentVisuals( slot_name, is_mounted );
98 base_building.UpdateAttachmentPhysics( slot_name, is_mounted );
108 GetInventory().GetCurrentInventoryLocation( inventory_location );
109 base_building.GetInventory().SetSlotLock( inventory_location.
GetSlot(), lock_state );
127 super.OnVariablesSynchronized();
129 if ( ( m_IsMounted && !m_LastMountedState ) || ( !m_IsMounted && m_LastMountedState ) )
132 PlaySoundSet( m_MountSound, SOUND_MOUNT, 0.1, 0.1 );
154 if ( !
GetGame().IsDedicatedServer() )
165 if ( !
GetGame().IsDedicatedServer() )
175 super.OnStoreSave( ctx );
180 if ( !super.OnStoreLoad( ctx, version ) )
188 if ( !ctx.
Read( is_mounted ) )
200 super.AfterStoreLoad();
232 override void OnWork(
float consumed_energy ) {}
248 super.OnInventoryEnter(player);
249 HideSelection(
"placing");
250 ShowSelection(
"zbytek");
253 GetCompEM().UnplugThis();
254 GetCompEM().UnplugAllDevices();
264 m_AreaDamage.SetHitZones({
"RightLeg",
"LeftLeg",
"RightFoot",
"LeftFoot"});
267 m_TriggerActive =
true;
274 m_AreaDamage.SetHitZones({
"RightLeg",
"LeftLeg",
"RightFoot",
"LeftFoot"});
277 m_TriggerActive =
true;
283 m_TriggerActive =
false;
315 string sound_type = m_SoundsCut[random_index];
326 string sound_type = m_SoundsSpark[random_index];
336 if (!m_BuzzSoundLoop)
338 m_BuzzSoundLoop = PlaySoundLoop(m_SoundBuzzLoop, 50);
351 m_BuzzSoundLoop = NULL;
362 string sound_type = m_SoundsShock[random_index];
372 int random_index =
Math.
RandomInt(0, SOUNDS_COLLISION_COUNT);
373 string sound_type = m_SoundsCollision[random_index];
383 if ( GetCompEM().IsPlugged() && GetCompEM().IsSwitchedOn() )
394 MiscGameplayFunctions.DealAbsoluteDmg(
this, 1000);
402 super.OnItemLocationChanged(old_owner, new_owner);
417 super.OnPlacementComplete( player, position, orientation );
422 HideSelection(
"zbytek");
424 if (!GetHierarchyParent())
426 if (GetCompEM().IsPlugged() && GetCompEM().IsWorking() )
439 return "placeBarbedWire_SoundSet";
444 return "barbedwire_deploy_SoundSet";
void AddAction(typename actionName)
void AreaDamageManager(EntityAI parent)
class BaseBuildingBase extends ItemBase bsbDebugPrint(string s)
protected ref AreaDamageManager m_AreaDamage
override void SetTakeable(bool pState)
void SetIsDeploySound(bool is_deploy_sound)
bool CanPlayDeployLoopSound()
override string GetDebugName()
Gets the debug name for the ParticleManager.
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
protected ref EffectSound m_DeployLoopSound
class JsonUndergroundAreaTriggerData GetPosition
proto native void ObjectDelete(Object obj)
override ScriptCallQueue GetCallQueue(int call_category)
Wrapper class for managing sound through SEffectManager.
bool IsSoundPlaying()
Get whether EffectSound is currently playing.
void SetSoundFadeOut(float fade_out)
Set the sound fade out duration.
void SoundStop()
Stops sound.
proto native int GetSlot()
returns slot id if current type is Attachment
provides access to slot configuration
static proto native owned string GetSlotName(int id)
converts slot_id to string
protected void UpdateAttachmentSlot()
protected bool m_TriggerActive
override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
override string GetDeploySoundset()
void SetMountedState(bool is_mounted)
protected bool GetSlotLockedState()
SoundOnVehicle m_BuzzSoundLoop
override void OnStoreSave(ParamsWriteContext ctx)
protected bool m_LastMountedState
override string GetLoopDeploySoundset()
protected ref AreaDamageManager m_AreaDamage
override void PostAreaDamageActions()
override void OnIsUnplugged(EntityAI last_energy_source)
void PlayDeployLoopSound()
void StopDeployLoopSound()
override void OnIsPlugged(EntityAI source_device)
override void OnWorkStop()
static const int SOUNDS_SHOCK_COUNT
override void PreAreaDamageActions()
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
static const int SOUNDS_SPARK_COUNT
protected EffectSound m_MountSound
override void OnWork(float consumed_energy)
static const int SOUNDS_CUT_COUNT
override void AfterStoreLoad()
override bool OnStoreLoad(ParamsReadContext ctx, int version)
protected bool m_IsPlaced
override void OnWorkStart()
ref protected EffectSound m_DeployLoopSound
protected void CreateElectrifiedDamageTrigger()
override void OnInventoryEnter(Man player)
override void OnVariablesSynchronized()
void SoundBuzzLoopStart()
protected bool m_IsMounted
protected void CreateDamageTrigger()
protected void LockAttachmentSlot(bool lock_state)
protected void DestroyDamageTrigger()
void SoundElectricShock()
override void SetActions()
static const int SOUNDS_COLLISION_COUNT
static const int BARBED_WIRE_SPARKS
Manager class for managing Effect (EffectParticle, EffectSound)
static void DestroyEffect(Effect effect)
Unregisters, stops and frees the Effect.
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.
proto void CallLater(func fn, int delay=0, bool repeat=false, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
Serialization general interface. Serializer API works with:
proto bool Read(void value_in)
proto native CGame GetGame()
static proto int RandomInt(int min, int max)
Returns a random int number between and min [inclusive] and max [exclusive].