From 3d8d023af9dc5be60a1373853eefaff660ab0d83 Mon Sep 17 00:00:00 2001 From: John Cote Date: Tue, 21 Jul 2015 10:04:58 -0400 Subject: [PATCH] hot keyerror fix --- toontown/estate/DistributedGardenPlot.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/toontown/estate/DistributedGardenPlot.py b/toontown/estate/DistributedGardenPlot.py index 5e7ea074..e5367909 100755 --- a/toontown/estate/DistributedGardenPlot.py +++ b/toontown/estate/DistributedGardenPlot.py @@ -354,20 +354,25 @@ class DistributedGardenPlot(DistributedLawnDecor.DistributedLawnDecor): self.stick2Ground() else: DistributedLawnDecor.DistributedLawnDecor.makeMovieNode(self) - + def setBoxDoId(self, boxId, index): - box = base.cr.doId2do[boxId] - x = GardenGlobals.FLOWER_POS[box.typeIndex][index] - + self.index = index + if boxId in base.cr.doId2do: + self.setBox(base.cr.doId2do[boxId]) + else: + self.acceptOnce('generate-%d' % boxId, self.setBox) + + def setBox(self, box): + x = GardenGlobals.FLOWER_POS[box.typeIndex][self.index] + self.setPos(0, 0, 0) self.reparentTo(box) self.setZ(1.2) self.setX(x) - + def stick2Ground(self, *args, **kwargs): plotType = GardenGlobals.whatCanBePlanted(self.ownerIndex, self.plot) if plotType == GardenGlobals.FLOWER_TYPE: return - + return DistributedLawnDecor.DistributedLawnDecor.stick2Ground(self, *args, **kwargs) - \ No newline at end of file