Player Data Structures
Functions
Section titled “Functions”defaultMapGetPlayer()
Section titled “defaultMapGetPlayer()”defaultMapGetPlayer<
V,Args>(map,player, …extraArgs):V
Defined in: packages/isaacscript-common/src/functions/playerDataStructures.ts:25
Helper function to make using default maps with an index of PlayerIndex easier. Use this
instead of the DefaultMap.getAndSetDefault method if you have a default map of this type.
For example:
const v = { run: { playersSpeedBoost: new DefaultMap<PlayerIndex, int>(0), },};
function evaluateCacheSpeed(player: EntityPlayer) { player.MoveSpeed = defaultMapGetPlayer(v.run.playersSpeedBoost, player);}Type Parameters
Section titled “Type Parameters”V
Args extends unknown[]
Parameters
Section titled “Parameters”DefaultMap<PlayerIndex, V, Args>
player
Section titled “player”EntityPlayer
extraArgs
Section titled “extraArgs”…Args
Returns
Section titled “Returns”V
Allow Empty Variadic
Section titled “Allow Empty Variadic”defaultMapSetPlayer()
Section titled “defaultMapSetPlayer()”defaultMapSetPlayer<
V>(map,player,value):void
Defined in: packages/isaacscript-common/src/functions/playerDataStructures.ts:41
Helper function to make using maps with an index of PlayerIndex easier. Use this instead of the
Map.set method if you have a map of this type.
Since Map and DefaultMap set values in the same way, this function is simply an alias for the
mapSetPlayer helper function.
Type Parameters
Section titled “Type Parameters”V
Parameters
Section titled “Parameters”Map<PlayerIndex, V>
player
Section titled “player”EntityPlayer
V
Returns
Section titled “Returns”void
mapDeletePlayer()
Section titled “mapDeletePlayer()”mapDeletePlayer(
map,player):boolean
Defined in: packages/isaacscript-common/src/functions/playerDataStructures.ts:54
Helper function to make using maps with an type of PlayerIndex easier. Use this instead of the
Map.delete method if you have a set of this type.
Parameters
Section titled “Parameters”Map<PlayerIndex, unknown>
player
Section titled “player”EntityPlayer
Returns
Section titled “Returns”boolean
mapGetPlayer()
Section titled “mapGetPlayer()”mapGetPlayer<
V>(map,player):V|undefined
Defined in: packages/isaacscript-common/src/functions/playerDataStructures.ts:83
Helper function to make using maps with an index of PlayerIndex easier. Use this instead of the
Map.get method if you have a map of this type.
For example:
const v = { run: { playersSpeedBoost: new Map<PlayerIndex, int>(), },};
function incrementSpeedBoost(player: EntityPlayer) { const oldSpeedBoost = mapGetPlayer(v.run.playersSpeedBoost, player); const newSpeedBoost = oldSpeedBoost + 0.1; mapSetPlayer(v.run.playersSpeedBoost, player);}Type Parameters
Section titled “Type Parameters”V
Parameters
Section titled “Parameters”ReadonlyMap<PlayerIndex, V>
player
Section titled “player”EntityPlayer
Returns
Section titled “Returns”V | undefined
mapHasPlayer()
Section titled “mapHasPlayer()”mapHasPlayer<
V>(map,player):boolean
Defined in: packages/isaacscript-common/src/functions/playerDataStructures.ts:95
Helper function to make using maps with an index of PlayerIndex easier. Use this instead of the
Map.has method if you have a map of this type.
Type Parameters
Section titled “Type Parameters”V
Parameters
Section titled “Parameters”ReadonlyMap<PlayerIndex, V>
player
Section titled “player”EntityPlayer
Returns
Section titled “Returns”boolean
mapSetPlayer()
Section titled “mapSetPlayer()”mapSetPlayer<
V>(map,player,value):void
Defined in: packages/isaacscript-common/src/functions/playerDataStructures.ts:123
Helper function to make using maps with an index of PlayerIndex easier. Use this instead of the
Map.set method if you have a map of this type.
For example:
const v = { run: { playersSpeedBoost: new Map<PlayerIndex, int>(), },};
function incrementSpeedBoost(player: EntityPlayer) { const oldSpeedBoost = mapGetPlayer(v.run.playersSpeedBoost, player); const newSpeedBoost = oldSpeedBoost + 0.1; mapSetPlayer(v.run.playersSpeedBoost, player);}Type Parameters
Section titled “Type Parameters”V
Parameters
Section titled “Parameters”Map<PlayerIndex, V>
player
Section titled “player”EntityPlayer
V
Returns
Section titled “Returns”void
setAddPlayer()
Section titled “setAddPlayer()”setAddPlayer(
set,player):void
Defined in: packages/isaacscript-common/src/functions/playerDataStructures.ts:137
Helper function to make using sets with an type of PlayerIndex easier. Use this instead of the
Set.add method if you have a set of this type.
Parameters
Section titled “Parameters”Set<PlayerIndex>
player
Section titled “player”EntityPlayer
Returns
Section titled “Returns”void
setDeletePlayer()
Section titled “setDeletePlayer()”setDeletePlayer(
set,player):boolean
Defined in: packages/isaacscript-common/src/functions/playerDataStructures.ts:150
Helper function to make using sets with an type of PlayerIndex easier. Use this instead of the
Set.delete method if you have a set of this type.
Parameters
Section titled “Parameters”Set<PlayerIndex>
player
Section titled “player”EntityPlayer
Returns
Section titled “Returns”boolean
setHasPlayer()
Section titled “setHasPlayer()”setHasPlayer(
set,player):boolean
Defined in: packages/isaacscript-common/src/functions/playerDataStructures.ts:163
Helper function to make using sets with an type of PlayerIndex easier. Use this instead of the
Set.has method if you have a set of this type.
Parameters
Section titled “Parameters”ReadonlySet<PlayerIndex>
player
Section titled “player”EntityPlayer
Returns
Section titled “Returns”boolean
