Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into langlabel-widget
Browse files Browse the repository at this point in the history
  • Loading branch information
Image-unavailable committed Oct 2, 2022
2 parents ea93c11 + e9e7d3c commit a921e76
Show file tree
Hide file tree
Showing 24 changed files with 6,810 additions and 24,330 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [Unreleased]
## [0.15.1] 2022-09-28

### Fixed
- `WallHorizontal` and `WallVertical` are now created with the correct default size on their non-resizable axis.

## [0.15.0] 2022-09-27

### Added
- New editor for `langlabel` properties.
Expand All @@ -13,6 +19,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Fixed compatibility with the newer Electron versions.
- Enemy editing popup no longer bugs out when editing enemies inside event steps.
- Fixed copy-pasting of `IF` steps and other steps with branches.
- Fixed inability to edit certain `String` properties of various event and action steps.

### Changed
- `String` inputs for event steps, action steps, and entity properties, as well as the map creation dialog now also allow values different from the suggested ones.

## [0.14.0] 2022-05-28
- Add coordinate display for the cursor in entity view
Expand Down
106 changes: 59 additions & 47 deletions tools/parse-action-step.js
Original file line number Diff line number Diff line change
@@ -1,57 +1,69 @@
// parse entities to map editor readable format
// Parse entities to map editor readable format. Copy it into the game console and it will put the result in your clipboard.

const ig = document.getElementById('frame').contentWindow.ig;
let og = {};
for (const [key, val] of Object.entries(ig.ACTION_STEP)) {
let wm = val.prototype._wm;
if (!wm) {
console.warn(key + ' has no wm property', val.prototype);
continue;
{ //Scope is so that you can run the script multiple times without having evil vars in the code
const STEP_TYPE = ig.EVENT_STEP; //Change this to ig.ACTION_STEP to copy action steps

//const ig = document.getElementById('frame').contentWindow.ig; //Uncomment this for old crosscode versions
let og = {};
for (const [key, val] of Object.entries(STEP_TYPE)) {
let wm = val.prototype._wm;
if (!wm) {
console.warn(key + ' has no wm property', val.prototype);
continue;
}
let prot = val.prototype;
prot = JSON.parse(JSON.stringify(prot));
delete prot._wm;
delete prot.classId;
og[key] = wm;
delete wm._data;
delete wm.classId;
wm.initialObject = prot;
}
let prot = val.prototype;
prot = JSON.parse(JSON.stringify(prot));
delete prot._wm;
delete prot.classId;
og[key] = wm;
delete wm._data;
delete wm.classId;
wm.initialObject = prot;
}

let out = JSON.parse(JSON.stringify(og));
let out = JSON.parse(JSON.stringify(og));

for (let [key, value] of Object.entries(out)) {
if (!value.attributes)
delete out[key]
}
for (let [key, value] of Object.entries(out)) {
if (!value.attributes)
delete out[key]
}

for (let [key, value] of Object.entries(out)) {
delete value.classId;
delete value._data;

for (let [key2, attr] of Object.entries(value.attributes)) {
for (let key3 of Object.keys(attr)) {
if (key3.startsWith('_')) {
attr[key3.substr(1)] = attr[key3];
delete attr[key3];
}
}
for (let [key, value] of Object.entries(out)) {
delete value.classId;
delete value._data;

attr.description = attr.info;
delete attr.info;
attr.options = ig.ACTION_STEP[key].prototype._wm.attributes[key2]._select;
delete attr.select;


if (attr.options) {
const newopt = {};
for (let optionKey of Object.keys(attr.options)) {
newopt[optionKey] = 0;
for (let [key2, attr] of Object.entries(value.attributes)) {
for (let key3 of Object.keys(attr)) {
if (key3.startsWith('_')) {
attr[key3.substr(1)] = attr[key3];
delete attr[key3];
}
}

attr.description = attr.info;
delete attr.info;
attr.options = STEP_TYPE[key].prototype._wm.attributes[key2]._select;
delete attr.select;


if (attr.options) {
const newopt = {};
let optIterator;

if(Array.isArray(attr.options)) {
optIterator = attr.options;
} else {
optIterator = Object.keys(attr.options);
}

for (let optionKey of optIterator) {
newopt[optionKey] = 0;
}
attr.options = newopt;
}
attr.options = newopt;
}
}
}

console.log(out);
copy(JSON.stringify(out));
console.log(out);
copy(JSON.stringify(out));
}
Loading

0 comments on commit a921e76

Please sign in to comment.