Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy to Clipboard Issue #30

Open
andy6170 opened this issue Apr 26, 2023 · 3 comments
Open

Copy to Clipboard Issue #30

andy6170 opened this issue Apr 26, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@andy6170
Copy link

andy6170 commented Apr 26, 2023

When copying to clipboard the mutation is now missing.

Example of old copy:
<block type="SetVariable" x="5684" y="3748"><value name="VALUE-0"><block type="variableReferenceBlock"><mutation isObjectVar="true"></mutation><field name="OBJECTTYPE">Player</field><field name="VAR" id=".1~L+5yj2frDus(~IK#H" variabletype="Player">switchTeamCounter</field><value name="OBJECT"><block type="EventPlayer"></block></value></block></value><value name="VALUE-1"><block type="Number"><field name="NUM">0</field></block></value></block>

Current version of copy:
<block type="SetVariable" x="5684" y="3748"><value name="VALUE-0"><block type="variableReferenceBlock"><field name="OBJECTTYPE">Player</field><field name="VAR" id=".1~L+5yj2frDus(~IK#H" variabletype="Player">switchTeamCounter</field><value name="OBJECT"><block type="EventPlayer"></block></value></block></value><value name="VALUE-1"><block type="Number"><field name="NUM">0</field></block></value></block>

As a result when pasting the code it is defaulting the blocks and missing the object variables and also has the same affect on Rules.

image

@The0zzy
Copy link

The0zzy commented Apr 26, 2023

Migration Guide from XML to JSON Serialization
https://docs.google.com/document/d/1wv5ORrO4icVHeU15FLSn37mdNLyJpQbMTo7mmTqsGl0/edit

@p0lygun
Copy link
Contributor

p0lygun commented Apr 27, 2023

Blocks

image

json

Click to show
{
    "type": "subroutineBlock",
    "id": "991Z^}*#2WiB.MJ_Q.[1",
    "extraState": {
        "subroutineName": "test_boi",
        "parameters": []
    },
    "fields": {
        "SUBROUTINE_NAME": "test_boi"
    },
    "inputs": {
        "ACTIONS": {
            "block": {
                "type": "SetVariable",
                "id": ".@|%|~Jt)gcPYYccdNt]",
                "inputs": {
                    "VALUE-0": {
                        "block": {
                            "type": "variableReferenceBlock",
                            "id": "Aqu;GWblLC@$5+`O/c6Q",
                            "extraState": {
                                "isObjectVar": false
                            },
                            "fields": {
                                "OBJECTTYPE": "Global",
                                "VAR": {
                                    "id": "i9Hbb3OYw@)$+K}O6e!B",
                                    "name": "test",
                                    "type": "Global"
                                }
                            }
                        }
                    }
                },
                "next": {
                    "block": {
                        "type": "SetVariable",
                        "id": "WL0uBCW7SC$$a}o-2x~o",
                        "inputs": {
                            "VALUE-0": {
                                "block": {
                                    "type": "variableReferenceBlock",
                                    "id": ";G/t8[/u9FUfH~mY.CpF",
                                    "extraState": {
                                        "isObjectVar": true
                                    },
                                    "fields": {
                                        "OBJECTTYPE": "Player",
                                        "VAR": {
                                            "id": "2kQ.)|a4BTY,ZuTE=SFi",
                                            "name": "test_player",
                                            "type": "Player"
                                        }
                                    },
                                    "inputs": {
                                        "OBJECT": {
                                            "block": {
                                                "type": "EventPlayer",
                                                "id": "drR[C#e469lX8U!t{+kq"
                                            }
                                        }
                                    }
                                }
                            }
                        },
                        "next": {
                            "block": {
                                "type": "SetVariable",
                                "id": "q:vq=rL`d[{40oy*0hvj",
                                "inputs": {
                                    "VALUE-0": {
                                        "block": {
                                            "type": "variableReferenceBlock",
                                            "id": "oiF8SL/}oRVAdApL%|gU",
                                            "extraState": {
                                                "isObjectVar": true
                                            },
                                            "fields": {
                                                "OBJECTTYPE": "TeamId",
                                                "VAR": {
                                                    "id": "a9Hl)bdum@M,]Ma:$YJD",
                                                    "name": "test_team",
                                                    "type": "TeamId"
                                                }
                                            },
                                            "inputs": {
                                                "OBJECT": {
                                                    "block": {
                                                        "type": "EventTeam",
                                                        "id": "+bJgBa$ALi^M)c4JBTcX"
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}

XML

Click to show
<?xml version="1.0" encoding="UTF-8"?>
<block type="subroutineBlock" deletable="false" x="177" y="195">
    <field name="SUBROUTINE_NAME">test_boi</field>
    <statement name="ACTIONS">
        <block type="SetVariable">
            <value name="VALUE-0">
                <block type="variableReferenceBlock">
                    <field name="OBJECTTYPE">Global</field>
                    <field name="VAR" id="i9Hbb3OYw@)$+K}O6e!B" variabletype="Global">test</field>
                </block>
            </value>
            <next>
                <block type="SetVariable">
                    <value name="VALUE-0">
                        <block type="variableReferenceBlock">
                            <field name="OBJECTTYPE">Player</field>
                            <field name="VAR" id="2kQ.)|a4BTY,ZuTE=SFi" variabletype="Player">test_player</field>
                            <value name="OBJECT">
                                <block type="EventPlayer" />
                            </value>
                        </block>
                    </value>
                    <next>
                        <block type="SetVariable">
                            <value name="VALUE-0">
                                <block type="variableReferenceBlock">
                                    <field name="OBJECTTYPE">TeamId</field>
                                    <field name="VAR" id="a9Hl)bdum@M,]Ma:$YJD" variabletype="TeamId">test_team</field>
                                    <value name="OBJECT">
                                        <block type="EventTeam" />
                                    </value>
                                </block>
                            </value>
                        </block>
                    </next>
                </block>
            </next>
        </block>
    </statement>
</block>

p0lygun added a commit to p0lygun/BF2042-Portal-Extensions that referenced this issue Apr 27, 2023
As XML has been ice boxed in blockly and as reported in LennardF1989#30, it fails to load team and player variables correctly, so migrating to json serialization is the obvious choice
@LennardF1989
Copy link
Owner

Should be fixed in 2.0.0-pr, please test and report.

@LennardF1989 LennardF1989 added the bug Something isn't working label May 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
4 participants