forked from noxious/server
Depth editing for map objects
This commit is contained in:
parent
47be8597bf
commit
7c78262982
@ -14,7 +14,7 @@ export class BaseMapObject extends BaseEntity {
|
|||||||
tags: string[] = []
|
tags: string[] = []
|
||||||
|
|
||||||
@Property({ type: 'json' })
|
@Property({ type: 'json' })
|
||||||
pivotPoints: { x: number; y: number; }[] = []
|
depthOffsets = [0]
|
||||||
|
|
||||||
@Property({ type: 'decimal', precision: 10, scale: 2 })
|
@Property({ type: 'decimal', precision: 10, scale: 2 })
|
||||||
originX = 0
|
originX = 0
|
||||||
@ -64,13 +64,13 @@ export class BaseMapObject extends BaseEntity {
|
|||||||
return this.tags
|
return this.tags
|
||||||
}
|
}
|
||||||
|
|
||||||
setPivotPoints(pivotPoints: { x: number; y: number; }[]) {
|
setDepthOffsets(offsets: any) {
|
||||||
this.pivotPoints = pivotPoints
|
this.depthOffsets = offsets
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
getPivotPoints() {
|
getDepthOffsets() {
|
||||||
return this.pivotPoints
|
return this.depthOffsets;
|
||||||
}
|
}
|
||||||
|
|
||||||
setOriginX(originX: number) {
|
setOriginX(originX: number) {
|
||||||
|
@ -7,7 +7,7 @@ type Payload = {
|
|||||||
id: UUID
|
id: UUID
|
||||||
name: string
|
name: string
|
||||||
tags: string[]
|
tags: string[]
|
||||||
pivotPoints: { x: number; y: number; }[]
|
depthOffsets: number[]
|
||||||
originX: number
|
originX: number
|
||||||
originY: number
|
originY: number
|
||||||
frameRate: number
|
frameRate: number
|
||||||
@ -31,7 +31,7 @@ export default class MapObjectUpdateEvent extends BaseEvent {
|
|||||||
|
|
||||||
if (data.name !== undefined) mapObject.name = data.name
|
if (data.name !== undefined) mapObject.name = data.name
|
||||||
if (data.tags !== undefined) mapObject.tags = data.tags
|
if (data.tags !== undefined) mapObject.tags = data.tags
|
||||||
if (data.pivotPoints !== undefined) mapObject.pivotPoints = data.pivotPoints
|
if (data.depthOffsets !== undefined) mapObject.depthOffsets = data.depthOffsets
|
||||||
if (data.originX !== undefined) mapObject.originX = data.originX
|
if (data.originX !== undefined) mapObject.originX = data.originX
|
||||||
if (data.originY !== undefined) mapObject.originY = data.originY
|
if (data.originY !== undefined) mapObject.originY = data.originY
|
||||||
if (data.frameRate !== undefined) mapObject.frameRate = data.frameRate
|
if (data.frameRate !== undefined) mapObject.frameRate = data.frameRate
|
||||||
|
@ -479,8 +479,8 @@
|
|||||||
"length": null,
|
"length": null,
|
||||||
"mappedType": "json"
|
"mappedType": "json"
|
||||||
},
|
},
|
||||||
"pivot_points": {
|
"depth_offsets": {
|
||||||
"name": "pivot_points",
|
"name": "depth_offsets",
|
||||||
"type": "json",
|
"type": "json",
|
||||||
"unsigned": false,
|
"unsigned": false,
|
||||||
"autoincrement": false,
|
"autoincrement": false,
|
||||||
|
13
src/migrations/Migration20250312011946.ts
Normal file
13
src/migrations/Migration20250312011946.ts
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import { Migration } from '@mikro-orm/migrations';
|
||||||
|
|
||||||
|
export class Migration20250312011946 extends Migration {
|
||||||
|
|
||||||
|
override async up(): Promise<void> {
|
||||||
|
this.addSql(`alter table \`map_object\` change \`pivot_points\` \`depth_offsets\` json not null;`);
|
||||||
|
}
|
||||||
|
|
||||||
|
override async down(): Promise<void> {
|
||||||
|
this.addSql(`alter table \`map_object\` change \`depth_offsets\` \`pivot_points\` json not null;`);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user