isaacscript-common 1.2.284 → 1.2.287
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.
|
@@ -6,6 +6,14 @@ import { PlayerIndex } from "../types/PlayerIndex";
|
|
|
6
6
|
* instead of the `DefaultMap.getAndSetDefault` method if you have a default map of this type.
|
|
7
7
|
*/
|
|
8
8
|
export declare function defaultMapGetPlayer<V, A extends unknown[]>(map: DefaultMap<PlayerIndex, V, A>, player: EntityPlayer, ...extraArgs: A): V;
|
|
9
|
+
/**
|
|
10
|
+
* Helper function to make using maps with an index of `PlayerIndex` easier. Use this instead of the
|
|
11
|
+
* `Map.set` method if you have a map of this type.
|
|
12
|
+
*
|
|
13
|
+
* Since `Map` and `DefaultMap` set values in the same way, this function is simply an alias for the
|
|
14
|
+
* `mapSetPlayer` helper function.
|
|
15
|
+
*/
|
|
16
|
+
export declare function defaultMapSetPlayer<V>(map: Map<PlayerIndex, V>, player: EntityPlayer, value: V): void;
|
|
9
17
|
/**
|
|
10
18
|
* Helper function to make using maps with an index of `PlayerIndex` easier. Use this instead of the
|
|
11
19
|
* `Map.get` method if you have a map of this type.
|
|
@@ -4,18 +4,21 @@ local Set = ____lualib.Set
|
|
|
4
4
|
local ____exports = {}
|
|
5
5
|
local ____playerIndex = require("functions.playerIndex")
|
|
6
6
|
local getPlayerIndex = ____playerIndex.getPlayerIndex
|
|
7
|
+
function ____exports.mapSetPlayer(self, map, player, value)
|
|
8
|
+
local playerIndex = getPlayerIndex(nil, player)
|
|
9
|
+
map:set(playerIndex, value)
|
|
10
|
+
end
|
|
7
11
|
function ____exports.defaultMapGetPlayer(self, map, player, ...)
|
|
8
12
|
local playerIndex = getPlayerIndex(nil, player)
|
|
9
13
|
return map:getAndSetDefault(playerIndex, ...)
|
|
10
14
|
end
|
|
15
|
+
function ____exports.defaultMapSetPlayer(self, map, player, value)
|
|
16
|
+
____exports.mapSetPlayer(nil, map, player, value)
|
|
17
|
+
end
|
|
11
18
|
function ____exports.mapGetPlayer(self, map, player)
|
|
12
19
|
local playerIndex = getPlayerIndex(nil, player)
|
|
13
20
|
return map:get(playerIndex)
|
|
14
21
|
end
|
|
15
|
-
function ____exports.mapSetPlayer(self, map, player, value)
|
|
16
|
-
local playerIndex = getPlayerIndex(nil, player)
|
|
17
|
-
map:set(playerIndex, value)
|
|
18
|
-
end
|
|
19
22
|
function ____exports.setAddPlayer(self, set, player)
|
|
20
23
|
local playerIndex = getPlayerIndex(nil, player)
|
|
21
24
|
return set:add(playerIndex)
|
|
@@ -123,6 +123,17 @@ export declare function printConsole(msg: string): void;
|
|
|
123
123
|
* ```
|
|
124
124
|
*/
|
|
125
125
|
export declare function repeat(n: int, func: (i: int) => void): void;
|
|
126
|
+
/**
|
|
127
|
+
* Helper function to signify that the enclosing code block is not yet complete. Using this function
|
|
128
|
+
* is similar to writing a "TODO" comment, but it has the benefit of preventing early returns from
|
|
129
|
+
* being automatically deleted by ESLint.
|
|
130
|
+
*
|
|
131
|
+
* When you see this function, it simply means that the programmer intends to add in more code to
|
|
132
|
+
* this spot later.
|
|
133
|
+
*
|
|
134
|
+
* This function does not actually do anything. (It is an "empty" function.)
|
|
135
|
+
*/
|
|
136
|
+
export declare function todo(): void;
|
|
126
137
|
/**
|
|
127
138
|
* Helper function to check every value of a custom enum for -1. This is helpful as a run-time check
|
|
128
139
|
* because many methods of the Isaac class return -1 if they fail.
|
package/dist/functions/utils.lua
CHANGED
|
@@ -84,6 +84,8 @@ ____exports["repeat"] = function(self, n, func)
|
|
|
84
84
|
end
|
|
85
85
|
end
|
|
86
86
|
end
|
|
87
|
+
function ____exports.todo(self)
|
|
88
|
+
end
|
|
87
89
|
function ____exports.validateCustomEnum(self, transpiledEnumName, transpiledEnum)
|
|
88
90
|
local customEnumType = type(transpiledEnum)
|
|
89
91
|
if customEnumType ~= "table" then
|