isaacscript-common 3.12.0 → 3.13.0

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.
@@ -3,10 +3,10 @@ local hasSubscriptions, postEffectUpdateDiceFloor, v
3
3
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
4
4
  local EffectVariant = ____isaac_2Dtypescript_2Ddefinitions.EffectVariant
5
5
  local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
6
- local ____constants = require("constants")
7
- local DICE_FLOOR_TRIGGER_DISTANCE = ____constants.DICE_FLOOR_TRIGGER_DISTANCE
8
6
  local ____exports = require("features.saveDataManager.exports")
9
7
  local saveDataManager = ____exports.saveDataManager
8
+ local ____effects = require("functions.effects")
9
+ local isCloseEnoughToTriggerDiceFloor = ____effects.isCloseEnoughToTriggerDiceFloor
10
10
  local ____player = require("functions.player")
11
11
  local getClosestPlayer = ____player.getClosestPlayer
12
12
  local ____postDiceRoomActivated = require("callbacks.subscriptions.postDiceRoomActivated")
@@ -22,9 +22,11 @@ function postEffectUpdateDiceFloor(self, effect)
22
22
  if v.room.diceRoomActivated then
23
23
  return
24
24
  end
25
+ if effect.FrameCount == 0 then
26
+ return
27
+ end
25
28
  local closestPlayer = getClosestPlayer(nil, effect.Position)
26
- local distance = effect.Position:Distance(closestPlayer.Position)
27
- if distance <= DICE_FLOOR_TRIGGER_DISTANCE then
29
+ if isCloseEnoughToTriggerDiceFloor(nil, closestPlayer, effect) then
28
30
  v.room.diceRoomActivated = true
29
31
  postDiceRoomActivatedFire(nil, closestPlayer, effect.SubType)
30
32
  end
package/constants.d.ts CHANGED
@@ -15,8 +15,6 @@ export declare const BLIND_ITEM_PNG_PATH = "gfx/items/collectibles/questionmark.
15
15
  /** Bombs explode when their frame count is equal to this value. */
16
16
  export declare const BOMB_EXPLODE_FRAME = 45;
17
17
  export declare const DEFAULT_ITEM_POOL_TYPE = ItemPoolType.TREASURE;
18
- /** For `EntityType.EFFECT` (1000), `EffectVariant.DICE_FLOOR` (76) */
19
- export declare const DICE_FLOOR_TRIGGER_DISTANCE = 75;
20
18
  /** This is also the distance that a player spawns from the door that they enter a room from. */
21
19
  export declare const DISTANCE_OF_GRID_TILE = 40;
22
20
  export declare const DOOR_HITBOX_RADIUS = 11;
package/constants.lua CHANGED
@@ -19,8 +19,6 @@ ____exports.BLIND_ITEM_PNG_PATH = "gfx/items/collectibles/questionmark.png"
19
19
  --- Bombs explode when their frame count is equal to this value.
20
20
  ____exports.BOMB_EXPLODE_FRAME = 45
21
21
  ____exports.DEFAULT_ITEM_POOL_TYPE = ItemPoolType.TREASURE
22
- --- For `EntityType.EFFECT` (1000), `EffectVariant.DICE_FLOOR` (76)
23
- ____exports.DICE_FLOOR_TRIGGER_DISTANCE = 75
24
22
  --- This is also the distance that a player spawns from the door that they enter a room from.
25
23
  ____exports.DISTANCE_OF_GRID_TILE = 40
26
24
  ____exports.DOOR_HITBOX_RADIUS = 11
@@ -0,0 +1,6 @@
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ /// <reference types="isaac-typescript-definitions" />
3
+ /** For `EntityType.EFFECT` (1000), `EffectVariant.DICE_FLOOR` (76) */
4
+ export declare const DICE_FLOOR_TRIGGER_SQUARE_SIZE = 75;
5
+ /** Helper function to see if a player is close enough to activate a Dice Room floor. */
6
+ export declare function isCloseEnoughToTriggerDiceFloor(player: EntityPlayer, diceFloor: EntityEffect): boolean;
@@ -0,0 +1,12 @@
1
+ local ____exports = {}
2
+ local ____math = require("functions.math")
3
+ local inRectangle = ____math.inRectangle
4
+ --- For `EntityType.EFFECT` (1000), `EffectVariant.DICE_FLOOR` (76)
5
+ ____exports.DICE_FLOOR_TRIGGER_SQUARE_SIZE = 75
6
+ --- Helper function to see if a player is close enough to activate a Dice Room floor.
7
+ function ____exports.isCloseEnoughToTriggerDiceFloor(self, player, diceFloor)
8
+ local topLeft = diceFloor.Position + Vector(-____exports.DICE_FLOOR_TRIGGER_SQUARE_SIZE, -____exports.DICE_FLOOR_TRIGGER_SQUARE_SIZE)
9
+ local bottomRight = diceFloor.Position + Vector(____exports.DICE_FLOOR_TRIGGER_SQUARE_SIZE, ____exports.DICE_FLOOR_TRIGGER_SQUARE_SIZE)
10
+ return inRectangle(nil, player.Position, topLeft, bottomRight)
11
+ end
12
+ return ____exports
package/index.d.ts CHANGED
@@ -51,6 +51,7 @@ export * from "./functions/direction";
51
51
  export * from "./functions/doors";
52
52
  export * from "./functions/easing";
53
53
  export * from "./functions/eden";
54
+ export * from "./functions/effects";
54
55
  export * from "./functions/entity";
55
56
  export * from "./functions/entitySpecific";
56
57
  export * from "./functions/entityTypes";
package/index.lua CHANGED
@@ -401,6 +401,14 @@ do
401
401
  end
402
402
  end
403
403
  end
404
+ do
405
+ local ____export = require("functions.effects")
406
+ for ____exportKey, ____exportValue in pairs(____export) do
407
+ if ____exportKey ~= "default" then
408
+ ____exports[____exportKey] = ____exportValue
409
+ end
410
+ end
411
+ end
404
412
  do
405
413
  local ____export = require("functions.entity")
406
414
  for ____exportKey, ____exportValue in pairs(____export) do
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "3.12.0",
3
+ "version": "3.13.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",