mirror of
https://github.com/4ian/GDevelop.git
synced 2025-10-15 10:19:04 +00:00
Fix a collision mask compatibility issue with a breaking change of Tiled 1.10 (#5122)
* Handle the "type" attribute as an alias of "class".
This commit is contained in:
@@ -88,12 +88,12 @@ ExpressionValidator::Type ExpressionValidator::ValidateFunction(const gd::Functi
|
||||
}
|
||||
|
||||
if (!function.behaviorName.empty() &&
|
||||
(globalObjectsContainer.HasObjectNamed(function.objectName) &&
|
||||
!globalObjectsContainer.GetObject(function.objectName)
|
||||
.HasBehaviorNamed(function.behaviorName) ||
|
||||
objectsContainer.HasObjectNamed(function.objectName) &&
|
||||
!objectsContainer.GetObject(function.objectName)
|
||||
.HasBehaviorNamed(function.behaviorName))) {
|
||||
((globalObjectsContainer.HasObjectNamed(function.objectName) &&
|
||||
!globalObjectsContainer.GetObject(function.objectName)
|
||||
.HasBehaviorNamed(function.behaviorName)) ||
|
||||
(objectsContainer.HasObjectNamed(function.objectName) &&
|
||||
!objectsContainer.GetObject(function.objectName)
|
||||
.HasBehaviorNamed(function.behaviorName)))) {
|
||||
RaiseTypeError(_("This behavior is not attached to this object."),
|
||||
function.behaviorNameLocation);
|
||||
return returnType;
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -111,7 +111,9 @@ export declare type TiledChunk = {
|
||||
y: integer;
|
||||
};
|
||||
export declare type TiledObject = {
|
||||
/** The class of the object (renamed from type since 1.9, optional) */
|
||||
/** The class of the object (was saved as class in 1.9, optional) */
|
||||
type?: string;
|
||||
/** The class of the object (used only in 1.9, optional) */
|
||||
class?: string;
|
||||
/** Used to mark an object as an ellipse */
|
||||
ellipse?: boolean;
|
||||
@@ -251,7 +253,9 @@ export declare type TiledTransformations = {
|
||||
export declare type TiledTileDefinition = {
|
||||
/** Array of {@link TiledTiles} */
|
||||
animation?: Array<TiledTileDefinition>;
|
||||
/** The class of the tile (renamed from type since 1.9, optional) */
|
||||
/** The class of the object (was saved as class in 1.9, optional) */
|
||||
type?: string;
|
||||
/** The class of the object (used only in 1.9, optional) */
|
||||
class?: string;
|
||||
/** Local ID of the tile */
|
||||
id: integer;
|
||||
|
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
{"version":3,"file":"TiledTileMapLoader.d.ts","sourceRoot":"","sources":["../../../src/load/tiled/TiledTileMapLoader.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EAGhB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAO7C;;GAEG;AACH,yBAAiB,kBAAkB,CAAC;IAClC;;;;;;OAMG;IACH,SAAgB,IAAI,CAClB,YAAY,EAAE,YAAY,EAC1B,IAAI,EAAE,GAAG,GACR,eAAe,GAAG,IAAI,CA0KxB;CACF"}
|
||||
{"version":3,"file":"TiledTileMapLoader.d.ts","sourceRoot":"","sources":["../../../src/load/tiled/TiledTileMapLoader.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EAGhB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAO7C;;GAEG;AACH,yBAAiB,kBAAkB,CAAC;IAClC;;;;;;OAMG;IACH,SAAgB,IAAI,CAClB,YAAY,EAAE,YAAY,EAC1B,IAAI,EAAE,GAAG,GACR,eAAe,GAAG,IAAI,CA2KxB;CACF"}
|
@@ -163,7 +163,10 @@ export type TiledChunk = {
|
||||
};
|
||||
|
||||
export type TiledObject = {
|
||||
/** The class of the object (renamed from type since 1.9, optional) */
|
||||
/** The class of the object (was saved as class in 1.9, optional) */
|
||||
type?: string;
|
||||
|
||||
/** The class of the object (used only in 1.9, optional) */
|
||||
class?: string;
|
||||
|
||||
/** Used to mark an object as an ellipse */
|
||||
@@ -367,7 +370,10 @@ export type TiledTileDefinition = {
|
||||
/** Array of {@link TiledTiles} */
|
||||
animation?: Array<TiledTileDefinition>;
|
||||
|
||||
/** The class of the tile (renamed from type since 1.9, optional) */
|
||||
/** The class of the object (was saved as class in 1.9, optional) */
|
||||
type?: string;
|
||||
|
||||
/** The class of the object (used only in 1.9, optional) */
|
||||
class?: string;
|
||||
|
||||
/** Local ID of the tile */
|
||||
|
@@ -147,7 +147,7 @@ describe("TiledTileMapLoader", function () {
|
||||
id: 1,
|
||||
name: "",
|
||||
rotation: 0,
|
||||
class: "",
|
||||
type: "",
|
||||
visible: true,
|
||||
width: 8,
|
||||
x: 0,
|
||||
@@ -160,7 +160,7 @@ describe("TiledTileMapLoader", function () {
|
||||
x: 0,
|
||||
y: 0,
|
||||
},
|
||||
class: "obstacle",
|
||||
type: "obstacle",
|
||||
},
|
||||
|
||||
// The tile with id == 1 is missing
|
||||
@@ -192,7 +192,7 @@ describe("TiledTileMapLoader", function () {
|
||||
},
|
||||
],
|
||||
rotation: 0,
|
||||
class: "",
|
||||
type: "",
|
||||
visible: true,
|
||||
width: 0,
|
||||
x: 0,
|
||||
@@ -205,7 +205,7 @@ describe("TiledTileMapLoader", function () {
|
||||
x: 0,
|
||||
y: 0,
|
||||
},
|
||||
class: "obstacle",
|
||||
type: "obstacle",
|
||||
},
|
||||
// Contains 2 polygons, one is a rotated.
|
||||
{
|
||||
@@ -234,7 +234,7 @@ describe("TiledTileMapLoader", function () {
|
||||
},
|
||||
],
|
||||
rotation: 0,
|
||||
class: "",
|
||||
type: "",
|
||||
visible: true,
|
||||
width: 0,
|
||||
x: 0,
|
||||
@@ -259,7 +259,7 @@ describe("TiledTileMapLoader", function () {
|
||||
},
|
||||
],
|
||||
rotation: 180,
|
||||
class: "",
|
||||
type: "",
|
||||
visible: true,
|
||||
width: 0,
|
||||
x: 8,
|
||||
@@ -272,7 +272,7 @@ describe("TiledTileMapLoader", function () {
|
||||
x: 0,
|
||||
y: 0,
|
||||
},
|
||||
class: "obstacle",
|
||||
type: "obstacle",
|
||||
},
|
||||
// Contains hitboxes for obstacle and lava.
|
||||
{
|
||||
@@ -301,7 +301,7 @@ describe("TiledTileMapLoader", function () {
|
||||
},
|
||||
],
|
||||
rotation: 0,
|
||||
class: "obstacle",
|
||||
type: "obstacle",
|
||||
visible: true,
|
||||
width: 0,
|
||||
x: 0,
|
||||
@@ -326,7 +326,7 @@ describe("TiledTileMapLoader", function () {
|
||||
},
|
||||
],
|
||||
rotation: 180,
|
||||
class: "lava",
|
||||
type: "lava",
|
||||
visible: true,
|
||||
width: 0,
|
||||
x: 8,
|
||||
@@ -353,7 +353,7 @@ describe("TiledTileMapLoader", function () {
|
||||
id: 1,
|
||||
name: "",
|
||||
rotation: 0,
|
||||
class: "lava",
|
||||
type: "lava",
|
||||
visible: true,
|
||||
width: 8,
|
||||
x: 0,
|
||||
@@ -366,7 +366,7 @@ describe("TiledTileMapLoader", function () {
|
||||
x: 0,
|
||||
y: 0,
|
||||
},
|
||||
class: "lava",
|
||||
type: "lava",
|
||||
},
|
||||
],
|
||||
tilewidth: 8,
|
||||
@@ -566,7 +566,7 @@ describe("TiledTileMapLoader", function () {
|
||||
tileheight: 8,
|
||||
tiles: [
|
||||
{
|
||||
class: "obstacle",
|
||||
type: "obstacle",
|
||||
id: 2,
|
||||
objectgroup: {
|
||||
draworder: "index",
|
||||
@@ -574,7 +574,7 @@ describe("TiledTileMapLoader", function () {
|
||||
name: "",
|
||||
objects: [
|
||||
{
|
||||
class: "",
|
||||
type: "",
|
||||
height: 0,
|
||||
id: 9,
|
||||
name: "",
|
||||
|
@@ -43,9 +43,10 @@ export namespace TiledTileMapLoader {
|
||||
const tileDefinition = new TileDefinition(
|
||||
tile.animation ? tile.animation.length : 0
|
||||
);
|
||||
const tileClass = tile.type || tile.class;
|
||||
if (tile.objectgroup) {
|
||||
for (const object of tile.objectgroup.objects) {
|
||||
const tag = object.class || tile.class;
|
||||
const tag = object.type || object.class || tileClass;
|
||||
if (!tag || tag.length === 0) {
|
||||
continue;
|
||||
}
|
||||
@@ -87,7 +88,7 @@ export namespace TiledTileMapLoader {
|
||||
tileDefinition.addHitBox(tag, polygon);
|
||||
}
|
||||
}
|
||||
} else if (tile.class && tile.class.length > 0) {
|
||||
} else if (tileClass) {
|
||||
// When there is no shape, default to the whole tile.
|
||||
const polygon: PolygonVertices = [
|
||||
[0, 0],
|
||||
@@ -95,7 +96,7 @@ export namespace TiledTileMapLoader {
|
||||
[tiledTileMap.tilewidth, tiledTileMap.tileheight],
|
||||
[tiledTileMap.tilewidth, 0],
|
||||
];
|
||||
tileDefinition.addHitBox(tile.class, polygon);
|
||||
tileDefinition.addHitBox(tileClass, polygon);
|
||||
}
|
||||
definitions.set(
|
||||
getTileIdFromTiledGUI(firstGid + tile.id),
|
||||
|
@@ -72,7 +72,7 @@ export namespace TiledPixiHelper {
|
||||
// a given tile size.
|
||||
// So the atlas images can have unused pixels at the right and bottom.
|
||||
// - Artists also sometimes add a banner.
|
||||
//
|
||||
//
|
||||
// It can also be that users rescaled the atlas without adapting the tile set
|
||||
// In this case, having a broken visual can help understand the issue.
|
||||
// Especially since the error can only be found in the logs.
|
||||
|
Reference in New Issue
Block a user