mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2024-12-23 19:52:37 -06:00
Add teleport toggle and prevent teleportation when ignored
This commit is contained in:
parent
2e744ba51f
commit
7053ae8676
5 changed files with 55 additions and 3 deletions
|
@ -72,6 +72,12 @@ class TTSFriendsManager(DistributedObjectGlobal):
|
||||||
if not hasattr(base.localAvatar, 'getTeleportAvailable') or not hasattr(base.localAvatar, 'ghostMode'):
|
if not hasattr(base.localAvatar, 'getTeleportAvailable') or not hasattr(base.localAvatar, 'ghostMode'):
|
||||||
self.sendUpdate('teleportResponse', [ fromId, 0, 0, 0, 0 ])
|
self.sendUpdate('teleportResponse', [ fromId, 0, 0, 0, 0 ])
|
||||||
return
|
return
|
||||||
|
if not base.localAvatar.acceptingTeleport:
|
||||||
|
self.sendUpdate('teleportResponse', [ fromId, 3, 0, 0, 0 ])
|
||||||
|
return
|
||||||
|
if base.localAvatar.isIgnored(fromId):
|
||||||
|
self.sendUpdate('teleportResponse', [ fromId, 2, 0, 0, 0 ])
|
||||||
|
return
|
||||||
|
|
||||||
friend = base.cr.identifyFriend(fromId)
|
friend = base.cr.identifyFriend(fromId)
|
||||||
|
|
||||||
|
|
|
@ -731,25 +731,28 @@ class ExtraOptionsTabPage(DirectFrame):
|
||||||
self.fov_label = DirectLabel(parent=self, relief=None, text=TTLocalizer.FieldOfViewLabel, text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=16, pos=(leftMargin, 0, textStartHeight))
|
self.fov_label = DirectLabel(parent=self, relief=None, text=TTLocalizer.FieldOfViewLabel, text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=16, pos=(leftMargin, 0, textStartHeight))
|
||||||
self.cogInterface_label = DirectLabel(parent=self, relief=None, text='', text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=16, pos=(leftMargin, 0, textStartHeight - textRowHeight))
|
self.cogInterface_label = DirectLabel(parent=self, relief=None, text='', text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=16, pos=(leftMargin, 0, textStartHeight - textRowHeight))
|
||||||
self.tpTransition_label = DirectLabel(parent=self, relief=None, text='', text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=16, pos=(leftMargin, 0, textStartHeight - 2 * textRowHeight))
|
self.tpTransition_label = DirectLabel(parent=self, relief=None, text='', text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=16, pos=(leftMargin, 0, textStartHeight - 2 * textRowHeight))
|
||||||
|
self.teleport_label = DirectLabel(parent=self, relief=None, text='', text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=16, pos=(leftMargin, 0, textStartHeight - 3 * textRowHeight))
|
||||||
self.fov_slider = DirectSlider(parent=self, pos=(buttonbase_xcoord, 0.0, buttonbase_ycoord),
|
self.fov_slider = DirectSlider(parent=self, pos=(buttonbase_xcoord, 0.0, buttonbase_ycoord),
|
||||||
value=settings['fov'], pageSize=5, range=(ToontownGlobals.DefaultCameraFov, ToontownGlobals.MaxCameraFov), command=self.__doFov,
|
value=settings['fov'], pageSize=5, range=(ToontownGlobals.DefaultCameraFov, ToontownGlobals.MaxCameraFov), command=self.__doFov,
|
||||||
thumb_geom=(circleModel.find('**/tt_t_gui_mat_namePanelCircle')), thumb_relief=None, thumb_geom_scale=2)
|
thumb_geom=(circleModel.find('**/tt_t_gui_mat_namePanelCircle')), thumb_relief=None, thumb_geom_scale=2)
|
||||||
self.fov_slider.setScale(0.25)
|
self.fov_slider.setScale(0.25)
|
||||||
self.cogInterface_toggleButton = DirectButton(parent=self, relief=None, image=button_image, image_scale=button_image_scale, text='', text_scale=options_text_scale, text_pos=button_textpos, pos=(buttonbase_xcoord, 0.0, buttonbase_ycoord - textRowHeight), command=self.__doToggleCogInterface)
|
self.cogInterface_toggleButton = DirectButton(parent=self, relief=None, image=button_image, image_scale=button_image_scale, text='', text_scale=options_text_scale, text_pos=button_textpos, pos=(buttonbase_xcoord, 0.0, buttonbase_ycoord - textRowHeight), command=self.__doToggleCogInterface)
|
||||||
self.tpTransition_toggleButton = DirectButton(parent=self, relief=None, image=button_image, image_scale=button_image_scale, text='', text_scale=options_text_scale, text_pos=button_textpos, pos=(buttonbase_xcoord, 0.0, buttonbase_ycoord - 2 * textRowHeight), command=self.__doToggleTpTransition)
|
self.tpTransition_toggleButton = DirectButton(parent=self, relief=None, image=button_image, image_scale=button_image_scale, text='', text_scale=options_text_scale, text_pos=button_textpos, pos=(buttonbase_xcoord, 0.0, buttonbase_ycoord - 2 * textRowHeight), command=self.__doToggleTpTransition)
|
||||||
|
self.teleport_toggleButton = DirectButton(parent=self, relief=None, image=button_image, image_scale=button_image_scale, text='', text_scale=options_text_scale, text_pos=button_textpos, pos=(buttonbase_xcoord, 0.0, buttonbase_ycoord - 3 * textRowHeight), command=self.__doToggleTeleport)
|
||||||
self.bugReportButton = DirectButton(parent=self, relief=None, text=TTLocalizer.BugReportButton, image=button_image, image_scale=button_image_scale, text_pos=(0, -0.01), text_fg=(0, 0, 0, 1),
|
self.bugReportButton = DirectButton(parent=self, relief=None, text=TTLocalizer.BugReportButton, image=button_image, image_scale=button_image_scale, text_pos=(0, -0.01), text_fg=(0, 0, 0, 1),
|
||||||
command=self.showReportNotice, pos=(0.0, 0.0, -0.6), text_scale=(0.045))
|
command=self.showReportNotice, pos=(0.0, 0.0, -0.6), text_scale=(0.045))
|
||||||
guiButton.removeNode()
|
guiButton.removeNode()
|
||||||
circleModel.removeNode()
|
circleModel.removeNode()
|
||||||
|
|
||||||
self.optionChoosers['pole'] = OptionChooser.OptionChooser(self, TTLocalizer.FishingPoleLabel, 3, self.__updateFishingPole, [False], self.__applyFishingPole)
|
self.optionChoosers['pole'] = OptionChooser.OptionChooser(self, TTLocalizer.FishingPoleLabel, 4, self.__updateFishingPole, [False], self.__applyFishingPole)
|
||||||
self.optionChoosers['nametag_style'] = OptionChooser.OptionChooser(self, TTLocalizer.NametagStyleLabel, 4, self.__updateNametagStyle, [False], self.__applyNametagStyle)
|
self.optionChoosers['nametag_style'] = OptionChooser.OptionChooser(self, TTLocalizer.NametagStyleLabel, 5, self.__updateNametagStyle, [False], self.__applyNametagStyle)
|
||||||
|
|
||||||
def enter(self):
|
def enter(self):
|
||||||
self.show()
|
self.show()
|
||||||
self.settingsChanged = 0
|
self.settingsChanged = 0
|
||||||
self.__setCogInterfaceButton()
|
self.__setCogInterfaceButton()
|
||||||
self.__setTpTransitionButton()
|
self.__setTpTransitionButton()
|
||||||
|
self.__setTeleportButton()
|
||||||
self.__updateNametagStyle()
|
self.__updateNametagStyle()
|
||||||
self.__updateFishingPole()
|
self.__updateFishingPole()
|
||||||
self.accept('refreshNametagStyle', self.__updateNametagStyle)
|
self.accept('refreshNametagStyle', self.__updateNametagStyle)
|
||||||
|
@ -776,6 +779,10 @@ class ExtraOptionsTabPage(DirectFrame):
|
||||||
del self.tpTransition_label
|
del self.tpTransition_label
|
||||||
self.tpTransition_toggleButton.destroy()
|
self.tpTransition_toggleButton.destroy()
|
||||||
del self.tpTransition_toggleButton
|
del self.tpTransition_toggleButton
|
||||||
|
self.teleport_label.destroy()
|
||||||
|
del self.teleport_label
|
||||||
|
self.teleport_toggleButton.destroy()
|
||||||
|
del self.teleport_toggleButton
|
||||||
self.bugReportButton.destroy()
|
self.bugReportButton.destroy()
|
||||||
del self.bugReportButton
|
del self.bugReportButton
|
||||||
self.destroyReportNotice()
|
self.destroyReportNotice()
|
||||||
|
@ -808,6 +815,23 @@ class ExtraOptionsTabPage(DirectFrame):
|
||||||
self.tpTransition_label['text'] = TTLocalizer.TpTransitionLabelOn if settings['tpTransition'] else TTLocalizer.TpTransitionLabelOff
|
self.tpTransition_label['text'] = TTLocalizer.TpTransitionLabelOn if settings['tpTransition'] else TTLocalizer.TpTransitionLabelOff
|
||||||
self.tpTransition_toggleButton['text'] = TTLocalizer.OptionsPageToggleOff if settings['tpTransition'] else TTLocalizer.OptionsPageToggleOn
|
self.tpTransition_toggleButton['text'] = TTLocalizer.OptionsPageToggleOff if settings['tpTransition'] else TTLocalizer.OptionsPageToggleOn
|
||||||
|
|
||||||
|
def __doToggleTeleport(self):
|
||||||
|
messenger.send('wakeup')
|
||||||
|
acceptingTeleport = settings.get('acceptingTeleport', {})
|
||||||
|
if base.localAvatar.acceptingTeleport:
|
||||||
|
base.localAvatar.acceptingTeleport = 0
|
||||||
|
acceptingTeleport[str(base.localAvatar.doId)] = False
|
||||||
|
else:
|
||||||
|
base.localAvatar.acceptingTeleport = 1
|
||||||
|
acceptingTeleport[str(base.localAvatar.doId)] = True
|
||||||
|
settings['acceptingTeleport'] = acceptingTeleport
|
||||||
|
self.settingsChanged = 1
|
||||||
|
self.__setTeleportButton()
|
||||||
|
|
||||||
|
def __setTeleportButton(self):
|
||||||
|
self.teleport_label['text'] = TTLocalizer.TeleportLabelOn if base.localAvatar.acceptingTeleport else TTLocalizer.TeleportLabelOff
|
||||||
|
self.teleport_toggleButton['text'] = TTLocalizer.OptionsPageToggleOff if base.localAvatar.acceptingTeleport else TTLocalizer.OptionsPageToggleOn
|
||||||
|
|
||||||
def __updateNametagStyle(self, resetIndex=True):
|
def __updateNametagStyle(self, resetIndex=True):
|
||||||
chooser = self.optionChoosers['nametag_style']
|
chooser = self.optionChoosers['nametag_style']
|
||||||
|
|
||||||
|
|
|
@ -150,6 +150,7 @@ class LocalToon(DistributedToon.DistributedToon, LocalAvatar.LocalAvatar):
|
||||||
self.createSystemMsgAckGui()
|
self.createSystemMsgAckGui()
|
||||||
self.acceptingNewFriends = True
|
self.acceptingNewFriends = True
|
||||||
self.acceptingNonFriendWhispers = True
|
self.acceptingNonFriendWhispers = True
|
||||||
|
self.acceptingTeleport = True
|
||||||
self.physControls.event.addAgainPattern('again%in')
|
self.physControls.event.addAgainPattern('again%in')
|
||||||
self.oldPos = None
|
self.oldPos = None
|
||||||
self.questMap = None
|
self.questMap = None
|
||||||
|
@ -214,14 +215,19 @@ class LocalToon(DistributedToon.DistributedToon, LocalAvatar.LocalAvatar):
|
||||||
|
|
||||||
acceptingNewFriends = settings.get('acceptingNewFriends', {})
|
acceptingNewFriends = settings.get('acceptingNewFriends', {})
|
||||||
acceptingNonFriendWhispers = settings.get('acceptingNonFriendWhispers', {})
|
acceptingNonFriendWhispers = settings.get('acceptingNonFriendWhispers', {})
|
||||||
|
acceptingTeleport = settings.get('acceptingTeleport', {})
|
||||||
if str(self.doId) not in acceptingNewFriends:
|
if str(self.doId) not in acceptingNewFriends:
|
||||||
acceptingNewFriends[str(self.doId)] = True
|
acceptingNewFriends[str(self.doId)] = True
|
||||||
settings['acceptingNewFriends'] = acceptingNewFriends
|
settings['acceptingNewFriends'] = acceptingNewFriends
|
||||||
if str(self.doId) not in acceptingNonFriendWhispers:
|
if str(self.doId) not in acceptingNonFriendWhispers:
|
||||||
acceptingNonFriendWhispers[str(self.doId)] = True
|
acceptingNonFriendWhispers[str(self.doId)] = True
|
||||||
settings['acceptingNonFriendWhispers'] = acceptingNonFriendWhispers
|
settings['acceptingNonFriendWhispers'] = acceptingNonFriendWhispers
|
||||||
|
if str(self.doId) not in acceptingTeleport:
|
||||||
|
acceptingTeleport[str(self.doId)] = True
|
||||||
|
settings['acceptingTeleport'] = acceptingTeleport
|
||||||
self.acceptingNewFriends = acceptingNewFriends[str(self.doId)]
|
self.acceptingNewFriends = acceptingNewFriends[str(self.doId)]
|
||||||
self.acceptingNonFriendWhispers = acceptingNonFriendWhispers[str(self.doId)]
|
self.acceptingNonFriendWhispers = acceptingNonFriendWhispers[str(self.doId)]
|
||||||
|
self.acceptingTeleport = acceptingTeleport[str(self.doId)]
|
||||||
|
|
||||||
def disable(self):
|
def disable(self):
|
||||||
self.laffMeter.destroy()
|
self.laffMeter.destroy()
|
||||||
|
|
|
@ -62,6 +62,9 @@ class ToonTeleportPanel(DirectFrame):
|
||||||
State.State('ignored',
|
State.State('ignored',
|
||||||
self.enterIgnored,
|
self.enterIgnored,
|
||||||
self.exitIgnored),
|
self.exitIgnored),
|
||||||
|
State.State('noTeleport',
|
||||||
|
self.enterNoTeleport,
|
||||||
|
self.exitNoTeleport),
|
||||||
State.State('notOnline',
|
State.State('notOnline',
|
||||||
self.enterNotOnline,
|
self.enterNotOnline,
|
||||||
self.exitNotOnline),
|
self.exitNotOnline),
|
||||||
|
@ -148,12 +151,19 @@ class ToonTeleportPanel(DirectFrame):
|
||||||
self.bOk.hide()
|
self.bOk.hide()
|
||||||
|
|
||||||
def enterIgnored(self):
|
def enterIgnored(self):
|
||||||
self['text'] = TTLocalizer.TeleportPanelNotAvailable % self.avName
|
self['text'] = TTLocalizer.TeleportPanelIgnored % self.avName
|
||||||
self.bOk.show()
|
self.bOk.show()
|
||||||
|
|
||||||
def exitIgnored(self):
|
def exitIgnored(self):
|
||||||
self.bOk.hide()
|
self.bOk.hide()
|
||||||
|
|
||||||
|
def enterNoTeleport(self):
|
||||||
|
self['text'] = TTLocalizer.TeleportPanelNoTeleport % self.avName
|
||||||
|
self.bOk.show()
|
||||||
|
|
||||||
|
def exitNoTeleport(self):
|
||||||
|
self.bOk.hide()
|
||||||
|
|
||||||
def enterNotOnline(self):
|
def enterNotOnline(self):
|
||||||
self['text'] = TTLocalizer.TeleportPanelNotOnline % self.avName
|
self['text'] = TTLocalizer.TeleportPanelNotOnline % self.avName
|
||||||
self.bOk.show()
|
self.bOk.show()
|
||||||
|
@ -270,6 +280,8 @@ class ToonTeleportPanel(DirectFrame):
|
||||||
elif available == 2:
|
elif available == 2:
|
||||||
teleportNotify.debug('__teleportResponse: ignored')
|
teleportNotify.debug('__teleportResponse: ignored')
|
||||||
self.fsm.request('ignored')
|
self.fsm.request('ignored')
|
||||||
|
elif available == 3:
|
||||||
|
self.fsm.request('noTeleport')
|
||||||
elif shardId != base.localAvatar.defaultShard:
|
elif shardId != base.localAvatar.defaultShard:
|
||||||
teleportNotify.debug('__teleportResponse: otherShard')
|
teleportNotify.debug('__teleportResponse: otherShard')
|
||||||
self.fsm.request('otherShard', [shardId, hoodId, zoneId])
|
self.fsm.request('otherShard', [shardId, hoodId, zoneId])
|
||||||
|
|
|
@ -8743,6 +8743,10 @@ BattleSOSPopupHP = '%s %s HP\n'
|
||||||
|
|
||||||
DetailPanelSOS = 'SOS Cards'
|
DetailPanelSOS = 'SOS Cards'
|
||||||
|
|
||||||
|
TeleportLabelOn = 'Accepting teleports.'
|
||||||
|
TeleportLabelOff = 'Not accepting teleports.'
|
||||||
|
TeleportPanelNoTeleport = '%s needs some time alone right now.'
|
||||||
|
|
||||||
Blacklist = [
|
Blacklist = [
|
||||||
"$1ut",
|
"$1ut",
|
||||||
"$h1t",
|
"$h1t",
|
||||||
|
|
Loading…
Reference in a new issue