Add a builder override to object.controls_other function. Also refine what is shown when examining based on ownership and permissions.
This commit is contained in:
parent
214534a86f
commit
a7a3a33334
2 changed files with 13 additions and 1 deletions
|
|
@ -253,6 +253,12 @@ def cmd_examine(command):
|
||||||
# Use standard_plr_objsearch to handle duplicate/nonexistant results.
|
# Use standard_plr_objsearch to handle duplicate/nonexistant results.
|
||||||
if not target_obj:
|
if not target_obj:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# If the user doesn't control the object, just look at it instead.
|
||||||
|
if not pobject.controls_other(target_obj, builder_override=True):
|
||||||
|
command.command_string = 'look'
|
||||||
|
cmd_look(command)
|
||||||
|
return
|
||||||
|
|
||||||
if attr_search:
|
if attr_search:
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -270,10 +270,11 @@ class Object(models.Model):
|
||||||
"""
|
"""
|
||||||
return self.id == other_obj.get_owner().id
|
return self.id == other_obj.get_owner().id
|
||||||
|
|
||||||
def controls_other(self, other_obj):
|
def controls_other(self, other_obj, builder_override=False):
|
||||||
"""
|
"""
|
||||||
See if the envoked object controls another object.
|
See if the envoked object controls another object.
|
||||||
other_obj: (Object) Reference for object to check dominance of.
|
other_obj: (Object) Reference for object to check dominance of.
|
||||||
|
builder_override: (bool) True if builder perm allows controllership.
|
||||||
"""
|
"""
|
||||||
if self == other_obj:
|
if self == other_obj:
|
||||||
return True
|
return True
|
||||||
|
|
@ -288,6 +289,11 @@ class Object(models.Model):
|
||||||
if self.owns_other(other_obj):
|
if self.owns_other(other_obj):
|
||||||
# If said object owns the target, then give it the green.
|
# If said object owns the target, then give it the green.
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
# When builder_override is enabled, a builder permission means
|
||||||
|
# the object controls the other.
|
||||||
|
if builder_override and not other_obj.is_player() and self.user_has_perm('genperms.builder'):
|
||||||
|
return True
|
||||||
|
|
||||||
# They've failed to meet any of the above conditions.
|
# They've failed to meet any of the above conditions.
|
||||||
return False
|
return False
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue