Skip to content

Commit

Permalink
allow disabling boundaries, rotating wall items with keys
Browse files Browse the repository at this point in the history
  • Loading branch information
sky-is-winning committed Jun 19, 2024
1 parent 215e0d4 commit f654c0c
Show file tree
Hide file tree
Showing 3 changed files with 474 additions and 334 deletions.
20 changes: 5 additions & 15 deletions src/engine/world/room/furniture/FurnitureSprite.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,18 @@ export default class FurnitureSprite extends Phaser.GameObjects.Sprite {
}

get isSafe() {
if (!this.iglooEdit.boundaries) {
return true
}

if (this.safeArea) {
return this.scene.matter.containsPoint(this.safeArea, this.x, this.y)
}
}

get isTrash() {
if (this.scene.trash) {
return this.scene.matter.containsPoint(this.scene.trash, this.x, this.y) || this.x < 0 || this.x > 1520 || this.y < 0 || this.y > 960 || (this.y < 200 && this.iglooEdit.controls.state == 'maximised')
return (this.iglooEdit.boundaries && this.scene.matter.containsPoint(this.scene.trash, this.x, this.y)) || this.x < 0 || this.x > 1520 || this.y < 0 || this.y > 960 || (this.y < 200 && this.iglooEdit.controls.state == 'maximised')
}
}

Expand Down Expand Up @@ -122,17 +126,6 @@ export default class FurnitureSprite extends Phaser.GameObjects.Sprite {
this.depth = this.y

this.checkPos()

if (!this.isWall || !this.wallBounds) return

// Auto rotate wall item
if (this.x < this.wallBounds[0]) {
this.updateFrame(0, 1, true)
} else if (this.x > this.wallBounds[1]) {
this.updateFrame(0, 3, true)
} else {
this.updateFrame(0, 2, true)
}
}

hover(pointer) {
Expand Down Expand Up @@ -191,9 +184,6 @@ export default class FurnitureSprite extends Phaser.GameObjects.Sprite {
* @returns
*/
updateFrame(index, value, set = false) {
// Can't rotate wall items with keys
if (this.isWall && index == 0 && !set) return

let frame = this.currentFrame
// Don't update set values if they are equal
if (set && frame[index] == value) return
Expand Down
Loading

0 comments on commit f654c0c

Please sign in to comment.