Make type/force update rather than reset. Resolve #2504

This commit is contained in:
Griatch 2022-02-14 00:04:07 +01:00
parent 2e94e1b67d
commit 39368bc9ae
2 changed files with 16 additions and 2 deletions

View file

@ -155,6 +155,8 @@ Up requirements to Django 4.0+, Twisted 22+, Python 3.9 or 3.10
from a web view.
- Update `evennia.utils.logger` to use Twisted's new logging API. No change in Evennia API
except more standard aliases logger.error/info/exception/debug etc can now be used.
- Have `type/force` default to `update`-mode rather than `reset`mode and add more verbose
warning when using reset mode.
## Evennia 0.9.5

View file

@ -25,6 +25,7 @@ from evennia.utils.utils import (
format_grid,
)
from evennia.utils.eveditor import EvEditor
from evennia.utils.evmenu import ask_yes_no
from evennia.utils.evmore import EvMore
from evennia.utils.evtable import EvTable
from evennia.prototypes import spawner, prototypes as protlib, menus as olc_menus
@ -2212,11 +2213,22 @@ class CmdTypeclass(COMMAND_DEFAULT_CLASS):
"Use /force to override."
)
else:
update = "update" in self.switches
reset = "reset" in self.switches
update = "update" in self.switches or not reset # default to update
hooks = "at_object_creation" if update and not reset else "all"
old_typeclass_path = obj.typeclass_path
if reset:
answer = yield("|yNote that this will reset the object back to its typeclass' default state, "
"removing any custom locks/perms/attributes etc that may have been added "
"by an explicit create_object call. Use `update` or type/force instead in order "
"to keep such data. "
"Continue [Y]/N?|n")
if answer.upper() == "N":
caller.msg("Aborted.")
return
# special prompt for the user in cases where we want
# to confirm changes.
if "prototype" in self.switches:
@ -2262,7 +2274,7 @@ class CmdTypeclass(COMMAND_DEFAULT_CLASS):
if reset:
string += " All old attributes where deleted before the swap."
else:
string += " Attributes set before swap were not removed."
string += " Attributes set before swap were not removed\n(use `swap` or `type/reset` to clear all)."
if "prototype" in self.switches and prototype_success:
string += (
" Prototype '%s' was successfully applied over the object type."