Player Data Structures
Functions
defaultMapGetPlayer
▸ defaultMapGetPlayer<V, Args>(map, player, ...extraArgs): V
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
| Name | Type |
|---|---|
V | V |
Args | extends unknown[] |
Parameters
| Name | Type |
|---|---|
map | DefaultMap<PlayerIndex, V, Args> |
player | EntityPlayer |
...extraArgs | Args |
Returns
V
Allow Empty Variadic
Defined in
packages/isaacscript-common/src/functions/playerDataStructures.ts:25
defaultMapSetPlayer
▸ defaultMapSetPlayer<V>(map, player, value): void
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
| Name |
|---|
V |
Parameters
| Name | Type |
|---|---|
map | Map<PlayerIndex, V> |
player | EntityPlayer |
value | V |
Returns
void
Defined in
packages/isaacscript-common/src/functions/playerDataStructures.ts:41
mapDeletePlayer
▸ mapDeletePlayer(map, player): boolean
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
| Name | Type |
|---|---|
map | Map<PlayerIndex, unknown> |
player | EntityPlayer |
Returns
boolean
Defined in
packages/isaacscript-common/src/functions/playerDataStructures.ts:54
mapGetPlayer
▸ mapGetPlayer<V>(map, player): V | undefined
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
| Name |
|---|
V |
Parameters
| Name | Type |
|---|---|
map | ReadonlyMap<PlayerIndex, V> |
player | EntityPlayer |
Returns
V | undefined
Defined in
packages/isaacscript-common/src/functions/playerDataStructures.ts:83
mapHasPlayer
▸ mapHasPlayer<V>(map, player): boolean
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
| Name |
|---|
V |
Parameters
| Name | Type |
|---|---|
map | ReadonlyMap<PlayerIndex, V> |
player | EntityPlayer |
Returns
boolean
Defined in
packages/isaacscript-common/src/functions/playerDataStructures.ts:95
mapSetPlayer
▸ mapSetPlayer<V>(map, player, value): void
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
| Name |
|---|
V |
Parameters
| Name | Type |
|---|---|
map | Map<PlayerIndex, V> |
player | EntityPlayer |
value | V |
Returns
void
Defined in
packages/isaacscript-common/src/functions/playerDataStructures.ts:123
setAddPlayer
▸ setAddPlayer(set, player): void
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
| Name | Type |
|---|---|
set | Set<PlayerIndex> |
player | EntityPlayer |
Returns
void
Defined in
packages/isaacscript-common/src/functions/playerDataStructures.ts:137
setDeletePlayer
▸ setDeletePlayer(set, player): boolean
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
| Name | Type |
|---|---|
set | Set<PlayerIndex> |
player | EntityPlayer |
Returns
boolean
Defined in
packages/isaacscript-common/src/functions/playerDataStructures.ts:150
setHasPlayer
▸ setHasPlayer(set, player): boolean
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
| Name | Type |
|---|---|
set | ReadonlySet<PlayerIndex> |
player | EntityPlayer |
Returns
boolean
Defined in
packages/isaacscript-common/src/functions/playerDataStructures.ts:163