isaacscript-common 1.2.83 → 1.2.86

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.
@@ -0,0 +1,6 @@
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ /**
3
+ * When used on The Forgotten, switches to The Soul. When used on The Soul, switches to The
4
+ * Forgotten. This takes 1 game frame to take effect.
5
+ */
6
+ export declare function isPonyActive(player: EntityPlayer): boolean;
@@ -0,0 +1,50 @@
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 ____exports = {}
6
+ local postPEffectUpdate, FLAGS_WHEN_PONY_IS_ACTIVE, v
7
+ local ____errors = require("errors")
8
+ local getUpgradeErrorMsg = ____errors.getUpgradeErrorMsg
9
+ local ____flag = require("functions.flag")
10
+ local hasFlag = ____flag.hasFlag
11
+ local ____player = require("functions.player")
12
+ local getPlayerIndex = ____player.getPlayerIndex
13
+ local ____exports = require("features.saveDataManager.exports")
14
+ local saveDataManager = ____exports.saveDataManager
15
+ function postPEffectUpdate(self, player)
16
+ local effects = player:GetEffects()
17
+ local entityFlags = player:GetEntityFlags()
18
+ local hasPonyCollectibleEffect = effects:HasCollectibleEffect(CollectibleType.COLLECTIBLE_PONY) or effects:HasCollectibleEffect(CollectibleType.COLLECTIBLE_WHITE_PONY)
19
+ local playerIndex = getPlayerIndex(nil, player)
20
+ local isPonyActiveOnPreviousFrame = v.run.playersIsPonyActive:has(playerIndex)
21
+ local hasPonyFlags = hasFlag(
22
+ nil,
23
+ entityFlags,
24
+ table.unpack(FLAGS_WHEN_PONY_IS_ACTIVE)
25
+ )
26
+ local isPonyActiveNow = hasPonyCollectibleEffect or isPonyActiveOnPreviousFrame and hasPonyFlags
27
+ if isPonyActiveNow then
28
+ v.run.playersIsPonyActive:add(playerIndex)
29
+ else
30
+ v.run.playersIsPonyActive:delete(playerIndex)
31
+ end
32
+ end
33
+ local FEATURE_NAME = "pony activation detector"
34
+ FLAGS_WHEN_PONY_IS_ACTIVE = {EntityFlag.FLAG_NO_KNOCKBACK, EntityFlag.FLAG_NO_PHYSICS_KNOCKBACK, EntityFlag.FLAG_NO_DAMAGE_BLINK}
35
+ local initialized = false
36
+ v = {run = {playersIsPonyActive = __TS__New(Set)}}
37
+ function ____exports.isPonyActiveInit(self, mod)
38
+ initialized = true
39
+ saveDataManager(nil, "isPonyActive", v)
40
+ mod:AddCallback(ModCallbacks.MC_POST_PEFFECT_UPDATE, postPEffectUpdate)
41
+ end
42
+ function ____exports.isPonyActive(self, player)
43
+ if not initialized then
44
+ local msg = getUpgradeErrorMsg(nil, FEATURE_NAME)
45
+ error(msg)
46
+ end
47
+ local playerIndex = getPlayerIndex(nil, player)
48
+ return v.run.playersIsPonyActive:has(playerIndex)
49
+ end
50
+ return ____exports
@@ -0,0 +1,14 @@
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ /**
3
+ * PlayerIndex is a specific type of string; see the documentation for the [[`getPlayerIndex`]]
4
+ * function. Mods can signify that data structures handle EntityPlayers by using this type:
5
+ *
6
+ * ```
7
+ * const myPlayerMap = new Map<PlayerIndex, string>();
8
+ * ```
9
+ *
10
+ * This type is branded for extra type safety.
11
+ */
12
+ export declare type PlayerIndex = int & {
13
+ __playerIndexBrand: unknown;
14
+ };
@@ -0,0 +1,3 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ local ____exports = {}
3
+ return ____exports
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.2.83",
3
+ "version": "1.2.86",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",