mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2024-10-30 16:27:54 +00:00
Magic word crash prevention
This commit is contained in:
parent
ecc33e1c3d
commit
5f9592cdd7
1 changed files with 4 additions and 3 deletions
|
@ -1,12 +1,9 @@
|
|||
from direct.directnotify import DirectNotifyGlobal
|
||||
from direct.distributed import DistributedObject
|
||||
|
||||
from otp.ai.MagicWordGlobal import *
|
||||
|
||||
|
||||
lastClickedNametag = None
|
||||
|
||||
|
||||
class MagicWordManager(DistributedObject.DistributedObject):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('MagicWordManager')
|
||||
neverDisable = 1
|
||||
|
@ -20,6 +17,9 @@ class MagicWordManager(DistributedObject.DistributedObject):
|
|||
DistributedObject.DistributedObject.disable(self)
|
||||
|
||||
def handleMagicWord(self, magicWord):
|
||||
if not base.localAvatar.isAdmin():
|
||||
return
|
||||
|
||||
if magicWord.startswith('~~'):
|
||||
if lastClickedNametag == None:
|
||||
target = base.localAvatar
|
||||
|
@ -32,6 +32,7 @@ class MagicWordManager(DistributedObject.DistributedObject):
|
|||
|
||||
targetId = target.doId
|
||||
self.sendUpdate('sendMagicWord', [magicWord, targetId])
|
||||
|
||||
if target == base.localAvatar:
|
||||
response = spellbook.process(base.localAvatar, target, magicWord)
|
||||
if response:
|
||||
|
|
Loading…
Reference in a new issue