rothiotome / godot-very-simple-twitch

Very Simple Twitch Chat integration for Godot
MIT License
46 stars 6 forks source link

[Bug]: VST's global class names can easily conflict with project classes #21

Open romlok opened 3 months ago

romlok commented 3 months ago

Project Version

0.0.1

Similar Issues

No response

What is the issue?

Upon installing the addon to my project, I immediately started getting errors because my game already uses a class called ChatMessage. While this particular class is defined by the example/ code, which is no problem to just delete, I do notice that there is also a Chatter class in the VST addon code, which seems general enough that it could trigger similar issues for other projects.

Therefore I suggest prefixing all of VST's global classes with VST (eg. VSTChatMessage) or something even more specific. That way it's far less likely that there will be any clash in class names with any given project, or any other addons (eg. connectors for other chat services)!

Steps to reproduce

  1. Have a project which defines a ChatMessage class (in my case it's internal to an autoload)
  2. Install the VST addon
  3. :sob:

Current behavior

I install VST and my game stops working

Expected behavior

I install VST and it has no effect on the running my game

Failure logs or additional information

No response

rothiotome commented 3 months ago

I never considered the possibility of conflicting names, and I understand that this can be an issue when adding the game to existing projects.

The best solution would be to use namespaces, but since GDScript doesn't allow them (yet!), I'll change the class names in the addon folder to names starting with VST and release a new version with these changes.