actiontoggleplaceobject.c 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. class ActionTogglePlaceObject : ActionSingleUseBase
  2. {
  3. void ActionTogglePlaceObject()
  4. {
  5. m_Text = "#toggle_placing";
  6. }
  7. override void CreateConditionComponents()
  8. {
  9. m_ConditionItem = new CCINonRuined();
  10. m_ConditionTarget = new CCTNone();
  11. }
  12. override bool HasTarget()
  13. {
  14. return false;
  15. }
  16. override bool IsLocal()
  17. {
  18. return true;
  19. }
  20. override bool IsInstant()
  21. {
  22. return true;
  23. }
  24. override bool IsDeploymentAction()
  25. {
  26. return true;
  27. }
  28. override bool RemoveForceTargetAfterUse()
  29. {
  30. return false;
  31. }
  32. override bool CanBeUsedWithBrokenLegs()
  33. {
  34. return false;
  35. }
  36. override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
  37. {
  38. // not placeable if liquid is present; exception for barrels, for now
  39. if (!item.IsKindOf("Barrel_ColorBase") && item.IsLiquidPresent())
  40. return false;
  41. return true;
  42. }
  43. override void Start(ActionData action_data)
  44. {
  45. super.Start(action_data);
  46. action_data.m_Player.SetLocalProjectionPosition(action_data.m_Target.GetCursorHitPos());
  47. action_data.m_Player.TogglePlacingLocal();
  48. }
  49. }