C#: Create script instance of reloaded scripts even if they're not tools

Scripts that are instantiated at some point will always be recreated
if they ever become placeholders to prevent non-tool scripts
instantiated manually by users to become placeholders, if they
do become placeholders due to errors that prevent instantiation
(such as a missing parameterless constructor) these scripts
will also be recreated replacing the temporary placeholder.

If a script is marked as a tool but becomes a non-tool script
in a rebuild, the script will become a placeholder and will
no longer be considered applicable to be replaced by an instance
since the user explicitly removed the Tool attribute.
This commit is contained in:
Raul Santos 2022-09-02 22:31:56 +02:00
parent 33b4153764
commit a91a3d01f8
No known key found for this signature in database
GPG key ID: B532473AE3A803E4
3 changed files with 44 additions and 6 deletions

View file

@ -90,6 +90,9 @@ class CSharpScript : public Script {
HashSet<ObjectID> pending_reload_instances;
RBMap<ObjectID, StateBackup> pending_reload_state;
bool was_tool_before_reload = false;
HashSet<ObjectID> pending_replace_placeholders;
#endif
String source;