Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This class deals with placement for all custom tents.
- // Class that deals with default tent.
- class CivilianTentCamo extends ItemBase
- {
- ref protected EffectSound m_DeployLoopSound;
- protected Object CivilianTentDeployed1;
- protected Object ClutterCutter;
- private bool m_IsOpend = false;
- void CivilianTentCamo()
- {
- RegisterNetSyncVariableBool("m_IsSoundSynchRemote");
- }
- override void EEInit()
- {
- super.EEInit();
- }
- // 1.03 requirement for all actions custom or otherwise.
- override void SetActions()
- {
- super.SetActions();
- AddAction(ActionToggleTentOpen); // 1021
- AddAction(ActionPackTent); // 1022
- AddAction(ActionOpenBarrel); // 1025
- AddAction(ActionCloseBarrel); // 1026
- AddAction(ActionTogglePlaceObject); // 527
- AddAction(ActionDeployObject); // 231
- AddAction(ActionPackTentCamoModded); // Custom Action.
- //AddAction(ActionOpenTent); // Custom Action.
- //AddAction(ActionCloseTent); // Custom Action.
- }
- 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();
- }
- }
- //================================================================
- // ADVANCED PLACEMENT
- //================================================================
- // Clutter cutter gets rid of grass clipping into the tent.
- 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();
- CivilianTentDeployed1 = GetGame().CreateObject("CivilianTentCamoDeployed", pb.GetLocalProjectionPosition(), false );
- ClutterCutter = GetGame().CreateObject("LargeTentClutterCutter", pb.GetLocalProjectionPosition(), false );
- CivilianTentDeployed1.SetPosition( position );
- CivilianTentDeployed1.SetOrientation( orientation );
- ClutterCutter.SetPosition( position );
- ClutterCutter.SetOrientation( orientation );
- GetGame().RemoteObjectCreate(ClutterCutter);
- this.Delete();
- }
- 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;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement