You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

65 lines
766 B

  1. define([
  2. ], function (
  3. ) {
  4. const colors = [
  5. '929398',
  6. '80f643',
  7. '3fa7dd',
  8. 'a24eff',
  9. 'ffeb38'
  10. ];
  11. const chances = [
  12. 0.0075,
  13. 0.02,
  14. 0.04,
  15. 0.08,
  16. 0.095
  17. ];
  18. const indices = {
  19. 50: 0,
  20. 51: 1,
  21. 128: 2,
  22. 52: 3,
  23. 53: 4
  24. };
  25. return {
  26. type: 'chest',
  27. ownerName: null,
  28. init: function (blueprint) {
  29. const index = indices[this.obj.cell] || 0;
  30. this.obj.addComponent('particles', {
  31. chance: chances[index],
  32. blueprint: {
  33. color: {
  34. start: colors[index]
  35. },
  36. alpha: {
  37. start: 0.75,
  38. end: 0.2
  39. },
  40. lifetime: {
  41. min: 1,
  42. max: 4
  43. },
  44. chance: chances[index],
  45. spawnType: 'rect',
  46. spawnRect: {
  47. x: -4,
  48. y: -4,
  49. w: 8,
  50. h: 8
  51. }
  52. }
  53. });
  54. }
  55. };
  56. });