mirror of
https://github.com/evennia/evennia.git
synced 2026-03-30 20:47:17 +02:00
fix clone num logic
This commit is contained in:
parent
d6d3fd3424
commit
0d00028374
1 changed files with 7 additions and 5 deletions
|
|
@ -1509,11 +1509,13 @@ class DefaultObject(ObjectDB, metaclass=TypeclassBase):
|
|||
returns the new clone name on the form keyXX
|
||||
"""
|
||||
key = self.key
|
||||
num = sum(
|
||||
1
|
||||
for obj in self.location.contents
|
||||
if obj.key.startswith(key) and obj.key.lstrip(key).isdigit()
|
||||
)
|
||||
num = 1
|
||||
if self.location:
|
||||
num = max(0, *[
|
||||
int(obj.key.lstrip(key) or 0)
|
||||
for obj in self.location.contents
|
||||
if obj.key.startswith(key)
|
||||
])+1
|
||||
return "%s%03i" % (key, num)
|
||||
|
||||
new_key = new_key or find_clone_key()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue