(() => {
const pluginName = "ButtonPicture";
PluginManager.registerCommand(pluginName, "set", args => {
const pictureId = Number(args.pictureId);
const commonEventId = Number(args.commonEventId);
const picture = $gameScreen.picture(pictureId);
if (picture) {
picture.mzkp_commonEventId = commonEventId;
}
});
Sprite_Picture.prototype.isClickEnabled = function() {
const picture = this.picture();
return picture && picture.mzkp_commonEventId && !$gameMessage.isBusy();
};
Sprite_Picture.prototype.onClick = function() {
$gameTemp.reserveCommonEvent(this.picture().mzkp_commonEventId);
};
Spriteset_Base.prototype.mzkp_isAnyPicturePressed = function() {
return this._pictureContainer.children.some(sprite =>
sprite.isPressed()
);
};
const _Scene_Map_isAnyButtonPressed =
Scene_Map.prototype.isAnyButtonPressed;
Scene_Map.prototype.isAnyButtonPressed = function() {
return (
_Scene_Map_isAnyButtonPressed.apply(this, arguments) ||
this._spriteset.mzkp_isAnyPicturePressed()
);
};
})();