dead-bunny/js/plugins/Nore_ConstructionTile.js
2025-01-12 01:21:39 -06:00

61 lines
1.5 KiB
JavaScript

Spriteset_Map.prototype.addConstrunctionTile = function (regionId) {
var tilemap = this._tilemap;
for (var x = 0; x < $gameMap.width(); x++) {
for (var y = 0; y < $gameMap.height(); y++) {
var rId = $gameMap.regionId(x, y);
if (regionId != rId) {
continue;
}
p(rId);
tilemap._addTile(tilemap._lowerLayer, 2892, x, y);
}
}
};
var DOUSEI_MAP_ID = 30;
var CEILING_ID = 7472;
var _Tilemap_prototype__readMapData = Tilemap.prototype._readMapData;
Tilemap.prototype._readMapData = function (x, y, z) {
if ($gameMap.mapId() != DOUSEI_MAP_ID) {
return _Tilemap_prototype__readMapData.call(this, x, y, z);
}
if (this._mapData) {
var width = this._mapWidth;
var height = this._mapHeight;
if (this.horizontalWrap) {
x = x.mod(width);
}
if (this.verticalWrap) {
y = y.mod(height);
}
var rId = $gameMap.regionId(x, y);
switch (rId) {
case 1:
if (!$gameSwitches.value(71)) {
return CEILING_ID;
}
break;
case 2:
if (!$gameSwitches.value(72)) {
return CEILING_ID;
}
break;
case 3:
if (!$gameSwitches.value(73)) {
return CEILING_ID;
}
break;
case 4:
if (!$gameSwitches.value(74)) {
return CEILING_ID;
}
break;
}
if (x >= 0 && x < width && y >= 0 && y < height) {
return this._mapData[(z * height + y) * width + x] || 0;
} else {
return 0;
}
} else {
return 0;
}
};