paper.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. class Paper extends ItemBase
  2. {
  3. protected ref WrittenNoteData m_NoteContents;
  4. void Paper()
  5. {
  6. m_NoteContents = new WrittenNoteData(this);
  7. }
  8. void ~Paper() {}
  9. override bool OnStoreLoad(ParamsReadContext ctx, int version)
  10. {
  11. if (!super.OnStoreLoad(ctx, version))
  12. return false;
  13. if (version >= 108 && !ctx.Read(m_NoteContents))
  14. return false;
  15. return true;
  16. }
  17. override void OnStoreSave(ParamsWriteContext ctx)
  18. {
  19. super.OnStoreSave(ctx);
  20. ctx.Write(m_NoteContents);
  21. }
  22. override WrittenNoteData GetWrittenNoteData()
  23. {
  24. return m_NoteContents;
  25. }
  26. //================================================================
  27. // IGNITION ACTION
  28. //================================================================
  29. override bool HasFlammableMaterial()
  30. {
  31. return true;
  32. }
  33. override bool CanBeIgnitedBy(EntityAI igniter = null)
  34. {
  35. return !GetHierarchyParent();
  36. }
  37. override bool CanIgniteItem(EntityAI ignite_target = null)
  38. {
  39. return false;
  40. }
  41. override void OnIgnitedTarget(EntityAI target_item) {}
  42. override void OnIgnitedThis(EntityAI fire_source)
  43. {
  44. Fireplace.IgniteEntityAsFireplace(this, fire_source);
  45. }
  46. override bool IsThisIgnitionSuccessful(EntityAI item_source = null)
  47. {
  48. return Fireplace.CanIgniteEntityAsFireplace(this);
  49. }
  50. override void SetActions()
  51. {
  52. super.SetActions();
  53. AddAction(ActionCreateIndoorFireplace);
  54. AddAction(ActionCreateIndoorOven);
  55. AddAction(ActionAttach);
  56. AddAction(ActionDetach);
  57. }
  58. }