Some cleanup

This commit is contained in:
John 2015-07-31 01:26:06 +03:00
parent ffd8f1f001
commit 42f79c3957
3 changed files with 11 additions and 19 deletions

View file

@ -96,9 +96,6 @@ ChairToPosHpr = {
720: ((0, -2.7, 0.2), (180, 0, 0), (0, -3.7, 0), -3.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

View file

@ -1,24 +1,21 @@
from direct.interval.IntervalGlobal import * from direct.interval.IntervalGlobal import *
from direct.gui.DirectGui import * from direct.gui.DirectGui import *
from toontown.effects import DustCloud from toontown.catalog import CatalogFurnitureItem
from toontown.toonbase import ToontownGlobals, TTLocalizer from toontown.toonbase import ToontownGlobals, TTLocalizer
from toontown.toontowngui import TTDialog from toontown.toontowngui import TTDialog
from toontown.quest import Quests from DistributedFurnitureItem import DistributedFurnitureItem
import DistributedFurnitureItem
from toontown.catalog import CatalogFurnitureItem
class DistributedChair(DistributedFurnitureItem.DistributedFurnitureItem): class DistributedChair(DistributedFurnitureItem):
def __init__(self, cr): def __init__(self, cr):
DistributedFurnitureItem.DistributedFurnitureItem.__init__(self, cr) DistributedFurnitureItem.__init__(self, cr)
self.dialog = None self.dialog = None
self.exitButton = None self.exitButton = None
self.locked = False
self.avId = ToontownGlobals.CHAIR_NONE self.avId = ToontownGlobals.CHAIR_NONE
def loadModel(self): def loadModel(self):
model = DistributedFurnitureItem.DistributedFurnitureItem.loadModel(self) model = DistributedFurnitureItem.loadModel(self)
cSphere = CollisionSphere(0.0, CatalogFurnitureItem.getChairCollOffset(self.item.furnitureType), 1.0, 1.575) cSphere = CollisionSphere(0.0, self.getChair()[3], 1.0, 1.575)
cSphere.setTangible(0) cSphere.setTangible(0)
colNode = CollisionNode('Chair-%s' % self.doId) colNode = CollisionNode('Chair-%s' % self.doId)
colNode.addSolid(cSphere) colNode.addSolid(cSphere)
@ -29,10 +26,12 @@ class DistributedChair(DistributedFurnitureItem.DistributedFurnitureItem):
def disable(self): def disable(self):
av = base.cr.doId2do.get(self.avId) av = base.cr.doId2do.get(self.avId)
if av: if av:
self.resetAvatar(av) self.resetAvatar(av)
self.ignoreAll() self.ignoreAll()
DistributedFurnitureItem.DistributedFurnitureItem.disable(self) DistributedFurnitureItem.disable(self)
def getChair(self): def getChair(self):
return CatalogFurnitureItem.ChairToPosHpr[self.item.furnitureType] return CatalogFurnitureItem.ChairToPosHpr[self.item.furnitureType]
@ -96,9 +95,6 @@ class DistributedChair(DistributedFurnitureItem.DistributedFurnitureItem):
if not av: if not av:
return return
if status == ToontownGlobals.CHAIR_LOCKED:
self.locked = True
if status == ToontownGlobals.CHAIR_UNEXPECTED_EXIT: if status == ToontownGlobals.CHAIR_UNEXPECTED_EXIT:
self.resetAvatar(av) self.resetAvatar(av)
@ -120,7 +116,7 @@ class DistributedChair(DistributedFurnitureItem.DistributedFurnitureItem):
self.destroyGui() self.destroyGui()
def __enterSphere(self, collisionEntry): def __enterSphere(self, collisionEntry):
if self.locked or self.avId in base.cr.doId2do: if self.avId in base.cr.doId2do:
return return
base.cr.playGame.getPlace().setState('stopped') base.cr.playGame.getPlace().setState('stopped')

View file

@ -1671,5 +1671,4 @@ CHAIR_START = 0
CHAIR_STOP = 1 CHAIR_STOP = 1
CHAIR_NONE = 0 CHAIR_NONE = 0
CHAIR_EXIT = 1 CHAIR_EXIT = 1
CHAIR_LOCKED = 2 CHAIR_UNEXPECTED_EXIT = 2
CHAIR_UNEXPECTED_EXIT = 3