isaacscript-common 1.0.535 → 1.0.539

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.
@@ -1,8 +1,12 @@
1
1
  --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ require("lualib_bundle");
2
3
  local ____exports = {}
3
- local hasSubscriptions, entityTakeDmgPlayer, damageIsFatal
4
+ local hasSubscriptions, entityTakeDmgPlayer, damageIsFatal, v
5
+ local ____exports = require("features.saveDataManager.exports")
6
+ local saveDataManager = ____exports.saveDataManager
4
7
  local ____player = require("functions.player")
5
8
  local getPlayerAvailableHeartSlots = ____player.getPlayerAvailableHeartSlots
9
+ local getPlayerIndex = ____player.getPlayerIndex
6
10
  local getPlayerNumAllHearts = ____player.getPlayerNumAllHearts
7
11
  local hasLostCurse = ____player.hasLostCurse
8
12
  local isChildPlayer = ____player.isChildPlayer
@@ -28,10 +32,15 @@ function entityTakeDmgPlayer(self, tookDamage, damageAmount, _damageFlags, _dama
28
32
  if isChildPlayer(nil, player) then
29
33
  return nil
30
34
  end
35
+ local game = Game()
36
+ local gameFrameCount = game:GetFrameCount()
37
+ local playerIndex = getPlayerIndex(nil, player)
38
+ local lastDamageFrame = v.run.playerLastDamageFrame:get(playerIndex)
39
+ v.run.playerLastDamageFrame:set(playerIndex, gameFrameCount)
31
40
  if willPlayerRevive(nil, player) then
32
41
  return nil
33
42
  end
34
- if (not damageIsFatal(nil, player, damageAmount)) and (not hasLostCurse(nil, player)) then
43
+ if (not damageIsFatal(nil, player, damageAmount, lastDamageFrame)) and (not hasLostCurse(nil, player)) then
35
44
  return nil
36
45
  end
37
46
  local shouldSustainDeath = postPlayerFatalDamageFire(nil, player)
@@ -40,7 +49,9 @@ function entityTakeDmgPlayer(self, tookDamage, damageAmount, _damageFlags, _dama
40
49
  end
41
50
  return nil
42
51
  end
43
- function damageIsFatal(self, player, damageAmount)
52
+ function damageIsFatal(self, player, damageAmount, lastDamageFrame)
53
+ local game = Game()
54
+ local gameFrameCount = game:GetFrameCount()
44
55
  local character = player:GetPlayerType()
45
56
  if character == PlayerType.PLAYER_JACOB2_B then
46
57
  return true
@@ -53,6 +64,9 @@ function damageIsFatal(self, player, damageAmount)
53
64
  if player:HasCollectible(CollectibleType.COLLECTIBLE_HEARTBREAK) and (playerAvailableHeartSlots >= 2) then
54
65
  return false
55
66
  end
67
+ if player:HasCollectible(CollectibleType.COLLECTIBLE_BROKEN_GLASS_CANNON) and (gameFrameCount == lastDamageFrame) then
68
+ return false
69
+ end
56
70
  local hearts = player:GetHearts()
57
71
  local eternalHearts = player:GetEternalHearts()
58
72
  local soulHearts = player:GetSoulHearts()
@@ -62,7 +76,13 @@ function damageIsFatal(self, player, damageAmount)
62
76
  end
63
77
  return true
64
78
  end
79
+ v = {
80
+ run = {
81
+ playerLastDamageFrame = __TS__New(Map)
82
+ }
83
+ }
65
84
  function ____exports.postPlayerFatalDamageCallbackInit(self, mod)
85
+ saveDataManager(nil, "postPlayerFatalDamage", v)
66
86
  mod:AddCallback(ModCallbacks.MC_ENTITY_TAKE_DMG, entityTakeDmgPlayer, EntityType.ENTITY_PLAYER)
67
87
  end
68
88
  return ____exports
@@ -51,6 +51,7 @@ export declare const EGGY_STATE_FRAME_OF_FINAL_SPIDER = 45;
51
51
  * information, see the documentation for the `clearSprite()` helper function.
52
52
  */
53
53
  export declare const EMPTY_PNG_PATH = "gfx/none.png";
54
+ export declare const FAMILIARS_THAT_SHOOT_PLAYER_TEARS: Set<FamiliarVariant>;
54
55
  /** As of Repentance, the final stage is floor 13 (which is the Home floor). */
55
56
  export declare const FINAL_STAGE: number;
56
57
  /**
@@ -22,6 +22,7 @@ ____exports.DISTANCE_OF_GRID_TILE = 40
22
22
  ____exports.DOOR_HITBOX_DISTANCE = 11
23
23
  ____exports.EGGY_STATE_FRAME_OF_FINAL_SPIDER = 45
24
24
  ____exports.EMPTY_PNG_PATH = "gfx/none.png"
25
+ ____exports.FAMILIARS_THAT_SHOOT_PLAYER_TEARS = __TS__New(Set, {FamiliarVariant.SCISSORS, FamiliarVariant.INCUBUS, FamiliarVariant.FATES_REWARD, FamiliarVariant.SPRINKLER, FamiliarVariant.LOST_SOUL, FamiliarVariant.TWISTED_BABY, FamiliarVariant.BLOOD_BABY, FamiliarVariant.DECAP_ATTACK})
25
26
  ____exports.FINAL_STAGE = LevelStage.NUM_STAGES - 1
26
27
  ____exports.FIRST_GLITCHED_COLLECTIBLE_TYPE = (1 << 32) - 1
27
28
  ____exports.GENESIS_ROOM_VARIANT = 1000
@@ -0,0 +1,2 @@
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ export declare function isFamiliarThatShootsPlayerTears(familiar: EntityFamiliar): boolean;
@@ -0,0 +1,8 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ local ____exports = {}
3
+ local ____constants = require("constants")
4
+ local FAMILIARS_THAT_SHOOT_PLAYER_TEARS = ____constants.FAMILIARS_THAT_SHOOT_PLAYER_TEARS
5
+ function ____exports.isFamiliarThatShootsPlayerTears(self, familiar)
6
+ return FAMILIARS_THAT_SHOOT_PLAYER_TEARS:has(familiar.Type)
7
+ end
8
+ return ____exports
@@ -19,7 +19,13 @@ export declare function addTrinketCostume(player: EntityPlayer, trinketType: Tri
19
19
  export declare function anyPlayerCloserThan(position: Vector, distance: float): boolean;
20
20
  export declare function anyPlayerHasCollectible(collectibleType: CollectibleType | int): boolean;
21
21
  export declare function anyPlayerHasTrinket(trinketType: TrinketType | int): boolean;
22
- export declare function anyPlayerIs(matchingCharacter: PlayerType): boolean;
22
+ /**
23
+ * Helper function to determine if the given character is present.
24
+ *
25
+ * This function is variadic, meaning that you can supply as many characters as you want to check
26
+ * for. Returns true if any of the characters supplied are present.
27
+ */
28
+ export declare function anyPlayerIs(...characters: PlayerType[]): boolean;
23
29
  /**
24
30
  * Helper function to determine if the provided character can have red heart containers. Returns
25
31
  * true for characters like Isaac, Magdalene, or Cain. Returns true for Keeper and Tainted Keeper,
@@ -126,12 +126,14 @@ function ____exports.anyPlayerHasTrinket(self, trinketType)
126
126
  end
127
127
  return false
128
128
  end
129
- function ____exports.anyPlayerIs(self, matchingCharacter)
129
+ function ____exports.anyPlayerIs(self, ...)
130
+ local characters = {...}
131
+ local characterSet = __TS__New(Set, characters)
130
132
  for ____, player in ipairs(
131
133
  ____exports.getPlayers(nil)
132
134
  ) do
133
135
  local character = player:GetPlayerType()
134
- if character == matchingCharacter then
136
+ if characterSet:has(character) then
135
137
  return true
136
138
  end
137
139
  end
package/dist/index.d.ts CHANGED
@@ -20,6 +20,7 @@ export { deepCopy } from "./functions/deepCopy";
20
20
  export { deepCopyTests } from "./functions/deepCopyTests";
21
21
  export * from "./functions/doors";
22
22
  export * from "./functions/entity";
23
+ export * from "./functions/familiars";
23
24
  export * from "./functions/flag";
24
25
  export * from "./functions/gridEntity";
25
26
  export * from "./functions/input";
package/dist/index.lua CHANGED
@@ -166,6 +166,14 @@ do
166
166
  end
167
167
  end
168
168
  end
169
+ do
170
+ local ____export = require("functions.familiars")
171
+ for ____exportKey, ____exportValue in pairs(____export) do
172
+ if ____exportKey ~= "default" then
173
+ ____exports[____exportKey] = ____exportValue
174
+ end
175
+ end
176
+ end
169
177
  do
170
178
  local ____export = require("functions.flag")
171
179
  for ____exportKey, ____exportValue in pairs(____export) do
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.0.535",
3
+ "version": "1.0.539",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",
@@ -25,7 +25,7 @@
25
25
  "dist/**/*.d.ts"
26
26
  ],
27
27
  "devDependencies": {
28
- "isaac-typescript-definitions": "^1.0.300",
28
+ "isaac-typescript-definitions": "^1.0.302",
29
29
  "isaacscript-lint": "^1.0.72",
30
30
  "typedoc": "^0.22.10",
31
31
  "typescript": "4.4.4",