Skip to content

Commit

Permalink
Fix Defilante bug by prioritizing Defilante objects in shamanObjects …
Browse files Browse the repository at this point in the history
…array.
  • Loading branch information
entibo committed Oct 17, 2024
1 parent 919d281 commit d17038a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion dist/main.js

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions src/data/editor/Map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import shamanObjectMetadata from "metadata/shamanObject"
import * as Base from "data/base"
import * as Editor from "data/editor"
import { eq } from "../base/util"
import { isDefilanteObject } from "./ShamanObject"


type Joint = Editor.Joint.Joint
Expand Down Expand Up @@ -61,6 +62,14 @@ export function serialize(map: Map): string {
map.mapSettings = encodeImages(map.mapSettings, map.images)
map.decorations = encodeMouseSpawns(map.mapSettings.miceSpawn, map.decorations)
map.shamanObjects = encodeShamanObjects(map.shamanObjects)
if(map.mapSettings.defilante.enabled) {
// Defilante doesn't work if all booster items are above index 40.
// So put them first, since their z-index has no incidence anyway.
map.shamanObjects = [
...map.shamanObjects.filter(obj => isDefilanteObject(obj)),
...map.shamanObjects.filter(obj => !isDefilanteObject(obj)),
]
}
;[map.platforms, map.joints] = encodeBoosterPlatforms(map.platforms, map.joints)
;[map.platforms, map.joints] = encodeSpinPlatforms(map.platforms, map.joints)
;[map.platforms, map.joints] = encodeStickyPlatforms(map.platforms, map.joints)
Expand Down
2 changes: 2 additions & 0 deletions src/data/editor/ShamanObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ export const make: (obj: Base.ShamanObject.ShamanObject) => ShamanObject = obj =
export const isForeground = (obj: ShamanObject) =>
false

export const isDefilanteObject = (obj: ShamanObject) =>
[6, 32, 15, 16].includes(obj.type)

export function getBoundingBox(obj: ShamanObject): Box {
let metadata = shamanObjectMetadata.get(obj.type)
Expand Down

0 comments on commit d17038a

Please sign in to comment.