Skip to content

Commit 7a00e3c

Browse files
committed
Fix #37 do not teleport in buildings when cancelled after completion
1 parent a83e87b commit 7a00e3c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/game/model/building/BuildingSite.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ export class BuildingSite {
135135
}
136136

137137
update(elapsedMs: number) {
138+
if (this.canceled) return
138139
this.placeDownTimer += elapsedMs
139140
if (this.placeDownTimer < 100) return
140141
if (this.primarySurface.isBlocked() || this.secondarySurface?.isBlocked()) {
@@ -146,7 +147,7 @@ export class BuildingSite {
146147
this.teleportIn()
147148
}
148149

149-
teleportIn() {
150+
private teleportIn() {
150151
this.worldMgr.entityMgr.completedBuildingSites.remove(this)
151152
this.surfaces.forEach((s) => s.site = undefined)
152153
this.onSiteByType.forEach((byType: MaterialEntity[]) => byType.forEach((item: MaterialEntity) => {
@@ -163,6 +164,7 @@ export class BuildingSite {
163164

164165
cancelSite() {
165166
this.worldMgr.entityMgr.buildingSites.remove(this)
167+
this.worldMgr.entityMgr.completedBuildingSites.remove(this)
166168
this.canceled = true
167169
this.surfaces.forEach((s) => {
168170
s.site = undefined

0 commit comments

Comments
 (0)