Poodletooth-iLand/toontown/estate/DistributedGagTreeAI.py

36 lines
1.1 KiB
Python
Raw Normal View History

2015-03-03 22:10:12 +00:00
from direct.directnotify import DirectNotifyGlobal
from toontown.estate.DistributedPlantBaseAI import DistributedPlantBaseAI
2015-05-24 23:23:54 +00:00
import GardenGlobals
2015-03-03 22:10:12 +00:00
class DistributedGagTreeAI(DistributedPlantBaseAI):
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedGagTreeAI")
2015-05-24 23:23:54 +00:00
def __init__(self, air):
DistributedPlantBaseAI.__init__(self, air)
2015-05-10 12:00:38 +00:00
self.air = air
self.wilted = 0
2015-05-24 23:23:54 +00:00
def announceGenerate(self):
DistributedPlantBaseAI.announceGenerate(self)
def delete(self):
DistributedPlantBaseAI.delete(self)
def disable(self):
DistributedPlantBaseAI.disable(self)
2015-05-10 11:47:03 +00:00
def setWilted(self, wilted):
2015-05-10 12:00:38 +00:00
self.wilted = wilted
2015-03-03 22:10:12 +00:00
2015-05-24 23:23:54 +00:00
def getWilted(self):
return self.wilted
def requestHarvest(self, doId):
2015-06-11 17:48:13 +00:00
# TODO: Actually harvest the gags and add them to toon inventory.
2015-05-24 23:23:54 +00: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])