anniversarybox.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. class AnniversaryBox extends Container_Base
  2. {
  3. private const int SPAWN_SHIRTS_MAX = 60;
  4. #ifndef SERVER
  5. protected AnniversaryBoxLight m_Light;
  6. #endif
  7. override void DeferredInit()
  8. {
  9. super.DeferredInit();
  10. #ifndef SERVER
  11. m_Light = AnniversaryBoxLight.Cast(ScriptedLightBase.CreateLight(AnniversaryBoxLight, "0 0 0"));
  12. if (m_Light)
  13. m_Light.AttachOnMemoryPoint(this, "light");
  14. #endif
  15. }
  16. override void EEDelete(EntityAI parent)
  17. {
  18. super.EEDelete(parent);
  19. #ifndef SERVER
  20. if (m_Light)
  21. m_Light.Destroy();
  22. #endif
  23. }
  24. override bool IsTakeable()
  25. {
  26. return false;
  27. }
  28. override bool CanSwapEntities(EntityAI otherItem, InventoryLocation otherDestination, InventoryLocation destination)
  29. {
  30. return false;
  31. }
  32. override bool CanPutInCargo(EntityAI parent)
  33. {
  34. return false;
  35. }
  36. override bool DisableVicinityIcon()
  37. {
  38. if (GetAnimationPhase("lidclosing") == 1)
  39. {
  40. return true;
  41. }
  42. else
  43. return false;
  44. }
  45. override bool CanDisplayCargo()
  46. {
  47. if (GetAnimationPhase("lidclosing") == 1)
  48. {
  49. return false;
  50. }
  51. else
  52. return true;
  53. }
  54. void EmtpyInventory()
  55. {
  56. if (GetGame().IsServer())//server or single player
  57. {
  58. for ( int j = 0; j < GetInventory().GetCargo().GetItemCount(); j++ )
  59. {
  60. GetInventory().GetCargo().GetItem(j).Delete();
  61. }
  62. }
  63. }
  64. void FillInventory()
  65. {
  66. if (GetGame().IsServer())//server or single player
  67. {
  68. EntityAI ent = GetInventory().CreateInInventory("TShirt_10thAnniversary");
  69. for (int i = 0; ent && i < SPAWN_SHIRTS_MAX - 1; i++)
  70. {
  71. ent = GetInventory().CreateInInventory("TShirt_10thAnniversary");
  72. }
  73. }
  74. }
  75. }