isaacscript-common 1.2.284 → 1.2.285

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)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.2.284",
3
+ "version": "1.2.285",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",