isaacscript-common 5.0.1 → 5.0.2
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/functions/charge.lua
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
local ____exports = {}
|
|
2
|
-
local getClampedChargesToAdd,
|
|
2
|
+
local getClampedChargesToAdd, getChargesToAddWithAAAModifier, shouldPlayFullRechargeSound
|
|
3
3
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
4
4
|
local ActiveSlot = ____isaac_2Dtypescript_2Ddefinitions.ActiveSlot
|
|
5
5
|
local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
|
|
@@ -40,7 +40,7 @@ function ____exports.addCharge(self, player, activeSlot, numCharges, playSoundEf
|
|
|
40
40
|
end
|
|
41
41
|
local hud = game:GetHUD()
|
|
42
42
|
local chargesToAdd = getClampedChargesToAdd(nil, player, activeSlot, numCharges)
|
|
43
|
-
local modifiedChargesToAdd =
|
|
43
|
+
local modifiedChargesToAdd = getChargesToAddWithAAAModifier(nil, player, activeSlot, chargesToAdd)
|
|
44
44
|
local totalCharge = ____exports.getTotalCharge(nil, player, activeSlot)
|
|
45
45
|
local newCharge = totalCharge + modifiedChargesToAdd
|
|
46
46
|
if newCharge == totalCharge then
|
|
@@ -105,7 +105,7 @@ function getClampedChargesToAdd(self, player, activeSlot, numCharges)
|
|
|
105
105
|
end
|
|
106
106
|
return numCharges
|
|
107
107
|
end
|
|
108
|
-
function
|
|
108
|
+
function getChargesToAddWithAAAModifier(self, player, activeSlot, chargesToAdd)
|
|
109
109
|
local activeItem = player:GetActiveItem(activeSlot)
|
|
110
110
|
local activeCharge = player:GetActiveCharge(activeSlot)
|
|
111
111
|
local batteryCharge = player:GetBatteryCharge(activeSlot)
|
|
@@ -145,9 +145,9 @@ function shouldPlayFullRechargeSound(self, player, activeSlot)
|
|
|
145
145
|
local hasBattery = player:HasCollectible(CollectibleType.BATTERY)
|
|
146
146
|
local maxCharges = getCollectibleMaxCharges(nil, activeItem)
|
|
147
147
|
if not hasBattery then
|
|
148
|
-
return
|
|
148
|
+
return activeCharge == maxCharges
|
|
149
149
|
end
|
|
150
|
-
return
|
|
150
|
+
return batteryCharge == maxCharges or activeCharge == maxCharges and batteryCharge == 0
|
|
151
151
|
end
|
|
152
152
|
--- Helper function to add a charge to a player's active item(s), emulating what happens when a room
|
|
153
153
|
-- is cleared.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/**
|
|
2
|
+
* The coordinates correspond to the x and y values that are present in a room's XML file.
|
|
3
|
+
*
|
|
4
|
+
* e.g. `<door exists="False" x="-1" y="3" />`
|
|
5
|
+
*/
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
local ____lualib = require("lualib_bundle")
|
|
2
|
-
local Set = ____lualib.Set
|
|
3
|
-
local __TS__New = ____lualib.__TS__New
|
|
4
|
-
local ____exports = {}
|
|
5
|
-
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
6
|
-
local DoorSlot = ____isaac_2Dtypescript_2Ddefinitions.DoorSlot
|
|
7
|
-
local RoomShape = ____isaac_2Dtypescript_2Ddefinitions.RoomShape
|
|
8
|
-
local ALL_DOOR_SLOTS_SET = __TS__New(Set, {
|
|
9
|
-
DoorSlot.LEFT_0,
|
|
10
|
-
DoorSlot.UP_0,
|
|
11
|
-
DoorSlot.RIGHT_0,
|
|
12
|
-
DoorSlot.DOWN_0,
|
|
13
|
-
DoorSlot.LEFT_1,
|
|
14
|
-
DoorSlot.UP_1,
|
|
15
|
-
DoorSlot.RIGHT_1,
|
|
16
|
-
DoorSlot.DOWN_1
|
|
17
|
-
})
|
|
18
|
-
____exports.ROOM_SHAPE_TO_DOOR_SLOT_COORDINATES = {
|
|
19
|
-
[RoomShape.SHAPE_1x1] = __TS__New(Set, {DoorSlot.LEFT_0, DoorSlot.UP_0, DoorSlot.RIGHT_0, DoorSlot.DOWN_0}),
|
|
20
|
-
[RoomShape.IH] = __TS__New(Set, {DoorSlot.LEFT_0, DoorSlot.RIGHT_0}),
|
|
21
|
-
[RoomShape.IV] = __TS__New(Set, {DoorSlot.UP_0, DoorSlot.DOWN_0}),
|
|
22
|
-
[RoomShape.SHAPE_1x2] = __TS__New(Set, {
|
|
23
|
-
DoorSlot.LEFT_0,
|
|
24
|
-
DoorSlot.UP_0,
|
|
25
|
-
DoorSlot.RIGHT_0,
|
|
26
|
-
DoorSlot.DOWN_0,
|
|
27
|
-
DoorSlot.LEFT_1,
|
|
28
|
-
DoorSlot.RIGHT_1
|
|
29
|
-
}),
|
|
30
|
-
[RoomShape.IIV] = __TS__New(Set, {DoorSlot.UP_0, DoorSlot.DOWN_0}),
|
|
31
|
-
[RoomShape.SHAPE_2x1] = __TS__New(Set, {
|
|
32
|
-
DoorSlot.LEFT_0,
|
|
33
|
-
DoorSlot.UP_0,
|
|
34
|
-
DoorSlot.RIGHT_0,
|
|
35
|
-
DoorSlot.DOWN_0,
|
|
36
|
-
DoorSlot.UP_1,
|
|
37
|
-
DoorSlot.DOWN_1
|
|
38
|
-
}),
|
|
39
|
-
[RoomShape.IIH] = __TS__New(Set, {DoorSlot.LEFT_0, DoorSlot.RIGHT_0}),
|
|
40
|
-
[RoomShape.SHAPE_2x2] = ALL_DOOR_SLOTS_SET,
|
|
41
|
-
[RoomShape.LTL] = ALL_DOOR_SLOTS_SET,
|
|
42
|
-
[RoomShape.LTR] = ALL_DOOR_SLOTS_SET,
|
|
43
|
-
[RoomShape.LBL] = ALL_DOOR_SLOTS_SET,
|
|
44
|
-
[RoomShape.LBR] = ALL_DOOR_SLOTS_SET
|
|
45
|
-
}
|
|
46
|
-
return ____exports
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.2",
|
|
4
4
|
"description": "Helper functions and features for IsaacScript mods.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"isaac",
|
|
@@ -22,6 +22,6 @@
|
|
|
22
22
|
"main": "index",
|
|
23
23
|
"types": "index.d.ts",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"isaac-typescript-definitions": "^3.0.
|
|
25
|
+
"isaac-typescript-definitions": "^3.0.18"
|
|
26
26
|
}
|
|
27
27
|
}
|