refridgerator.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. class Refridgerator extends ItemBase
  2. {
  3. SoundOnVehicle m_SoundLoopEntity;
  4. override bool IsElectricAppliance()
  5. {
  6. return true;
  7. }
  8. override void OnInitEnergy()
  9. {
  10. m_SoundLoopEntity = NULL;
  11. }
  12. //--- POWER EVENTS
  13. override void OnWorkStart()
  14. {
  15. // TO DO: Slow down or stop the aging of food inside of the fridge when such functionality is created.
  16. m_SoundLoopEntity = PlaySoundLoop("powerGeneratorLoop", 50); // using placeholder sound
  17. }
  18. override void OnWork( float consumed_energy )
  19. {
  20. }
  21. override void OnWorkStop()
  22. {
  23. // TO DO: Allow food inside the fridge to start aging again.
  24. GetGame().ObjectDelete(m_SoundLoopEntity);
  25. m_SoundLoopEntity = NULL;
  26. }
  27. //--- ACTION EVENTS
  28. override void OnSwitchOn()
  29. {
  30. }
  31. override void OnSwitchOff()
  32. {
  33. }
  34. //================================================================
  35. // ADVANCED PLACEMENT
  36. //================================================================
  37. override string GetDeploySoundset()
  38. {
  39. return "placeRefridgerator_SoundSet";
  40. }
  41. override void SetActions()
  42. {
  43. super.SetActions();
  44. RemoveAction(ActionTakeItemToHands);
  45. AddAction(ActionPlugIn);
  46. AddAction(ActionTogglePlaceObject);
  47. AddAction(ActionUnplugThisByCord);
  48. AddAction(ActionTurnOnWhileOnGround);
  49. AddAction(ActionTurnOffWhileOnGround);
  50. AddAction(ActionRepositionPluggedItem);
  51. AddAction(ActionPlaceObject);
  52. AddAction(ActionTakeItemToHands);
  53. }
  54. }