216 lines
5 KiB
Text
216 lines
5 KiB
Text
#..\toontown\toon\Toon
|
|
|
|
def takeOffSuit(self):
|
|
|
|
if not self.isDisguised:
|
|
|
|
return None
|
|
|
|
suitType = self.suit.style.name
|
|
toonHeadNull = self.find('**/1000/**/def_head')
|
|
|
|
if not toonHeadNull:
|
|
|
|
toonHeadNull = self.find('**/1000/**/joint_head')
|
|
|
|
toonHead = self.getPart('head', '1000')
|
|
|
|
toonHead.reparentTo(toonHeadNull)
|
|
toonHead.setScale(self.headOrigScale)
|
|
|
|
toonHead.setPos(0, 0, 0)
|
|
headPosNode = self.suitGeom.find('**/headPos')
|
|
|
|
headPosNode.removeNode()
|
|
self.suitGeom.reparentTo(self.suit)
|
|
|
|
self.resetHeight()
|
|
|
|
self.nametag3d.setPos(0, 0, self.height + 0.5)
|
|
|
|
toonGeom = self.getGeomNode()
|
|
toonGeom.show()
|
|
|
|
Emote.globalEmote.releaseAll(self)
|
|
|
|
self.isDisguised = 0
|
|
self.setFont(ToontownGlobals.getToonFont())
|
|
|
|
self.nametag.setNameWordwrap(-1)
|
|
|
|
if hasattr(base, 'idTags') and base.idTags:
|
|
|
|
name = self.getAvIdName()
|
|
|
|
else:
|
|
|
|
name = self.getName()
|
|
|
|
self.setDisplayName(name)
|
|
|
|
if self.isLocal(): # to 547
|
|
|
|
if hasattr(self, 'book'):
|
|
|
|
self.book.obscureButton(0)
|
|
|
|
ToontownGlobals.ToonForwardSpeed = self.oldForward
|
|
ToontownGlobals.ToonReverseSpeed = self.oldReverse
|
|
|
|
ToontownGlobals.ToonRotateSpeed = self.oldRotate
|
|
|
|
if self.hasTrackAnimToSpeed():
|
|
|
|
self.stopTrackAnimToSpeed()
|
|
self.startTrackAnimToSpeed()
|
|
|
|
del self.oldForward
|
|
del self.oldReverse
|
|
|
|
del self.oldRotate
|
|
|
|
self.controlManager.enableAvatarJump()
|
|
self.chatMgr.chatInputSpeedChat.removeCogMenu()
|
|
|
|
self.suit.delete()
|
|
|
|
del self.suit
|
|
del self.suitGeom
|
|
|
|
def putOnSuit(self, suitType, setDisplayName=True, rental=False):
|
|
|
|
if self.isDisguised:
|
|
|
|
self.takeOffSuit()
|
|
|
|
if launcher and launcher.getPhaseComplete(5):
|
|
|
|
return None
|
|
|
|
from toontown.suit import Suit
|
|
|
|
deptIndex = suitType
|
|
|
|
suit = Suit.Suit()
|
|
dna = SuitDNA.SuitDNA()
|
|
|
|
if rental == True:
|
|
|
|
if SuitDNA.suitDepts[deptIndex] == 's':
|
|
|
|
suitType = 'cc' # Cold Caller
|
|
|
|
elif SuitDNA.suitDepts[deptIndex] == 'm':
|
|
|
|
suitType = 'sc' # Short Change
|
|
|
|
elif SuitDNA.suitDepts[deptIndex] == 'l':
|
|
|
|
suitType = 'bf' # Bottom Feeder
|
|
|
|
elif SuitDNA.suitDepts[deptIndex] == 'c':
|
|
|
|
suitType = 'f' # Flunky
|
|
|
|
else:
|
|
|
|
self.notify.warning('Suspicious: Incorrect rental suit department requested')
|
|
suitType = 'cc' # Cold Caller
|
|
|
|
dna.newSuit(suitType)
|
|
|
|
suit.setStyle(dna)
|
|
suit.isDisguised = 1
|
|
|
|
suit.generateSuit()
|
|
suit.initializeDropShadow()
|
|
|
|
suit.setPos(self.getPos())
|
|
suit.setHpr(self.getHpr())
|
|
|
|
for part in suit.getHeadParts():
|
|
|
|
part.hide()
|
|
|
|
suitHeadNull = suit.find('**/joint_head')
|
|
toonHead = self.getPart('head', '1000')
|
|
|
|
Emote.globalEmote.disableAll(self)
|
|
|
|
toonGeom = self.getGeomNode()
|
|
toonGeom.hide()
|
|
|
|
worldScale = toonHead.getScale(render)
|
|
self.headOrigScale = toonHead.getScale()
|
|
|
|
headPosNode = hidden.attachNewNode('headPos')
|
|
toonHead.reparentTo(headPosNode)
|
|
|
|
toonHead.setPos(0, 0, 0.20000000000000001)
|
|
headPosNode.reparentTo(suitHeadNull)
|
|
|
|
headPosNode.setScale(render, worldScale)
|
|
|
|
suitGeom = suit.getGeomNode()
|
|
suitGeom.reparentTo(self)
|
|
|
|
if rental == True:
|
|
|
|
suit.makeRentalSuit(SuitDNA.suitDepts[deptIndex])
|
|
|
|
self.suit = suit
|
|
self.suitGeom = suitGeom
|
|
|
|
self.setHeight(suit.getHeight())
|
|
self.nametag3d.setPos(0, 0, self.height + 1.3)
|
|
|
|
if self.isLocal(): # to 959
|
|
|
|
if hasattr(self, 'book'):
|
|
|
|
self.book.obscureButton(1)
|
|
|
|
self.oldForward = ToontownGlobals.ToonForwardSpeed
|
|
self.oldReverse = ToontownGlobals.ToonReverseSpeed
|
|
|
|
self.oldRotate = ToontownGlobals.ToonRotateSpeed
|
|
|
|
ToontownGlobals.ToonForwardSpeed = ToontownGlobals.SuitWalkSpeed
|
|
ToontownGlobals.ToonReverseSpeed = ToontownGlobals.SuitWalkSpeed
|
|
|
|
ToontownGlobals.ToonRotateSpeed = ToontownGlobals.ToonRotateSlowSpeed
|
|
|
|
if self.hasTrackAnimToSpeed():
|
|
|
|
self.stopTrackAnimToSpeed()
|
|
self.startTrackAnimToSpeed()
|
|
|
|
self.controlManager.disableAvatarJump()
|
|
|
|
indices = range(OTPLocalizer.SCMenuCommonCogIndices[0], OTPLocalizer.SCMenuCommonCogIndices[1] + 1)
|
|
customIndices = OTPLocalizer.SCMenuCustomCogIndices[suitType]
|
|
|
|
indices += range(customIndices[0], customIndices[1] + 1)
|
|
self.chatMgr.chatInputSpeedChat.addCogMenu(indices)
|
|
|
|
self.suit.loop('neutral')
|
|
self.isDisguised = 1
|
|
|
|
self.setFont(ToontownGlobals.getSuitFont())
|
|
|
|
if setDisplayName: # to 1189
|
|
|
|
if hasattr(base, 'idTags') and base.idTags:
|
|
|
|
name = self.getAvIdName()
|
|
|
|
else:
|
|
|
|
name = self.getName()
|
|
|
|
suitDept = SuitDNA.suitDepts.index(SuitDNA.getSuitDept(suitType))
|
|
suitName = SuitBattleGlobals.SuitAttributes[suitType]['name']
|
|
|
|
self.nametag.setDisplayName(TTLocalizer.SuitBaseNameWithLevel % {'name':name, 'dept':suitName, 'level':self.cogLevels[suitDept] + 1})
|
|
|
|
self.nametag.setNameWordwrap(9.0)
|