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.conf import settings
|
||||||
from django.core.paginator import Paginator
|
from django.core.paginator import Paginator
|
||||||
from django.db.models import Max, Min, Q
|
from django.db.models import Max, Min, Q
|
||||||
|
|
||||||
from evennia import InterruptCommand
|
from evennia import InterruptCommand
|
||||||
from evennia.commands.cmdhandler import get_and_merge_cmdsets
|
from evennia.commands.cmdhandler import get_and_merge_cmdsets
|
||||||
from evennia.locks.lockhandler import LockException
|
from evennia.locks.lockhandler import LockException
|
||||||
|
|
@ -3355,21 +3354,29 @@ class CmdScripts(COMMAND_DEFAULT_CLASS):
|
||||||
"pause": "|Paused|n",
|
"pause": "|Paused|n",
|
||||||
"delete": "|rDeleted|n",
|
"delete": "|rDeleted|n",
|
||||||
}
|
}
|
||||||
|
# never show these script types
|
||||||
|
hide_script_paths = ("evennia.prototypes.prototypes.DbPrototype",)
|
||||||
|
|
||||||
def _search_script(self, args):
|
def _search_script(self, args):
|
||||||
# test first if this is a script match
|
# 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:
|
if scripts:
|
||||||
return scripts
|
return scripts
|
||||||
# try typeclass path
|
# 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:
|
if scripts:
|
||||||
return scripts
|
return scripts
|
||||||
if "-" in args:
|
if "-" in args:
|
||||||
# may be a dbref-range
|
# may be a dbref-range
|
||||||
val1, val2 = (dbref(part.strip()) for part in args.split("-", 1))
|
val1, val2 = (dbref(part.strip()) for part in args.split("-", 1))
|
||||||
if val1 and val2:
|
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:
|
if scripts:
|
||||||
return scripts
|
return scripts
|
||||||
|
|
||||||
|
|
@ -3380,7 +3387,7 @@ class CmdScripts(COMMAND_DEFAULT_CLASS):
|
||||||
|
|
||||||
if not self.args:
|
if not self.args:
|
||||||
# show all scripts
|
# show all scripts
|
||||||
scripts = ScriptDB.objects.all()
|
scripts = ScriptDB.objects.all().exclude(db_typeclass_path__in=self.hide_script_paths)
|
||||||
if not scripts:
|
if not scripts:
|
||||||
caller.msg("No scripts found.")
|
caller.msg("No scripts found.")
|
||||||
return
|
return
|
||||||
|
|
@ -3418,7 +3425,9 @@ class CmdScripts(COMMAND_DEFAULT_CLASS):
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
# just show all scripts on object
|
# 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:
|
if scripts:
|
||||||
ScriptEvMore(caller, scripts.order_by("id"), session=self.session)
|
ScriptEvMore(caller, scripts.order_by("id"), session=self.session)
|
||||||
else:
|
else:
|
||||||
|
|
@ -3450,7 +3459,9 @@ class CmdScripts(COMMAND_DEFAULT_CLASS):
|
||||||
# modification switches - must operate on existing scripts
|
# modification switches - must operate on existing scripts
|
||||||
|
|
||||||
if not 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:
|
if scripts.count() > 1:
|
||||||
ret = yield (
|
ret = yield (
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue