isaacscript-common 1.0.556 → 1.0.560

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.
@@ -32,12 +32,20 @@ function entityTakeDmgPlayer(self, tookDamage, _damageAmount, _damageFlags, _dam
32
32
  end
33
33
  local trinketMap = getTrinketMap(nil, player)
34
34
  for ____, trinketType in ipairs(TRINKETS_THAT_CAN_BREAK) do
35
- local numTrinkets = player:GetTrinketMultiplier(trinketType)
36
- local oldNumTrinkets = trinketMap:get(trinketType)
37
- if (oldNumTrinkets ~= nil) and (numTrinkets < oldNumTrinkets) then
38
- trinketMap:set(trinketType, numTrinkets)
35
+ do
36
+ local numTrinketsHeld = player:GetTrinketMultiplier(trinketType)
37
+ local oldNumTrinketsHeld = trinketMap:get(trinketType)
38
+ if (oldNumTrinketsHeld == nil) or (numTrinketsHeld >= oldNumTrinketsHeld) then
39
+ goto __continue10
40
+ end
41
+ trinketMap:set(trinketType, numTrinketsHeld)
42
+ local numTrinketsOnGround = Isaac.CountEntities(nil, EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, trinketType)
43
+ if numTrinketsOnGround > 0 then
44
+ goto __continue10
45
+ end
39
46
  postTrinketBreakFire(nil, player, trinketType)
40
47
  end
48
+ ::__continue10::
41
49
  end
42
50
  end
43
51
  function getTrinketMap(self, player)
@@ -0,0 +1,3 @@
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ /** Get the proper name for a `Challenge` enum. This will only work for vanilla challenges. */
3
+ export declare function getChallengeName(challenge: Challenge): string;
@@ -0,0 +1,9 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ local ____exports = {}
3
+ local ____challengeNameMap = require("maps.challengeNameMap")
4
+ local CHALLENGE_NAME_MAP = ____challengeNameMap.CHALLENGE_NAME_MAP
5
+ function ____exports.getChallengeName(self, challenge)
6
+ local challengeName = CHALLENGE_NAME_MAP:get(challenge)
7
+ return ((challengeName == nil) and "Unknown") or challengeName
8
+ end
9
+ return ____exports
@@ -209,9 +209,12 @@ export declare function removeTrinketCostume(player: EntityPlayer, trinketType:
209
209
  */
210
210
  export declare function setActiveItem(player: EntityPlayer, collectibleType: CollectibleType, activeSlot: ActiveSlot, charge?: int, keepInPools?: boolean): void;
211
211
  /**
212
- * If you want to stop the player from shooting without the blindfold costume, then simply call
213
- * `player.TryRemoveNullCostume(NullItemID.ID_BLINDFOLD)` after invoking this function.
212
+ * Helper function to blindfold the player by using a hack with the challenge variable.
214
213
  *
215
- * This function was originally created by im_tem.
214
+ * The method used in this function was discovered by im_tem.
215
+ *
216
+ * @param player The player to apply or remove the blindfold state from.
217
+ * @param enabled Whether or not to apply or remove the blindfold.
218
+ * @param modifyCostume Optional. Whether to add or remove the blindfold costume. True by default.
216
219
  */
217
- export declare function setBlindfold(player: EntityPlayer, enabled: boolean): void;
220
+ export declare function setBlindfold(player: EntityPlayer, enabled: boolean, modifyCostume?: boolean): void;
@@ -472,7 +472,10 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
472
472
  end
473
473
  until true
474
474
  end
475
- function ____exports.setBlindfold(self, player, enabled)
475
+ function ____exports.setBlindfold(self, player, enabled, modifyCostume)
476
+ if modifyCostume == nil then
477
+ modifyCostume = true
478
+ end
476
479
  local game = Game()
477
480
  local character = player:GetPlayerType()
478
481
  local challenge = Isaac.GetChallenge()
@@ -480,11 +483,16 @@ function ____exports.setBlindfold(self, player, enabled)
480
483
  game.Challenge = Challenge.CHALLENGE_SOLAR_SYSTEM
481
484
  player:ChangePlayerType(character)
482
485
  game.Challenge = challenge
486
+ if not modifyCostume then
487
+ player:TryRemoveNullCostume(NullItemID.ID_BLINDFOLD)
488
+ end
483
489
  else
484
490
  game.Challenge = Challenge.CHALLENGE_NULL
485
491
  player:ChangePlayerType(character)
486
492
  game.Challenge = challenge
487
- player:TryRemoveNullCostume(NullItemID.ID_BLINDFOLD)
493
+ if modifyCostume then
494
+ player:TryRemoveNullCostume(NullItemID.ID_BLINDFOLD)
495
+ end
488
496
  end
489
497
  end
490
498
  return ____exports
@@ -1,6 +1,8 @@
1
1
  --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
2
  require("lualib_bundle");
3
3
  local ____exports = {}
4
+ local ____constants = require("constants")
5
+ local MAX_PLAYER_POCKET_ITEM_SLOTS = ____constants.MAX_PLAYER_POCKET_ITEM_SLOTS
4
6
  local ____PocketItemType = require("types.PocketItemType")
5
7
  local PocketItemType = ____PocketItemType.PocketItemType
6
8
  function ____exports.getPocketItems(self, player)
@@ -14,7 +16,7 @@ function ____exports.getPocketItems(self, player)
14
16
  local pocketItem2Identified = false
15
17
  do
16
18
  local slot = 0
17
- while slot < 4 do
19
+ while slot < MAX_PLAYER_POCKET_ITEM_SLOTS do
18
20
  local card = player:GetCard(slot)
19
21
  local pill = player:GetPill(slot)
20
22
  if card ~= Card.CARD_NULL then
package/dist/index.d.ts CHANGED
@@ -11,6 +11,7 @@ export { hasSirenStolenFamiliar, setFamiliarNoSirenSteal, } from "./features/sir
11
11
  export * from "./functions/array";
12
12
  export * from "./functions/bitwise";
13
13
  export * from "./functions/cards";
14
+ export * from "./functions/challenges";
14
15
  export * from "./functions/charge";
15
16
  export * from "./functions/collectibles";
16
17
  export * from "./functions/collectibleSet";
package/dist/index.lua CHANGED
@@ -100,6 +100,14 @@ do
100
100
  end
101
101
  end
102
102
  end
103
+ do
104
+ local ____export = require("functions.challenges")
105
+ for ____exportKey, ____exportValue in pairs(____export) do
106
+ if ____exportKey ~= "default" then
107
+ ____exports[____exportKey] = ____exportValue
108
+ end
109
+ end
110
+ end
103
111
  do
104
112
  local ____export = require("functions.charge")
105
113
  for ____exportKey, ____exportValue in pairs(____export) do
@@ -0,0 +1,2 @@
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ export declare const CHALLENGE_NAME_MAP: Map<Challenge, string>;
@@ -0,0 +1,5 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ require("lualib_bundle");
3
+ local ____exports = {}
4
+ ____exports.CHALLENGE_NAME_MAP = __TS__New(Map, {{Challenge.CHALLENGE_PITCH_BLACK, "Pitch Black"}, {Challenge.CHALLENGE_HIGH_BROW, "High Brow"}, {Challenge.CHALLENGE_HEAD_TRAUMA, "Head Trauma"}, {Challenge.CHALLENGE_DARKNESS_FALLS, "Darkness Falls"}, {Challenge.CHALLENGE_THE_TANK, "The Tank"}, {Challenge.CHALLENGE_SOLAR_SYSTEM, "Solar System"}, {Challenge.CHALLENGE_SUICIDE_KING, "Suicide King"}, {Challenge.CHALLENGE_CAT_GOT_YOUR_TONGUE, "Cat Got Your Tongue"}, {Challenge.CHALLENGE_DEMO_MAN, "Demo Man"}, {Challenge.CHALLENGE_CURSED, "Cursed!"}, {Challenge.CHALLENGE_GLASS_CANNON, "Glass Cannon"}, {Challenge.CHALLENGE_WHEN_LIFE_GIVES_LEMONS, "When Life Gives You Lemons"}, {Challenge.CHALLENGE_BEANS, "Beans!"}, {Challenge.CHALLENGE_ITS_IN_THE_CARDS, "It's In The Cards"}, {Challenge.CHALLENGE_SLOW_ROLL, "Slow Roll"}, {Challenge.CHALLENGE_COMPUTER_SAVY, "Computer Savvy"}, {Challenge.CHALLENGE_WAKA_WAKA, "Waka Waka"}, {Challenge.CHALLENGE_THE_HOST, "The Host"}, {Challenge.CHALLENGE_THE_FAMILY_MAN, "The Family Man"}, {Challenge.CHALLENGE_PURIST, "Purist"}, {Challenge.CHALLENGE_XXXXXXXXL, "XXXXXXXXL"}, {Challenge.CHALLENGE_SPEED, "SPEED!"}, {Challenge.CHALLENGE_BLUE_BOMBER, "Blue Bomber"}, {Challenge.CHALLENGE_PAY_TO_PLAY, "PAY TO PLAY"}, {Challenge.CHALLENGE_HAVE_A_HEART, "Have a Heart"}, {Challenge.CHALLENGE_I_RULE, "I RULE!"}, {Challenge.CHALLENGE_BRAINS, "BRAINS!"}, {Challenge.CHALLENGE_PRIDE_DAY, "PRIDE DAY!"}, {Challenge.CHALLENGE_ONANS_STREAK, "Onan's Streak"}, {Challenge.CHALLENGE_GUARDIAN, "The Guardian"}, {Challenge.CHALLENGE_BACKASSWARDS, "Backasswards"}, {Challenge.CHALLENGE_APRILS_FOOL, "Aprils Fool"}, {Challenge.CHALLENGE_POKEY_MANS, "Pokey Mans"}, {Challenge.CHALLENGE_ULTRA_HARD, "Ultra Hard"}, {Challenge.CHALLENGE_PONG, "Pong"}, {Challenge.CHALLENGE_SCAT_MAN, "Scat Man"}, {Challenge.CHALLENGE_BLOODY_MARY, "Bloody Mary"}, {Challenge.CHALLENGE_BAPTISM_BY_FIRE, "Baptism By Fire"}, {Challenge.CHALLENGE_ISAACS_AWAKENING, "Isaac's Awakening"}, {Challenge.CHALLENGE_SEEING_DOUBLE, "Seeing Double"}, {Challenge.CHALLENGE_PICA_RUN, "Pica Run"}, {Challenge.CHALLENGE_HOT_POTATO, "Hot Potato"}, {Challenge.CHALLENGE_CANTRIPPED, "Cantripped!"}, {Challenge.CHALLENGE_RED_REDEMPTION, "Red Redemption"}, {Challenge.CHALLENGE_DELETE_THIS, "DELETE THIS"}})
5
+ return ____exports
@@ -166,7 +166,8 @@ export interface CallbackParametersCustom {
166
166
  callback: PostCursedTeleportCallbackType
167
167
  ];
168
168
  [ModCallbacksCustom.MC_POST_TRINKET_BREAK]: [
169
- callback: PostTrinketBreakCallbackType
169
+ callback: PostTrinketBreakCallbackType,
170
+ trinketType?: TrinketType
170
171
  ];
171
172
  [ModCallbacksCustom.MC_POST_SLOT_INIT]: [
172
173
  callback: PostSlotInitCallbackType,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.0.556",
3
+ "version": "1.0.560",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",
@@ -25,8 +25,8 @@
25
25
  "dist/**/*.d.ts"
26
26
  ],
27
27
  "devDependencies": {
28
- "isaac-typescript-definitions": "^1.0.307",
29
- "isaacscript-lint": "^1.0.73",
28
+ "isaac-typescript-definitions": "^1.0.310",
29
+ "isaacscript-lint": "^1.0.74",
30
30
  "typedoc": "^0.22.10",
31
31
  "typescript": "4.4.4",
32
32
  "typescript-to-lua": "1.1.1"