isaacscript-common 1.0.604 → 1.0.608
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/postCursedTeleport.lua +3 -3
- package/dist/callbacks/preBerserkDeath.lua +3 -3
- package/dist/functions/globals.lua +18 -2
- package/dist/functions/npc.lua +3 -1
- package/dist/functions/player.d.ts +8 -3
- package/dist/functions/player.lua +2 -2
- package/dist/functions/util.d.ts +12 -0
- package/dist/functions/util.lua +8 -0
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@ local ____flag = require("functions.flag")
|
|
|
8
8
|
local hasFlag = ____flag.hasFlag
|
|
9
9
|
local ____player = require("functions.player")
|
|
10
10
|
local getPlayerIndex = ____player.getPlayerIndex
|
|
11
|
-
local
|
|
11
|
+
local getPlayerNumHitsRemaining = ____player.getPlayerNumHitsRemaining
|
|
12
12
|
local ____postCursedTeleport = require("callbacks.subscriptions.postCursedTeleport")
|
|
13
13
|
local postCursedTeleportFire = ____postCursedTeleport.postCursedTeleportFire
|
|
14
14
|
local postCursedTeleportHasSubscriptions = ____postCursedTeleport.postCursedTeleportHasSubscriptions
|
|
@@ -93,8 +93,8 @@ function playerIsTeleportingFromCursedTeleport(self, player, lastDamageFrame)
|
|
|
93
93
|
if player:HasCollectible(CollectibleType.COLLECTIBLE_CURSED_EYE) then
|
|
94
94
|
return true
|
|
95
95
|
end
|
|
96
|
-
local
|
|
97
|
-
if player:HasTrinket(TrinketType.TRINKET_CURSED_SKULL) and
|
|
96
|
+
local numHitsRemaining = getPlayerNumHitsRemaining(nil, player)
|
|
97
|
+
if player:HasTrinket(TrinketType.TRINKET_CURSED_SKULL) and numHitsRemaining == 1 then
|
|
98
98
|
return true
|
|
99
99
|
end
|
|
100
100
|
return false
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
local ____exports = {}
|
|
3
3
|
local hasSubscriptions, postPEffectUpdateReordered
|
|
4
4
|
local ____player = require("functions.player")
|
|
5
|
-
local
|
|
5
|
+
local getPlayerNumHitsRemaining = ____player.getPlayerNumHitsRemaining
|
|
6
6
|
local isChildPlayer = ____player.isChildPlayer
|
|
7
7
|
local ____revive = require("functions.revive")
|
|
8
8
|
local willPlayerRevive = ____revive.willPlayerRevive
|
|
@@ -23,8 +23,8 @@ function postPEffectUpdateReordered(self, player)
|
|
|
23
23
|
end
|
|
24
24
|
local effects = player:GetEffects()
|
|
25
25
|
local berserkEffect = effects:GetCollectibleEffect(CollectibleType.COLLECTIBLE_BERSERK)
|
|
26
|
-
local
|
|
27
|
-
if berserkEffect ~= nil and berserkEffect.Cooldown == 1 and
|
|
26
|
+
local numHitsRemaining = getPlayerNumHitsRemaining(nil, player)
|
|
27
|
+
if berserkEffect ~= nil and berserkEffect.Cooldown == 1 and numHitsRemaining == 0 and not willPlayerRevive(nil, player) then
|
|
28
28
|
preBerserkDeathFire(nil, player)
|
|
29
29
|
end
|
|
30
30
|
end
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
2
|
require("lualib_bundle");
|
|
3
3
|
local ____exports = {}
|
|
4
|
+
local twoDimensionalSort
|
|
4
5
|
local ____log = require("functions.log")
|
|
5
6
|
local log = ____log.log
|
|
6
7
|
local ____util = require("functions.util")
|
|
7
|
-
local
|
|
8
|
+
local addSetsToSet = ____util.addSetsToSet
|
|
9
|
+
local copySet = ____util.copySet
|
|
8
10
|
local isLuaDebugEnabled = ____util.isLuaDebugEnabled
|
|
11
|
+
function twoDimensionalSort(self, a, b)
|
|
12
|
+
if a[1] == b[1] then
|
|
13
|
+
return 0
|
|
14
|
+
end
|
|
15
|
+
return a[1] < b[1] and -1 or 1
|
|
16
|
+
end
|
|
9
17
|
local DEFAULT_GLOBALS = __TS__New(Set, {
|
|
10
18
|
"ActionTriggers",
|
|
11
19
|
"ActiveSlot",
|
|
@@ -126,6 +134,7 @@ local DEFAULT_GLOBALS = __TS__New(Set, {
|
|
|
126
134
|
"SeedEffect",
|
|
127
135
|
"Seeds",
|
|
128
136
|
"ShockwaveParams",
|
|
137
|
+
"SkinColor",
|
|
129
138
|
"SortingLayer",
|
|
130
139
|
"SoundEffect",
|
|
131
140
|
"Sprite",
|
|
@@ -173,8 +182,14 @@ local DEFAULT_GLOBALS = __TS__New(Set, {
|
|
|
173
182
|
"xpcall"
|
|
174
183
|
})
|
|
175
184
|
local LUA_DEBUG_ADDED_GLOBALS = __TS__New(Set, {"debug", "io", "os", "package"})
|
|
185
|
+
local RACING_PLUS_SANDBOX_ADDED_GLOBALS = __TS__New(Set, {"sandboxTraceback", "sandboxGetTraceback", "getParentFunctionDescription"})
|
|
176
186
|
function ____exports.getDefaultGlobals(self)
|
|
177
|
-
|
|
187
|
+
local defaultGlobals = copySet(nil, DEFAULT_GLOBALS)
|
|
188
|
+
if isLuaDebugEnabled(nil) then
|
|
189
|
+
addSetsToSet(nil, defaultGlobals, LUA_DEBUG_ADDED_GLOBALS)
|
|
190
|
+
end
|
|
191
|
+
addSetsToSet(nil, defaultGlobals, RACING_PLUS_SANDBOX_ADDED_GLOBALS)
|
|
192
|
+
return defaultGlobals
|
|
178
193
|
end
|
|
179
194
|
function ____exports.getNewGlobals(self)
|
|
180
195
|
local defaultGlobals = ____exports.getDefaultGlobals(nil)
|
|
@@ -185,6 +200,7 @@ function ____exports.getNewGlobals(self)
|
|
|
185
200
|
__TS__ArrayPush(newGlobals, keyValueTuple)
|
|
186
201
|
end
|
|
187
202
|
end
|
|
203
|
+
__TS__ArraySort(newGlobals, twoDimensionalSort)
|
|
188
204
|
return newGlobals
|
|
189
205
|
end
|
|
190
206
|
function ____exports.logNewGlobals(self)
|
package/dist/functions/npc.lua
CHANGED
|
@@ -70,7 +70,9 @@ NON_ALIVE_NPCS_TYPE_VARIANT = __TS__New(
|
|
|
70
70
|
(tostring(EntityType.ENTITY_MAMA_GURDY) .. ".") .. 1,
|
|
71
71
|
(tostring(EntityType.ENTITY_MAMA_GURDY) .. ".") .. 2,
|
|
72
72
|
(tostring(EntityType.ENTITY_BIG_HORN) .. ".") .. 1,
|
|
73
|
-
(tostring(EntityType.ENTITY_BIG_HORN) .. ".") .. 2
|
|
73
|
+
(tostring(EntityType.ENTITY_BIG_HORN) .. ".") .. 2,
|
|
74
|
+
(tostring(EntityType.ENTITY_DARK_ESAU) .. ".") .. 0,
|
|
75
|
+
(tostring(EntityType.ENTITY_DARK_ESAU) .. ".") .. 1
|
|
74
76
|
}
|
|
75
77
|
)
|
|
76
78
|
NON_ALIVE_NPCS_TYPE_VARIANT_SUBTYPE = __TS__New(
|
|
@@ -132,10 +132,15 @@ export declare function getPlayerIndexVanilla(playerToFind: EntityPlayer): int |
|
|
|
132
132
|
*/
|
|
133
133
|
export declare function getPlayerMaxHeartContainers(player: EntityPlayer): int;
|
|
134
134
|
/**
|
|
135
|
-
* Returns the combined value of all of the player's red hearts, soul/black hearts, and bone hearts
|
|
136
|
-
*
|
|
135
|
+
* Returns the combined value of all of the player's red hearts, soul/black hearts, and bone hearts,
|
|
136
|
+
* minus the value of the player's rotten hearts.
|
|
137
|
+
*
|
|
138
|
+
* This is equivalent to the number of hits that the player can currently take, but does not take
|
|
139
|
+
* into account double damage from champion enemies and/or being on later floors. (For example, on
|
|
140
|
+
* Womb 1, players who have 1 soul heart remaining would die in 1 hit to anything, even though this
|
|
141
|
+
* function would report that they have 2 hits remaining.)
|
|
137
142
|
*/
|
|
138
|
-
export declare function
|
|
143
|
+
export declare function getPlayerNumHitsRemaining(player: EntityPlayer): int;
|
|
139
144
|
/**
|
|
140
145
|
* This function always excludes players with a non-undefined parent, since they are not real
|
|
141
146
|
* players. (e.g. the Strawman Keeper)
|
|
@@ -299,7 +299,7 @@ function ____exports.getPlayerIndexVanilla(self, playerToFind)
|
|
|
299
299
|
end
|
|
300
300
|
return nil
|
|
301
301
|
end
|
|
302
|
-
function ____exports.
|
|
302
|
+
function ____exports.getPlayerNumHitsRemaining(self, player)
|
|
303
303
|
local hearts = player:GetHearts()
|
|
304
304
|
local soulHearts = player:GetSoulHearts()
|
|
305
305
|
local boneHearts = player:GetBoneHearts()
|
|
@@ -371,7 +371,7 @@ function ____exports.isDamageToPlayerFatal(self, player, damageAmount, damageSou
|
|
|
371
371
|
if ____exports.hasLostCurse(nil, player) then
|
|
372
372
|
return true
|
|
373
373
|
end
|
|
374
|
-
local playerNumAllHearts = ____exports.
|
|
374
|
+
local playerNumAllHearts = ____exports.getPlayerNumHitsRemaining(nil, player)
|
|
375
375
|
if damageAmount < playerNumAllHearts then
|
|
376
376
|
return false
|
|
377
377
|
end
|
package/dist/functions/util.d.ts
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
2
|
/// <reference types="typescript-to-lua/language-extensions" />
|
|
3
|
+
/**
|
|
4
|
+
* Helper function to add all of the contents of one set to another set. The first set passed will
|
|
5
|
+
* be modified in place.
|
|
6
|
+
*
|
|
7
|
+
* This function is variadic, meaning that you can specify N sets to add to the first set.
|
|
8
|
+
*/
|
|
9
|
+
export declare function addSetsToSet<T>(mainSet: Set<T>, ...setsToAdd: Array<Set<T>>): void;
|
|
3
10
|
/**
|
|
4
11
|
* Using a Map constructor to copy a Map does not seem to work properly, so use this helper function
|
|
5
12
|
* instead.
|
|
@@ -10,6 +17,11 @@ export declare function copyMap<K, V>(oldMap: Map<K, V>): Map<K, V>;
|
|
|
10
17
|
* instead.
|
|
11
18
|
*/
|
|
12
19
|
export declare function copySet<T>(oldSet: Set<T>): Set<T>;
|
|
20
|
+
/**
|
|
21
|
+
* Helper function to create a new set that is the composition of two or more sets.
|
|
22
|
+
*
|
|
23
|
+
* This function is variadic, meaning that you can specify N sets.
|
|
24
|
+
*/
|
|
13
25
|
export declare function combineSets<T>(...sets: Array<Set<T>>): Set<T>;
|
|
14
26
|
/**
|
|
15
27
|
* Helper function to get type safety on a switch statement.
|
package/dist/functions/util.lua
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
require("lualib_bundle");
|
|
3
3
|
local ____exports = {}
|
|
4
4
|
local HEX_STRING_LENGTH = 6
|
|
5
|
+
function ____exports.addSetsToSet(self, mainSet, ...)
|
|
6
|
+
local setsToAdd = {...}
|
|
7
|
+
for ____, set in ipairs(setsToAdd) do
|
|
8
|
+
for ____, value in __TS__Iterator(set:values()) do
|
|
9
|
+
mainSet:add(value)
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
5
13
|
function ____exports.copyMap(self, oldMap)
|
|
6
14
|
local newMap = __TS__New(Map)
|
|
7
15
|
for ____, ____value in __TS__Iterator(oldMap:entries()) do
|