isaacscript-common 1.2.135 → 1.2.138
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/customRevive.lua +1 -0
- package/dist/callbacks/postCustomDoorEnter.d.ts +8 -0
- package/dist/callbacks/postCustomDoorEnter.lua +35 -0
- package/dist/callbacks/postPlayerChangeHealth.lua +4 -64
- package/dist/callbacks/subscriptions/postCustomDoorEnter.d.ts +2 -0
- package/dist/callbacks/subscriptions/postCustomDoorEnter.lua +25 -0
- package/dist/constants.d.ts +5 -0
- package/dist/constants.lua +1 -0
- package/dist/features/extraConsoleCommands/commands.d.ts +250 -0
- package/dist/features/extraConsoleCommands/commands.lua +658 -0
- package/dist/features/extraConsoleCommands/init.d.ts +25 -0
- package/dist/features/extraConsoleCommands/init.lua +153 -0
- package/dist/features/extraConsoleCommands/v.d.ts +9 -0
- package/dist/features/extraConsoleCommands/v.lua +5 -0
- package/dist/functions/log.d.ts +5 -1
- package/dist/functions/log.lua +172 -2
- package/dist/functions/map.d.ts +16 -0
- package/dist/functions/map.lua +24 -0
- package/dist/functions/player.d.ts +2 -2
- package/dist/functions/playerHealth.d.ts +3 -0
- package/dist/functions/playerHealth.lua +142 -0
- package/dist/functions/run.d.ts +12 -0
- package/dist/functions/run.lua +25 -0
- package/dist/functions/utils.d.ts +0 -6
- package/dist/functions/utils.lua +0 -8
- package/dist/functions/vector.lua +8 -8
- package/dist/index.d.ts +6 -0
- package/dist/index.lua +46 -0
- package/dist/maps/cardMap.d.ts +3 -0
- package/dist/maps/cardMap.lua +202 -0
- package/dist/maps/characterMap.d.ts +3 -0
- package/dist/maps/characterMap.lua +90 -0
- package/dist/maps/pillEffectMap.d.ts +3 -0
- package/dist/maps/pillEffectMap.lua +88 -0
- package/dist/types/CallbackParametersCustom.d.ts +4 -0
- package/dist/types/HealthType.d.ts +4 -2
- package/dist/types/HealthType.lua +3 -1
- package/dist/types/ModCallbacksCustom.d.ts +2 -1
- package/dist/types/ModCallbacksCustom.lua +2 -0
- package/dist/types/ModUpgraded.lua +8 -0
- package/dist/types/PlayerIndex.d.ts +2 -2
- package/dist/upgradeMod.lua +3 -0
- package/package.json +1 -1
|
@@ -0,0 +1,153 @@
|
|
|
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 ____exports = {}
|
|
6
|
+
local postUpdate, evaluateCacheSpeed, entityTakeDmgPlayer, executeCmd, postFireTear, commandFunctionsMap
|
|
7
|
+
local ____constants = require("constants")
|
|
8
|
+
local MAX_SPEED_STAT = ____constants.MAX_SPEED_STAT
|
|
9
|
+
local ____map = require("functions.map")
|
|
10
|
+
local getMapPartialMatch = ____map.getMapPartialMatch
|
|
11
|
+
local ____utils = require("functions.utils")
|
|
12
|
+
local printConsole = ____utils.printConsole
|
|
13
|
+
local ____exports = require("features.saveDataManager.exports")
|
|
14
|
+
local saveDataManager = ____exports.saveDataManager
|
|
15
|
+
local commands = require("features.extraConsoleCommands.commands")
|
|
16
|
+
local ____v = require("features.extraConsoleCommands.v")
|
|
17
|
+
local v = ____v.default
|
|
18
|
+
function postUpdate(self)
|
|
19
|
+
if v.run.spamBloodRights then
|
|
20
|
+
local player = Isaac.GetPlayer()
|
|
21
|
+
player:UseActiveItem(CollectibleType.COLLECTIBLE_BLOOD_RIGHTS)
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
function evaluateCacheSpeed(self, player)
|
|
25
|
+
if v.run.maxSpeed then
|
|
26
|
+
player.MoveSpeed = MAX_SPEED_STAT
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
function entityTakeDmgPlayer(self)
|
|
30
|
+
if v.run.spamBloodRights then
|
|
31
|
+
return false
|
|
32
|
+
end
|
|
33
|
+
return nil
|
|
34
|
+
end
|
|
35
|
+
function executeCmd(self, command, params)
|
|
36
|
+
local commandFunction = getMapPartialMatch(nil, command, commandFunctionsMap)
|
|
37
|
+
if commandFunction == nil then
|
|
38
|
+
printConsole(nil, "That is an invalid console command.")
|
|
39
|
+
else
|
|
40
|
+
commandFunction(nil, params)
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
function postFireTear(self, tear)
|
|
44
|
+
if v.run.chaosCardTears then
|
|
45
|
+
tear:ChangeVariant(TearVariant.CHAOS_CARD)
|
|
46
|
+
end
|
|
47
|
+
if v.run.maxDamage then
|
|
48
|
+
tear.CollisionDamage = tear.CollisionDamage * 1000
|
|
49
|
+
tear:ChangeVariant(TearVariant.TOOTH)
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
commandFunctionsMap = __TS__New(Map)
|
|
53
|
+
local initialized = false
|
|
54
|
+
function ____exports.enableExtraConsoleCommands(self, mod)
|
|
55
|
+
initialized = true
|
|
56
|
+
saveDataManager(nil, "extraConsoleCommands", v)
|
|
57
|
+
mod:AddCallback(ModCallbacks.MC_POST_UPDATE, postUpdate)
|
|
58
|
+
mod:AddCallback(ModCallbacks.MC_EVALUATE_CACHE, evaluateCacheSpeed, CacheFlag.CACHE_SPEED)
|
|
59
|
+
mod:AddCallback(ModCallbacks.MC_ENTITY_TAKE_DMG, entityTakeDmgPlayer, EntityType.ENTITY_PLAYER)
|
|
60
|
+
mod:AddCallback(ModCallbacks.MC_EXECUTE_CMD, executeCmd)
|
|
61
|
+
mod:AddCallback(ModCallbacks.MC_POST_FIRE_TEAR, postFireTear)
|
|
62
|
+
end
|
|
63
|
+
function ____exports.addConsoleCommand(self, commandName, commandFunction)
|
|
64
|
+
if not initialized then
|
|
65
|
+
error("Before adding extra console commands, you must first enable the feature by invoking the \"enableExtraConsoleCommands\" function.")
|
|
66
|
+
end
|
|
67
|
+
if commandFunctionsMap:has(commandName) then
|
|
68
|
+
error(("You cannot add a new console command of \"" .. commandName) .. "\" because there is already an existing command by that name. If you want to overwrite a command from the standard library, you can use the \"removeExtraConsoleCommand\" function.")
|
|
69
|
+
end
|
|
70
|
+
commandFunctionsMap:set(commandName, commandFunction)
|
|
71
|
+
end
|
|
72
|
+
function ____exports.removeConsoleCommand(self, commandName)
|
|
73
|
+
if not initialized then
|
|
74
|
+
error("Before removing console commands, you must first enable the feature by invoking the \"enableExtraConsoleCommands\" function.")
|
|
75
|
+
end
|
|
76
|
+
if not commandFunctionsMap:has(commandName) then
|
|
77
|
+
error(("The console command of \"" .. commandName) .. "\" does not exist, so you cannot remove it.")
|
|
78
|
+
end
|
|
79
|
+
commandFunctionsMap:delete(commandName)
|
|
80
|
+
end
|
|
81
|
+
commandFunctionsMap:set("angel", commands.angel)
|
|
82
|
+
commandFunctionsMap:set("ascent", commands.ascent)
|
|
83
|
+
commandFunctionsMap:set("bh", commands.bh)
|
|
84
|
+
commandFunctionsMap:set("blackhearts", commands.blackHearts)
|
|
85
|
+
commandFunctionsMap:set("blackmarket", commands.blackMarket)
|
|
86
|
+
commandFunctionsMap:set("bloodcharges", commands.bloodCharges)
|
|
87
|
+
commandFunctionsMap:set("bomb", commands.bomb)
|
|
88
|
+
commandFunctionsMap:set("bombs", commands.bombs)
|
|
89
|
+
commandFunctionsMap:set("bonehearts", commands.boneHearts)
|
|
90
|
+
commandFunctionsMap:set("boss", commands.boss)
|
|
91
|
+
commandFunctionsMap:set("bm", commands.bm)
|
|
92
|
+
commandFunctionsMap:set("brokenhearts", commands.brokenHearts)
|
|
93
|
+
commandFunctionsMap:set("card", commands.card)
|
|
94
|
+
commandFunctionsMap:set("cards", commands.cards)
|
|
95
|
+
commandFunctionsMap:set("cc", commands.cc)
|
|
96
|
+
commandFunctionsMap:set("chaoscardtears", commands.chaosCardTears)
|
|
97
|
+
commandFunctionsMap:set("character", commands.characterCommand)
|
|
98
|
+
commandFunctionsMap:set("coin", commands.coin)
|
|
99
|
+
commandFunctionsMap:set("coins", commands.coins)
|
|
100
|
+
commandFunctionsMap:set("crawlspace", commands.crawlspace)
|
|
101
|
+
commandFunctionsMap:set("d6", commands.d6)
|
|
102
|
+
commandFunctionsMap:set("d20", commands.d20)
|
|
103
|
+
commandFunctionsMap:set("damage", commands.damage)
|
|
104
|
+
commandFunctionsMap:set("dd", commands.dd)
|
|
105
|
+
commandFunctionsMap:set("devil", commands.devil)
|
|
106
|
+
commandFunctionsMap:set("down", commands.down)
|
|
107
|
+
commandFunctionsMap:set("effects", commands.effects)
|
|
108
|
+
commandFunctionsMap:set("eh", commands.eh)
|
|
109
|
+
commandFunctionsMap:set("error", commands.error)
|
|
110
|
+
commandFunctionsMap:set("eternalhearts", commands.eternalHearts)
|
|
111
|
+
commandFunctionsMap:set("fool", commands.fool)
|
|
112
|
+
commandFunctionsMap:set("goldbomb", commands.goldBomb)
|
|
113
|
+
commandFunctionsMap:set("goldenbomb", commands.goldenBomb)
|
|
114
|
+
commandFunctionsMap:set("goldkey", commands.goldKey)
|
|
115
|
+
commandFunctionsMap:set("goldenkey", commands.goldenKey)
|
|
116
|
+
commandFunctionsMap:set("h", commands.h)
|
|
117
|
+
commandFunctionsMap:set("hearts", commands.hearts)
|
|
118
|
+
commandFunctionsMap:set("iamerror", commands.IAMERROR)
|
|
119
|
+
commandFunctionsMap:set("key", commands.key)
|
|
120
|
+
commandFunctionsMap:set("keys", commands.keys)
|
|
121
|
+
commandFunctionsMap:set("list", commands.list)
|
|
122
|
+
commandFunctionsMap:set("listall", commands.listAll)
|
|
123
|
+
commandFunctionsMap:set("listgrid", commands.listGrid)
|
|
124
|
+
commandFunctionsMap:set("listgridall", commands.listGridAll)
|
|
125
|
+
commandFunctionsMap:set("lowhp", commands.lowHP)
|
|
126
|
+
commandFunctionsMap:set("luck", commands.luck)
|
|
127
|
+
commandFunctionsMap:set("maxhearts", commands.maxHearts)
|
|
128
|
+
commandFunctionsMap:set("mh", commands.mh)
|
|
129
|
+
commandFunctionsMap:set("pill", commands.pill)
|
|
130
|
+
commandFunctionsMap:set("pills", commands.pills)
|
|
131
|
+
commandFunctionsMap:set("planetarium", commands.planetarium)
|
|
132
|
+
commandFunctionsMap:set("pocket", commands.pocket)
|
|
133
|
+
commandFunctionsMap:set("position", commands.positionCommand)
|
|
134
|
+
commandFunctionsMap:set("redhearts", commands.redHearts)
|
|
135
|
+
commandFunctionsMap:set("rh", commands.rh)
|
|
136
|
+
commandFunctionsMap:set("room", commands.roomCommand)
|
|
137
|
+
commandFunctionsMap:set("rottenhearts", commands.rottenHearts)
|
|
138
|
+
commandFunctionsMap:set("s", commands.s)
|
|
139
|
+
commandFunctionsMap:set("seeds", commands.seeds)
|
|
140
|
+
commandFunctionsMap:set("sh", commands.sh)
|
|
141
|
+
commandFunctionsMap:set("shop", commands.shop)
|
|
142
|
+
commandFunctionsMap:set("smelt", commands.smelt)
|
|
143
|
+
commandFunctionsMap:set("soulcharges", commands.soulCharges)
|
|
144
|
+
commandFunctionsMap:set("soulhearts", commands.soulHearts)
|
|
145
|
+
commandFunctionsMap:set("sound", commands.sound)
|
|
146
|
+
commandFunctionsMap:set("sounds", commands.sounds)
|
|
147
|
+
commandFunctionsMap:set("spam", commands.spam)
|
|
148
|
+
commandFunctionsMap:set("speed", commands.speed)
|
|
149
|
+
commandFunctionsMap:set("startingroom", commands.startingRoom)
|
|
150
|
+
commandFunctionsMap:set("trapdoor", commands.trapdoorCommand)
|
|
151
|
+
commandFunctionsMap:set("treasure", commands.treasure)
|
|
152
|
+
commandFunctionsMap:set("ultra", commands.ultra)
|
|
153
|
+
return ____exports
|
package/dist/functions/log.d.ts
CHANGED
|
@@ -36,11 +36,15 @@ export declare function logAllUseFlags(this: void, _flags: int): void;
|
|
|
36
36
|
export declare function logArray<T>(this: void, array: T[]): void;
|
|
37
37
|
export declare function logColor(this: void, color: Color): void;
|
|
38
38
|
export declare function logEntity(this: void, entity: Entity): void;
|
|
39
|
+
export declare function logEntities(this: void, includeBackgroundEffects: boolean, entityTypeFilter?: EntityType | int): void;
|
|
40
|
+
export declare function logGridEntities(this: void, includeWalls: boolean, gridEntityTypeFilter?: GridEntityType | int): void;
|
|
39
41
|
export declare function logKColor(this: void, kColor: KColor): void;
|
|
40
42
|
export declare function logMap(this: void, map: Map<AnyNotNil, unknown>): void;
|
|
41
43
|
export declare function logPlayerHealth(this: void, player: EntityPlayer): void;
|
|
42
|
-
/** Helper function for
|
|
44
|
+
/** Helper function for logging information about the current room. */
|
|
43
45
|
export declare function logRoom(this: void): void;
|
|
46
|
+
/** Helper function for logging every sound effect that is currently playing. */
|
|
47
|
+
export declare function logSounds(this: void): void;
|
|
44
48
|
export declare function logTable(this: void, table: unknown, parentTables?: number): void;
|
|
45
49
|
export declare function logTemporaryEffects(this: void, player: EntityPlayer): void;
|
|
46
50
|
export declare function logSet(this: void, set: Set<AnyNotNil>): void;
|
package/dist/functions/log.lua
CHANGED
|
@@ -1,19 +1,28 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
2
|
local ____lualib = require("lualib_bundle")
|
|
3
|
+
local Set = ____lualib.Set
|
|
4
|
+
local __TS__New = ____lualib.__TS__New
|
|
5
|
+
local __TS__ArrayForEach = ____lualib.__TS__ArrayForEach
|
|
3
6
|
local Map = ____lualib.Map
|
|
4
7
|
local __TS__Spread = ____lualib.__TS__Spread
|
|
5
8
|
local __TS__ArraySort = ____lualib.__TS__ArraySort
|
|
6
|
-
local __TS__ArrayForEach = ____lualib.__TS__ArrayForEach
|
|
7
|
-
local Set = ____lualib.Set
|
|
8
9
|
local ____exports = {}
|
|
9
10
|
local ____cachedClasses = require("cachedClasses")
|
|
10
11
|
local game = ____cachedClasses.game
|
|
12
|
+
local sfxManager = ____cachedClasses.sfxManager
|
|
11
13
|
local ____array = require("functions.array")
|
|
12
14
|
local arrayToString = ____array.arrayToString
|
|
13
15
|
local ____collectibles = require("functions.collectibles")
|
|
14
16
|
local getCollectibleName = ____collectibles.getCollectibleName
|
|
17
|
+
local ____entity = require("functions.entity")
|
|
18
|
+
local getEntities = ____entity.getEntities
|
|
19
|
+
local getEntityID = ____entity.getEntityID
|
|
15
20
|
local ____flag = require("functions.flag")
|
|
16
21
|
local hasFlag = ____flag.hasFlag
|
|
22
|
+
local ____gridEntity = require("functions.gridEntity")
|
|
23
|
+
local getGridEntities = ____gridEntity.getGridEntities
|
|
24
|
+
local ____math = require("functions.math")
|
|
25
|
+
local range = ____math.range
|
|
17
26
|
local ____player = require("functions.player")
|
|
18
27
|
local getEffectsList = ____player.getEffectsList
|
|
19
28
|
local getPlayerName = ____player.getPlayerName
|
|
@@ -65,6 +74,17 @@ function ____exports.logAllFlags(flags, flagEnum, description)
|
|
|
65
74
|
____exports.log(" n/a (no flags)")
|
|
66
75
|
end
|
|
67
76
|
end
|
|
77
|
+
local IGNORE_EFFECT_VARIANTS = __TS__New(Set, {
|
|
78
|
+
EffectVariant.BLOOD_EXPLOSION,
|
|
79
|
+
EffectVariant.BLOOD_PARTICLE,
|
|
80
|
+
EffectVariant.TINY_BUG,
|
|
81
|
+
EffectVariant.TINY_FLY,
|
|
82
|
+
EffectVariant.WATER_DROPLET,
|
|
83
|
+
EffectVariant.WALL_BUG,
|
|
84
|
+
EffectVariant.FALLING_EMBER,
|
|
85
|
+
EffectVariant.LIGHT,
|
|
86
|
+
EffectVariant.TADPOLE
|
|
87
|
+
})
|
|
68
88
|
function ____exports.logAllDamageFlags(flags)
|
|
69
89
|
____exports.logAllFlags(flags, DamageFlag, "damage")
|
|
70
90
|
end
|
|
@@ -120,6 +140,145 @@ end
|
|
|
120
140
|
function ____exports.logEntity(entity)
|
|
121
141
|
____exports.log((((("Entity: " .. tostring(entity.Type)) .. ".") .. tostring(entity.Variant)) .. ".") .. tostring(entity.SubType))
|
|
122
142
|
end
|
|
143
|
+
function ____exports.logEntities(includeBackgroundEffects, entityTypeFilter)
|
|
144
|
+
local headerMsg = "Entities in the room"
|
|
145
|
+
if entityTypeFilter ~= nil then
|
|
146
|
+
headerMsg = headerMsg .. (" (filtered to entity type " .. tostring(entityTypeFilter)) .. ")"
|
|
147
|
+
end
|
|
148
|
+
if not includeBackgroundEffects then
|
|
149
|
+
headerMsg = headerMsg .. " (not excluding background effects)"
|
|
150
|
+
end
|
|
151
|
+
headerMsg = headerMsg .. ":"
|
|
152
|
+
____exports.log(headerMsg)
|
|
153
|
+
local entities = getEntities(nil)
|
|
154
|
+
local numMatchedEntities = 0
|
|
155
|
+
__TS__ArrayForEach(
|
|
156
|
+
entities,
|
|
157
|
+
function(____, entity, i)
|
|
158
|
+
if entityTypeFilter ~= nil and entity.Type ~= entityTypeFilter then
|
|
159
|
+
return
|
|
160
|
+
end
|
|
161
|
+
if not includeBackgroundEffects and entity.Type == EntityType.ENTITY_EFFECT and IGNORE_EFFECT_VARIANTS:has(entity.Variant) then
|
|
162
|
+
return
|
|
163
|
+
end
|
|
164
|
+
local entityID = getEntityID(nil, entity)
|
|
165
|
+
local debugString = (tostring(i + 1) .. " - ") .. entityID
|
|
166
|
+
local bomb = entity:ToBomb()
|
|
167
|
+
if bomb ~= nil then
|
|
168
|
+
debugString = debugString .. " (bomb)"
|
|
169
|
+
end
|
|
170
|
+
local effect = entity:ToEffect()
|
|
171
|
+
if effect ~= nil then
|
|
172
|
+
debugString = debugString .. ("." .. tostring(effect.State)) .. " (effect)"
|
|
173
|
+
end
|
|
174
|
+
local familiar = entity:ToFamiliar()
|
|
175
|
+
if familiar ~= nil then
|
|
176
|
+
debugString = debugString .. ("." .. tostring(familiar.State)) .. " (familiar)"
|
|
177
|
+
end
|
|
178
|
+
local knife = entity:ToKnife()
|
|
179
|
+
if knife ~= nil then
|
|
180
|
+
debugString = debugString .. " (knife)"
|
|
181
|
+
end
|
|
182
|
+
local laser = entity:ToLaser()
|
|
183
|
+
if laser ~= nil then
|
|
184
|
+
debugString = debugString .. " (laser)"
|
|
185
|
+
end
|
|
186
|
+
local npc = entity:ToNPC()
|
|
187
|
+
if npc ~= nil then
|
|
188
|
+
debugString = debugString .. ((("." .. tostring(npc.State)) .. " (NPC) (CanShutDoors: ") .. tostring(npc.CanShutDoors)) .. ")"
|
|
189
|
+
end
|
|
190
|
+
local pickup = entity:ToPickup()
|
|
191
|
+
if pickup ~= nil then
|
|
192
|
+
debugString = debugString .. ("." .. tostring(pickup.State)) .. " (pickup)"
|
|
193
|
+
end
|
|
194
|
+
local player = entity:ToPlayer()
|
|
195
|
+
if player ~= nil then
|
|
196
|
+
debugString = debugString .. " (player)"
|
|
197
|
+
end
|
|
198
|
+
local projectile = entity:ToProjectile()
|
|
199
|
+
if projectile ~= nil then
|
|
200
|
+
debugString = debugString .. " (projectile)"
|
|
201
|
+
end
|
|
202
|
+
local tear = entity:ToTear()
|
|
203
|
+
if tear ~= nil then
|
|
204
|
+
debugString = debugString .. " (tear)"
|
|
205
|
+
end
|
|
206
|
+
debugString = debugString .. (" (InitSeed: " .. tostring(entity.InitSeed)) .. ")"
|
|
207
|
+
debugString = debugString .. (" (DropSeed: " .. tostring(entity.DropSeed)) .. ")"
|
|
208
|
+
debugString = debugString .. (((" (Position: " .. tostring(entity.Position.X)) .. ", ") .. tostring(entity.Position.Y)) .. ")"
|
|
209
|
+
debugString = debugString .. (((" (Velocity: " .. tostring(entity.Velocity.X)) .. ", ") .. tostring(entity.Velocity.Y)) .. ")"
|
|
210
|
+
____exports.log(debugString)
|
|
211
|
+
numMatchedEntities = numMatchedEntities + 1
|
|
212
|
+
end
|
|
213
|
+
)
|
|
214
|
+
if numMatchedEntities == 0 then
|
|
215
|
+
____exports.log("(no entities matched)")
|
|
216
|
+
end
|
|
217
|
+
end
|
|
218
|
+
function ____exports.logGridEntities(includeWalls, gridEntityTypeFilter)
|
|
219
|
+
local headerMsg = "Grid entities in the room"
|
|
220
|
+
if gridEntityTypeFilter ~= nil then
|
|
221
|
+
headerMsg = headerMsg .. (" (filtered to grid entity type " .. tostring(gridEntityTypeFilter)) .. ")"
|
|
222
|
+
end
|
|
223
|
+
if not includeWalls then
|
|
224
|
+
headerMsg = headerMsg .. " (not including walls)"
|
|
225
|
+
end
|
|
226
|
+
____exports.log(headerMsg)
|
|
227
|
+
local gridEntities = getGridEntities(nil)
|
|
228
|
+
local numMatchedEntities = 0
|
|
229
|
+
__TS__ArrayForEach(
|
|
230
|
+
gridEntities,
|
|
231
|
+
function(____, gridEntity)
|
|
232
|
+
local gridEntityIndex = gridEntity:GetGridIndex()
|
|
233
|
+
local gridEntityType = gridEntity:GetType()
|
|
234
|
+
local gridEntityVariant = gridEntity:GetVariant()
|
|
235
|
+
local gridEntityDesc = gridEntity:GetSaveState()
|
|
236
|
+
if gridEntityTypeFilter ~= nil and gridEntityType ~= gridEntityTypeFilter then
|
|
237
|
+
return
|
|
238
|
+
end
|
|
239
|
+
if not includeWalls and gridEntityType == GridEntityType.GRID_WALL and gridEntityTypeFilter ~= GridEntityType.GRID_WALL then
|
|
240
|
+
return
|
|
241
|
+
end
|
|
242
|
+
local debugString = (((((tostring(gridEntityIndex) .. " - ") .. tostring(gridEntityType)) .. ".") .. tostring(gridEntityVariant)) .. ".") .. tostring(gridEntity.State)
|
|
243
|
+
local door = gridEntity:ToDoor()
|
|
244
|
+
if door ~= nil then
|
|
245
|
+
debugString = debugString .. (((((((" (door) (Slot: " .. tostring(door.Slot)) .. ", Direction: ") .. tostring(door.Direction)) .. ", TargetRoomIndex: ") .. tostring(door.TargetRoomIndex)) .. ", TargetRoomType: ") .. tostring(door.TargetRoomType)) .. ")"
|
|
246
|
+
end
|
|
247
|
+
local pit = gridEntity:ToPit()
|
|
248
|
+
if pit ~= nil then
|
|
249
|
+
debugString = debugString .. " (pit)"
|
|
250
|
+
end
|
|
251
|
+
local poop = gridEntity:ToPoop()
|
|
252
|
+
if poop ~= nil then
|
|
253
|
+
debugString = debugString .. " (poop)"
|
|
254
|
+
end
|
|
255
|
+
local pressurePlate = gridEntity:ToPressurePlate()
|
|
256
|
+
if pressurePlate ~= nil then
|
|
257
|
+
debugString = debugString .. " (pressurePlate)"
|
|
258
|
+
end
|
|
259
|
+
local rock = gridEntity:ToRock()
|
|
260
|
+
if rock ~= nil then
|
|
261
|
+
debugString = debugString .. " (rock)"
|
|
262
|
+
end
|
|
263
|
+
local spikes = gridEntity:ToSpikes()
|
|
264
|
+
if spikes ~= nil then
|
|
265
|
+
debugString = debugString .. " (spikes)"
|
|
266
|
+
end
|
|
267
|
+
local tnt = gridEntity:ToTNT()
|
|
268
|
+
if tnt ~= nil then
|
|
269
|
+
debugString = debugString .. " (TNT)"
|
|
270
|
+
end
|
|
271
|
+
debugString = debugString .. (" (VarData: " .. tostring(gridEntity.VarData)) .. ")"
|
|
272
|
+
debugString = debugString .. (((" (Position: " .. tostring(gridEntity.Position.X)) .. ", ") .. tostring(gridEntity.Position.Y)) .. ")"
|
|
273
|
+
debugString = debugString .. (((" (SpawnSeed: " .. tostring(gridEntityDesc.SpawnSeed)) .. ", VariableSeed: ") .. tostring(gridEntityDesc.VariableSeed)) .. ")"
|
|
274
|
+
____exports.log(debugString)
|
|
275
|
+
numMatchedEntities = numMatchedEntities + 1
|
|
276
|
+
end
|
|
277
|
+
)
|
|
278
|
+
if numMatchedEntities == 0 then
|
|
279
|
+
____exports.log("(no grid entities matched)")
|
|
280
|
+
end
|
|
281
|
+
end
|
|
123
282
|
function ____exports.logKColor(kColor)
|
|
124
283
|
____exports.log((((((("Color: R" .. tostring(kColor.Red)) .. ", G") .. tostring(kColor.Green)) .. ", B") .. tostring(kColor.Blue)) .. ", A") .. tostring(kColor.Alpha))
|
|
125
284
|
end
|
|
@@ -161,6 +320,13 @@ function ____exports.logRoom()
|
|
|
161
320
|
____exports.log("Current room grid index: " .. tostring(roomGridIndex))
|
|
162
321
|
____exports.log("Current room list index: " .. tostring(roomListIndex))
|
|
163
322
|
end
|
|
323
|
+
function ____exports.logSounds()
|
|
324
|
+
for ____, soundEffect in ipairs(range(nil, 0, SoundEffect.NUM_SOUND_EFFECTS - 1)) do
|
|
325
|
+
if sfxManager:IsPlaying(soundEffect) then
|
|
326
|
+
____exports.log("Currently playing sound effect: " .. tostring(soundEffect))
|
|
327
|
+
end
|
|
328
|
+
end
|
|
329
|
+
end
|
|
164
330
|
function ____exports.logTable(____table, parentTables)
|
|
165
331
|
if parentTables == nil then
|
|
166
332
|
parentTables = 0
|
|
@@ -233,11 +399,15 @@ function ____exports.setLogFunctionsGlobal(self)
|
|
|
233
399
|
globals.logArray = ____exports.logArray
|
|
234
400
|
globals.logColor = ____exports.logColor
|
|
235
401
|
globals.logEntity = ____exports.logEntity
|
|
402
|
+
globals.logEntities = ____exports.logEntities
|
|
403
|
+
globals.logGridEntities = ____exports.logGridEntities
|
|
236
404
|
globals.logKColor = ____exports.logKColor
|
|
237
405
|
globals.logMap = ____exports.logMap
|
|
406
|
+
globals.logRoom = ____exports.logRoom
|
|
238
407
|
globals.logTable = ____exports.logTable
|
|
239
408
|
globals.logTemporaryEffects = ____exports.logTemporaryEffects
|
|
240
409
|
globals.logSet = ____exports.logSet
|
|
410
|
+
globals.logSounds = ____exports.logSounds
|
|
241
411
|
globals.logVector = ____exports.logVector
|
|
242
412
|
end
|
|
243
413
|
return ____exports
|
package/dist/functions/map.d.ts
CHANGED
|
@@ -7,6 +7,22 @@ export declare function copyMap<K, V>(oldMap: Map<K, V>): Map<K, V>;
|
|
|
7
7
|
* manually getting the current value, incrementing it, and then setting it.
|
|
8
8
|
*/
|
|
9
9
|
export declare function defaultMapGetNextSeed<K, A extends unknown[]>(map: DefaultMap<K, Seed, A>, key: K, ...extraArgs: A): Seed;
|
|
10
|
+
/**
|
|
11
|
+
* Helper function to get the closest value from a map based on partial search text. For the
|
|
12
|
+
* purposes of this function, both search text and map keys are converted to lowercase before
|
|
13
|
+
* attempting to find a match.
|
|
14
|
+
*
|
|
15
|
+
* Example:
|
|
16
|
+
* ```ts
|
|
17
|
+
* const map = new <string, number>Map([
|
|
18
|
+
* ["foo", 123],
|
|
19
|
+
* ["bar", 456],
|
|
20
|
+
* ]);
|
|
21
|
+
* const searchText = "f";
|
|
22
|
+
* const match = getMapPartialMatch(map, searchText); // match is now equal to 123
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare function getMapPartialMatch<T>(searchText: string, map: ReadonlyMap<string, T>): T | undefined;
|
|
10
26
|
/**
|
|
11
27
|
* Helper function to make using maps with `Seed` values easier. Use this instead of manually
|
|
12
28
|
* getting the current value, incrementing it, and then setting it.
|
package/dist/functions/map.lua
CHANGED
|
@@ -3,6 +3,11 @@ local ____lualib = require("lualib_bundle")
|
|
|
3
3
|
local Map = ____lualib.Map
|
|
4
4
|
local __TS__New = ____lualib.__TS__New
|
|
5
5
|
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
6
|
+
local __TS__Spread = ____lualib.__TS__Spread
|
|
7
|
+
local __TS__ArraySort = ____lualib.__TS__ArraySort
|
|
8
|
+
local __TS__StringReplaceAll = ____lualib.__TS__StringReplaceAll
|
|
9
|
+
local __TS__StringStartsWith = ____lualib.__TS__StringStartsWith
|
|
10
|
+
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
6
11
|
local ____exports = {}
|
|
7
12
|
local ____random = require("functions.random")
|
|
8
13
|
local nextSeed = ____random.nextSeed
|
|
@@ -24,6 +29,25 @@ function ____exports.defaultMapGetNextSeed(self, map, key, ...)
|
|
|
24
29
|
map:set(key, newSeed)
|
|
25
30
|
return newSeed
|
|
26
31
|
end
|
|
32
|
+
function ____exports.getMapPartialMatch(self, searchText, map)
|
|
33
|
+
local keys = {__TS__Spread(map:keys())}
|
|
34
|
+
__TS__ArraySort(keys)
|
|
35
|
+
searchText = string.lower(searchText)
|
|
36
|
+
searchText = __TS__StringReplaceAll(searchText, " ", "")
|
|
37
|
+
local matchingKeys = __TS__ArrayFilter(
|
|
38
|
+
keys,
|
|
39
|
+
function(____, key) return __TS__StringStartsWith(
|
|
40
|
+
string.lower(key),
|
|
41
|
+
searchText
|
|
42
|
+
) end
|
|
43
|
+
)
|
|
44
|
+
__TS__ArraySort(matchingKeys)
|
|
45
|
+
local matchingKey = matchingKeys[1]
|
|
46
|
+
if matchingKey == nil then
|
|
47
|
+
return nil
|
|
48
|
+
end
|
|
49
|
+
return map:get(matchingKey)
|
|
50
|
+
end
|
|
27
51
|
function ____exports.mapGetNextSeed(self, map, key)
|
|
28
52
|
local seed = map:get(key)
|
|
29
53
|
if seed == nil then
|
|
@@ -101,8 +101,8 @@ export declare function getFinalPlayer(): EntityPlayer;
|
|
|
101
101
|
*/
|
|
102
102
|
export declare function getHearts(player: EntityPlayer): int;
|
|
103
103
|
/**
|
|
104
|
-
* Helper function that returns the type of the rightmost heart
|
|
105
|
-
* they
|
|
104
|
+
* Helper function that returns the type of the rightmost heart. This does not including golden
|
|
105
|
+
* hearts or broken hearts, since they cannot be damaged directly.
|
|
106
106
|
*/
|
|
107
107
|
export declare function getLastHeart(player: EntityPlayer): HealthType;
|
|
108
108
|
/**
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
+
import { HealthType } from "../types/HealthType";
|
|
2
3
|
import { PlayerHealth } from "../types/PlayerHealth";
|
|
4
|
+
export declare function addPlayerHealthType(player: EntityPlayer, healthType: HealthType, numHearts: int): void;
|
|
3
5
|
/**
|
|
4
6
|
* Helper function to get an inventory of the player's health. Use this in combination with the
|
|
5
7
|
* `setPlayerHealth` function to restore the player's health back to a certain configuration at a
|
|
@@ -8,6 +10,7 @@ import { PlayerHealth } from "../types/PlayerHealth";
|
|
|
8
10
|
* This is based on the `REVEL.StoreHealth` function in the Revelations mod.
|
|
9
11
|
*/
|
|
10
12
|
export declare function getPlayerHealth(player: EntityPlayer): PlayerHealth;
|
|
13
|
+
export declare function getPlayerHealthType(player: EntityPlayer, healthType: HealthType): int;
|
|
11
14
|
/**
|
|
12
15
|
* Helper function to set a player's health to a specific state. You can use this in combination
|
|
13
16
|
* with the `getPlayerHealth` function to restore the player's health back to a certain
|
|
@@ -5,9 +5,14 @@ local __TS__ArrayForEach = ____lualib.__TS__ArrayForEach
|
|
|
5
5
|
local ____exports = {}
|
|
6
6
|
local ____constants = require("constants")
|
|
7
7
|
local MAX_PLAYER_HEART_CONTAINERS = ____constants.MAX_PLAYER_HEART_CONTAINERS
|
|
8
|
+
local ____HealthType = require("types.HealthType")
|
|
9
|
+
local HealthType = ____HealthType.HealthType
|
|
8
10
|
local ____player = require("functions.player")
|
|
11
|
+
local getBlackHearts = ____player.getBlackHearts
|
|
9
12
|
local getHearts = ____player.getHearts
|
|
13
|
+
local getSoulHearts = ____player.getSoulHearts
|
|
10
14
|
local ____utils = require("functions.utils")
|
|
15
|
+
local ensureAllCases = ____utils.ensureAllCases
|
|
11
16
|
local ____repeat = ____utils["repeat"]
|
|
12
17
|
function ____exports.removeAllPlayerHealth(self, player)
|
|
13
18
|
local character = player:GetPlayerType()
|
|
@@ -29,6 +34,79 @@ function ____exports.removeAllPlayerHealth(self, player)
|
|
|
29
34
|
end
|
|
30
35
|
end
|
|
31
36
|
end
|
|
37
|
+
function ____exports.addPlayerHealthType(self, player, healthType, numHearts)
|
|
38
|
+
repeat
|
|
39
|
+
local ____switch3 = healthType
|
|
40
|
+
local ____cond3 = ____switch3 == HealthType.RED
|
|
41
|
+
if ____cond3 then
|
|
42
|
+
do
|
|
43
|
+
player:AddHearts(numHearts)
|
|
44
|
+
return
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
____cond3 = ____cond3 or ____switch3 == HealthType.SOUL
|
|
48
|
+
if ____cond3 then
|
|
49
|
+
do
|
|
50
|
+
player:AddSoulHearts(numHearts)
|
|
51
|
+
return
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
____cond3 = ____cond3 or ____switch3 == HealthType.ETERNAL
|
|
55
|
+
if ____cond3 then
|
|
56
|
+
do
|
|
57
|
+
player:AddEternalHearts(numHearts)
|
|
58
|
+
return
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
____cond3 = ____cond3 or ____switch3 == HealthType.BLACK
|
|
62
|
+
if ____cond3 then
|
|
63
|
+
do
|
|
64
|
+
player:AddBlackHearts(numHearts)
|
|
65
|
+
return
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
____cond3 = ____cond3 or ____switch3 == HealthType.GOLDEN
|
|
69
|
+
if ____cond3 then
|
|
70
|
+
do
|
|
71
|
+
player:AddGoldenHearts(numHearts)
|
|
72
|
+
return
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
____cond3 = ____cond3 or ____switch3 == HealthType.BONE
|
|
76
|
+
if ____cond3 then
|
|
77
|
+
do
|
|
78
|
+
player:AddBoneHearts(numHearts)
|
|
79
|
+
return
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
____cond3 = ____cond3 or ____switch3 == HealthType.ROTTEN
|
|
83
|
+
if ____cond3 then
|
|
84
|
+
do
|
|
85
|
+
player:AddRottenHearts(numHearts)
|
|
86
|
+
return
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
____cond3 = ____cond3 or ____switch3 == HealthType.BROKEN
|
|
90
|
+
if ____cond3 then
|
|
91
|
+
do
|
|
92
|
+
player:AddBrokenHearts(numHearts)
|
|
93
|
+
return
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
____cond3 = ____cond3 or ____switch3 == HealthType.MAX_HEARTS
|
|
97
|
+
if ____cond3 then
|
|
98
|
+
do
|
|
99
|
+
player:AddMaxHearts(numHearts, false)
|
|
100
|
+
return
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
do
|
|
104
|
+
do
|
|
105
|
+
ensureAllCases(nil, healthType)
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
until true
|
|
109
|
+
end
|
|
32
110
|
function ____exports.getPlayerHealth(self, player)
|
|
33
111
|
local character = player:GetPlayerType()
|
|
34
112
|
local soulHeartTypes = {}
|
|
@@ -91,6 +169,70 @@ function ____exports.getPlayerHealth(self, player)
|
|
|
91
169
|
soulHeartTypes = soulHeartTypes
|
|
92
170
|
}
|
|
93
171
|
end
|
|
172
|
+
function ____exports.getPlayerHealthType(self, player, healthType)
|
|
173
|
+
repeat
|
|
174
|
+
local ____switch25 = healthType
|
|
175
|
+
local ____cond25 = ____switch25 == HealthType.RED
|
|
176
|
+
if ____cond25 then
|
|
177
|
+
do
|
|
178
|
+
return getHearts(nil, player)
|
|
179
|
+
end
|
|
180
|
+
end
|
|
181
|
+
____cond25 = ____cond25 or ____switch25 == HealthType.SOUL
|
|
182
|
+
if ____cond25 then
|
|
183
|
+
do
|
|
184
|
+
return getSoulHearts(nil, player)
|
|
185
|
+
end
|
|
186
|
+
end
|
|
187
|
+
____cond25 = ____cond25 or ____switch25 == HealthType.ETERNAL
|
|
188
|
+
if ____cond25 then
|
|
189
|
+
do
|
|
190
|
+
return player:GetEternalHearts()
|
|
191
|
+
end
|
|
192
|
+
end
|
|
193
|
+
____cond25 = ____cond25 or ____switch25 == HealthType.BLACK
|
|
194
|
+
if ____cond25 then
|
|
195
|
+
do
|
|
196
|
+
return getBlackHearts(nil, player)
|
|
197
|
+
end
|
|
198
|
+
end
|
|
199
|
+
____cond25 = ____cond25 or ____switch25 == HealthType.GOLDEN
|
|
200
|
+
if ____cond25 then
|
|
201
|
+
do
|
|
202
|
+
return player:GetGoldenHearts()
|
|
203
|
+
end
|
|
204
|
+
end
|
|
205
|
+
____cond25 = ____cond25 or ____switch25 == HealthType.BONE
|
|
206
|
+
if ____cond25 then
|
|
207
|
+
do
|
|
208
|
+
return player:GetBoneHearts()
|
|
209
|
+
end
|
|
210
|
+
end
|
|
211
|
+
____cond25 = ____cond25 or ____switch25 == HealthType.ROTTEN
|
|
212
|
+
if ____cond25 then
|
|
213
|
+
do
|
|
214
|
+
return player:GetRottenHearts()
|
|
215
|
+
end
|
|
216
|
+
end
|
|
217
|
+
____cond25 = ____cond25 or ____switch25 == HealthType.BROKEN
|
|
218
|
+
if ____cond25 then
|
|
219
|
+
do
|
|
220
|
+
return player:GetBrokenHearts()
|
|
221
|
+
end
|
|
222
|
+
end
|
|
223
|
+
____cond25 = ____cond25 or ____switch25 == HealthType.MAX_HEARTS
|
|
224
|
+
if ____cond25 then
|
|
225
|
+
do
|
|
226
|
+
return player:GetMaxHearts()
|
|
227
|
+
end
|
|
228
|
+
end
|
|
229
|
+
do
|
|
230
|
+
do
|
|
231
|
+
return ensureAllCases(nil, healthType)
|
|
232
|
+
end
|
|
233
|
+
end
|
|
234
|
+
until true
|
|
235
|
+
end
|
|
94
236
|
function ____exports.setPlayerHealth(self, player, playerHealth)
|
|
95
237
|
local character = player:GetPlayerType()
|
|
96
238
|
local subPlayer = player:GetSubPlayer()
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
+
/**
|
|
3
|
+
* Whether or not the player is playing on a set seed (i.e. that they entered in a specific seed by
|
|
4
|
+
* pressing tab on the character selection screen). When the player resets the game on a set seed,
|
|
5
|
+
* the game will not switch to a different seed.
|
|
6
|
+
*/
|
|
7
|
+
export declare function onSetSeed(): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Helper function to restart the game using the console command of "restart". You can optionally
|
|
10
|
+
* specify a `PlayerType` to restart the game as that character.
|
|
11
|
+
*/
|
|
12
|
+
export declare function restart(character?: PlayerType): void;
|