mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 21:06:30 +01:00
Make Sripthandler.add not fail if passed instantiated script. Resolve #3272
This commit is contained in:
parent
cf38de0922
commit
808bde0c7c
2 changed files with 10 additions and 3 deletions
|
|
@ -7,12 +7,15 @@
|
|||
instead of 'Custom' (InspectorCaracal)
|
||||
- [Fix][pull3274]: Traceback when creating objects with initial nattributes
|
||||
(InspectorCaracal)
|
||||
- [Fix][issue3272]: Make sure `ScriptHandler.add` does not fail if passed an
|
||||
instantiated script.
|
||||
- Docs: Typo fixes and starting earlier with explaining how to add to the
|
||||
default cmdsets.
|
||||
|
||||
[pull3267]: https://github.com/evennia/evennia/pull/3267
|
||||
[pull3270]: https://github.com/evennia/evennia/pull/3270
|
||||
[pull3274]: https://github.com/evennia/evennia/pull/3274
|
||||
[issue3272]: https://github.com/evennia/evennia/issues/3272
|
||||
|
||||
## Evennia 2.3.0
|
||||
|
||||
|
|
|
|||
|
|
@ -76,10 +76,14 @@ class ScriptHandler(object):
|
|||
script = create.create_script(
|
||||
scriptclass, key=key, account=self.obj, autostart=autostart
|
||||
)
|
||||
else:
|
||||
# adding to an Object. We wait to autostart so we can differentiate
|
||||
# a failing creation from a script that immediately starts/stops.
|
||||
elif isinstance(scriptclass, str) or callable(scriptclass):
|
||||
# a str or class to use create before adding to an Object. We wait to autostart
|
||||
# so we can differentiate a failing creation from a script that immediately starts/stops.
|
||||
script = create.create_script(scriptclass, key=key, obj=self.obj, autostart=False)
|
||||
else:
|
||||
# already an instantiated class
|
||||
script = scriptclass
|
||||
|
||||
if not script:
|
||||
logger.log_err(f"Script {scriptclass} failed to be created.")
|
||||
return None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue