matchbox.c 750 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. class Matchbox extends ItemBase
  2. {
  3. override void InitItemVariables()
  4. {
  5. super.InitItemVariables();
  6. can_this_be_combined = true;
  7. }
  8. override bool CanIgniteItem( EntityAI ignite_target = NULL )
  9. {
  10. if ( GetQuantity() > 0 && GetWet() < GameConstants.STATE_DAMP )
  11. return true;
  12. else
  13. return false;
  14. }
  15. override void OnIgnitedTarget( EntityAI target_item )
  16. {
  17. if ( GetGame().IsServer() )
  18. {
  19. AddQuantity( -1 );
  20. }
  21. }
  22. override void OnIgnitedTargetFailed( EntityAI target_item )
  23. {
  24. if ( GetGame().IsServer() )
  25. {
  26. AddQuantity( -1 );
  27. }
  28. }
  29. override void SetActions()
  30. {
  31. super.SetActions();
  32. AddAction(ActionLightItemOnFire);
  33. }
  34. /*
  35. override bool IsTargetIgnitionSuccessful( EntityAI item_target = NULL )
  36. {
  37. }
  38. */
  39. }