2015-03-03 16:10:12 -06:00
|
|
|
from direct.directnotify import DirectNotifyGlobal
|
|
|
|
from toontown.estate.DistributedPlantBaseAI import DistributedPlantBaseAI
|
2015-05-24 18:23:54 -05:00
|
|
|
import GardenGlobals
|
2015-03-03 16:10:12 -06:00
|
|
|
|
|
|
|
class DistributedGagTreeAI(DistributedPlantBaseAI):
|
|
|
|
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedGagTreeAI")
|
|
|
|
|
2015-05-24 18:23:54 -05:00
|
|
|
def __init__(self, air):
|
|
|
|
DistributedPlantBaseAI.__init__(self, air)
|
2015-05-10 07:00:38 -05:00
|
|
|
self.air = air
|
|
|
|
self.wilted = 0
|
|
|
|
|
2015-05-24 18:23:54 -05:00
|
|
|
def announceGenerate(self):
|
|
|
|
DistributedPlantBaseAI.announceGenerate(self)
|
|
|
|
|
|
|
|
def delete(self):
|
|
|
|
DistributedPlantBaseAI.delete(self)
|
|
|
|
|
|
|
|
def disable(self):
|
|
|
|
DistributedPlantBaseAI.disable(self)
|
|
|
|
|
2015-05-10 06:47:03 -05:00
|
|
|
def setWilted(self, wilted):
|
2015-05-10 07:00:38 -05:00
|
|
|
self.wilted = wilted
|
2015-03-03 16:10:12 -06:00
|
|
|
|
2015-05-24 18:23:54 -05:00
|
|
|
def getWilted(self):
|
|
|
|
return self.wilted
|
|
|
|
|
|
|
|
def requestHarvest(self, doId):
|
2015-06-11 12:48:13 -05:00
|
|
|
# TODO: Actually harvest the gags and add them to toon inventory.
|
2015-05-24 18:23:54 -05:00
|
|
|
av = simbase.air.doId2do.get(doId)
|
|
|
|
harvested = 0
|
|
|
|
track, level = GardenGlobals.getTreeTrackAndLevel(self.typeIndex)
|
|
|
|
while av.inventory.addItem(track, level) > 0 and harvested < 10:
|
|
|
|
harvested += 1
|
|
|
|
self.sendUpdate('setMovie', [GardenGlobals.MOVIE_HARVEST, doId])
|