mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2024-12-23 11:42:39 -06:00
Chairs.. my blood went into this..
This commit is contained in:
parent
0c06b40b39
commit
49b2422187
12 changed files with 300 additions and 39 deletions
7
dependencies/astron/dclass/stride.dc
vendored
7
dependencies/astron/dclass/stride.dc
vendored
|
@ -291,6 +291,7 @@ from toontown.estate import DistributedCloset/AI
|
||||||
from toontown.estate import DistributedTrunk/AI
|
from toontown.estate import DistributedTrunk/AI
|
||||||
from toontown.estate import DistributedPhone/AI
|
from toontown.estate import DistributedPhone/AI
|
||||||
from toontown.estate import DistributedRewardCrate/AI
|
from toontown.estate import DistributedRewardCrate/AI
|
||||||
|
from toontown.estate import DistributedChair/AI
|
||||||
from toontown.effects import DistributedFireworkShow/AI
|
from toontown.effects import DistributedFireworkShow/AI
|
||||||
from toontown.estate import DistributedFireworksCannon/AI
|
from toontown.estate import DistributedFireworksCannon/AI
|
||||||
from toontown.coghq import LobbyManager/AI
|
from toontown.coghq import LobbyManager/AI
|
||||||
|
@ -2097,6 +2098,12 @@ dclass DistributedRewardCrate : DistributedFurnitureItem {
|
||||||
useKeyResponse(uint8, uint32);
|
useKeyResponse(uint8, uint32);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
dclass DistributedChair : DistributedFurnitureItem {
|
||||||
|
setAvId(uint32) broadcast ram;
|
||||||
|
requestSit(uint8) airecv clsend;
|
||||||
|
setStatus(uint8) broadcast ram;
|
||||||
|
};
|
||||||
|
|
||||||
dclass DistributedFireworkShow : DistributedObject {
|
dclass DistributedFireworkShow : DistributedObject {
|
||||||
startShow(uint8, uint8, uint8, int16) broadcast ram;
|
startShow(uint8, uint8, uint8, int16) broadcast ram;
|
||||||
requestFirework(int16/10, int16/10, int16/100, uint8, uint8, uint8) airecv clsend;
|
requestFirework(int16/10, int16/10, int16/100, uint8, uint8, uint8) airecv clsend;
|
||||||
|
|
|
@ -62,6 +62,7 @@ class LocalAvatar(DistributedAvatar.DistributedAvatar, DistributedSmoothNode.Dis
|
||||||
self.sleepFlag = 0
|
self.sleepFlag = 0
|
||||||
self.isDisguised = 0
|
self.isDisguised = 0
|
||||||
self.movingFlag = 0
|
self.movingFlag = 0
|
||||||
|
self.preventCameraDisable = False
|
||||||
self.lastNeedH = None
|
self.lastNeedH = None
|
||||||
self.accept('friendOnline', self.__friendOnline)
|
self.accept('friendOnline', self.__friendOnline)
|
||||||
self.accept('friendOffline', self.__friendOffline)
|
self.accept('friendOffline', self.__friendOffline)
|
||||||
|
@ -73,6 +74,9 @@ class LocalAvatar(DistributedAvatar.DistributedAvatar, DistributedSmoothNode.Dis
|
||||||
self.accept('avatarMoving', self.clearPageUpDown)
|
self.accept('avatarMoving', self.clearPageUpDown)
|
||||||
self.showNametag2d()
|
self.showNametag2d()
|
||||||
self.setPickable(0)
|
self.setPickable(0)
|
||||||
|
|
||||||
|
def setPreventCameraDisable(self, prevent):
|
||||||
|
self.preventCameraDisable = prevent
|
||||||
|
|
||||||
def useSwimControls(self):
|
def useSwimControls(self):
|
||||||
self.controlManager.use('swim', self)
|
self.controlManager.use('swim', self)
|
||||||
|
@ -421,7 +425,7 @@ class LocalAvatar(DistributedAvatar.DistributedAvatar, DistributedSmoothNode.Dis
|
||||||
self.controlManager.setSpeeds(OTPGlobals.ToonForwardSlowSpeed, OTPGlobals.ToonJumpSlowForce, OTPGlobals.ToonReverseSlowSpeed, OTPGlobals.ToonRotateSlowSpeed)
|
self.controlManager.setSpeeds(OTPGlobals.ToonForwardSlowSpeed, OTPGlobals.ToonJumpSlowForce, OTPGlobals.ToonReverseSlowSpeed, OTPGlobals.ToonRotateSlowSpeed)
|
||||||
|
|
||||||
def pageUp(self):
|
def pageUp(self):
|
||||||
if not self.avatarControlsEnabled:
|
if not (self.avatarControlsEnabled or self.preventCameraDisable):
|
||||||
return
|
return
|
||||||
self.wakeUp()
|
self.wakeUp()
|
||||||
if not self.isPageUp:
|
if not self.isPageUp:
|
||||||
|
@ -433,7 +437,7 @@ class LocalAvatar(DistributedAvatar.DistributedAvatar, DistributedSmoothNode.Dis
|
||||||
self.clearPageUpDown()
|
self.clearPageUpDown()
|
||||||
|
|
||||||
def pageDown(self):
|
def pageDown(self):
|
||||||
if not self.avatarControlsEnabled:
|
if not (self.avatarControlsEnabled and self.preventCameraDisable):
|
||||||
return
|
return
|
||||||
self.wakeUp()
|
self.wakeUp()
|
||||||
if not self.isPageDown:
|
if not self.isPageDown:
|
||||||
|
@ -452,7 +456,7 @@ class LocalAvatar(DistributedAvatar.DistributedAvatar, DistributedSmoothNode.Dis
|
||||||
self.setCameraPositionByIndex(self.cameraIndex)
|
self.setCameraPositionByIndex(self.cameraIndex)
|
||||||
|
|
||||||
def nextCameraPos(self, forward):
|
def nextCameraPos(self, forward):
|
||||||
if not self.avatarControlsEnabled:
|
if not (self.avatarControlsEnabled or self.preventCameraDisable):
|
||||||
return
|
return
|
||||||
self.wakeUp()
|
self.wakeUp()
|
||||||
self.__cameraHasBeenMoved = 1
|
self.__cameraHasBeenMoved = 1
|
||||||
|
@ -465,6 +469,10 @@ class LocalAvatar(DistributedAvatar.DistributedAvatar, DistributedSmoothNode.Dis
|
||||||
if self.cameraIndex < 0:
|
if self.cameraIndex < 0:
|
||||||
self.cameraIndex = len(self.cameraPositions) - 1
|
self.cameraIndex = len(self.cameraPositions) - 1
|
||||||
self.setCameraPositionByIndex(self.cameraIndex)
|
self.setCameraPositionByIndex(self.cameraIndex)
|
||||||
|
|
||||||
|
def setCameraPosition(self, index):
|
||||||
|
self.cameraIndex = index
|
||||||
|
self.setCameraPositionByIndex(index)
|
||||||
|
|
||||||
def initCameraPositions(self):
|
def initCameraPositions(self):
|
||||||
camHeight = self.getClampedAvatarHeight()
|
camHeight = self.getClampedAvatarHeight()
|
||||||
|
|
|
@ -17,12 +17,13 @@ FLRug = 4
|
||||||
FLPainting = 8
|
FLPainting = 8
|
||||||
FLOnTable = 16
|
FLOnTable = 16
|
||||||
FLIsTable = 32
|
FLIsTable = 32
|
||||||
FLPhone = 64
|
FLBillboard = 64
|
||||||
FLCrate = 128
|
FLPhone = 128
|
||||||
FLBillboard = 256
|
FLCrate = 256
|
||||||
FLTrunk = 512
|
FLChair = 512
|
||||||
FLBoysOnly = 1024
|
FLTrunk = 1024
|
||||||
FLGirlsOnly = 2048
|
FLBoysOnly = 2048
|
||||||
|
FLGirlsOnly = 4096
|
||||||
furnitureColors = [
|
furnitureColors = [
|
||||||
(0.792, 0.353, 0.29, 1.0),
|
(0.792, 0.353, 0.29, 1.0),
|
||||||
(0.176, 0.592, 0.439, 1.0),
|
(0.176, 0.592, 0.439, 1.0),
|
||||||
|
@ -74,16 +75,36 @@ MaxClosetIds = (508, 518)
|
||||||
|
|
||||||
TvToPosScale = {
|
TvToPosScale = {
|
||||||
1530: ((-1.15, -0.5, 1.1), (2.5, 1.7, 1.4)),
|
1530: ((-1.15, -0.5, 1.1), (2.5, 1.7, 1.4)),
|
||||||
1531: ((-2.3, -0.2, 1.6), (5, 5, 5)),
|
1531: ((-2.3, -0.2, 2.522), (5, 3.75, 3.187)),
|
||||||
1532: ((-7, -0.2, 1.8), (15, 10, 8.5))
|
1532: ((-7, -0.2, 2.8), (15, 10, 7.8))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ChairToPosHpr = {
|
||||||
|
100: ((0, -3.9, 0.88), (180, 0, 0), (0, -4.9, 0), -3.0),
|
||||||
|
105: ((0, -3.9, 0.88), (180, 0, 0), (0, -4.9, 0), -3.0),
|
||||||
|
110: ((0, -1.6, 0.5), (180, 0, 0), (0, -2.6, 0), 0.0),
|
||||||
|
120: ((0, -1.6, 0.5), (180, 0, 0), (0, -2.6, 0), 0.0),
|
||||||
|
130: ((0, -2.8, 0.5), (180, 0, 0), (0, -3.8, 0), -2.0),
|
||||||
|
140: ((0, -1.6, 0.5), (180, 0, 0), (0, -2.6, 0), 0.0),
|
||||||
|
145: ((0, -2.1, 0.2), (180, 0, 0), (0, -3.1, 0), 0.0),
|
||||||
|
160: ((-1.7, 0, 0.9), (90, 0, 0), (-2.7, 0, 0), 0.0),
|
||||||
|
170: ((0, 1.8, 0.4), (0, 0, 0), (0, 2.8, 0), 0.0),
|
||||||
|
700: ((0, -1.2, 0.5), (180, 0, 0), (0, -2.2, 0), 0.0),
|
||||||
|
705: ((0, -1.2, 0.5), (180, 0, 0), (0, -2.2, 0), 0.0),
|
||||||
|
710: ((0, -1.1, 0.4), (180, 0, 0), (0, -2.1, 0), 0.0),
|
||||||
|
715: ((0, -1.1, 0.4), (180, 0, 0), (0, -2.1, 0), 0.0),
|
||||||
|
720: ((0, -2.7, 0.2), (180, 0, 0), (0, -3.7, 0), -3.0)
|
||||||
|
}
|
||||||
|
|
||||||
|
def getChairCollOffset(furnitureId):
|
||||||
|
return ChairToPosHpr[furnitureId][3]
|
||||||
|
|
||||||
FurnitureTypes = {
|
FurnitureTypes = {
|
||||||
100: ('phase_5.5/models/estate/chairA', # Model
|
100: ('phase_5.5/models/estate/chairA', # Model
|
||||||
None, # Color
|
None, # Color
|
||||||
None, # Color Options
|
None, # Color Options
|
||||||
80), # Base Price
|
80, # Base Price
|
||||||
# Flags
|
FLChair), # Flags
|
||||||
# Scale
|
# Scale
|
||||||
105: ('phase_5.5/models/estate/chairAdesat',
|
105: ('phase_5.5/models/estate/chairAdesat',
|
||||||
None,
|
None,
|
||||||
|
@ -93,27 +114,33 @@ FurnitureTypes = {
|
||||||
3: (('**/cushion*', furnitureColors[3]), ('**/arm*', furnitureColors[3])),
|
3: (('**/cushion*', furnitureColors[3]), ('**/arm*', furnitureColors[3])),
|
||||||
4: (('**/cushion*', furnitureColors[4]), ('**/arm*', furnitureColors[4])),
|
4: (('**/cushion*', furnitureColors[4]), ('**/arm*', furnitureColors[4])),
|
||||||
5: (('**/cushion*', furnitureColors[5]), ('**/arm*', furnitureColors[5]))},
|
5: (('**/cushion*', furnitureColors[5]), ('**/arm*', furnitureColors[5]))},
|
||||||
160),
|
160,
|
||||||
|
FLChair),
|
||||||
110: ('phase_3.5/models/modules/chair',
|
110: ('phase_3.5/models/modules/chair',
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
40),
|
40,
|
||||||
|
FLChair),
|
||||||
120: ('phase_5.5/models/estate/deskChair',
|
120: ('phase_5.5/models/estate/deskChair',
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
60),
|
60,
|
||||||
|
FLChair),
|
||||||
130: ('phase_5.5/models/estate/BugRoomChair',
|
130: ('phase_5.5/models/estate/BugRoomChair',
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
160),
|
160,
|
||||||
|
FLChair),
|
||||||
140: ('phase_5.5/models/estate/UWlobsterChair',
|
140: ('phase_5.5/models/estate/UWlobsterChair',
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
200),
|
200,
|
||||||
|
FLChair),
|
||||||
145: ('phase_5.5/models/estate/UWlifeSaverChair',
|
145: ('phase_5.5/models/estate/UWlifeSaverChair',
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
200),
|
200,
|
||||||
|
FLChair),
|
||||||
150: ('phase_5.5/models/estate/West_saddleStool2',
|
150: ('phase_5.5/models/estate/West_saddleStool2',
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
|
@ -121,11 +148,13 @@ FurnitureTypes = {
|
||||||
160: ('phase_5.5/models/estate/West_nativeChair',
|
160: ('phase_5.5/models/estate/West_nativeChair',
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
160),
|
160,
|
||||||
|
FLChair),
|
||||||
170: ('phase_5.5/models/estate/cupcakeChair',
|
170: ('phase_5.5/models/estate/cupcakeChair',
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
240),
|
240,
|
||||||
|
FLChair),
|
||||||
200: ('phase_5.5/models/estate/regular_bed',
|
200: ('phase_5.5/models/estate/regular_bed',
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
|
@ -415,7 +444,8 @@ FurnitureTypes = {
|
||||||
700: ('phase_3.5/models/modules/couch_1person',
|
700: ('phase_3.5/models/modules/couch_1person',
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
230),
|
230,
|
||||||
|
FLChair),
|
||||||
705: ('phase_5.5/models/estate/couch_1personDesat',
|
705: ('phase_5.5/models/estate/couch_1personDesat',
|
||||||
None,
|
None,
|
||||||
{0: (('**/*couch', furnitureColors[0]),),
|
{0: (('**/*couch', furnitureColors[0]),),
|
||||||
|
@ -424,11 +454,13 @@ FurnitureTypes = {
|
||||||
3: (('**/*couch', furnitureColors[3]),),
|
3: (('**/*couch', furnitureColors[3]),),
|
||||||
4: (('**/*couch', furnitureColors[4]),),
|
4: (('**/*couch', furnitureColors[4]),),
|
||||||
5: (('**/*couch', furnitureColors[5]),)},
|
5: (('**/*couch', furnitureColors[5]),)},
|
||||||
460),
|
460,
|
||||||
|
FLChair),
|
||||||
710: ('phase_3.5/models/modules/couch_2person',
|
710: ('phase_3.5/models/modules/couch_2person',
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
230),
|
230,
|
||||||
|
FLChair),
|
||||||
715: ('phase_5.5/models/estate/couch_2personDesat',
|
715: ('phase_5.5/models/estate/couch_2personDesat',
|
||||||
None,
|
None,
|
||||||
{0: (('**/*couch', furnitureColors[0]),),
|
{0: (('**/*couch', furnitureColors[0]),),
|
||||||
|
@ -437,11 +469,13 @@ FurnitureTypes = {
|
||||||
3: (('**/*couch', furnitureColors[3]),),
|
3: (('**/*couch', furnitureColors[3]),),
|
||||||
4: (('**/*couch', furnitureColors[4]),),
|
4: (('**/*couch', furnitureColors[4]),),
|
||||||
5: (('**/*couch', furnitureColors[5]),)},
|
5: (('**/*couch', furnitureColors[5]),)},
|
||||||
460),
|
460,
|
||||||
|
FLChair),
|
||||||
720: ('phase_5.5/models/estate/West_HayCouch',
|
720: ('phase_5.5/models/estate/West_HayCouch',
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
420),
|
420,
|
||||||
|
FLChair),
|
||||||
730: ('phase_5.5/models/estate/twinkieCouch',
|
730: ('phase_5.5/models/estate/twinkieCouch',
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
|
|
|
@ -7,7 +7,6 @@ from direct.fsm import ClassicFSM
|
||||||
from toontown.battle.BattleBase import *
|
from toontown.battle.BattleBase import *
|
||||||
import CogDisguiseGlobals
|
import CogDisguiseGlobals
|
||||||
from direct.showbase.PythonUtil import addListsByValue
|
from direct.showbase.PythonUtil import addListsByValue
|
||||||
import time
|
|
||||||
|
|
||||||
class DistributedLevelBattleAI(DistributedBattleAI.DistributedBattleAI):
|
class DistributedLevelBattleAI(DistributedBattleAI.DistributedBattleAI):
|
||||||
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedLevelBattleAI')
|
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedLevelBattleAI')
|
||||||
|
@ -105,11 +104,9 @@ class DistributedLevelBattleAI(DistributedBattleAI.DistributedBattleAI):
|
||||||
|
|
||||||
self.sendUpdate('announceCrateReward')
|
self.sendUpdate('announceCrateReward')
|
||||||
item = CatalogFurnitureItem.CatalogFurnitureItem(10040)
|
item = CatalogFurnitureItem.CatalogFurnitureItem(10040)
|
||||||
item.deliveryDate = int(time.time() / 60. + .5)
|
|
||||||
|
|
||||||
for toon in toons:
|
for toon in toons:
|
||||||
toon.onOrder.append(item)
|
toon.addToDeliverySchedule(item)
|
||||||
toon.b_setDeliverySchedule(toon.onOrder)
|
|
||||||
|
|
||||||
def enterFaceOff(self):
|
def enterFaceOff(self):
|
||||||
self.notify.debug('DistributedLevelBattleAI.enterFaceOff()')
|
self.notify.debug('DistributedLevelBattleAI.enterFaceOff()')
|
||||||
|
|
145
toontown/estate/DistributedChair.py
Normal file
145
toontown/estate/DistributedChair.py
Normal file
|
@ -0,0 +1,145 @@
|
||||||
|
from direct.interval.IntervalGlobal import *
|
||||||
|
from direct.gui.DirectGui import *
|
||||||
|
from toontown.effects import DustCloud
|
||||||
|
from toontown.toonbase import ToontownGlobals, TTLocalizer
|
||||||
|
from toontown.toontowngui import TTDialog
|
||||||
|
from toontown.quest import Quests
|
||||||
|
import DistributedFurnitureItem
|
||||||
|
from toontown.catalog import CatalogFurnitureItem
|
||||||
|
|
||||||
|
class DistributedChair(DistributedFurnitureItem.DistributedFurnitureItem):
|
||||||
|
|
||||||
|
def __init__(self, cr):
|
||||||
|
DistributedFurnitureItem.DistributedFurnitureItem.__init__(self, cr)
|
||||||
|
self.dialog = None
|
||||||
|
self.exitButton = None
|
||||||
|
self.locked = False
|
||||||
|
self.avId = ToontownGlobals.CHAIR_NONE
|
||||||
|
|
||||||
|
def loadModel(self):
|
||||||
|
model = DistributedFurnitureItem.DistributedFurnitureItem.loadModel(self)
|
||||||
|
cSphere = CollisionSphere(0.0, CatalogFurnitureItem.getChairCollOffset(self.item.furnitureType), 1.0, 1.575)
|
||||||
|
cSphere.setTangible(0)
|
||||||
|
colNode = CollisionNode('Chair-%s' % self.doId)
|
||||||
|
colNode.addSolid(cSphere)
|
||||||
|
cSpherePath = model.attachNewNode(colNode)
|
||||||
|
cSpherePath.setCollideMask(ToontownGlobals.WallBitmask)
|
||||||
|
self.accept('enterChair-%s' % self.doId, self.__enterSphere)
|
||||||
|
return model
|
||||||
|
|
||||||
|
def disable(self):
|
||||||
|
av = base.cr.doId2do.get(self.avId)
|
||||||
|
if av:
|
||||||
|
self.resetAvatar(av)
|
||||||
|
self.ignoreAll()
|
||||||
|
DistributedFurnitureItem.DistributedFurnitureItem.disable(self)
|
||||||
|
|
||||||
|
def getChair(self):
|
||||||
|
return CatalogFurnitureItem.ChairToPosHpr[self.item.furnitureType]
|
||||||
|
|
||||||
|
def destroyGui(self):
|
||||||
|
if self.exitButton:
|
||||||
|
self.exitButton.destroy()
|
||||||
|
self.exitButton = None
|
||||||
|
|
||||||
|
if self.dialog:
|
||||||
|
self.dialog.destroy()
|
||||||
|
self.dialog = None
|
||||||
|
|
||||||
|
def setupGui(self):
|
||||||
|
castGui = loader.loadModel('phase_4/models/gui/fishingGui')
|
||||||
|
self.exitButton = DirectButton(parent=base.a2dBottomRight, relief=None, text=('', TTLocalizer.FishingExit, TTLocalizer.FishingExit), text_align=TextNode.ACenter, text_scale=0.1, text_fg=Vec4(1, 1, 1, 1), text_shadow=Vec4(0, 0, 0, 1), text_pos=(0.0, -0.12), pos=(-0.158, 0, 0.14), image=(castGui.find('**/exit_buttonUp'), castGui.find('**/exit_buttonDown'), castGui.find('**/exit_buttonRollover')), command=self.sendUpdate, extraArgs=['requestSit', [ToontownGlobals.CHAIR_STOP]])
|
||||||
|
castGui.removeNode()
|
||||||
|
|
||||||
|
base.localAvatar.stopSleepWatch()
|
||||||
|
base.localAvatar.startSleepWatch(self.__handleFallingAsleep)
|
||||||
|
|
||||||
|
def resetAvatar(self, av):
|
||||||
|
av.loop('neutral')
|
||||||
|
av.setPos(av.getPos(render))
|
||||||
|
av.getGeomNode().setHpr(0, 0, 0)
|
||||||
|
av.setH(self.getH() + self.getChair()[1][0])
|
||||||
|
av.reparentTo(render)
|
||||||
|
|
||||||
|
if av == base.localAvatar:
|
||||||
|
base.localAvatar.setPreventCameraDisable(False)
|
||||||
|
base.cr.playGame.getPlace().setState('walk')
|
||||||
|
|
||||||
|
def setAvId(self, avId):
|
||||||
|
print 'Get av id %s' % avId
|
||||||
|
if avId == ToontownGlobals.CHAIR_NONE:
|
||||||
|
self.avId = avId
|
||||||
|
return
|
||||||
|
|
||||||
|
chair = self.getChair()
|
||||||
|
av = base.cr.doId2do.get(avId)
|
||||||
|
|
||||||
|
if not av:
|
||||||
|
return
|
||||||
|
|
||||||
|
sitStartDuration = av.getDuration('sit-start')
|
||||||
|
sequence = Sequence(Func(av.loop, 'walk'), av.getGeomNode().hprInterval(0.25, chair[1]), Parallel(Sequence(Wait(sitStartDuration * 0.25), av.posInterval(sitStartDuration * 0.25, chair[0])), ActorInterval(av, 'sit-start')), Func(av.setAnimState, 'Sit', 1.0))
|
||||||
|
|
||||||
|
av.setPosHpr(chair[2], (0, 0, 0))
|
||||||
|
av.reparentTo(self)
|
||||||
|
|
||||||
|
if av == base.localAvatar:
|
||||||
|
base.cr.playGame.getPlace().setState('walk')
|
||||||
|
base.localAvatar.setPreventCameraDisable(True)
|
||||||
|
base.cr.playGame.getPlace().setState('stopped')
|
||||||
|
sequence.append(Func(self.setupGui))
|
||||||
|
|
||||||
|
sequence.start()
|
||||||
|
self.avId = avId
|
||||||
|
|
||||||
|
def setStatus(self, status):
|
||||||
|
print 'Got status %s %s' % (status, self.avId)
|
||||||
|
av = base.cr.doId2do.get(self.avId)
|
||||||
|
|
||||||
|
if not av:
|
||||||
|
print 'RIP'
|
||||||
|
return
|
||||||
|
|
||||||
|
if status == ToontownGlobals.CHAIR_LOCKED:
|
||||||
|
print 'locked'
|
||||||
|
self.locked = True
|
||||||
|
|
||||||
|
if status == ToontownGlobals.CHAIR_UNEXPECTED_EXIT:
|
||||||
|
print 'unexpected'
|
||||||
|
self.resetAvatar(av)
|
||||||
|
else:
|
||||||
|
print 'rektangle'
|
||||||
|
sitStartDuration = av.getDuration('sit-start')
|
||||||
|
self.destroyGui()
|
||||||
|
Sequence(Parallel(ActorInterval(av, 'sit-start', startTime=sitStartDuration, endTime=0.0), Sequence(Wait(sitStartDuration * 0.25), av.posInterval(sitStartDuration * 0.25, self.getChair()[2]))), Func(self.resetAvatar, av)).start()
|
||||||
|
|
||||||
|
def resetAvatar(self, av):
|
||||||
|
av.loop('neutral')
|
||||||
|
av.setPos(av.getPos(render))
|
||||||
|
av.getGeomNode().setHpr(0, 0, 0)
|
||||||
|
av.setH(self.getH() + self.getChair()[1][0])
|
||||||
|
av.reparentTo(render)
|
||||||
|
|
||||||
|
if av == base.localAvatar:
|
||||||
|
base.localAvatar.setPreventCameraDisable(False)
|
||||||
|
base.cr.playGame.getPlace().setState('walk')
|
||||||
|
self.destroyGui()
|
||||||
|
|
||||||
|
def __enterSphere(self, collisionEntry):
|
||||||
|
if self.locked or self.avId in base.cr.doId2do:
|
||||||
|
return
|
||||||
|
|
||||||
|
base.cr.playGame.getPlace().setState('stopped')
|
||||||
|
self.dialog = TTDialog.TTDialog(style=TTDialog.TwoChoice, text=TTLocalizer.ChairAskToUse, fadeScreen=1, command=self.__handleDialogResponse)
|
||||||
|
|
||||||
|
def __handleDialogResponse(self, response):
|
||||||
|
self.destroyGui()
|
||||||
|
|
||||||
|
if response < 0:
|
||||||
|
base.cr.playGame.getPlace().setState('walk')
|
||||||
|
return
|
||||||
|
|
||||||
|
self.sendUpdate('requestSit', [ToontownGlobals.CHAIR_START])
|
||||||
|
|
||||||
|
def __handleFallingAsleep(self, arg):
|
||||||
|
self.sendUpdate('requestSit', [ToontownGlobals.CHAIR_STOP])
|
57
toontown/estate/DistributedChairAI.py
Normal file
57
toontown/estate/DistributedChairAI.py
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
from toontown.catalog import CatalogAccessoryItem, CatalogClothingItem, CatalogNametagItem, CatalogEmoteItem
|
||||||
|
from toontown.catalog.CatalogAccessoryItemGlobals import *
|
||||||
|
from toontown.toonbase import ToontownGlobals, TTLocalizer
|
||||||
|
from toontown.toon import ToonDNA
|
||||||
|
from toontown.quest import Quests
|
||||||
|
from DistributedFurnitureItemAI import DistributedFurnitureItemAI
|
||||||
|
import random, time
|
||||||
|
|
||||||
|
class DistributedChairAI(DistributedFurnitureItemAI):
|
||||||
|
|
||||||
|
def __init__(self, air, furnitureMgr, itemType):
|
||||||
|
DistributedFurnitureItemAI.__init__(self, air, furnitureMgr, itemType)
|
||||||
|
self.avId = ToontownGlobals.CHAIR_NONE
|
||||||
|
|
||||||
|
def destroy(self):
|
||||||
|
self.ignoreAll()
|
||||||
|
DistributedFurnitureItemAI.destroy(self)
|
||||||
|
|
||||||
|
def b_setAvId(self, avId):
|
||||||
|
self.avId = avId
|
||||||
|
self.sendUpdate('setAvId', [avId])
|
||||||
|
|
||||||
|
def b_resetAvId(self):
|
||||||
|
self.b_setAvId(ToontownGlobals.CHAIR_NONE)
|
||||||
|
|
||||||
|
def b_resetAvWithAnim(self, reason):
|
||||||
|
self.sendUpdate('setStatus', [reason])
|
||||||
|
self.b_resetAvId()
|
||||||
|
|
||||||
|
def getAvId(self):
|
||||||
|
return self.avId
|
||||||
|
|
||||||
|
def getSitResponse(self):
|
||||||
|
return ToontownGlobals.CHAIR_NONE
|
||||||
|
|
||||||
|
def requestSit(self, requestCode):
|
||||||
|
avId = self.air.getAvatarIdFromSender()
|
||||||
|
av = self.air.doId2do.get(avId)
|
||||||
|
|
||||||
|
if not av:
|
||||||
|
return
|
||||||
|
|
||||||
|
if requestCode == ToontownGlobals.CHAIR_START:
|
||||||
|
if self.avId in self.air.doId2do:
|
||||||
|
return
|
||||||
|
|
||||||
|
self.b_setAvId(avId)
|
||||||
|
self.acceptOnce(self.air.getAvatarExitEvent(avId), self.__handleUnexpectedExit)
|
||||||
|
elif requestCode == ToontownGlobals.CHAIR_STOP:
|
||||||
|
if self.avId != avId:
|
||||||
|
return
|
||||||
|
|
||||||
|
self.b_resetAvWithAnim(ToontownGlobals.CHAIR_EXIT)
|
||||||
|
self.ignoreAll()
|
||||||
|
|
||||||
|
def __handleUnexpectedExit(self):
|
||||||
|
self.b_resetAvWithAnim(ToontownGlobals.CHAIR_UNEXPECTED_EXIT)
|
|
@ -1,7 +1,7 @@
|
||||||
from direct.distributed.DistributedObjectAI import DistributedObjectAI
|
from direct.distributed.DistributedObjectAI import DistributedObjectAI
|
||||||
from toontown.catalog.CatalogItemList import CatalogItemList
|
from toontown.catalog.CatalogItemList import CatalogItemList
|
||||||
from toontown.catalog import CatalogItem
|
from toontown.catalog import CatalogItem
|
||||||
from toontown.catalog.CatalogFurnitureItem import CatalogFurnitureItem, FLTrunk, FLCloset, FLBank, FLPhone, FLCrate
|
from toontown.catalog.CatalogFurnitureItem import CatalogFurnitureItem, FLTrunk, FLCloset, FLBank, FLPhone, FLCrate, FLChair
|
||||||
from toontown.catalog.CatalogWallpaperItem import CatalogWallpaperItem
|
from toontown.catalog.CatalogWallpaperItem import CatalogWallpaperItem
|
||||||
from toontown.catalog.CatalogMouldingItem import CatalogMouldingItem
|
from toontown.catalog.CatalogMouldingItem import CatalogMouldingItem
|
||||||
from toontown.catalog.CatalogFlooringItem import CatalogFlooringItem
|
from toontown.catalog.CatalogFlooringItem import CatalogFlooringItem
|
||||||
|
@ -13,6 +13,7 @@ from DistributedClosetAI import DistributedClosetAI
|
||||||
from DistributedTrunkAI import DistributedTrunkAI
|
from DistributedTrunkAI import DistributedTrunkAI
|
||||||
from DistributedBankAI import DistributedBankAI
|
from DistributedBankAI import DistributedBankAI
|
||||||
from DistributedRewardCrateAI import DistributedRewardCrateAI
|
from DistributedRewardCrateAI import DistributedRewardCrateAI
|
||||||
|
from DistributedChairAI import DistributedChairAI
|
||||||
from otp.ai.MagicWordGlobal import *
|
from otp.ai.MagicWordGlobal import *
|
||||||
|
|
||||||
class FurnitureError(Exception):
|
class FurnitureError(Exception):
|
||||||
|
@ -246,6 +247,8 @@ class DistributedFurnitureManagerAI(DistributedObjectAI):
|
||||||
do = DistributedPhoneAI(self.air, self, item)
|
do = DistributedPhoneAI(self.air, self, item)
|
||||||
elif item.getFlags() & FLCrate:
|
elif item.getFlags() & FLCrate:
|
||||||
do = DistributedRewardCrateAI(self.air, self, item)
|
do = DistributedRewardCrateAI(self.air, self, item)
|
||||||
|
elif item.getFlags() & FLChair:
|
||||||
|
do = DistributedChairAI(self.air, self, item)
|
||||||
else:
|
else:
|
||||||
do = DistributedFurnitureItemAI(self.air, self, item)
|
do = DistributedFurnitureItemAI(self.air, self, item)
|
||||||
|
|
||||||
|
|
|
@ -40,10 +40,11 @@ class Walk(StateData.StateData):
|
||||||
self.fsm.request('off')
|
self.fsm.request('off')
|
||||||
self.ignore('control')
|
self.ignore('control')
|
||||||
base.localAvatar.disableAvatarControls()
|
base.localAvatar.disableAvatarControls()
|
||||||
base.localAvatar.stopUpdateSmartCamera()
|
if not base.localAvatar.preventCameraDisable:
|
||||||
|
base.localAvatar.stopUpdateSmartCamera()
|
||||||
|
base.localAvatar.detachCamera()
|
||||||
base.localAvatar.stopPosHprBroadcast()
|
base.localAvatar.stopPosHprBroadcast()
|
||||||
base.localAvatar.stopBlink()
|
base.localAvatar.stopBlink()
|
||||||
base.localAvatar.detachCamera()
|
|
||||||
base.localAvatar.stopGlitchKiller()
|
base.localAvatar.stopGlitchKiller()
|
||||||
base.localAvatar.collisionsOff()
|
base.localAvatar.collisionsOff()
|
||||||
base.localAvatar.controlManager.placeOnFloor()
|
base.localAvatar.controlManager.placeOnFloor()
|
||||||
|
|
|
@ -34,7 +34,6 @@ class ShtikerBook(DirectFrame, StateData.StateData):
|
||||||
self.pageOrder = [TTLocalizer.OptionsPageTitle,
|
self.pageOrder = [TTLocalizer.OptionsPageTitle,
|
||||||
TTLocalizer.ShardPageTitle,
|
TTLocalizer.ShardPageTitle,
|
||||||
TTLocalizer.MapPageTitle,
|
TTLocalizer.MapPageTitle,
|
||||||
TTLocalizer.StatPageTitle,
|
|
||||||
TTLocalizer.InventoryPageTitle,
|
TTLocalizer.InventoryPageTitle,
|
||||||
TTLocalizer.QuestPageToonTasks,
|
TTLocalizer.QuestPageToonTasks,
|
||||||
TTLocalizer.TrackPageShortTitle,
|
TTLocalizer.TrackPageShortTitle,
|
||||||
|
@ -46,7 +45,8 @@ class ShtikerBook(DirectFrame, StateData.StateData):
|
||||||
TTLocalizer.GardenPageTitle,
|
TTLocalizer.GardenPageTitle,
|
||||||
TTLocalizer.GolfPageTitle,
|
TTLocalizer.GolfPageTitle,
|
||||||
TTLocalizer.PhotoPageTitle,
|
TTLocalizer.PhotoPageTitle,
|
||||||
TTLocalizer.EventsPageName]
|
TTLocalizer.EventsPageName,
|
||||||
|
TTLocalizer.StatPageTitle]
|
||||||
|
|
||||||
def setSafeMode(self, setting):
|
def setSafeMode(self, setting):
|
||||||
self.safeMode = setting
|
self.safeMode = setting
|
||||||
|
|
|
@ -307,9 +307,6 @@ class LocalToon(DistributedToon.DistributedToon, LocalAvatar.LocalAvatar):
|
||||||
self.shardPage = ShardPage.ShardPage()
|
self.shardPage = ShardPage.ShardPage()
|
||||||
self.shardPage.load()
|
self.shardPage.load()
|
||||||
self.book.addPage(self.shardPage, pageName=TTLocalizer.ShardPageTitle)
|
self.book.addPage(self.shardPage, pageName=TTLocalizer.ShardPageTitle)
|
||||||
self.statPage = StatPage.StatPage()
|
|
||||||
self.statPage.load()
|
|
||||||
self.book.addPage(self.statPage, pageName=TTLocalizer.StatPageTitle)
|
|
||||||
self.mapPage = MapPage.MapPage()
|
self.mapPage = MapPage.MapPage()
|
||||||
self.mapPage.load()
|
self.mapPage.load()
|
||||||
self.book.addPage(self.mapPage, pageName=TTLocalizer.MapPageTitle)
|
self.book.addPage(self.mapPage, pageName=TTLocalizer.MapPageTitle)
|
||||||
|
@ -342,6 +339,9 @@ class LocalToon(DistributedToon.DistributedToon, LocalAvatar.LocalAvatar):
|
||||||
self.photoPage.load()
|
self.photoPage.load()
|
||||||
self.book.addPage(self.photoPage, pageName=TTLocalizer.PhotoPageTitle)
|
self.book.addPage(self.photoPage, pageName=TTLocalizer.PhotoPageTitle)
|
||||||
self.addEventsPage()
|
self.addEventsPage()
|
||||||
|
self.statPage = StatPage.StatPage()
|
||||||
|
self.statPage.load()
|
||||||
|
self.book.addPage(self.statPage, pageName=TTLocalizer.StatPageTitle)
|
||||||
self.book.setPage(self.mapPage, enterPage=False)
|
self.book.setPage(self.mapPage, enterPage=False)
|
||||||
self.laffMeter = LaffMeter.LaffMeter(self.style, self.hp, self.maxHp)
|
self.laffMeter = LaffMeter.LaffMeter(self.style, self.hp, self.maxHp)
|
||||||
self.laffMeter.setAvatar(self)
|
self.laffMeter.setAvatar(self)
|
||||||
|
|
|
@ -8652,6 +8652,8 @@ Stats = [
|
||||||
StatResetAsk = 'Are you sure you want to reset your stats? This is an irreversible action!'
|
StatResetAsk = 'Are you sure you want to reset your stats? This is an irreversible action!'
|
||||||
StatResetDone = 'Your stats have been reset.'
|
StatResetDone = 'Your stats have been reset.'
|
||||||
|
|
||||||
|
ChairAskToUse = 'Would you like to sit on this chair?'
|
||||||
|
|
||||||
Blacklist = [
|
Blacklist = [
|
||||||
"$1ut",
|
"$1ut",
|
||||||
"$h1t",
|
"$h1t",
|
||||||
|
|
|
@ -1665,4 +1665,11 @@ STAT_GOLF = 17
|
||||||
STAT_SOS = 18
|
STAT_SOS = 18
|
||||||
STAT_UNITES = 19
|
STAT_UNITES = 19
|
||||||
STAT_SLIPS = 20
|
STAT_SLIPS = 20
|
||||||
STAT_GAGS = 21
|
STAT_GAGS = 21
|
||||||
|
|
||||||
|
CHAIR_START = 0
|
||||||
|
CHAIR_STOP = 1
|
||||||
|
CHAIR_NONE = 0
|
||||||
|
CHAIR_EXIT = 1
|
||||||
|
CHAIR_LOCKED = 2
|
||||||
|
CHAIR_UNEXPECTED_EXIT = 3
|
Loading…
Reference in a new issue