mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2024-12-23 11:42:39 -06: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.directnotify import DirectNotifyGlobal
|
||||||
from direct.distributed import DistributedObject
|
from direct.distributed import DistributedObject
|
||||||
|
|
||||||
from otp.ai.MagicWordGlobal import *
|
from otp.ai.MagicWordGlobal import *
|
||||||
|
|
||||||
|
|
||||||
lastClickedNametag = None
|
lastClickedNametag = None
|
||||||
|
|
||||||
|
|
||||||
class MagicWordManager(DistributedObject.DistributedObject):
|
class MagicWordManager(DistributedObject.DistributedObject):
|
||||||
notify = DirectNotifyGlobal.directNotify.newCategory('MagicWordManager')
|
notify = DirectNotifyGlobal.directNotify.newCategory('MagicWordManager')
|
||||||
neverDisable = 1
|
neverDisable = 1
|
||||||
|
@ -20,6 +17,9 @@ class MagicWordManager(DistributedObject.DistributedObject):
|
||||||
DistributedObject.DistributedObject.disable(self)
|
DistributedObject.DistributedObject.disable(self)
|
||||||
|
|
||||||
def handleMagicWord(self, magicWord):
|
def handleMagicWord(self, magicWord):
|
||||||
|
if not base.localAvatar.isAdmin():
|
||||||
|
return
|
||||||
|
|
||||||
if magicWord.startswith('~~'):
|
if magicWord.startswith('~~'):
|
||||||
if lastClickedNametag == None:
|
if lastClickedNametag == None:
|
||||||
target = base.localAvatar
|
target = base.localAvatar
|
||||||
|
@ -32,6 +32,7 @@ class MagicWordManager(DistributedObject.DistributedObject):
|
||||||
|
|
||||||
targetId = target.doId
|
targetId = target.doId
|
||||||
self.sendUpdate('sendMagicWord', [magicWord, targetId])
|
self.sendUpdate('sendMagicWord', [magicWord, targetId])
|
||||||
|
|
||||||
if target == base.localAvatar:
|
if target == base.localAvatar:
|
||||||
response = spellbook.process(base.localAvatar, target, magicWord)
|
response = spellbook.process(base.localAvatar, target, magicWord)
|
||||||
if response:
|
if response:
|
||||||
|
|
Loading…
Reference in a new issue