Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Hesco_1_Kit extends ItemBase
- {
- ref protected EffectSound m_DeployLoopSound;
- protected Object Hesco_1_Kit1;
- void SandbagLong_Kit()
- {
- RegisterNetSyncVariableBool("m_IsSoundSynchRemote");
- }
- override void EEInit()
- {
- super.EEInit();
- }
- override void OnItemLocationChanged( EntityAI old_owner, EntityAI new_owner )
- {
- super.OnItemLocationChanged( old_owner, new_owner );
- }
- override void OnVariablesSynchronized()
- {
- super.OnVariablesSynchronized();
- if ( IsDeploySound() )
- {
- PlayDeploySound();
- }
- if ( CanPlayDeployLoopSound() )
- {
- PlayDeployLoopSound();
- }
- if ( m_DeployLoopSound && !CanPlayDeployLoopSound() )
- {
- StopDeployLoopSound();
- }
- }
- override void SetActions()
- {
- super.SetActions();
- AddAction(ActionTogglePlaceObject);
- AddAction(ActionPlaceObject);
- }
- //================================================================
- // ADVANCED PLACEMENT
- //================================================================
- override void OnPlacementComplete( Man player )
- {
- super.OnPlacementComplete( player );
- PlayerBase pb = PlayerBase.Cast( player );
- if ( GetGame().IsServer() )
- {
- PlayerBase player_base = PlayerBase.Cast( player );
- vector position = player_base.GetLocalProjectionPosition();
- vector orientation = player_base.GetLocalProjectionOrientation();
- Hesco_1_Kit1 = GetGame().CreateObject("FortHesco_1", pb.GetLocalProjectionPosition(), false );
- Hesco_1_Kit1.SetPosition( position );
- Hesco_1_Kit1.SetOrientation( orientation );
- }
- SetIsDeploySound( true );
- }
- override bool IsDeployable()
- {
- return true;
- }
- override string GetDeploySoundset()
- {
- return "putDown_FenceKit_SoundSet";
- }
- override string GetLoopDeploySoundset()
- {
- return "BarbedWire_Deploy_loop_SoundSet";
- }
- void PlayDeployLoopSound()
- {
- if ( GetGame().IsMultiplayer() && GetGame().IsClient() || !GetGame().IsMultiplayer() )
- {
- m_DeployLoopSound = SEffectManager.PlaySound( GetLoopDeploySoundset(), GetPosition() );
- }
- }
- void StopDeployLoopSound()
- {
- if ( GetGame().IsMultiplayer() && GetGame().IsClient() || !GetGame().IsMultiplayer() )
- {
- m_DeployLoopSound.SoundStop();
- delete m_DeployLoopSound;
- }
- }
- }
- class FortHesco_1 : Fence
- {
- override bool HasBase()
- {
- return true;
- }
- override bool HasGate()
- {
- return false;
- }
- override void AfterStoreLoad()
- {
- //super.AfterStoreLoad();
- //set gate state
- //ConstructionPart gate_part = GetConstruction().GetGateConstructionPart();
- //SetGateState( gate_part.IsBuilt() );
- //update gate state visual
- if ( IsOpened() )
- {
- OpenFence();
- }
- UpdateVisuals();
- //bsbDebugPrint("[bsb] AfterStoreLoad - build=" + gate_part.IsBuilt() + " opened=" + IsOpened());
- }
- void Fort_Destroy()
- {
- //delete object
- GetGame().ObjectDelete( this );
- }
- bool IsFacingFront( PlayerBase player, string selection )
- {
- vector metal_pos = GetPosition();
- vector player_pos = player.GetPosition();
- vector metal_dir = GetDirection();
- vector metal_player_dir = player_pos - metal_pos;
- metal_player_dir.Normalize();
- metal_dir.Normalize();
- if ( metal_dir.Length() != 0 )
- {
- float dot = vector.Dot( metal_player_dir, metal_dir );
- if ( dot > 0 )
- {
- return true;
- }
- }
- return false;
- }
- bool IsFacingBack( PlayerBase player, string selection )
- {
- return !IsFacingFront( player, selection );
- }
- override bool HasProperDistance( string selection, PlayerBase player )
- {
- if ( MemoryPointExists( selection ) )
- {
- vector selection_pos = ModelToWorld( GetMemoryPointPos( selection ) );
- float distance = vector.Distance( selection_pos, player.GetPosition() );
- if ( distance >= 1.3 )
- {
- return false;
- }
- }
- return true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement