mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2024-10-30 16:27:54 +00:00
~disableGM , ~enableGM + anybody can use magic words (but ppl are kicked)
This commit is contained in:
parent
5a76de3d72
commit
7352c9df43
7 changed files with 35 additions and 10 deletions
|
@ -20,9 +20,6 @@ class MagicWordManager(DistributedObject.DistributedObject):
|
|||
DistributedObject.DistributedObject.disable(self)
|
||||
|
||||
def handleMagicWord(self, magicWord):
|
||||
if not self.cr.wantMagicWords:
|
||||
return
|
||||
|
||||
if magicWord.startswith('~~'):
|
||||
if lastClickedNametag == None:
|
||||
target = base.localAvatar
|
||||
|
|
|
@ -343,8 +343,6 @@ class DistributedPlayer(DistributedAvatar.DistributedAvatar, PlayerBase.PlayerBa
|
|||
def setAdminAccess(self, access):
|
||||
self.adminAccess = access
|
||||
self.considerUnderstandable()
|
||||
if self.isLocal():
|
||||
self.cr.wantMagicWords = self.isAdmin()
|
||||
|
||||
def getAdminAccess(self):
|
||||
return self.adminAccess
|
||||
|
|
|
@ -217,4 +217,35 @@ def accessLevel(accessLevel, storage='PERSISTENT'):
|
|||
return "%s's access level has been set to %d." % (target.getName(), accessLevel)
|
||||
else:
|
||||
target.d_setSystemMessage(0, '%s set your access level to %d temporarily!' % (invoker.getName(), accessLevel))
|
||||
return "%s's access level has been set to %d temporarily." % (target.getName(), accessLevel)
|
||||
return "%s's access level has been set to %d temporarily." % (target.getName(), accessLevel)
|
||||
|
||||
@magicWord(category=CATEGORY_COMMUNITY_MANAGER)
|
||||
def disableGM():
|
||||
"""
|
||||
Temporarily disable GM features.
|
||||
"""
|
||||
target = spellbook.getTarget()
|
||||
|
||||
if hasattr(target, 'oldAccess'):
|
||||
return 'GM features are already disabled!\nTo enable, use ~enableGM.'
|
||||
|
||||
if not target.isAdmin():
|
||||
return 'Target is not an admin!'
|
||||
|
||||
target.oldAccess = target.adminAccess
|
||||
target.d_setAdminAccess(100)
|
||||
return 'GM features are disabled!'
|
||||
|
||||
@magicWord(category=CATEGORY_COMMUNITY_MANAGER)
|
||||
def enableGM():
|
||||
"""
|
||||
Enable GM features.
|
||||
"""
|
||||
target = spellbook.getTarget()
|
||||
|
||||
if not hasattr(target, 'oldAccess'):
|
||||
return 'GM features are not disabled!'
|
||||
|
||||
target.d_setAdminAccess(target.oldAccess)
|
||||
del target.oldAccess
|
||||
return 'GM features are enabled!'
|
|
@ -123,7 +123,7 @@ class ChatManager(DirectObject.DirectObject):
|
|||
|
||||
def enterMainMenu(self):
|
||||
self.checkObscurred()
|
||||
if self.localAvatar.canChat() or self.cr.wantMagicWords:
|
||||
if self.localAvatar.canChat():
|
||||
if self.wantBackgroundFocus:
|
||||
self.chatInputNormal.chatEntry['backgroundFocus'] = 1
|
||||
self.acceptOnce('enterNormalChat', self.fsm.request, ['normalChat'])
|
||||
|
|
|
@ -17,7 +17,7 @@ class TalkAssistant(DirectObject.DirectObject):
|
|||
pass
|
||||
|
||||
def sendOpenTalk(self, message):
|
||||
if base.cr.wantMagicWords and len(message) > 0 and message[0] == '~':
|
||||
if len(message) > 0 and message[0] == '~':
|
||||
messenger.send('magicWord', [message])
|
||||
else:
|
||||
chatFlags = CFSpeech | CFTimeout
|
||||
|
|
|
@ -30,7 +30,6 @@ class OTPClientRepository(ClientRepositoryBase):
|
|||
self.createAvatarClass = None
|
||||
self.systemMessageSfx = None
|
||||
self.playToken = launcher.getPlayToken()
|
||||
self.wantMagicWords = False
|
||||
|
||||
self.parentMgr.registerParent(OTPGlobals.SPRender, base.render)
|
||||
self.parentMgr.registerParent(OTPGlobals.SPHidden, NodePath())
|
||||
|
|
|
@ -2360,4 +2360,4 @@ AccessToString = {
|
|||
500: '\x01androidGreen\x01Developer\x02',
|
||||
600: '\x01cobalt\x01Admin\x02',
|
||||
700: '\x01azure\x01System Admin\x02'
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue