isaacscript-common 30.5.5 → 30.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3457,6 +3457,13 @@ declare class DisableInputs extends Feature {
3457
3457
  private isActionTriggered;
3458
3458
  private getActionValue;
3459
3459
  private getReturnValue;
3460
+ /**
3461
+ * Helper function to check if the `ISCFeature.DISABLE_INPUTS` feature is turned on in some
3462
+ * capacity.
3463
+ *
3464
+ * In order to use this function, you must upgrade your mod with `ISCFeature.DISABLE_INPUTS`.
3465
+ */
3466
+ areInputsEnabled(): boolean;
3460
3467
  /**
3461
3468
  * Helper function to enable all inputs. Use this function to set things back to normal after
3462
3469
  * having used one of the other helper functions to disable inputs.
@@ -12883,6 +12890,15 @@ export declare function newRNG(seed?: Seed): RNG;
12883
12890
  */
12884
12891
  export declare function newRoom(seedOrRNG?: Seed | RNG): int | undefined;
12885
12892
 
12893
+ /**
12894
+ * Helper function to load a new sprite and play its default animation.
12895
+ *
12896
+ * @param anm2Path The path to the "anm2" file that should be loaded.
12897
+ * @param pngPath Optional. The path to a custom PNG file that should be loaded on layer 0 of the
12898
+ * sprite.
12899
+ */
12900
+ export declare function newSprite(anm2Path: string, pngPath?: string): Sprite;
12901
+
12886
12902
  /**
12887
12903
  * Helper function to generate a new sprite based on a collectible. If the provided collectible type
12888
12904
  * is invalid, a sprite with a Curse of the Blind question mark will be returned.
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 30.5.5
3
+ isaacscript-common 30.6.1
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -20714,6 +20714,19 @@ function ____exports.getLastFrameOfAnimation(self, sprite, animation)
20714
20714
  sprite:SetFrame(currentFrame)
20715
20715
  return finalFrame
20716
20716
  end
20717
+ function ____exports.newSprite(self, anm2Path, pngPath)
20718
+ local sprite = Sprite()
20719
+ if pngPath == nil then
20720
+ sprite:Load(anm2Path, true)
20721
+ else
20722
+ sprite:Load(anm2Path, false)
20723
+ sprite:ReplaceSpritesheet(0, pngPath)
20724
+ sprite:LoadGraphics()
20725
+ end
20726
+ local defaultAnimation = sprite:GetDefaultAnimation()
20727
+ sprite:Play(defaultAnimation, true)
20728
+ return sprite
20729
+ end
20717
20730
  function ____exports.setSpriteOpacity(self, sprite, alpha)
20718
20731
  local fadedColor = copyColor(nil, sprite.Color)
20719
20732
  fadedColor.A = alpha
@@ -40609,6 +40622,9 @@ function DisableInputs.prototype.getReturnValue(self, buttonAction, booleanCallb
40609
40622
  end
40610
40623
  return nil
40611
40624
  end
40625
+ function DisableInputs.prototype.areInputsEnabled(self)
40626
+ return v.run.disableInputs.size == 0 and v.run.enableAllInputsWithBlacklistMap.size == 0 and v.run.disableAllInputsWithWhitelistMap.size == 0
40627
+ end
40612
40628
  function DisableInputs.prototype.enableAllInputs(self, key)
40613
40629
  v.run.disableAllInputsWithWhitelistMap:delete(key)
40614
40630
  v.run.enableAllInputsWithBlacklistMap:delete(key)
@@ -40641,6 +40657,7 @@ function DisableInputs.prototype.disableShootingInputs(self, key)
40641
40657
  local shootActions = getShootActions(nil)
40642
40658
  self:enableAllInputsExceptFor(key, shootActions)
40643
40659
  end
40660
+ __TS__Decorate({Exported}, DisableInputs.prototype, "areInputsEnabled", true)
40644
40661
  __TS__Decorate({Exported}, DisableInputs.prototype, "enableAllInputs", true)
40645
40662
  __TS__Decorate({Exported}, DisableInputs.prototype, "disableInputs", true)
40646
40663
  __TS__Decorate({Exported}, DisableInputs.prototype, "disableAllInputs", true)
@@ -5,6 +5,13 @@ export declare class DisableInputs extends Feature {
5
5
  private isActionTriggered;
6
6
  private getActionValue;
7
7
  private getReturnValue;
8
+ /**
9
+ * Helper function to check if the `ISCFeature.DISABLE_INPUTS` feature is turned on in some
10
+ * capacity.
11
+ *
12
+ * In order to use this function, you must upgrade your mod with `ISCFeature.DISABLE_INPUTS`.
13
+ */
14
+ areInputsEnabled(): boolean;
8
15
  /**
9
16
  * Helper function to enable all inputs. Use this function to set things back to normal after
10
17
  * having used one of the other helper functions to disable inputs.
@@ -1 +1 @@
1
- {"version":3,"file":"DisableInputs.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/DisableInputs.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAGb,MAAM,8BAA8B,CAAC;AAItC,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AA4BhD,qBAAa,aAAc,SAAQ,OAAO;IAiCxC,OAAO,CAAC,eAAe,CAIsB;IAG7C,OAAO,CAAC,iBAAiB,CAIoB;IAG7C,OAAO,CAAC,cAAc,CAIwB;IAE9C,OAAO,CAAC,cAAc;IAwBtB;;;;;;;;;;OAUG;IAEI,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAKzC;;;;;;;;;;;;;;;OAeG;IAEI,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,aAAa,EAAE,YAAY,EAAE,GAAG,IAAI;IAKzE;;;;;;;;;;;;OAYG;IAEI,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAK1C;;;;;;;;;;;;;OAaG;IAEI,wBAAwB,CAC7B,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,GAAG,CAAC,YAAY,CAAC,GAAG,WAAW,CAAC,YAAY,CAAC,GACvD,IAAI;IAKP;;;;;;;;;;;;;OAaG;IAEI,yBAAyB,CAC9B,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,GAAG,CAAC,YAAY,CAAC,GAAG,WAAW,CAAC,YAAY,CAAC,GACvD,IAAI;IAKP;;;;;;;;;;;;;OAaG;IAEI,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAK/C;;;;;;;;;;;;OAYG;IAEI,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;CAIhD"}
1
+ {"version":3,"file":"DisableInputs.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/DisableInputs.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAGb,MAAM,8BAA8B,CAAC;AAItC,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AA4BhD,qBAAa,aAAc,SAAQ,OAAO;IAiCxC,OAAO,CAAC,eAAe,CAIsB;IAG7C,OAAO,CAAC,iBAAiB,CAIoB;IAG7C,OAAO,CAAC,cAAc,CAIwB;IAE9C,OAAO,CAAC,cAAc;IAwBtB;;;;;OAKG;IAEI,gBAAgB,IAAI,OAAO;IAQlC;;;;;;;;;;OAUG;IAEI,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAKzC;;;;;;;;;;;;;;;OAeG;IAEI,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,aAAa,EAAE,YAAY,EAAE,GAAG,IAAI;IAKzE;;;;;;;;;;;;OAYG;IAEI,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAK1C;;;;;;;;;;;;;OAaG;IAEI,wBAAwB,CAC7B,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,GAAG,CAAC,YAAY,CAAC,GAAG,WAAW,CAAC,YAAY,CAAC,GACvD,IAAI;IAKP;;;;;;;;;;;;;OAaG;IAEI,yBAAyB,CAC9B,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,GAAG,CAAC,YAAY,CAAC,GAAG,WAAW,CAAC,YAAY,CAAC,GACvD,IAAI;IAKP;;;;;;;;;;;;;OAaG;IAEI,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAK/C;;;;;;;;;;;;OAYG;IAEI,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;CAIhD"}
@@ -61,6 +61,9 @@ function DisableInputs.prototype.getReturnValue(self, buttonAction, booleanCallb
61
61
  end
62
62
  return nil
63
63
  end
64
+ function DisableInputs.prototype.areInputsEnabled(self)
65
+ return v.run.disableInputs.size == 0 and v.run.enableAllInputsWithBlacklistMap.size == 0 and v.run.disableAllInputsWithWhitelistMap.size == 0
66
+ end
64
67
  function DisableInputs.prototype.enableAllInputs(self, key)
65
68
  v.run.disableAllInputsWithWhitelistMap:delete(key)
66
69
  v.run.enableAllInputsWithBlacklistMap:delete(key)
@@ -93,6 +96,7 @@ function DisableInputs.prototype.disableShootingInputs(self, key)
93
96
  local shootActions = getShootActions(nil)
94
97
  self:enableAllInputsExceptFor(key, shootActions)
95
98
  end
99
+ __TS__Decorate({Exported}, DisableInputs.prototype, "areInputsEnabled", true)
96
100
  __TS__Decorate({Exported}, DisableInputs.prototype, "enableAllInputs", true)
97
101
  __TS__Decorate({Exported}, DisableInputs.prototype, "disableInputs", true)
98
102
  __TS__Decorate({Exported}, DisableInputs.prototype, "disableAllInputs", true)
@@ -32,6 +32,14 @@ export declare function clearSprite(sprite: Sprite, ...layerIDs: int[]): void;
32
32
  * player animations.
33
33
  */
34
34
  export declare function getLastFrameOfAnimation(sprite: Sprite, animation?: string): int;
35
+ /**
36
+ * Helper function to load a new sprite and play its default animation.
37
+ *
38
+ * @param anm2Path The path to the "anm2" file that should be loaded.
39
+ * @param pngPath Optional. The path to a custom PNG file that should be loaded on layer 0 of the
40
+ * sprite.
41
+ */
42
+ export declare function newSprite(anm2Path: string, pngPath?: string): Sprite;
35
43
  /**
36
44
  * Helper function to keep a sprite's color the same values as it already is but set the opacity to
37
45
  * a specific value.
@@ -1 +1 @@
1
- {"version":3,"file":"sprites.d.ts","sourceRoot":"","sources":["../../../src/functions/sprites.ts"],"names":[],"mappings":";;;AAKA;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,GAAG,EAAE,GAAG,IAAI,CAWpE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,MAAM,EACd,SAAS,CAAC,EAAE,MAAM,GACjB,GAAG,CAmBL;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,M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AG,EACZ,UAAU,EAAE,GAAG,GACd,OAAO,CAaT;AAED,uFAAuF;AACvF,wBAAgB,WAAW,CACzB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,GAAG,GACX,OAAO,CAIT"}
@@ -64,6 +64,24 @@ function ____exports.getLastFrameOfAnimation(self, sprite, animation)
64
64
  sprite:SetFrame(currentFrame)
65
65
  return finalFrame
66
66
  end
67
+ --- Helper function to load a new sprite and play its default animation.
68
+ --
69
+ -- @param anm2Path The path to the "anm2" file that should be loaded.
70
+ -- @param pngPath Optional. The path to a custom PNG file that should be loaded on layer 0 of the
71
+ -- sprite.
72
+ function ____exports.newSprite(self, anm2Path, pngPath)
73
+ local sprite = Sprite()
74
+ if pngPath == nil then
75
+ sprite:Load(anm2Path, true)
76
+ else
77
+ sprite:Load(anm2Path, false)
78
+ sprite:ReplaceSpritesheet(0, pngPath)
79
+ sprite:LoadGraphics()
80
+ end
81
+ local defaultAnimation = sprite:GetDefaultAnimation()
82
+ sprite:Play(defaultAnimation, true)
83
+ return sprite
84
+ end
67
85
  --- Helper function to keep a sprite's color the same values as it already is but set the opacity to
68
86
  -- a specific value.
69
87
  --
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "30.5.5",
3
+ "version": "30.6.1",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -111,6 +111,21 @@ export class DisableInputs extends Feature {
111
111
  return undefined;
112
112
  }
113
113
 
114
+ /**
115
+ * Helper function to check if the `ISCFeature.DISABLE_INPUTS` feature is turned on in some
116
+ * capacity.
117
+ *
118
+ * In order to use this function, you must upgrade your mod with `ISCFeature.DISABLE_INPUTS`.
119
+ */
120
+ @Exported
121
+ public areInputsEnabled(): boolean {
122
+ return (
123
+ v.run.disableInputs.size === 0 &&
124
+ v.run.enableAllInputsWithBlacklistMap.size === 0 &&
125
+ v.run.disableAllInputsWithWhitelistMap.size === 0
126
+ );
127
+ }
128
+
114
129
  /**
115
130
  * Helper function to enable all inputs. Use this function to set things back to normal after
116
131
  * having used one of the other helper functions to disable inputs.
@@ -69,6 +69,30 @@ export function getLastFrameOfAnimation(
69
69
  return finalFrame;
70
70
  }
71
71
 
72
+ /**
73
+ * Helper function to load a new sprite and play its default animation.
74
+ *
75
+ * @param anm2Path The path to the "anm2" file that should be loaded.
76
+ * @param pngPath Optional. The path to a custom PNG file that should be loaded on layer 0 of the
77
+ * sprite.
78
+ */
79
+ export function newSprite(anm2Path: string, pngPath?: string): Sprite {
80
+ const sprite = Sprite();
81
+
82
+ if (pngPath === undefined) {
83
+ sprite.Load(anm2Path, true);
84
+ } else {
85
+ sprite.Load(anm2Path, false);
86
+ sprite.ReplaceSpritesheet(0, pngPath);
87
+ sprite.LoadGraphics();
88
+ }
89
+
90
+ const defaultAnimation = sprite.GetDefaultAnimation();
91
+ sprite.Play(defaultAnimation, true);
92
+
93
+ return sprite;
94
+ }
95
+
72
96
  /**
73
97
  * Helper function to keep a sprite's color the same values as it already is but set the opacity to
74
98
  * a specific value.