Access level on nametag

This commit is contained in:
John 2015-07-01 13:15:05 +03:00
parent 67d8bb1a1d
commit 3b9a4e8820
2 changed files with 20 additions and 6 deletions

View file

@ -127,6 +127,7 @@ class Avatar(Actor, ShadowCaster):
self.nametag.setColorCode(self.playerType)
else:
self.nametag.setColorCode(NametagGroup.CCNoChat)
self.setNametagName()
def considerUnderstandable(self):
speed = 0
@ -223,18 +224,31 @@ class Avatar(Actor, ShadowCaster):
return self.avatarType
def setName(self, name):
if hasattr(self, 'isDisguised'):
if self.isDisguised:
return
if hasattr(self, 'isDisguised') and self.isDisguised:
return
self.name = name
if hasattr(self, 'nametag'):
self.nametag.setName(name)
self.setNametagName()
def setDisplayName(self, str):
if hasattr(self, 'isDisguised'):
if self.isDisguised:
return
self.nametag.setDisplayName(str)
self.setNametagName(str)
def setNametagName(self, name=None):
if not name:
name = self.name
if hasattr(self, 'adminAccess') and self.isAdmin():
access = self.getAdminAccess()
if access in OTPLocalizer.AccessToString:
name += '\n\x01shadow\x01%s\x02' % OTPLocalizer.AccessToString[access]
self.nametag.setDisplayName(name)
def getFont(self):
return self.__font

View file

@ -133,7 +133,7 @@ class Nametag(ClickablePopup):
t.node().setAlign(TextNode.ACenter)
t.node().setWordwrap(self.wordWrap)
t.node().setText(self.displayName)
t.setColor(self.nameFg)
t.node().setTextColor(self.nameFg)
t.setTransparency(self.nameFg[3] < 1.0)
width, height = t.node().getWidth(), t.node().getHeight()