GDevelopApp / GDevelop-extensions

Repository of behaviors, actions, conditions and expressions to be used in GDevelop for creating games
https://gdevelop.io
MIT License
131 stars 52 forks source link

Updated extension: Add copy variables to Extended Variables #139

Closed D8H closed 3 years ago

D8H commented 3 years ago

Describe the extension

It contains actions to

This allows to copy structure variables at once. I use it for the tactical game example to copy variable from level objects to in-game objects (https://github.com/4ian/GDevelop/issues/2612)

Checklist

Extension file

https://www.dropbox.com/s/nd87wtshqad4n4u/ExtendedVariables.zip?dl=1

Bouh commented 3 years ago

What you think to merge your extension with mine? Extended variables support

Bouh commented 3 years ago
D8H commented 3 years ago

What you think to merge your extension with mine? Extended variables support

Of course, I made the changes and update the archive file.

Bouh commented 3 years ago

Cool! Extension description have been updated, the version ,and tags too. You function is added and changes are done. What to said ^^ You can add your Github handle on the Author field!

For A_CopyAllObjectVariables is mandatory to check if the target have the variable? The variables must exist in this object for the values to be copied GDevelop create the variable on the fly when this one is missing.

https://github.com/4ian/GDevelop/blob/916938b4a8df88a060da95019b4921d615f15205/GDJS/Runtime/variablescontainer.ts#L126-L146

image

D8H commented 3 years ago

For A_CopyAllObjectVariables is mandatory to check if the target have the variable?

Not really, in the documentation of Variable#add I saw "This can be costly". So I avoided to use it and left the choice to the user to declare them but this may be not really user friendly. I don't know what's best.

Bouh commented 3 years ago

For A_CopyAllObjectVariables is mandatory to check if the target have the variable?

Not really, in the documentation of Variable#add I saw "This can be costly". So I avoided to use it and left the choice to the user to declare them but this may be not really user friendly. I don't know what's best.

@4ian

Yes it can be costly because indexOf is used image

D8H commented 3 years ago

Yes it can be costly because indexOf is used

I see so the "get" method must be use. I changed the extension code to let the "get" creates the variables if necessary. It's simpler that way.

Bouh commented 3 years ago

Ok I'll make a last check later today and merge it. Thanks you!

4ian commented 3 years ago

Thanks both 👍