Skip to content
Snippets Groups Projects
Commit 3048f047 authored by Pregmodder's avatar Pregmodder
Browse files

Merge branch 'importSlave' into 'pregmod-master'

Import slave to js

See merge request pregmodfan/fc-pregmod!8740
parents e73f495c 5650097d
No related branches found
No related tags found
No related merge requests found
......@@ -72,3 +72,12 @@ new App.DomPassage(
return App.UI.SlaveInteract.surgeryDegradation(getSlave(V.AS));
}, ["jump-from-safe"]
);
new App.DomPassage(
"Import Slave",
() => {
V.nextButton = "Continue";
V.nextLink = "Slave Interact";
return App.UI.SlaveInteract.importSlave();
}, ["jump-from-safe"]
);
App.UI.SlaveInteract.importSlave = function() {
const el = new DocumentFragment();
App.UI.DOM.appendNewElement("span", el, `Paste the code into the text box and press enter: `);
el.append(
App.UI.DOM.makeTextBox(
"",
v => {
if (v) {
const slave = eval(`({${v}})`);
slave.ID = generateSlaveID();
newSlave(slave);
SlaveDatatypeCleanup(slave);
V.AS = slave.ID;
Engine.play("Slave Interact");
}
}
)
);
return el;
};
:: Import Slave [nobr]
<<set $nextButton = "Continue", $nextLink = "Slave Interact">>
//Paste the code into the text box and click Apply//
<br><br>
<span id = "import">
</span>
<<set $tempSlave = "">>
<<textbox "$tempSlave" $tempSlave>>
<<link "Apply">>
<<if (def $tempSlave) && ($tempSlave !== "")>>
<<set $tempSlave = eval('({' + $tempSlave + '})')>>
<<set $tempSlave.ID = generateSlaveID()>>
<<run newSlave($tempSlave)>>
<<replace #import>>
''Slave imported successfully!''
<br><br>
<</replace>>
<<unset $tempSlave>>
<<else>>
<<replace #import>>
''Slave not imported!''
<br><br>
<</replace>>
<</if>>
<</link>>
<br><br>
<<link "Continue">>
<<set $AS = $tempSlave.ID>>
<<goto "Slave Interact">>
<</link>>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment