diff --git a/source/funkin/editors/character/CharacterEditor.hx b/source/funkin/editors/character/CharacterEditor.hx index a89b4e5e..a1cf9129 100644 --- a/source/funkin/editors/character/CharacterEditor.hx +++ b/source/funkin/editors/character/CharacterEditor.hx @@ -1,6 +1,6 @@ package funkin.editors.character; -import hscript.Printer; +import haxe.xml.Printer; import haxe.xml.Access; import funkin.editors.character.CharacterAnimsWindow.CharacterAnimButtons; import funkin.backend.utils.XMLUtil.AnimData; @@ -297,9 +297,24 @@ class CharacterEditor extends UIState { } function _file_save(_) { + #if sys + sys.io.File.saveContent( + Paths.xml('characters/${character.curCharacter}'), + buildCharacter() + ); + return; + #end + _file_saveas(_); } function _file_saveas(_) { + openSubState(new SaveSubstate(buildCharacter(), { + defaultSaveFile: '${character.curCharacter}.xml' + })); + } + + function buildCharacter():String { + return "\n" + Printer.print(character.buildXML(), true); } function _edit_undo(_) { diff --git a/source/funkin/game/Character.hx b/source/funkin/game/Character.hx index 6d413022..879b2310 100644 --- a/source/funkin/game/Character.hx +++ b/source/funkin/game/Character.hx @@ -357,6 +357,7 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset } public function applyXML(xml:Access) { + this.xml = xml; // modders wassup sprite = curCharacter; if (xml.has.isPlayer) playerOffsets = (xml.att.isPlayer == "true");