Skip to content

Commit

Permalink
Fix incorrect map coordinates for copy-pasted NPC & item spawns
Browse files Browse the repository at this point in the history
  • Loading branch information
Cirras committed Jan 15, 2024
1 parent 886c0de commit 6027ccd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- Copy-pasted NPC and item spawns had incorrect map coordinates.

## [1.2.0] - 2024-01-11

### Added
Expand Down
12 changes: 12 additions & 0 deletions src/core/state/entity-state.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,24 @@ export class EntityState {
withX(x) {
let copy = this.copy();
copy.x = x;
for (let npc of copy.npcs) {
npc.x = x;
}
for (let item of copy.items) {
item.x = x;
}
return copy;
}

withY(y) {
let copy = this.copy();
copy.y = y;
for (let npc of copy.npcs) {
npc.y = y;
}
for (let item of copy.items) {
item.y = y;
}
return copy;
}

Expand Down

0 comments on commit 6027ccd

Please sign in to comment.