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[] = []
|
||||
|
||||
@Property({ type: 'json' })
|
||||
pivotPoints: { x: number; y: number; }[] = []
|
||||
depthOffsets = [0]
|
||||
|
||||
@Property({ type: 'decimal', precision: 10, scale: 2 })
|
||||
originX = 0
|
||||
@ -64,13 +64,13 @@ export class BaseMapObject extends BaseEntity {
|
||||
return this.tags
|
||||
}
|
||||
|
||||
setPivotPoints(pivotPoints: { x: number; y: number; }[]) {
|
||||
this.pivotPoints = pivotPoints
|
||||
setDepthOffsets(offsets: any) {
|
||||
this.depthOffsets = offsets
|
||||
return this
|
||||
}
|
||||
|
||||
getPivotPoints() {
|
||||
return this.pivotPoints
|
||||
getDepthOffsets() {
|
||||
return this.depthOffsets;
|
||||
}
|
||||
|
||||
setOriginX(originX: number) {
|
||||
|
@ -7,7 +7,7 @@ type Payload = {
|
||||
id: UUID
|
||||
name: string
|
||||
tags: string[]
|
||||
pivotPoints: { x: number; y: number; }[]
|
||||
depthOffsets: number[]
|
||||
originX: number
|
||||
originY: number
|
||||
frameRate: number
|
||||
@ -31,7 +31,7 @@ export default class MapObjectUpdateEvent extends BaseEvent {
|
||||
|
||||
if (data.name !== undefined) mapObject.name = data.name
|
||||
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.originY !== undefined) mapObject.originY = data.originY
|
||||
if (data.frameRate !== undefined) mapObject.frameRate = data.frameRate
|
||||
|
@ -479,8 +479,8 @@
|
||||
"length": null,
|
||||
"mappedType": "json"
|
||||
},
|
||||
"pivot_points": {
|
||||
"name": "pivot_points",
|
||||
"depth_offsets": {
|
||||
"name": "depth_offsets",
|
||||
"type": "json",
|
||||
"unsigned": 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