actionclosebarrelholes.c 1012 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. class ActionCloseBarrelHoles: ActionInteractBase
  2. {
  3. void ActionCloseBarrelHoles()
  4. {
  5. m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_INTERACTONCE;
  6. m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT | DayZPlayerConstants.STANCEMASK_CROUCH;
  7. m_Text = "#close";
  8. }
  9. override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
  10. {
  11. Object target_object = target.GetObject();
  12. if ( target_object.IsItemBase() )
  13. {
  14. BarrelHoles_ColorBase ntarget = BarrelHoles_ColorBase.Cast( target_object );
  15. if( ntarget )
  16. {
  17. if ( ntarget.IsOpen() )
  18. {
  19. return true;
  20. }
  21. }
  22. }
  23. return false;
  24. }
  25. override void OnExecuteServer( ActionData action_data )
  26. {
  27. Object target_object = action_data.m_Target.GetObject();
  28. BarrelHoles_ColorBase ntarget = BarrelHoles_ColorBase.Cast( target_object );
  29. if( ntarget )
  30. {
  31. ntarget.Close();
  32. if (ntarget.GetBarrelCloseSoundset() != string.Empty)
  33. ntarget.StartItemSoundServer(SoundConstants.ITEM_BARREL_CLOSE);
  34. }
  35. }
  36. }