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

Added way to add creation code in rooms and instances #1901

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

luizzeroxis
Copy link
Contributor

@luizzeroxis luizzeroxis commented Sep 4, 2024

Description

Made so the little + icon on creation code in rooms and instances can actually create the script instead of giving an error. Fixes #1900. Based on code from #1412.

Caveats

I tried to make it in a way that it could be expanded with other stuff. Maybe you could create derived classes from UndertaleObjectReference instead, so it doesn't clutter it up with a bunch of properties. Also the part that actually creates the code should probably be in the room model, and the part that creates arguments be separated and merged with the one that does that for object events already.

Notes

None

Copy link

github-actions bot commented Sep 4, 2024

@luizzeroxis luizzeroxis marked this pull request as ready for review September 4, 2024 13:23
Comment on lines 197 to 204
if (!IsPreCreate)
{
ObjectReference = CreationCode(mainWindow.Data, "gml_RoomCC_" + Room.Name.Content + "_" + RoomGameObject.InstanceID.ToString() + "_Create");
}
else
{
ObjectReference = CreationCode(mainWindow.Data, "gml_RoomCC_" + Room.Name.Content + "_" + RoomGameObject.InstanceID.ToString() + "_PreCreate");
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please condense these

@@ -173,6 +215,33 @@ private void Details_Click(object sender, RoutedEventArgs e)
}
}

// TODO move this to the models
UndertaleCode CreationCode(UndertaleData data, string name)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

function name feels too generic.

This is adding a code entry, not creation code.
And I'm fairly certain we already have a function in the lib to do exactly that

@luizzeroxis
Copy link
Contributor Author

Note that this will need to be changed if #1937 is merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Doesnt allow to add creation codes
2 participants