isaacscript-common 15.6.0 → 15.6.1
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/index.d.ts +2 -2
- package/dist/isaacscript-common.lua +31 -12
- package/dist/src/classes/features/other/ForgottenSwitch.d.ts +2 -1
- package/dist/src/classes/features/other/ForgottenSwitch.d.ts.map +1 -1
- package/dist/src/classes/features/other/ForgottenSwitch.lua +2 -2
- package/dist/src/classes/features/other/PressInput.d.ts +1 -1
- package/dist/src/classes/features/other/PressInput.d.ts.map +1 -1
- package/dist/src/classes/features/other/PressInput.lua +28 -9
- package/package.json +1 -1
- package/src/classes/features/other/ForgottenSwitch.ts +2 -2
- package/src/classes/features/other/PressInput.ts +29 -7
package/dist/index.d.ts
CHANGED
|
@@ -3801,7 +3801,7 @@ declare class ForgottenSwitch extends Feature {
|
|
|
3801
3801
|
*
|
|
3802
3802
|
* In order to use this function, you must upgrade your mod with `ISCFeature.FORGOTTEN_SWITCH`.
|
|
3803
3803
|
*/
|
|
3804
|
-
forgottenSwitch(): void;
|
|
3804
|
+
forgottenSwitch(player: EntityPlayer): void;
|
|
3805
3805
|
}
|
|
3806
3806
|
|
|
3807
3807
|
declare type FunctionIsNotSerializable = "Error: Functions are not serializable. For more information, see: https://isaacscript.github.io/main/gotchas#functions-are-not-serializable";
|
|
@@ -11726,7 +11726,7 @@ declare class PressInput extends Feature {
|
|
|
11726
11726
|
*
|
|
11727
11727
|
* In order to use this function, you must upgrade your mod with `ISCFeature.PRESS_INPUT`.
|
|
11728
11728
|
*/
|
|
11729
|
-
pressInput(buttonAction: ButtonAction): void;
|
|
11729
|
+
pressInput(player: EntityPlayer, buttonAction: ButtonAction): void;
|
|
11730
11730
|
}
|
|
11731
11731
|
|
|
11732
11732
|
declare class PreventChildEntities extends Feature {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
--[[
|
|
2
2
|
|
|
3
|
-
isaacscript-common 15.6.
|
|
3
|
+
isaacscript-common 15.6.1
|
|
4
4
|
|
|
5
5
|
This is the "isaacscript-common" library, which was created with the IsaacScript tool.
|
|
6
6
|
|
|
@@ -46295,8 +46295,7 @@ return ____exports
|
|
|
46295
46295
|
local ____lualib = require("lualib_bundle")
|
|
46296
46296
|
local __TS__Class = ____lualib.__TS__Class
|
|
46297
46297
|
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
46298
|
-
local
|
|
46299
|
-
local __TS__New = ____lualib.__TS__New
|
|
46298
|
+
local __TS__ArraySplice = ____lualib.__TS__ArraySplice
|
|
46300
46299
|
local __TS__Decorate = ____lualib.__TS__Decorate
|
|
46301
46300
|
local ____exports = {}
|
|
46302
46301
|
local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
|
|
@@ -46304,6 +46303,8 @@ local InputHook = ____isaac_2Dtypescript_2Ddefinitions.InputHook
|
|
|
46304
46303
|
local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
|
|
46305
46304
|
local ____decorators = require("src.decorators")
|
|
46306
46305
|
local Exported = ____decorators.Exported
|
|
46306
|
+
local ____playerIndex = require("src.functions.playerIndex")
|
|
46307
|
+
local getPlayerIndex = ____playerIndex.getPlayerIndex
|
|
46307
46308
|
local ____Feature = require("src.classes.private.Feature")
|
|
46308
46309
|
local Feature = ____Feature.Feature
|
|
46309
46310
|
____exports.PressInput = __TS__Class()
|
|
@@ -46312,18 +46313,36 @@ PressInput.name = "PressInput"
|
|
|
46312
46313
|
__TS__ClassExtends(PressInput, Feature)
|
|
46313
46314
|
function PressInput.prototype.____constructor(self)
|
|
46314
46315
|
Feature.prototype.____constructor(self)
|
|
46315
|
-
self.v = {run = {
|
|
46316
|
-
self.isActionTriggered = function(____,
|
|
46317
|
-
if
|
|
46316
|
+
self.v = {run = {buttonActionTuples = {}}}
|
|
46317
|
+
self.isActionTriggered = function(____, entity, _inputHook, buttonAction)
|
|
46318
|
+
if entity == nil then
|
|
46318
46319
|
return nil
|
|
46319
46320
|
end
|
|
46320
|
-
|
|
46321
|
-
|
|
46321
|
+
local player = entity:ToPlayer()
|
|
46322
|
+
if player == nil then
|
|
46323
|
+
return nil
|
|
46324
|
+
end
|
|
46325
|
+
local playerIndex = getPlayerIndex(nil, player)
|
|
46326
|
+
do
|
|
46327
|
+
local i = #self.v.run.buttonActionTuples - 1
|
|
46328
|
+
while i >= 0 do
|
|
46329
|
+
local tuple = self.v.run.buttonActionTuples[i + 1]
|
|
46330
|
+
local tuplePlayerIndex, tupleButtonAction = table.unpack(tuple)
|
|
46331
|
+
if tuplePlayerIndex == playerIndex and tupleButtonAction == buttonAction then
|
|
46332
|
+
__TS__ArraySplice(self.v.run.buttonActionTuples, i)
|
|
46333
|
+
return true
|
|
46334
|
+
end
|
|
46335
|
+
i = i - 1
|
|
46336
|
+
end
|
|
46337
|
+
end
|
|
46338
|
+
return nil
|
|
46322
46339
|
end
|
|
46323
46340
|
self.callbacksUsed = {{ModCallback.INPUT_ACTION, {self.isActionTriggered, InputHook.IS_ACTION_TRIGGERED}}}
|
|
46324
46341
|
end
|
|
46325
|
-
function PressInput.prototype.pressInput(self, buttonAction)
|
|
46326
|
-
|
|
46342
|
+
function PressInput.prototype.pressInput(self, player, buttonAction)
|
|
46343
|
+
local playerIndex = getPlayerIndex(nil, player)
|
|
46344
|
+
local ____self_v_run_buttonActionTuples_0 = self.v.run.buttonActionTuples
|
|
46345
|
+
____self_v_run_buttonActionTuples_0[#____self_v_run_buttonActionTuples_0 + 1] = {playerIndex, buttonAction}
|
|
46327
46346
|
end
|
|
46328
46347
|
__TS__Decorate({Exported}, PressInput.prototype, "pressInput", true)
|
|
46329
46348
|
return ____exports
|
|
@@ -46352,8 +46371,8 @@ function ForgottenSwitch.prototype.____constructor(self, pressInput)
|
|
|
46352
46371
|
self.featuresUsed = {ISCFeature.PRESS_INPUT}
|
|
46353
46372
|
self.pressInput = pressInput
|
|
46354
46373
|
end
|
|
46355
|
-
function ForgottenSwitch.prototype.forgottenSwitch(self)
|
|
46356
|
-
self.pressInput:pressInput(ButtonAction.DROP)
|
|
46374
|
+
function ForgottenSwitch.prototype.forgottenSwitch(self, player)
|
|
46375
|
+
self.pressInput:pressInput(player, ButtonAction.DROP)
|
|
46357
46376
|
end
|
|
46358
46377
|
__TS__Decorate({Exported}, ForgottenSwitch.prototype, "forgottenSwitch", true)
|
|
46359
46378
|
return ____exports
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
1
2
|
import { Feature } from "../../private/Feature";
|
|
2
3
|
export declare class ForgottenSwitch extends Feature {
|
|
3
4
|
private pressInput;
|
|
@@ -7,6 +8,6 @@ export declare class ForgottenSwitch extends Feature {
|
|
|
7
8
|
*
|
|
8
9
|
* In order to use this function, you must upgrade your mod with `ISCFeature.FORGOTTEN_SWITCH`.
|
|
9
10
|
*/
|
|
10
|
-
forgottenSwitch(): void;
|
|
11
|
+
forgottenSwitch(player: EntityPlayer): void;
|
|
11
12
|
}
|
|
12
13
|
//# sourceMappingURL=ForgottenSwitch.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ForgottenSwitch.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/ForgottenSwitch.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAGhD,qBAAa,eAAgB,SAAQ,OAAO;IAQ1C,OAAO,CAAC,UAAU,CAAa;IAW/B;;;;;OAKG;IAEI,eAAe,
|
|
1
|
+
{"version":3,"file":"ForgottenSwitch.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/ForgottenSwitch.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAGhD,qBAAa,eAAgB,SAAQ,OAAO;IAQ1C,OAAO,CAAC,UAAU,CAAa;IAW/B;;;;;OAKG;IAEI,eAAe,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI;CAGnD"}
|
|
@@ -21,8 +21,8 @@ function ForgottenSwitch.prototype.____constructor(self, pressInput)
|
|
|
21
21
|
self.featuresUsed = {ISCFeature.PRESS_INPUT}
|
|
22
22
|
self.pressInput = pressInput
|
|
23
23
|
end
|
|
24
|
-
function ForgottenSwitch.prototype.forgottenSwitch(self)
|
|
25
|
-
self.pressInput:pressInput(ButtonAction.DROP)
|
|
24
|
+
function ForgottenSwitch.prototype.forgottenSwitch(self, player)
|
|
25
|
+
self.pressInput:pressInput(player, ButtonAction.DROP)
|
|
26
26
|
end
|
|
27
27
|
__TS__Decorate({Exported}, ForgottenSwitch.prototype, "forgottenSwitch", true)
|
|
28
28
|
return ____exports
|
|
@@ -9,6 +9,6 @@ export declare class PressInput extends Feature {
|
|
|
9
9
|
*
|
|
10
10
|
* In order to use this function, you must upgrade your mod with `ISCFeature.PRESS_INPUT`.
|
|
11
11
|
*/
|
|
12
|
-
pressInput(buttonAction: ButtonAction): void;
|
|
12
|
+
pressInput(player: EntityPlayer, buttonAction: ButtonAction): void;
|
|
13
13
|
}
|
|
14
14
|
//# sourceMappingURL=PressInput.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PressInput.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/PressInput.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAGb,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"PressInput.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/PressInput.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAGb,MAAM,8BAA8B,CAAC;AAItC,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhD,qBAAa,UAAW,SAAQ,OAAO;IAsBrC,OAAO,CAAC,iBAAiB,CA8BvB;IAEF;;;;;;OAMG;IAEI,UAAU,CAAC,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,GAAG,IAAI;CAI1E"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
local ____lualib = require("lualib_bundle")
|
|
2
2
|
local __TS__Class = ____lualib.__TS__Class
|
|
3
3
|
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
4
|
-
local
|
|
5
|
-
local __TS__New = ____lualib.__TS__New
|
|
4
|
+
local __TS__ArraySplice = ____lualib.__TS__ArraySplice
|
|
6
5
|
local __TS__Decorate = ____lualib.__TS__Decorate
|
|
7
6
|
local ____exports = {}
|
|
8
7
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
@@ -10,6 +9,8 @@ local InputHook = ____isaac_2Dtypescript_2Ddefinitions.InputHook
|
|
|
10
9
|
local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
|
|
11
10
|
local ____decorators = require("src.decorators")
|
|
12
11
|
local Exported = ____decorators.Exported
|
|
12
|
+
local ____playerIndex = require("src.functions.playerIndex")
|
|
13
|
+
local getPlayerIndex = ____playerIndex.getPlayerIndex
|
|
13
14
|
local ____Feature = require("src.classes.private.Feature")
|
|
14
15
|
local Feature = ____Feature.Feature
|
|
15
16
|
____exports.PressInput = __TS__Class()
|
|
@@ -18,18 +19,36 @@ PressInput.name = "PressInput"
|
|
|
18
19
|
__TS__ClassExtends(PressInput, Feature)
|
|
19
20
|
function PressInput.prototype.____constructor(self)
|
|
20
21
|
Feature.prototype.____constructor(self)
|
|
21
|
-
self.v = {run = {
|
|
22
|
-
self.isActionTriggered = function(____,
|
|
23
|
-
if
|
|
22
|
+
self.v = {run = {buttonActionTuples = {}}}
|
|
23
|
+
self.isActionTriggered = function(____, entity, _inputHook, buttonAction)
|
|
24
|
+
if entity == nil then
|
|
24
25
|
return nil
|
|
25
26
|
end
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
local player = entity:ToPlayer()
|
|
28
|
+
if player == nil then
|
|
29
|
+
return nil
|
|
30
|
+
end
|
|
31
|
+
local playerIndex = getPlayerIndex(nil, player)
|
|
32
|
+
do
|
|
33
|
+
local i = #self.v.run.buttonActionTuples - 1
|
|
34
|
+
while i >= 0 do
|
|
35
|
+
local tuple = self.v.run.buttonActionTuples[i + 1]
|
|
36
|
+
local tuplePlayerIndex, tupleButtonAction = table.unpack(tuple)
|
|
37
|
+
if tuplePlayerIndex == playerIndex and tupleButtonAction == buttonAction then
|
|
38
|
+
__TS__ArraySplice(self.v.run.buttonActionTuples, i)
|
|
39
|
+
return true
|
|
40
|
+
end
|
|
41
|
+
i = i - 1
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
return nil
|
|
28
45
|
end
|
|
29
46
|
self.callbacksUsed = {{ModCallback.INPUT_ACTION, {self.isActionTriggered, InputHook.IS_ACTION_TRIGGERED}}}
|
|
30
47
|
end
|
|
31
|
-
function PressInput.prototype.pressInput(self, buttonAction)
|
|
32
|
-
|
|
48
|
+
function PressInput.prototype.pressInput(self, player, buttonAction)
|
|
49
|
+
local playerIndex = getPlayerIndex(nil, player)
|
|
50
|
+
local ____self_v_run_buttonActionTuples_0 = self.v.run.buttonActionTuples
|
|
51
|
+
____self_v_run_buttonActionTuples_0[#____self_v_run_buttonActionTuples_0 + 1] = {playerIndex, buttonAction}
|
|
33
52
|
end
|
|
34
53
|
__TS__Decorate({Exported}, PressInput.prototype, "pressInput", true)
|
|
35
54
|
return ____exports
|
package/package.json
CHANGED
|
@@ -30,7 +30,7 @@ export class ForgottenSwitch extends Feature {
|
|
|
30
30
|
* In order to use this function, you must upgrade your mod with `ISCFeature.FORGOTTEN_SWITCH`.
|
|
31
31
|
*/
|
|
32
32
|
@Exported
|
|
33
|
-
public forgottenSwitch(): void {
|
|
34
|
-
this.pressInput.pressInput(ButtonAction.DROP);
|
|
33
|
+
public forgottenSwitch(player: EntityPlayer): void {
|
|
34
|
+
this.pressInput.pressInput(player, ButtonAction.DROP);
|
|
35
35
|
}
|
|
36
36
|
}
|
|
@@ -4,13 +4,15 @@ import {
|
|
|
4
4
|
ModCallback,
|
|
5
5
|
} from "isaac-typescript-definitions";
|
|
6
6
|
import { Exported } from "../../../decorators";
|
|
7
|
+
import { getPlayerIndex } from "../../../functions/playerIndex";
|
|
8
|
+
import { PlayerIndex } from "../../../types/PlayerIndex";
|
|
7
9
|
import { Feature } from "../../private/Feature";
|
|
8
10
|
|
|
9
11
|
export class PressInput extends Feature {
|
|
10
12
|
/** @internal */
|
|
11
13
|
public override v = {
|
|
12
14
|
run: {
|
|
13
|
-
|
|
15
|
+
buttonActionTuples: [] as Array<[PlayerIndex, ButtonAction]>,
|
|
14
16
|
},
|
|
15
17
|
};
|
|
16
18
|
|
|
@@ -29,16 +31,35 @@ export class PressInput extends Feature {
|
|
|
29
31
|
// ModCallback.INPUT_ACTION (13)
|
|
30
32
|
// InputHook.IS_ACTION_TRIGGERED (1)
|
|
31
33
|
private isActionTriggered = (
|
|
32
|
-
|
|
34
|
+
entity: Entity | undefined,
|
|
33
35
|
_inputHook: InputHook,
|
|
34
36
|
buttonAction: ButtonAction,
|
|
35
37
|
) => {
|
|
36
|
-
if (
|
|
38
|
+
if (entity === undefined) {
|
|
37
39
|
return undefined;
|
|
38
40
|
}
|
|
39
41
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
const player = entity.ToPlayer();
|
|
43
|
+
if (player === undefined) {
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const playerIndex = getPlayerIndex(player);
|
|
48
|
+
|
|
49
|
+
for (let i = this.v.run.buttonActionTuples.length - 1; i >= 0; i--) {
|
|
50
|
+
const tuple = this.v.run.buttonActionTuples[i]!; // eslint-disable-line @typescript-eslint/no-non-null-assertion
|
|
51
|
+
const [tuplePlayerIndex, tupleButtonAction] = tuple;
|
|
52
|
+
|
|
53
|
+
if (
|
|
54
|
+
tuplePlayerIndex === playerIndex &&
|
|
55
|
+
tupleButtonAction === buttonAction
|
|
56
|
+
) {
|
|
57
|
+
this.v.run.buttonActionTuples.splice(i);
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return undefined;
|
|
42
63
|
};
|
|
43
64
|
|
|
44
65
|
/**
|
|
@@ -49,7 +70,8 @@ export class PressInput extends Feature {
|
|
|
49
70
|
* In order to use this function, you must upgrade your mod with `ISCFeature.PRESS_INPUT`.
|
|
50
71
|
*/
|
|
51
72
|
@Exported
|
|
52
|
-
public pressInput(buttonAction: ButtonAction): void {
|
|
53
|
-
|
|
73
|
+
public pressInput(player: EntityPlayer, buttonAction: ButtonAction): void {
|
|
74
|
+
const playerIndex = getPlayerIndex(player);
|
|
75
|
+
this.v.run.buttonActionTuples.push([playerIndex, buttonAction]);
|
|
54
76
|
}
|
|
55
77
|
}
|