tripod.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. class TripodBase : ItemBase
  2. {
  3. override bool HasProxyParts()
  4. {
  5. return true;
  6. }
  7. override bool CanDetachAttachment( EntityAI parent )
  8. {
  9. FireplaceBase fireplace = FireplaceBase.Cast(parent);
  10. if(fireplace)
  11. {
  12. if ( fireplace.GetCookingEquipment() != null )
  13. {
  14. return false;
  15. }
  16. }
  17. return true;
  18. }
  19. override bool CanSwapEntities(EntityAI otherItem, InventoryLocation otherDestination, InventoryLocation destination)
  20. {
  21. if (GetHierarchyParent() && GetHierarchyParent().IsFireplace() && otherItem)
  22. {
  23. if (otherItem.IsInherited(Pot) || otherItem.IsInherited(Cauldron))
  24. {
  25. return false;
  26. }
  27. }
  28. return true;
  29. }
  30. override void OnDebugSpawn()
  31. {
  32. HideAllSelections();
  33. ShowSelection( "Deployed" );
  34. }
  35. override void SetActions()
  36. {
  37. super.SetActions();
  38. AddAction(ActionAttach);
  39. AddAction(ActionDetach);
  40. }
  41. override void OnWasAttached( EntityAI parent, int slot_id )
  42. {
  43. super.OnWasAttached(parent, slot_id);
  44. if (parent.IsFireplace())
  45. {
  46. HideAllSelections();
  47. ShowSelection( "Deployed" );
  48. }
  49. }
  50. override void OnWasDetached( EntityAI parent, int slot_id )
  51. {
  52. super.OnWasDetached(parent, slot_id);
  53. if (parent.IsFireplace())
  54. {
  55. HideAllSelections();
  56. ShowSelection( "Collapsed" );
  57. }
  58. }
  59. }
  60. class Tripod : TripodBase
  61. {
  62. }