actionfoldobject.c 868 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. class ActionFoldObject: ActionInteractBase
  2. {
  3. void ActionFoldObject()
  4. {
  5. m_SpecialtyWeight = UASoftSkillsWeight.ROUGH_MEDIUM;
  6. m_Text = "#fold";
  7. }
  8. override typename GetInputType()
  9. {
  10. return ContinuousInteractActionInput;
  11. }
  12. override bool HasProgress()
  13. {
  14. return false;
  15. }
  16. override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
  17. {
  18. Object targetObject = target.GetObject();
  19. if ( targetObject.IsInherited(HescoBox) )
  20. {
  21. HescoBox hesco = HescoBox.Cast( targetObject );
  22. if ( hesco.GetState() == HescoBox.UNFOLDED )
  23. {
  24. return true;
  25. }
  26. }
  27. return false;
  28. }
  29. override void OnExecuteServer( ActionData action_data )
  30. {
  31. Object targetObject = action_data.m_Target.GetObject();
  32. HescoBox hesco = HescoBox.Cast( targetObject );
  33. if ( hesco.GetState() == HescoBox.UNFOLDED )
  34. {
  35. hesco.Fold();
  36. }
  37. }
  38. };