mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 21:06:30 +01:00
Hide prototypes from script command (use spawn/list) instead
This commit is contained in:
parent
81bc51fa72
commit
d8924837f9
1 changed files with 18 additions and 7 deletions
|
|
@ -6,7 +6,6 @@ import re
|
|||
from django.conf import settings
|
||||
from django.core.paginator import Paginator
|
||||
from django.db.models import Max, Min, Q
|
||||
|
||||
from evennia import InterruptCommand
|
||||
from evennia.commands.cmdhandler import get_and_merge_cmdsets
|
||||
from evennia.locks.lockhandler import LockException
|
||||
|
|
@ -3355,21 +3354,29 @@ class CmdScripts(COMMAND_DEFAULT_CLASS):
|
|||
"pause": "|Paused|n",
|
||||
"delete": "|rDeleted|n",
|
||||
}
|
||||
# never show these script types
|
||||
hide_script_paths = ("evennia.prototypes.prototypes.DbPrototype",)
|
||||
|
||||
def _search_script(self, args):
|
||||
# test first if this is a script match
|
||||
scripts = ScriptDB.objects.get_all_scripts(key=args)
|
||||
scripts = ScriptDB.objects.get_all_scripts(key=args).exclude(
|
||||
db_typeclass_path__in=self.hide_script_paths
|
||||
)
|
||||
if scripts:
|
||||
return scripts
|
||||
# try typeclass path
|
||||
scripts = ScriptDB.objects.filter(db_typeclass_path__iendswith=args)
|
||||
scripts = ScriptDB.objects.filter(db_typeclass_path__iendswith=args).exclude(
|
||||
db_typeclass_path__in=self.hide_script_paths
|
||||
)
|
||||
if scripts:
|
||||
return scripts
|
||||
if "-" in args:
|
||||
# may be a dbref-range
|
||||
val1, val2 = (dbref(part.strip()) for part in args.split("-", 1))
|
||||
if val1 and val2:
|
||||
scripts = ScriptDB.objects.filter(id__in=(range(val1, val2 + 1)))
|
||||
scripts = ScriptDB.objects.filter(id__in=(range(val1, val2 + 1))).exclude(
|
||||
db_typeclass_path__in=self.hide_script_paths
|
||||
)
|
||||
if scripts:
|
||||
return scripts
|
||||
|
||||
|
|
@ -3380,7 +3387,7 @@ class CmdScripts(COMMAND_DEFAULT_CLASS):
|
|||
|
||||
if not self.args:
|
||||
# show all scripts
|
||||
scripts = ScriptDB.objects.all()
|
||||
scripts = ScriptDB.objects.all().exclude(db_typeclass_path__in=self.hide_script_paths)
|
||||
if not scripts:
|
||||
caller.msg("No scripts found.")
|
||||
return
|
||||
|
|
@ -3418,7 +3425,9 @@ class CmdScripts(COMMAND_DEFAULT_CLASS):
|
|||
)
|
||||
else:
|
||||
# just show all scripts on object
|
||||
scripts = ScriptDB.objects.filter(db_obj=obj)
|
||||
scripts = ScriptDB.objects.filter(db_obj=obj).exclude(
|
||||
db_typeclass_path__in=self.hide_script_paths
|
||||
)
|
||||
if scripts:
|
||||
ScriptEvMore(caller, scripts.order_by("id"), session=self.session)
|
||||
else:
|
||||
|
|
@ -3450,7 +3459,9 @@ class CmdScripts(COMMAND_DEFAULT_CLASS):
|
|||
# modification switches - must operate on existing scripts
|
||||
|
||||
if not scripts:
|
||||
scripts = ScriptDB.objects.filter(db_obj=obj)
|
||||
scripts = ScriptDB.objects.filter(db_obj=obj).exclude(
|
||||
db_typeclass_paths__in=self.hide_script_paths
|
||||
)
|
||||
|
||||
if scripts.count() > 1:
|
||||
ret = yield (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue