isaacscript-common 1.0.462 → 1.0.463

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.
@@ -42,10 +42,10 @@ export declare function removeAllCollectibles(): void;
42
42
  * Python program located at: https://github.com/Rchardon/RebirthItemTracker
43
43
  */
44
44
  export declare function removeCollectibleFromItemTracker(collectibleType: CollectibleType | int): void;
45
- export declare function setCollectibleBlind(pickup: EntityPickup): void;
46
- export declare function setCollectibleSprite(pickup: EntityPickup, pngPath: string): void;
45
+ export declare function setCollectibleBlind(collectible: EntityPickup): void;
46
+ export declare function setCollectibleSprite(collectible: EntityPickup, pngPath: string): void;
47
47
  /**
48
- * Helper function to change the item on an item pedestal. Simply updating the SubType is not
49
- * sufficient because you also need to update the sprite.
48
+ * Helper function to change the collectible on a pedestal. Simply updating the SubType property is
49
+ * not sufficient because the sprite will not change.
50
50
  */
51
51
  export declare function setCollectibleSubType(collectible: EntityPickup, newCollectibleType: CollectibleType | int): void;
@@ -6,13 +6,13 @@ local ____collectibleNameMap = require("collectibleNameMap")
6
6
  local COLLECTIBLE_NAME_MAP = ____collectibleNameMap.COLLECTIBLE_NAME_MAP
7
7
  local ____entity = require("functions.entity")
8
8
  local removeAllMatchingEntities = ____entity.removeAllMatchingEntities
9
- function ____exports.setCollectibleSprite(self, pickup, pngPath)
10
- if pickup.Variant ~= PickupVariant.PICKUP_COLLECTIBLE then
9
+ function ____exports.setCollectibleSprite(self, collectible, pngPath)
10
+ if collectible.Variant ~= PickupVariant.PICKUP_COLLECTIBLE then
11
11
  error(
12
- "You cannot set a collectible sprite for pickups of variant: " .. tostring(pickup.Variant)
12
+ "You cannot set a collectible sprite for pickups of variant: " .. tostring(collectible.Variant)
13
13
  )
14
14
  end
15
- local sprite = pickup:GetSprite()
15
+ local sprite = collectible:GetSprite()
16
16
  sprite:ReplaceSpritesheet(COLLECTIBLE_SPRITE_LAYER, pngPath)
17
17
  sprite:LoadGraphics()
18
18
  end
@@ -121,18 +121,20 @@ function ____exports.removeCollectibleFromItemTracker(self, collectibleType)
121
121
  ((("Removing collectible " .. tostring(collectibleType)) .. " (") .. collectibleName) .. ") on player 0 (Player)"
122
122
  )
123
123
  end
124
- function ____exports.setCollectibleBlind(self, pickup)
125
- ____exports.setCollectibleSprite(nil, pickup, BLIND_ITEM_PNG_PATH)
124
+ function ____exports.setCollectibleBlind(self, collectible)
125
+ if collectible.Variant ~= PickupVariant.PICKUP_COLLECTIBLE then
126
+ error(
127
+ "You cannot set a collectible to be blind for pickups of variant: " .. tostring(collectible.Variant)
128
+ )
129
+ end
130
+ ____exports.setCollectibleSprite(nil, collectible, BLIND_ITEM_PNG_PATH)
126
131
  end
127
132
  function ____exports.setCollectibleSubType(self, collectible, newCollectibleType)
128
- collectible.SubType = newCollectibleType
129
- local itemConfig = Isaac.GetItemConfig()
130
- local itemConfigItem = itemConfig:GetCollectible(newCollectibleType)
131
- if itemConfigItem == nil then
133
+ if collectible.Variant ~= PickupVariant.PICKUP_COLLECTIBLE then
132
134
  error(
133
- "Failed to get the item config for: " .. tostring(newCollectibleType)
135
+ "You cannot set a collectible sub type for pickups of variant: " .. tostring(collectible.Variant)
134
136
  )
135
137
  end
136
- ____exports.setCollectibleSprite(nil, collectible, itemConfigItem.GfxFileName)
138
+ collectible:Morph(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, newCollectibleType, true, true, true)
137
139
  end
138
140
  return ____exports
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.0.462",
3
+ "version": "1.0.463",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",