isaacscript-common 7.2.2 → 7.3.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.
- package/dist/callbacks/postDiceRoomActivated.d.ts.map +1 -1
- package/dist/callbacks/postDiceRoomActivated.lua +4 -5
- package/dist/callbacks/postItemDischarged.d.ts.map +1 -1
- package/dist/callbacks/postItemDischarged.lua +3 -2
- package/dist/callbacks/postPlayerChangeStat.d.ts.map +1 -1
- package/dist/callbacks/postPlayerChangeStat.lua +10 -7
- package/dist/functions/types.d.ts +8 -1
- package/dist/functions/types.d.ts.map +1 -1
- package/dist/functions/types.lua +7 -0
- package/package.json +1 -1
- package/src/callbacks/postDiceRoomActivated.ts +12 -7
- package/src/callbacks/postItemDischarged.ts +2 -3
- package/src/callbacks/postPlayerChangeStat.ts +4 -8
- package/src/functions/types.ts +11 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postDiceRoomActivated.d.ts","sourceRoot":"","sources":["../../src/callbacks/postDiceRoomActivated.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"postDiceRoomActivated.d.ts","sourceRoot":"","sources":["../../src/callbacks/postDiceRoomActivated.ts"],"names":[],"mappings":";AAmBA,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,CAQxD"}
|
|
@@ -16,20 +16,19 @@ function hasSubscriptions(self)
|
|
|
16
16
|
return postDiceRoomActivatedHasSubscriptions(nil)
|
|
17
17
|
end
|
|
18
18
|
function postEffectUpdateDiceFloor(self, effect)
|
|
19
|
-
local diceFloor = effect
|
|
20
19
|
if not hasSubscriptions(nil) then
|
|
21
20
|
return
|
|
22
21
|
end
|
|
23
22
|
if v.room.diceRoomActivated then
|
|
24
23
|
return
|
|
25
24
|
end
|
|
26
|
-
if
|
|
25
|
+
if effect.FrameCount == 0 then
|
|
27
26
|
return
|
|
28
27
|
end
|
|
29
|
-
local closestPlayer = getClosestPlayer(nil,
|
|
30
|
-
if isCloseEnoughToTriggerDiceFloor(nil, closestPlayer,
|
|
28
|
+
local closestPlayer = getClosestPlayer(nil, effect.Position)
|
|
29
|
+
if isCloseEnoughToTriggerDiceFloor(nil, closestPlayer, effect) then
|
|
31
30
|
v.room.diceRoomActivated = true
|
|
32
|
-
postDiceRoomActivatedFire(nil, closestPlayer,
|
|
31
|
+
postDiceRoomActivatedFire(nil, closestPlayer, effect.SubType)
|
|
33
32
|
end
|
|
34
33
|
end
|
|
35
34
|
v = {room = {diceRoomActivated = false}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postItemDischarged.d.ts","sourceRoot":"","sources":["../../src/callbacks/postItemDischarged.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"postItemDischarged.d.ts","sourceRoot":"","sources":["../../src/callbacks/postItemDischarged.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAqCrD,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,WAAW,GAAG,IAAI,CAS5D"}
|
|
@@ -22,6 +22,8 @@ local ____playerDataStructures = require("functions.playerDataStructures")
|
|
|
22
22
|
local defaultMapGetPlayer = ____playerDataStructures.defaultMapGetPlayer
|
|
23
23
|
local mapGetPlayer = ____playerDataStructures.mapGetPlayer
|
|
24
24
|
local mapSetPlayer = ____playerDataStructures.mapSetPlayer
|
|
25
|
+
local ____types = require("functions.types")
|
|
26
|
+
local asNumber = ____types.asNumber
|
|
25
27
|
local ____postItemDischarged = require("callbacks.subscriptions.postItemDischarged")
|
|
26
28
|
local postItemDischargeFire = ____postItemDischarged.postItemDischargeFire
|
|
27
29
|
local postItemDischargeHasSubscriptions = ____postItemDischarged.postItemDischargeHasSubscriptions
|
|
@@ -70,11 +72,10 @@ function playerRecentlyCollidedWithBulb(self, player)
|
|
|
70
72
|
return collidedOnThisFrame or collidedOnLastFrame
|
|
71
73
|
end
|
|
72
74
|
function preNPCCollisionSucker(self, npc, collider)
|
|
73
|
-
local sucker = npc
|
|
74
75
|
if not hasSubscriptions(nil) then
|
|
75
76
|
return nil
|
|
76
77
|
end
|
|
77
|
-
if
|
|
78
|
+
if npc.Variant ~= asNumber(nil, SuckerVariant.BULB) then
|
|
78
79
|
return nil
|
|
79
80
|
end
|
|
80
81
|
local player = collider:ToPlayer()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postPlayerChangeStat.d.ts","sourceRoot":"","sources":["../../src/callbacks/postPlayerChangeStat.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"postPlayerChangeStat.d.ts","sourceRoot":"","sources":["../../src/callbacks/postPlayerChangeStat.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AA2BrD,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,WAAW,GAAG,IAAI,CAO/D"}
|
|
@@ -11,17 +11,20 @@ local ____ModCallbackCustom = require("enums.ModCallbackCustom")
|
|
|
11
11
|
local ModCallbackCustom = ____ModCallbackCustom.ModCallbackCustom
|
|
12
12
|
local ____exports = require("features.saveDataManager.exports")
|
|
13
13
|
local saveDataManager = ____exports.saveDataManager
|
|
14
|
-
local
|
|
15
|
-
local
|
|
16
|
-
local
|
|
17
|
-
local
|
|
18
|
-
local
|
|
19
|
-
local isColor = ____functions.isColor
|
|
20
|
-
local isNumber = ____functions.isNumber
|
|
14
|
+
local ____bitSet128 = require("functions.bitSet128")
|
|
15
|
+
local isBitSet128 = ____bitSet128.isBitSet128
|
|
16
|
+
local ____color = require("functions.color")
|
|
17
|
+
local colorEquals = ____color.colorEquals
|
|
18
|
+
local isColor = ____color.isColor
|
|
21
19
|
local ____enums = require("functions.enums")
|
|
22
20
|
local getEnumValues = ____enums.getEnumValues
|
|
23
21
|
local ____playerIndex = require("functions.playerIndex")
|
|
24
22
|
local getPlayerIndex = ____playerIndex.getPlayerIndex
|
|
23
|
+
local ____playerStats = require("functions.playerStats")
|
|
24
|
+
local getPlayerStat = ____playerStats.getPlayerStat
|
|
25
|
+
local ____types = require("functions.types")
|
|
26
|
+
local isBoolean = ____types.isBoolean
|
|
27
|
+
local isNumber = ____types.isNumber
|
|
25
28
|
local ____postPlayerChangeStat = require("callbacks.subscriptions.postPlayerChangeStat")
|
|
26
29
|
local postPlayerChangeStatFire = ____postPlayerChangeStat.postPlayerChangeStatFire
|
|
27
30
|
local postPlayerChangeStatHasSubscriptions = ____postPlayerChangeStat.postPlayerChangeStatHasSubscriptions
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="typescript-to-lua/language-extensions" />
|
|
2
2
|
/// <reference types="lua-types/5.3" />
|
|
3
|
-
import { Card, CollectibleType, LevelStage, PillColor, PillEffect, PlayerType, TrinketType } from "isaac-typescript-definitions";
|
|
3
|
+
import { Card, CollectibleType, LevelStage, NpcState, PillColor, PillEffect, PlayerType, TrinketType } from "isaac-typescript-definitions";
|
|
4
4
|
/**
|
|
5
5
|
* Helper function to safely cast a `number` to a `Card`. (This is better than using the `as`
|
|
6
6
|
* TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
@@ -22,6 +22,13 @@ export declare function asCollectibleType(num: number): CollectibleType;
|
|
|
22
22
|
* This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
23
23
|
*/
|
|
24
24
|
export declare function asLevelStage(num: number): LevelStage;
|
|
25
|
+
/**
|
|
26
|
+
* Helper function to safely cast a `number` to a `NpcState`. (This is better than using the `as`
|
|
27
|
+
* TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
28
|
+
*
|
|
29
|
+
* This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
30
|
+
*/
|
|
31
|
+
export declare function asNpcState(num: number): NpcState;
|
|
25
32
|
/**
|
|
26
33
|
* Helper function to safely cast an enum to a `number`. (This is better than using the `as`
|
|
27
34
|
* TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/functions/types.ts"],"names":[],"mappings":";;AAAA,OAAO,EACL,IAAI,EACJ,eAAe,EACf,UAAU,EACV,SAAS,EACT,UAAU,EACV,UAAU,EACV,WAAW,EACZ,MAAM,8BAA8B,CAAC;AAEtC;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAExC;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,CAE9D;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAEpD;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE5C;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAElD;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAEpD;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAEpD;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE5C;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CAEtD;AAED,wBAAgB,SAAS,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,OAAO,CAEhE;AAGD,wBAAgB,UAAU,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,QAAQ,CAElE;AAED,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IA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AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE5C;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CAEtD;AAED,wBAAgB,SAAS,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,OAAO,CAEhE;AAGD,wBAAgB,UAAU,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,QAAQ,CAElE;AAED,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,MAAM,CAE9D;AAED,+EAA+E;AAC/E,wBAAgB,WAAW,CACzB,QAAQ,EAAE,OAAO,GAChB,QAAQ,IAAI,OAAO,GAAG,MAAM,GAAG,MAAM,CAOvC;AAED,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,MAAM,CAE9D;AAED,wBAAgB,OAAO,CACrB,QAAQ,EAAE,OAAO,GAChB,QAAQ,IAAI,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,CAExC;AAED,wBAAgB,UAAU,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,WAAW,CAErE"}
|
package/dist/functions/types.lua
CHANGED
|
@@ -20,6 +20,13 @@ end
|
|
|
20
20
|
function ____exports.asLevelStage(self, num)
|
|
21
21
|
return num
|
|
22
22
|
end
|
|
23
|
+
--- Helper function to safely cast a `number` to a `NpcState`. (This is better than using the `as`
|
|
24
|
+
-- TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
25
|
+
--
|
|
26
|
+
-- This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
27
|
+
function ____exports.asNpcState(self, num)
|
|
28
|
+
return num
|
|
29
|
+
end
|
|
23
30
|
--- Helper function to safely cast an enum to a `number`. (This is better than using the `as`
|
|
24
31
|
-- TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
25
32
|
--
|
package/package.json
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
DiceFloorSubType,
|
|
3
|
+
EffectVariant,
|
|
4
|
+
ModCallback,
|
|
5
|
+
} from "isaac-typescript-definitions";
|
|
2
6
|
import { saveDataManager } from "../features/saveDataManager/exports";
|
|
3
7
|
import { isCloseEnoughToTriggerDiceFloor } from "../functions/effects";
|
|
4
8
|
import { getClosestPlayer } from "../functions/players";
|
|
@@ -30,8 +34,6 @@ function hasSubscriptions() {
|
|
|
30
34
|
// ModCallback.POST_EFFECT_UPDATE (55)
|
|
31
35
|
// EffectVariant.DICE_FLOOR (76)
|
|
32
36
|
function postEffectUpdateDiceFloor(effect: EntityEffect) {
|
|
33
|
-
const diceFloor = effect as EntityEffectDiceFloor;
|
|
34
|
-
|
|
35
37
|
if (!hasSubscriptions()) {
|
|
36
38
|
return;
|
|
37
39
|
}
|
|
@@ -42,13 +44,16 @@ function postEffectUpdateDiceFloor(effect: EntityEffect) {
|
|
|
42
44
|
|
|
43
45
|
// When using the debug console to go to a dice room, the player can appear on top of the dice
|
|
44
46
|
// floor before they snap to the door.
|
|
45
|
-
if (
|
|
47
|
+
if (effect.FrameCount === 0) {
|
|
46
48
|
return;
|
|
47
49
|
}
|
|
48
50
|
|
|
49
|
-
const closestPlayer = getClosestPlayer(
|
|
50
|
-
if (isCloseEnoughToTriggerDiceFloor(closestPlayer,
|
|
51
|
+
const closestPlayer = getClosestPlayer(effect.Position);
|
|
52
|
+
if (isCloseEnoughToTriggerDiceFloor(closestPlayer, effect)) {
|
|
51
53
|
v.room.diceRoomActivated = true;
|
|
52
|
-
postDiceRoomActivatedFire(
|
|
54
|
+
postDiceRoomActivatedFire(
|
|
55
|
+
closestPlayer,
|
|
56
|
+
effect.SubType as DiceFloorSubType,
|
|
57
|
+
);
|
|
53
58
|
}
|
|
54
59
|
}
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
mapGetPlayer,
|
|
17
17
|
mapSetPlayer,
|
|
18
18
|
} from "../functions/playerDataStructures";
|
|
19
|
+
import { asNumber } from "../functions/types";
|
|
19
20
|
import { PlayerIndex } from "../types/PlayerIndex";
|
|
20
21
|
import {
|
|
21
22
|
postItemDischargeFire,
|
|
@@ -131,13 +132,11 @@ function preNPCCollisionSucker(
|
|
|
131
132
|
npc: EntityNPC,
|
|
132
133
|
collider: Entity,
|
|
133
134
|
): boolean | undefined {
|
|
134
|
-
const sucker = npc as EntityNPCSucker;
|
|
135
|
-
|
|
136
135
|
if (!hasSubscriptions()) {
|
|
137
136
|
return undefined;
|
|
138
137
|
}
|
|
139
138
|
|
|
140
|
-
if (
|
|
139
|
+
if (npc.Variant !== asNumber(SuckerVariant.BULB)) {
|
|
141
140
|
return undefined;
|
|
142
141
|
}
|
|
143
142
|
|
|
@@ -4,16 +4,12 @@ import { ModUpgraded } from "../classes/ModUpgraded";
|
|
|
4
4
|
import { StatType } from "../enums";
|
|
5
5
|
import { ModCallbackCustom } from "../enums/ModCallbackCustom";
|
|
6
6
|
import { saveDataManager } from "../features/saveDataManager/exports";
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
getPlayerStat,
|
|
10
|
-
isBitSet128,
|
|
11
|
-
isBoolean,
|
|
12
|
-
isColor,
|
|
13
|
-
isNumber,
|
|
14
|
-
} from "../functions";
|
|
7
|
+
import { isBitSet128 } from "../functions/bitSet128";
|
|
8
|
+
import { colorEquals, isColor } from "../functions/color";
|
|
15
9
|
import { getEnumValues } from "../functions/enums";
|
|
16
10
|
import { getPlayerIndex } from "../functions/playerIndex";
|
|
11
|
+
import { getPlayerStat } from "../functions/playerStats";
|
|
12
|
+
import { isBoolean, isNumber } from "../functions/types";
|
|
17
13
|
import { PlayerIndex } from "../types/PlayerIndex";
|
|
18
14
|
import {
|
|
19
15
|
postPlayerChangeStatFire,
|
package/src/functions/types.ts
CHANGED
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
Card,
|
|
3
3
|
CollectibleType,
|
|
4
4
|
LevelStage,
|
|
5
|
+
NpcState,
|
|
5
6
|
PillColor,
|
|
6
7
|
PillEffect,
|
|
7
8
|
PlayerType,
|
|
@@ -38,6 +39,16 @@ export function asLevelStage(num: number): LevelStage {
|
|
|
38
39
|
return num;
|
|
39
40
|
}
|
|
40
41
|
|
|
42
|
+
/**
|
|
43
|
+
* Helper function to safely cast a `number` to a `NpcState`. (This is better than using the `as`
|
|
44
|
+
* TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
45
|
+
*
|
|
46
|
+
* This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
47
|
+
*/
|
|
48
|
+
export function asNpcState(num: number): NpcState {
|
|
49
|
+
return num;
|
|
50
|
+
}
|
|
51
|
+
|
|
41
52
|
/**
|
|
42
53
|
* Helper function to safely cast an enum to a `number`. (This is better than using the `as`
|
|
43
54
|
* TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|