isaacscript-common 1.2.19 → 1.2.23
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/postGridEntity.lua +10 -10
- package/dist/callbacks/postGridEntityCollision.d.ts +1 -0
- package/dist/callbacks/postGridEntityCollision.lua +63 -0
- package/dist/callbacks/subscriptions/postGridEntityCollision.d.ts +2 -0
- package/dist/callbacks/subscriptions/postGridEntityCollision.lua +26 -0
- package/dist/functions/collectibleCacheFlag.d.ts +1 -1
- package/dist/functions/flying.d.ts +18 -0
- package/dist/functions/flying.lua +44 -0
- package/dist/functions/gridEntity.d.ts +1 -0
- package/dist/functions/gridEntity.lua +26 -2
- package/dist/functions/math.d.ts +9 -0
- package/dist/functions/math.lua +16 -0
- package/dist/functions/set.d.ts +9 -2
- package/dist/functions/set.lua +8 -0
- package/dist/functions/transformations.d.ts +3 -1
- package/dist/functions/transformations.lua +14 -2
- package/dist/functions/trinketCacheFlag.d.ts +5 -0
- package/dist/functions/trinketCacheFlag.lua +41 -0
- package/dist/functions/trinkets.d.ts +1 -0
- package/dist/functions/trinkets.lua +10 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.lua +16 -0
- package/dist/types/CallbackParametersCustom.d.ts +5 -0
- package/dist/types/ModCallbacksCustom.d.ts +2 -1
- package/dist/types/ModCallbacksCustom.lua +2 -0
- package/dist/types/ModUpgraded.lua +8 -0
- package/dist/upgradeMod.lua +3 -0
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@ local Map = ____lualib.Map
|
|
|
4
4
|
local __TS__New = ____lualib.__TS__New
|
|
5
5
|
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
6
6
|
local ____exports = {}
|
|
7
|
-
local hasSubscriptions, postUpdate, checkGridEntityRemoved, postNewRoom,
|
|
7
|
+
local hasSubscriptions, postUpdate, checkNewGridEntity, checkGridEntityRemoved, postNewRoom, v
|
|
8
8
|
local ____exports = require("features.saveDataManager.exports")
|
|
9
9
|
local saveDataManager = ____exports.saveDataManager
|
|
10
10
|
local ____gridEntity = require("functions.gridEntity")
|
|
@@ -31,6 +31,15 @@ function postUpdate(self)
|
|
|
31
31
|
end
|
|
32
32
|
checkGridEntityRemoved(nil)
|
|
33
33
|
end
|
|
34
|
+
function checkNewGridEntity(self, gridEntity)
|
|
35
|
+
local gridIndex = gridEntity:GetGridIndex()
|
|
36
|
+
local gridEntityType = gridEntity:GetType()
|
|
37
|
+
local storedGridEntityType = v.room.initializedGridEntities:get(gridIndex)
|
|
38
|
+
if storedGridEntityType ~= gridEntityType then
|
|
39
|
+
v.room.initializedGridEntities:set(gridIndex, gridEntityType)
|
|
40
|
+
postGridEntityInitFire(nil, gridEntity)
|
|
41
|
+
end
|
|
42
|
+
end
|
|
34
43
|
function checkGridEntityRemoved(self)
|
|
35
44
|
local game = Game()
|
|
36
45
|
local room = game:GetRoom()
|
|
@@ -52,15 +61,6 @@ function postNewRoom(self)
|
|
|
52
61
|
checkNewGridEntity(nil, gridEntity)
|
|
53
62
|
end
|
|
54
63
|
end
|
|
55
|
-
function checkNewGridEntity(self, gridEntity)
|
|
56
|
-
local gridIndex = gridEntity:GetGridIndex()
|
|
57
|
-
local gridEntityType = gridEntity:GetType()
|
|
58
|
-
local storedGridEntityType = v.room.initializedGridEntities:get(gridIndex)
|
|
59
|
-
if storedGridEntityType ~= gridEntityType then
|
|
60
|
-
v.room.initializedGridEntities:set(gridIndex, gridEntityType)
|
|
61
|
-
postGridEntityInitFire(nil, gridEntity)
|
|
62
|
-
end
|
|
63
|
-
end
|
|
64
64
|
v = {room = {initializedGridEntities = __TS__New(Map)}}
|
|
65
65
|
function ____exports.postGridEntityCallbacksInit(self, mod)
|
|
66
66
|
saveDataManager(nil, "postGridEntity", v, hasSubscriptions)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
local ____lualib = require("lualib_bundle")
|
|
3
|
+
local Map = ____lualib.Map
|
|
4
|
+
local __TS__New = ____lualib.__TS__New
|
|
5
|
+
local Set = ____lualib.Set
|
|
6
|
+
local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
7
|
+
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
8
|
+
local ____exports = {}
|
|
9
|
+
local hasSubscriptions, postUpdate, v
|
|
10
|
+
local ____exports = require("features.saveDataManager.exports")
|
|
11
|
+
local saveDataManager = ____exports.saveDataManager
|
|
12
|
+
local ____gridEntity = require("functions.gridEntity")
|
|
13
|
+
local getCollidingEntitiesWithGridEntity = ____gridEntity.getCollidingEntitiesWithGridEntity
|
|
14
|
+
local getGridEntities = ____gridEntity.getGridEntities
|
|
15
|
+
local ____postGridEntityCollision = require("callbacks.subscriptions.postGridEntityCollision")
|
|
16
|
+
local postGridEntityCollisionFire = ____postGridEntityCollision.postGridEntityCollisionFire
|
|
17
|
+
local postGridEntityCollisionHasSubscriptions = ____postGridEntityCollision.postGridEntityCollisionHasSubscriptions
|
|
18
|
+
function hasSubscriptions(self)
|
|
19
|
+
return postGridEntityCollisionHasSubscriptions(nil)
|
|
20
|
+
end
|
|
21
|
+
function postUpdate(self)
|
|
22
|
+
if not hasSubscriptions(nil) then
|
|
23
|
+
return
|
|
24
|
+
end
|
|
25
|
+
for ____, gridEntity in ipairs(getGridEntities(nil)) do
|
|
26
|
+
do
|
|
27
|
+
if gridEntity.CollisionClass == GridCollisionClass.COLLISION_NONE then
|
|
28
|
+
goto __continue6
|
|
29
|
+
end
|
|
30
|
+
local gridEntityPtrHash = GetPtrHash(gridEntity)
|
|
31
|
+
local oldCollidingEntities = v.room.collidingEntitiesMap:get(gridEntityPtrHash)
|
|
32
|
+
if oldCollidingEntities == nil then
|
|
33
|
+
oldCollidingEntities = __TS__New(Set)
|
|
34
|
+
v.room.collidingEntitiesMap:set(gridEntityPtrHash, oldCollidingEntities)
|
|
35
|
+
end
|
|
36
|
+
local collidingEntities = getCollidingEntitiesWithGridEntity(nil, gridEntity)
|
|
37
|
+
for ____, entity in ipairs(collidingEntities) do
|
|
38
|
+
local entityPtrHash = GetPtrHash(entity)
|
|
39
|
+
if not oldCollidingEntities:has(entityPtrHash) then
|
|
40
|
+
oldCollidingEntities:add(entityPtrHash)
|
|
41
|
+
postGridEntityCollisionFire(nil, gridEntity, entity)
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
local collidingEntitiesPtrHashes = __TS__ArrayMap(
|
|
45
|
+
collidingEntities,
|
|
46
|
+
function(____, entity) return GetPtrHash(entity) end
|
|
47
|
+
)
|
|
48
|
+
local collidingEntitiesPtrHashSet = __TS__New(Set, collidingEntitiesPtrHashes)
|
|
49
|
+
for ____, oldCollidingEntityPtrHash in __TS__Iterator(oldCollidingEntities:values()) do
|
|
50
|
+
if not collidingEntitiesPtrHashSet:has(oldCollidingEntityPtrHash) then
|
|
51
|
+
oldCollidingEntities:delete(oldCollidingEntityPtrHash)
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
::__continue6::
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
v = {room = {collidingEntitiesMap = __TS__New(Map)}}
|
|
59
|
+
function ____exports.postGridEntityCollisionInit(self, mod)
|
|
60
|
+
saveDataManager(nil, "postGridEntityCollision", v, hasSubscriptions)
|
|
61
|
+
mod:AddCallback(ModCallbacks.MC_POST_UPDATE, postUpdate)
|
|
62
|
+
end
|
|
63
|
+
return ____exports
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
local ____lualib = require("lualib_bundle")
|
|
3
|
+
local __TS__ArrayPush = ____lualib.__TS__ArrayPush
|
|
4
|
+
local ____exports = {}
|
|
5
|
+
local subscriptions = {}
|
|
6
|
+
function ____exports.postGridEntityCollisionHasSubscriptions(self)
|
|
7
|
+
return #subscriptions > 0
|
|
8
|
+
end
|
|
9
|
+
function ____exports.postGridEntityCollisionRegister(self, callback, gridEntityType)
|
|
10
|
+
__TS__ArrayPush(subscriptions, {callback, gridEntityType})
|
|
11
|
+
end
|
|
12
|
+
function ____exports.postGridEntityCollisionFire(self, gridEntity, entity)
|
|
13
|
+
local gridEntityType = gridEntity:GetType()
|
|
14
|
+
for ____, ____value in ipairs(subscriptions) do
|
|
15
|
+
local callback = ____value[1]
|
|
16
|
+
local callbackGridEntityType = ____value[2]
|
|
17
|
+
do
|
|
18
|
+
if callbackGridEntityType ~= nil and callbackGridEntityType ~= gridEntityType then
|
|
19
|
+
goto __continue5
|
|
20
|
+
end
|
|
21
|
+
callback(nil, gridEntity, entity)
|
|
22
|
+
end
|
|
23
|
+
::__continue5::
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
return ____exports
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
2
|
/**
|
|
3
3
|
* Returns a set containing every collectible type with the given cache flag, including modded
|
|
4
|
-
*
|
|
4
|
+
* collectibles.
|
|
5
5
|
*/
|
|
6
6
|
export declare function getCollectiblesForCacheFlag(cacheFlag: CacheFlag): Set<CollectibleType | int>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
+
/**
|
|
3
|
+
* Returns a set of all of the collectibles that grant flight. This is derived from collectibles
|
|
4
|
+
* that have `CacheFlag.CACHE_FLYING` set in the "items.xml" file.
|
|
5
|
+
*
|
|
6
|
+
* Collectibles that only grant flight conditionally are manually pruned. Collectibles such as Empty
|
|
7
|
+
* Vessel should be checked for via the `hasFlyingTemporaryEffect` function.
|
|
8
|
+
*
|
|
9
|
+
* @param pruneConditionalItems Whether or not collectibles that only grant flight conditionally
|
|
10
|
+
* should be included in the set (like Empty Vessel).
|
|
11
|
+
*/
|
|
12
|
+
export declare function getFlyingCollectibles(pruneConditionalItems: boolean): Set<CollectibleType | int>;
|
|
13
|
+
/**
|
|
14
|
+
* Returns a set of all of the trinkets that grant flight. (All trinkets that grant flight do so
|
|
15
|
+
* conditionally, like Bat Wing.)
|
|
16
|
+
*/
|
|
17
|
+
export declare function getFlyingTrinkets(): Set<CollectibleType | int>;
|
|
18
|
+
export declare function hasFlyingTemporaryEffect(player: EntityPlayer): boolean;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
local ____lualib = require("lualib_bundle")
|
|
3
|
+
local Set = ____lualib.Set
|
|
4
|
+
local __TS__New = ____lualib.__TS__New
|
|
5
|
+
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
6
|
+
local ____exports = {}
|
|
7
|
+
local ____collectibleCacheFlag = require("functions.collectibleCacheFlag")
|
|
8
|
+
local getCollectiblesForCacheFlag = ____collectibleCacheFlag.getCollectiblesForCacheFlag
|
|
9
|
+
local ____set = require("functions.set")
|
|
10
|
+
local copySet = ____set.copySet
|
|
11
|
+
local deleteSetsFromSet = ____set.deleteSetsFromSet
|
|
12
|
+
local FLYING_TRINKETS = __TS__New(Set, {TrinketType.TRINKET_BAT_WING, TrinketType.TRINKET_AZAZELS_STUMP})
|
|
13
|
+
function ____exports.getFlyingCollectibles(self, pruneConditionalItems)
|
|
14
|
+
local collectiblesWithFlyingCacheFlag = getCollectiblesForCacheFlag(nil, CacheFlag.CACHE_FLYING)
|
|
15
|
+
local collectiblesWithAllCacheFlag = getCollectiblesForCacheFlag(nil, CacheFlag.CACHE_ALL)
|
|
16
|
+
deleteSetsFromSet(nil, collectiblesWithFlyingCacheFlag, collectiblesWithAllCacheFlag)
|
|
17
|
+
if pruneConditionalItems then
|
|
18
|
+
collectiblesWithFlyingCacheFlag:delete(CollectibleType.COLLECTIBLE_BIBLE)
|
|
19
|
+
collectiblesWithFlyingCacheFlag:delete(CollectibleType.COLLECTIBLE_EMPTY_VESSEL)
|
|
20
|
+
collectiblesWithFlyingCacheFlag:delete(CollectibleType.COLLECTIBLE_ASTRAL_PROJECTION)
|
|
21
|
+
collectiblesWithFlyingCacheFlag:delete(CollectibleType.COLLECTIBLE_RECALL)
|
|
22
|
+
end
|
|
23
|
+
return collectiblesWithFlyingCacheFlag
|
|
24
|
+
end
|
|
25
|
+
function ____exports.getFlyingTrinkets(self)
|
|
26
|
+
return copySet(nil, FLYING_TRINKETS)
|
|
27
|
+
end
|
|
28
|
+
function ____exports.hasFlyingTemporaryEffect(self, player)
|
|
29
|
+
local effects = player:GetEffects()
|
|
30
|
+
local flyingCollectibles = ____exports.getFlyingCollectibles(nil, false)
|
|
31
|
+
for ____, collectibleType in __TS__Iterator(flyingCollectibles:values()) do
|
|
32
|
+
if effects:HasCollectibleEffect(collectibleType) then
|
|
33
|
+
return true
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
local flyingTrinkets = ____exports.getFlyingTrinkets(nil)
|
|
37
|
+
for ____, trinketType in __TS__Iterator(flyingTrinkets:values()) do
|
|
38
|
+
if effects:HasTrinketEffect(trinketType) then
|
|
39
|
+
return true
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
return false
|
|
43
|
+
end
|
|
44
|
+
return ____exports
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* 1000.0 in a room XML file, but `GridEntityType.GRID_ROCK` is equal to 2.
|
|
6
6
|
*/
|
|
7
7
|
export declare function convertXMLGridEntityType(gridEntityXMLType: int, gridEntityXMLVariant: int): [int, int] | undefined;
|
|
8
|
+
export declare function getCollidingEntitiesWithGridEntity(gridEntity: GridEntity): Entity[];
|
|
8
9
|
/**
|
|
9
10
|
* Helper function to get every grid entity in the current room. Use it with no arguments to get
|
|
10
11
|
* every grid entity, or specify a variadic amount of arguments to match specific grid entity types.
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
2
|
local ____lualib = require("lualib_bundle")
|
|
3
3
|
local Map = ____lualib.Map
|
|
4
|
+
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
4
5
|
local Set = ____lualib.Set
|
|
5
6
|
local __TS__New = ____lualib.__TS__New
|
|
6
7
|
local __TS__ArrayPush = ____lualib.__TS__ArrayPush
|
|
7
8
|
local __TS__ArrayEvery = ____lualib.__TS__ArrayEvery
|
|
8
9
|
local ____exports = {}
|
|
10
|
+
local ____constants = require("constants")
|
|
11
|
+
local DISTANCE_OF_GRID_TILE = ____constants.DISTANCE_OF_GRID_TILE
|
|
9
12
|
local ____gridEntityXMLMap = require("maps.gridEntityXMLMap")
|
|
10
13
|
local GRID_ENTITY_XML_MAP = ____gridEntityXMLMap.GRID_ENTITY_XML_MAP
|
|
11
14
|
local ____roomShapeToTopLeftWallGridIndexMap = require("maps.roomShapeToTopLeftWallGridIndexMap")
|
|
12
15
|
local DEFAULT_TOP_LEFT_WALL_GRID_INDEX = ____roomShapeToTopLeftWallGridIndexMap.DEFAULT_TOP_LEFT_WALL_GRID_INDEX
|
|
13
16
|
local ROOM_SHAPE_TO_TOP_LEFT_WALL_GRID_INDEX_MAP = ____roomShapeToTopLeftWallGridIndexMap.ROOM_SHAPE_TO_TOP_LEFT_WALL_GRID_INDEX_MAP
|
|
17
|
+
local ____math = require("functions.math")
|
|
18
|
+
local isCircleIntersectingRectangle = ____math.isCircleIntersectingRectangle
|
|
14
19
|
local ____rooms = require("functions.rooms")
|
|
15
20
|
local roomUpdateSafe = ____rooms.roomUpdateSafe
|
|
16
21
|
local ____sprite = require("functions.sprite")
|
|
@@ -68,6 +73,25 @@ function ____exports.convertXMLGridEntityType(self, gridEntityXMLType, gridEntit
|
|
|
68
73
|
end
|
|
69
74
|
return {gridEntityType, gridEntityVariant}
|
|
70
75
|
end
|
|
76
|
+
function ____exports.getCollidingEntitiesWithGridEntity(self, gridEntity)
|
|
77
|
+
local gridEntityCollisionTopLeft = Vector(gridEntity.Position.X - DISTANCE_OF_GRID_TILE / 2, gridEntity.Position.Y - DISTANCE_OF_GRID_TILE / 2)
|
|
78
|
+
local gridEntityCollisionBottomRight = Vector(gridEntity.Position.X + DISTANCE_OF_GRID_TILE / 2, gridEntity.Position.Y + DISTANCE_OF_GRID_TILE / 2)
|
|
79
|
+
local closeEntities = Isaac.FindInRadius(gridEntity.Position, DISTANCE_OF_GRID_TILE * 2)
|
|
80
|
+
local closeEntitiesThatCollideWithGrid = __TS__ArrayFilter(
|
|
81
|
+
closeEntities,
|
|
82
|
+
function(____, entity) return entity:CollidesWithGrid() end
|
|
83
|
+
)
|
|
84
|
+
return __TS__ArrayFilter(
|
|
85
|
+
closeEntitiesThatCollideWithGrid,
|
|
86
|
+
function(____, entity) return isCircleIntersectingRectangle(
|
|
87
|
+
nil,
|
|
88
|
+
entity.Position,
|
|
89
|
+
entity.Size + 0.1,
|
|
90
|
+
gridEntityCollisionTopLeft,
|
|
91
|
+
gridEntityCollisionBottomRight
|
|
92
|
+
) end
|
|
93
|
+
)
|
|
94
|
+
end
|
|
71
95
|
function ____exports.getGridEntities(self, ...)
|
|
72
96
|
local gridEntityTypes = {...}
|
|
73
97
|
local game = Game()
|
|
@@ -81,7 +105,7 @@ function ____exports.getGridEntities(self, ...)
|
|
|
81
105
|
do
|
|
82
106
|
local gridEntity = room:GetGridEntity(gridIndex)
|
|
83
107
|
if gridEntity == nil then
|
|
84
|
-
goto
|
|
108
|
+
goto __continue10
|
|
85
109
|
end
|
|
86
110
|
if #gridEntityTypes == 0 then
|
|
87
111
|
__TS__ArrayPush(gridEntities, gridEntity)
|
|
@@ -92,7 +116,7 @@ function ____exports.getGridEntities(self, ...)
|
|
|
92
116
|
end
|
|
93
117
|
end
|
|
94
118
|
end
|
|
95
|
-
::
|
|
119
|
+
::__continue10::
|
|
96
120
|
gridIndex = gridIndex + 1
|
|
97
121
|
end
|
|
98
122
|
end
|
package/dist/functions/math.d.ts
CHANGED
|
@@ -13,6 +13,15 @@ export declare function getAngleDifference(angle1: float, angle2: float): float;
|
|
|
13
13
|
* this can be optionally changed by specifying this argument.
|
|
14
14
|
*/
|
|
15
15
|
export declare function getCircleDiscretizedPoints(centerPos: Vector, radius: float, numPoints: int, xMultiplier?: number, yMultiplier?: number, initialDirection?: Direction): Vector[];
|
|
16
|
+
/**
|
|
17
|
+
* Helper function to check if a given position is within a given rectangle. This is an inclusive
|
|
18
|
+
* check, meaning that it will return true if the position is on the border of the rectangle.
|
|
19
|
+
*/
|
|
20
|
+
export declare function inRectangle(position: Vector, topLeft: Vector, bottomRight: Vector): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* From: https://www.geeksforgeeks.org/check-if-any-point-overlaps-the-given-circle-and-rectangle/
|
|
23
|
+
*/
|
|
24
|
+
export declare function isCircleIntersectingRectangle(circleCenter: Vector, circleRadius: float, rectangleTopLeft: Vector, rectangleBottomRight: Vector): boolean;
|
|
16
25
|
export declare function isEven(num: int): boolean;
|
|
17
26
|
export declare function isOdd(num: int): boolean;
|
|
18
27
|
export declare function lerp(a: number, b: number, pos: float): number;
|
package/dist/functions/math.lua
CHANGED
|
@@ -75,6 +75,22 @@ function ____exports.getCircleDiscretizedPoints(self, centerPos, radius, numPoin
|
|
|
75
75
|
end
|
|
76
76
|
return positions
|
|
77
77
|
end
|
|
78
|
+
function ____exports.inRectangle(self, position, topLeft, bottomRight)
|
|
79
|
+
return position.X >= topLeft.X and position.X <= bottomRight.X and position.Y <= topLeft.Y and position.Y >= bottomRight.Y
|
|
80
|
+
end
|
|
81
|
+
function ____exports.isCircleIntersectingRectangle(self, circleCenter, circleRadius, rectangleTopLeft, rectangleBottomRight)
|
|
82
|
+
local nearestX = math.max(
|
|
83
|
+
rectangleTopLeft.X,
|
|
84
|
+
math.min(circleCenter.X, rectangleBottomRight.X)
|
|
85
|
+
)
|
|
86
|
+
local nearestY = math.max(
|
|
87
|
+
rectangleTopLeft.Y,
|
|
88
|
+
math.min(circleCenter.Y, rectangleBottomRight.Y)
|
|
89
|
+
)
|
|
90
|
+
local nearestPointToCircleOnRectangle = Vector(nearestX, nearestY)
|
|
91
|
+
local distanceToCenterOfCircle = nearestPointToCircleOnRectangle:Distance(circleCenter)
|
|
92
|
+
return distanceToCenterOfCircle <= circleRadius
|
|
93
|
+
end
|
|
78
94
|
function ____exports.isEven(self, num)
|
|
79
95
|
return num & 1 == 0
|
|
80
96
|
end
|
package/dist/functions/set.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Helper function to add all of the
|
|
3
|
-
*
|
|
2
|
+
* Helper function to add all of the values in one set to another set. The first set passed will be
|
|
3
|
+
* modified in place.
|
|
4
4
|
*
|
|
5
5
|
* This function is variadic, meaning that you can specify N sets to add to the first set.
|
|
6
6
|
*/
|
|
@@ -13,3 +13,10 @@ export declare function copySet<T>(oldSet: Set<T>): Set<T>;
|
|
|
13
13
|
* This function is variadic, meaning that you can specify N sets.
|
|
14
14
|
*/
|
|
15
15
|
export declare function combineSets<T>(...sets: Array<Set<T>>): Set<T>;
|
|
16
|
+
/**
|
|
17
|
+
* Helper function to delete all of the values in one set from another set. The first set passed
|
|
18
|
+
* will be modified in place.
|
|
19
|
+
*
|
|
20
|
+
* This function is variadic, meaning that you can specify N sets to remove from the first set.
|
|
21
|
+
*/
|
|
22
|
+
export declare function deleteSetsFromSet<T>(mainSet: Set<T>, ...setsToRemove: Array<Set<T>>): void;
|
package/dist/functions/set.lua
CHANGED
|
@@ -29,4 +29,12 @@ function ____exports.combineSets(self, ...)
|
|
|
29
29
|
end
|
|
30
30
|
return newSet
|
|
31
31
|
end
|
|
32
|
+
function ____exports.deleteSetsFromSet(self, mainSet, ...)
|
|
33
|
+
local setsToRemove = {...}
|
|
34
|
+
for ____, set in ipairs(setsToRemove) do
|
|
35
|
+
for ____, value in __TS__Iterator(set:values()) do
|
|
36
|
+
mainSet:delete(value)
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
32
40
|
return ____exports
|
|
@@ -11,5 +11,7 @@ export declare function getPlayerNumTransformationCollectibles(player: EntityPla
|
|
|
11
11
|
* // transformationName is "Beelzebub"
|
|
12
12
|
* ```
|
|
13
13
|
*/
|
|
14
|
-
export declare function getTransformationName(
|
|
14
|
+
export declare function getTransformationName(playerForm: PlayerForm): string;
|
|
15
15
|
export declare function getTransformationsForCollectibleType(collectibleType: CollectibleType | int): Set<PlayerForm>;
|
|
16
|
+
export declare function isTransformationFlying(playerForm: PlayerForm): boolean;
|
|
17
|
+
export declare function playerHasFlyingTransformation(player: EntityPlayer): boolean;
|
|
@@ -27,6 +27,7 @@ local TRANSFORMATION_TO_TAG_MAP = __TS__New(Map, {
|
|
|
27
27
|
{PlayerForm.PLAYERFORM_SPIDERBABY, 16384}
|
|
28
28
|
})
|
|
29
29
|
local TRANSFORMATIONS_NOT_BASED_ON_ITEMS = __TS__New(Set, {PlayerForm.PLAYERFORM_ADULTHOOD, PlayerForm.PLAYERFORM_STOMPY, PlayerForm.PLAYERFORM_FLIGHT})
|
|
30
|
+
local TRANSFORMATIONS_THAT_GRANT_FLYING = __TS__New(Set, {PlayerForm.PLAYERFORM_GUPPY, PlayerForm.PLAYERFORM_LORD_OF_THE_FLIES, PlayerForm.PLAYERFORM_ANGEL, PlayerForm.PLAYERFORM_EVIL_ANGEL})
|
|
30
31
|
local TRANSFORMATION_TO_COLLECTIBLE_TYPES_MAP = __TS__New(Map)
|
|
31
32
|
local COLLECTIBLE_TYPE_TO_TRANSFORMATION_MAP = __TS__New(Map)
|
|
32
33
|
local function initMaps(self)
|
|
@@ -89,9 +90,9 @@ function ____exports.getPlayerNumTransformationCollectibles(self, player, player
|
|
|
89
90
|
end
|
|
90
91
|
return numCollectibles
|
|
91
92
|
end
|
|
92
|
-
function ____exports.getTransformationName(self,
|
|
93
|
+
function ____exports.getTransformationName(self, playerForm)
|
|
93
94
|
local defaultName = "Unknown"
|
|
94
|
-
local transformationName = TRANSFORMATION_NAME_MAP:get(
|
|
95
|
+
local transformationName = TRANSFORMATION_NAME_MAP:get(playerForm)
|
|
95
96
|
return transformationName == nil and defaultName or transformationName
|
|
96
97
|
end
|
|
97
98
|
function ____exports.getTransformationsForCollectibleType(self, collectibleType)
|
|
@@ -101,4 +102,15 @@ function ____exports.getTransformationsForCollectibleType(self, collectibleType)
|
|
|
101
102
|
local transformations = COLLECTIBLE_TYPE_TO_TRANSFORMATION_MAP:get(collectibleType)
|
|
102
103
|
return transformations == nil and __TS__New(Set) or copySet(nil, transformations)
|
|
103
104
|
end
|
|
105
|
+
function ____exports.isTransformationFlying(self, playerForm)
|
|
106
|
+
return TRANSFORMATIONS_THAT_GRANT_FLYING:has(playerForm)
|
|
107
|
+
end
|
|
108
|
+
function ____exports.playerHasFlyingTransformation(self, player)
|
|
109
|
+
for ____, playerForm in __TS__Iterator(TRANSFORMATIONS_THAT_GRANT_FLYING:values()) do
|
|
110
|
+
if player:HasPlayerForm(playerForm) then
|
|
111
|
+
return true
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
return false
|
|
115
|
+
end
|
|
104
116
|
return ____exports
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
local ____lualib = require("lualib_bundle")
|
|
3
|
+
local Map = ____lualib.Map
|
|
4
|
+
local __TS__New = ____lualib.__TS__New
|
|
5
|
+
local Set = ____lualib.Set
|
|
6
|
+
local ____exports = {}
|
|
7
|
+
local ____set = require("functions.set")
|
|
8
|
+
local copySet = ____set.copySet
|
|
9
|
+
local ____trinkets = require("functions.trinkets")
|
|
10
|
+
local getMaxTrinketID = ____trinkets.getMaxTrinketID
|
|
11
|
+
local trinketHasCacheFlag = ____trinkets.trinketHasCacheFlag
|
|
12
|
+
local ____util = require("functions.util")
|
|
13
|
+
local getEnumValues = ____util.getEnumValues
|
|
14
|
+
local CACHE_FLAG_TO_TRINKETS_MAP = __TS__New(Map)
|
|
15
|
+
local function initCacheFlagMap(self)
|
|
16
|
+
local maxTrinketID = getMaxTrinketID(nil)
|
|
17
|
+
for ____, cacheFlag in ipairs(getEnumValues(nil, CacheFlag)) do
|
|
18
|
+
local trinketsSet = __TS__New(Set)
|
|
19
|
+
do
|
|
20
|
+
local trinketType = 1
|
|
21
|
+
while trinketType <= maxTrinketID do
|
|
22
|
+
if trinketHasCacheFlag(nil, trinketType, cacheFlag) then
|
|
23
|
+
trinketsSet:add(trinketType)
|
|
24
|
+
end
|
|
25
|
+
trinketType = trinketType + 1
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
CACHE_FLAG_TO_TRINKETS_MAP:set(cacheFlag, trinketsSet)
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
function ____exports.getTrinketsForCacheFlag(self, cacheFlag)
|
|
32
|
+
if CACHE_FLAG_TO_TRINKETS_MAP.size == 0 then
|
|
33
|
+
initCacheFlagMap(nil)
|
|
34
|
+
end
|
|
35
|
+
local trinketsSet = CACHE_FLAG_TO_TRINKETS_MAP:get(cacheFlag)
|
|
36
|
+
if trinketsSet == nil then
|
|
37
|
+
return __TS__New(Set)
|
|
38
|
+
end
|
|
39
|
+
return copySet(nil, trinketsSet)
|
|
40
|
+
end
|
|
41
|
+
return ____exports
|
|
@@ -52,3 +52,4 @@ export declare function isGoldenTrinket(trinketType: TrinketType | int): boolean
|
|
|
52
52
|
* avoid calling this function multiple times. 1 by default.
|
|
53
53
|
*/
|
|
54
54
|
export declare function smeltTrinket(player: EntityPlayer, trinketType: TrinketType | int, numTrinkets?: number): void;
|
|
55
|
+
export declare function trinketHasCacheFlag(trinketType: TrinketType | int, cacheFlag: CacheFlag): boolean;
|
|
@@ -10,6 +10,8 @@ local ____trinketNameMap = require("maps.trinketNameMap")
|
|
|
10
10
|
local TRINKET_NAME_MAP = ____trinketNameMap.TRINKET_NAME_MAP
|
|
11
11
|
local ____entity = require("functions.entity")
|
|
12
12
|
local getPickups = ____entity.getPickups
|
|
13
|
+
local ____flag = require("functions.flag")
|
|
14
|
+
local hasFlag = ____flag.hasFlag
|
|
13
15
|
local ____player = require("functions.player")
|
|
14
16
|
local useActiveItemTemp = ____player.useActiveItemTemp
|
|
15
17
|
local ____trinketGive = require("functions.trinketGive")
|
|
@@ -98,4 +100,12 @@ function ____exports.smeltTrinket(self, player, trinketType, numTrinkets)
|
|
|
98
100
|
end
|
|
99
101
|
giveTrinketsBack(nil, player, trinketSituation)
|
|
100
102
|
end
|
|
103
|
+
function ____exports.trinketHasCacheFlag(self, trinketType, cacheFlag)
|
|
104
|
+
local itemConfig = Isaac.GetItemConfig()
|
|
105
|
+
local itemConfigItem = itemConfig:GetTrinket(trinketType)
|
|
106
|
+
if itemConfigItem == nil then
|
|
107
|
+
return false
|
|
108
|
+
end
|
|
109
|
+
return hasFlag(nil, itemConfigItem.CacheFlags, cacheFlag)
|
|
110
|
+
end
|
|
101
111
|
return ____exports
|
package/dist/index.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ export * from "./functions/doors";
|
|
|
24
24
|
export * from "./functions/entity";
|
|
25
25
|
export * from "./functions/familiars";
|
|
26
26
|
export * from "./functions/flag";
|
|
27
|
+
export * from "./functions/flying";
|
|
27
28
|
export * from "./functions/globals";
|
|
28
29
|
export * from "./functions/gridEntity";
|
|
29
30
|
export * from "./functions/input";
|
|
@@ -49,6 +50,7 @@ export * from "./functions/sprite";
|
|
|
49
50
|
export * from "./functions/stage";
|
|
50
51
|
export * from "./functions/tears";
|
|
51
52
|
export * from "./functions/transformations";
|
|
53
|
+
export * from "./functions/trinketCacheFlag";
|
|
52
54
|
export * from "./functions/trinketGive";
|
|
53
55
|
export * from "./functions/trinkets";
|
|
54
56
|
export * from "./functions/trinketSet";
|
package/dist/index.lua
CHANGED
|
@@ -198,6 +198,14 @@ do
|
|
|
198
198
|
end
|
|
199
199
|
end
|
|
200
200
|
end
|
|
201
|
+
do
|
|
202
|
+
local ____export = require("functions.flying")
|
|
203
|
+
for ____exportKey, ____exportValue in pairs(____export) do
|
|
204
|
+
if ____exportKey ~= "default" then
|
|
205
|
+
____exports[____exportKey] = ____exportValue
|
|
206
|
+
end
|
|
207
|
+
end
|
|
208
|
+
end
|
|
201
209
|
do
|
|
202
210
|
local ____export = require("functions.globals")
|
|
203
211
|
for ____exportKey, ____exportValue in pairs(____export) do
|
|
@@ -398,6 +406,14 @@ do
|
|
|
398
406
|
end
|
|
399
407
|
end
|
|
400
408
|
end
|
|
409
|
+
do
|
|
410
|
+
local ____export = require("functions.trinketCacheFlag")
|
|
411
|
+
for ____exportKey, ____exportValue in pairs(____export) do
|
|
412
|
+
if ____exportKey ~= "default" then
|
|
413
|
+
____exports[____exportKey] = ____exportValue
|
|
414
|
+
end
|
|
415
|
+
end
|
|
416
|
+
end
|
|
401
417
|
do
|
|
402
418
|
local ____export = require("functions.trinketGive")
|
|
403
419
|
for ____exportKey, ____exportValue in pairs(____export) do
|
|
@@ -9,6 +9,7 @@ import { PostFirstEsauJrCallbackType } from "../callbacks/subscriptions/postFirs
|
|
|
9
9
|
import { PostFirstFlipCallbackType } from "../callbacks/subscriptions/postFirstFlip";
|
|
10
10
|
import { PostFlipCallbackType } from "../callbacks/subscriptions/postFlip";
|
|
11
11
|
import { PostGameStartedReorderedCallbackType } from "../callbacks/subscriptions/postGameStartedReordered";
|
|
12
|
+
import { PostGridEntityCollisionCallbackType } from "../callbacks/subscriptions/postGridEntityCollision";
|
|
12
13
|
import { PostGridEntityInitCallbackType } from "../callbacks/subscriptions/postGridEntityInit";
|
|
13
14
|
import { PostGridEntityRemoveCallbackType } from "../callbacks/subscriptions/postGridEntityRemove";
|
|
14
15
|
import { PostGridEntityUpdateCallbackType } from "../callbacks/subscriptions/postGridEntityUpdate";
|
|
@@ -207,4 +208,8 @@ export interface CallbackParametersCustom {
|
|
|
207
208
|
callback: PostGridEntityRemoveCallbackType,
|
|
208
209
|
gridEntityType?: GridEntityType
|
|
209
210
|
];
|
|
211
|
+
[ModCallbacksCustom.MC_POST_GRID_ENTITY_COLLISION]: [
|
|
212
|
+
callback: PostGridEntityCollisionCallbackType,
|
|
213
|
+
gridEntityType?: GridEntityType
|
|
214
|
+
];
|
|
210
215
|
}
|
|
@@ -91,4 +91,6 @@ ____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_UPDATE = 43
|
|
|
91
91
|
____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_UPDATE] = "MC_POST_GRID_ENTITY_UPDATE"
|
|
92
92
|
____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_REMOVE = 44
|
|
93
93
|
____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_REMOVE] = "MC_POST_GRID_ENTITY_REMOVE"
|
|
94
|
+
____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_COLLISION = 45
|
|
95
|
+
____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_COLLISION] = "MC_POST_GRID_ENTITY_COLLISION"
|
|
94
96
|
return ____exports
|
|
@@ -25,6 +25,8 @@ local ____postFlip = require("callbacks.subscriptions.postFlip")
|
|
|
25
25
|
local postFlipRegister = ____postFlip.postFlipRegister
|
|
26
26
|
local ____postGameStartedReordered = require("callbacks.subscriptions.postGameStartedReordered")
|
|
27
27
|
local postGameStartedReorderedRegister = ____postGameStartedReordered.postGameStartedReorderedRegister
|
|
28
|
+
local ____postGridEntityCollision = require("callbacks.subscriptions.postGridEntityCollision")
|
|
29
|
+
local postGridEntityCollisionRegister = ____postGridEntityCollision.postGridEntityCollisionRegister
|
|
28
30
|
local ____postGridEntityInit = require("callbacks.subscriptions.postGridEntityInit")
|
|
29
31
|
local postGridEntityInitRegister = ____postGridEntityInit.postGridEntityInitRegister
|
|
30
32
|
local ____postGridEntityRemove = require("callbacks.subscriptions.postGridEntityRemove")
|
|
@@ -384,6 +386,12 @@ function getCallbackRegisterFunction(self, callbackID)
|
|
|
384
386
|
return postGridEntityRemoveRegister
|
|
385
387
|
end
|
|
386
388
|
end
|
|
389
|
+
____cond19 = ____cond19 or ____switch19 == ModCallbacksCustom.MC_POST_GRID_ENTITY_COLLISION
|
|
390
|
+
if ____cond19 then
|
|
391
|
+
do
|
|
392
|
+
return postGridEntityCollisionRegister
|
|
393
|
+
end
|
|
394
|
+
end
|
|
387
395
|
do
|
|
388
396
|
do
|
|
389
397
|
ensureAllCases(nil, callbackID)
|
package/dist/upgradeMod.lua
CHANGED
|
@@ -21,6 +21,8 @@ local ____postFlip = require("callbacks.postFlip")
|
|
|
21
21
|
local postFlipCallbacksInit = ____postFlip.postFlipCallbacksInit
|
|
22
22
|
local ____postGridEntity = require("callbacks.postGridEntity")
|
|
23
23
|
local postGridEntityCallbacksInit = ____postGridEntity.postGridEntityCallbacksInit
|
|
24
|
+
local ____postGridEntityCollision = require("callbacks.postGridEntityCollision")
|
|
25
|
+
local postGridEntityCollisionInit = ____postGridEntityCollision.postGridEntityCollisionInit
|
|
24
26
|
local ____postKnifeInitLate = require("callbacks.postKnifeInitLate")
|
|
25
27
|
local postKnifeInitLateCallbackInit = ____postKnifeInitLate.postKnifeInitLateCallbackInit
|
|
26
28
|
local ____postLaserInitLate = require("callbacks.postLaserInitLate")
|
|
@@ -122,6 +124,7 @@ function initCustomCallbacks(self, mod)
|
|
|
122
124
|
postSlotInitUpdateCallbacksInit(nil, mod)
|
|
123
125
|
postSlotRenderBrokenCallbacksInit(nil, mod)
|
|
124
126
|
postGridEntityCallbacksInit(nil, mod)
|
|
127
|
+
postGridEntityCollisionInit(nil, mod)
|
|
125
128
|
end
|
|
126
129
|
function initFeatures(self, mod)
|
|
127
130
|
deployJSONRoomInit(nil, mod)
|