gardening: it begins
This commit is contained in:
parent
e1f11bb0ac
commit
85d5aa1130
7 changed files with 121 additions and 18 deletions
|
@ -33,10 +33,10 @@ class CatalogGardenStarterItem(CatalogItem.CatalogItem):
|
|||
print 'rental-- record purchase'
|
||||
if avatar:
|
||||
print 'starter garden-- has avater'
|
||||
estate = simbase.air.estateMgr.estate.get(avatar.doId)
|
||||
estate = simbase.air.estateManager.toon2estate.get(avatar)
|
||||
if estate:
|
||||
print 'starter garden-- has estate'
|
||||
estate.placeStarterGarden(avatar.doId)
|
||||
estate.placeStarterGarden(avatar)
|
||||
else:
|
||||
print 'starter garden-- something not there'
|
||||
return ToontownGlobals.P_ItemAvailable
|
||||
|
|
|
@ -513,7 +513,7 @@ MonthlySchedule = ((7,
|
|||
CatalogGardenItem(104, 1),
|
||||
CatalogToonStatueItem(105, endPoseIndex=108),
|
||||
CatalogRentalItem(1, 2880, 1000),
|
||||
# CatalogGardenStarterItem(), # We don't want Gardens yet.
|
||||
CatalogGardenStarterItem(), # We don't want Gardens yet.
|
||||
CatalogNametagItem(100),
|
||||
CatalogNametagItem(0),
|
||||
CatalogClothingItem(1608, 0, 720),
|
||||
|
|
|
@ -2,6 +2,7 @@ from direct.directnotify import DirectNotifyGlobal
|
|||
from direct.distributed.DistributedObjectAI import DistributedObjectAI
|
||||
from toontown.toonbase import ToontownGlobals
|
||||
import HouseGlobals
|
||||
import GardenGlobals
|
||||
import time
|
||||
|
||||
from toontown.fishing.DistributedFishingPondAI import DistributedFishingPondAI
|
||||
|
@ -10,6 +11,9 @@ from toontown.fishing.DistributedPondBingoManagerAI import DistributedPondBingoM
|
|||
from toontown.fishing import FishingTargetGlobals
|
||||
from toontown.safezone.DistributedFishingSpotAI import DistributedFishingSpotAI
|
||||
|
||||
from toontown.estate.DistributedGardenBoxAI import DistributedGardenBoxAI
|
||||
from toontown.estate.DistributedGardenPlotAI import DistributedGardenPlotAI
|
||||
|
||||
|
||||
class DistributedEstateAI(DistributedObjectAI):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedEstateAI")
|
||||
|
@ -44,7 +48,20 @@ class DistributedEstateAI(DistributedObjectAI):
|
|||
target.setPondDoId(self.pond.getDoId())
|
||||
target.generateWithRequired(self.zoneId)
|
||||
self.targets.append(target)
|
||||
|
||||
|
||||
for i in xrange(6):
|
||||
avItems = self.items[i]
|
||||
for item in avItems:
|
||||
type, hardPoint, waterLevel, growthLevel, optional = item
|
||||
if type == 2: # broken for now, rip
|
||||
boxes = GardenGlobals.estateBoxes[i]
|
||||
box = DistributedGardenBoxAI(self.air)
|
||||
box.setPlot(i)
|
||||
box.setOwnerIndex(i)
|
||||
box.setTypeIndex(boxes[hardPoint][3])
|
||||
box.setPosition(boxes[hardPoint][0], boxes[hardPoint][1], 20)
|
||||
box.setHeading(boxes[hardPoint][2])
|
||||
box.generateWithRequired(self.zoneId)
|
||||
|
||||
spot = DistributedFishingSpotAI(self.air)
|
||||
spot.setPondDoId(self.pond.getDoId())
|
||||
|
@ -78,12 +95,16 @@ class DistributedEstateAI(DistributedObjectAI):
|
|||
for house in self.houses:
|
||||
if house:
|
||||
house.requestDelete()
|
||||
del self.houses[:]
|
||||
if self.pond:
|
||||
self.pond.requestDelete()
|
||||
for spot in self.spots:
|
||||
spot.requestDelete()
|
||||
for target in self.targets:
|
||||
target.requestDelete()
|
||||
del self.targets[:]
|
||||
del self.spots[:]
|
||||
del self.pond
|
||||
self.requestDelete()
|
||||
|
||||
def setEstateReady(self):
|
||||
|
@ -373,4 +394,50 @@ class DistributedEstateAI(DistributedObjectAI):
|
|||
|
||||
def gameTableOver(self):
|
||||
pass
|
||||
|
||||
def updateToons(self):
|
||||
self.d_setSlot0ToonId(self.toons[0])
|
||||
self.d_setSlot1ToonId(self.toons[1])
|
||||
self.d_setSlot2ToonId(self.toons[2])
|
||||
self.d_setSlot3ToonId(self.toons[3])
|
||||
self.d_setSlot4ToonId(self.toons[4])
|
||||
self.d_setSlot5ToonId(self.toons[5])
|
||||
self.sendUpdate('setIdList', [self.toons])
|
||||
|
||||
def updateItems(self):
|
||||
self.d_setSlot0Items(self.items[0])
|
||||
self.d_setSlot1Items(self.items[1])
|
||||
self.d_setSlot2Items(self.items[2])
|
||||
self.d_setSlot3Items(self.items[3])
|
||||
self.d_setSlot4Items(self.items[4])
|
||||
self.d_setSlot5Items(self.items[5])
|
||||
|
||||
def placeStarterGarden(self, avatar):
|
||||
items = []
|
||||
if avatar.getGardenStarted():
|
||||
return
|
||||
avId = avatar.getDoId()
|
||||
houseIndex = self.toons.index(avId)
|
||||
plots = GardenGlobals.estatePlots[houseIndex]
|
||||
boxes = GardenGlobals.estateBoxes[houseIndex]
|
||||
for i in xrange(len(boxes)):
|
||||
items.append([2, i, 0, 0, 0])
|
||||
box = DistributedGardenBoxAI(self.air)
|
||||
box.setPlot(i)
|
||||
box.setOwnerIndex(houseIndex)
|
||||
box.setTypeIndex(boxes[i][3])
|
||||
box.setPosition(boxes[i][0], boxes[i][1], 20)
|
||||
box.setHeading(boxes[i][2])
|
||||
box.generateWithRequired(self.zoneId)
|
||||
for i in xrange(len(plots)):
|
||||
items.append([1, i, 0, 0, 0])
|
||||
plot = DistributedGardenPlotAI(self.air)
|
||||
plot.setPlot(i)
|
||||
plot.setOwnerIndex(houseIndex)
|
||||
if plots[i][3] != GardenGlobals.FLOWER_TYPE:
|
||||
plot.setPosition(plots[i][0], plots[i][1], 20)
|
||||
plot.setHeading(plots[i][2])
|
||||
plot.generateWithRequired(self.zoneId)
|
||||
self.items[houseIndex] = items
|
||||
self.updateItems()
|
||||
avatar.b_setGardenStarted(1)
|
|
@ -3,7 +3,14 @@ from toontown.estate.DistributedLawnDecorAI import DistributedLawnDecorAI
|
|||
|
||||
class DistributedGardenBoxAI(DistributedLawnDecorAI):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedGardenBoxAI")
|
||||
|
||||
def __init__(self, air):
|
||||
DistributedLawnDecorAI.__init__(self, air)
|
||||
self.typeIndex = 0
|
||||
|
||||
def setTypeIndex(self, todo0):
|
||||
pass
|
||||
def setTypeIndex(self, index):
|
||||
self.typeIndex = index
|
||||
|
||||
def getTypeIndex(self):
|
||||
return self.typeIndex
|
||||
|
||||
|
|
|
@ -265,9 +265,6 @@ class DistributedLawnDecor(DistributedNode.DistributedNode, NodePath, ShadowCast
|
|||
toonTrack = Sequence(Parallel(ActorInterval(toon, 'walk', loop=True, duration=1), Parallel(LerpPosInterval(toon, 1.0, Point3(finalX, finalY, toon.getZ(render)), fluid=True, bakeInStart=False)), LerpHprInterval(toon, 1.0, hpr=hpr)), Func(toon.loop, 'neutral'))
|
||||
return toonTrack
|
||||
|
||||
def unprint(self, string):
|
||||
print string
|
||||
|
||||
def startInteraction(self):
|
||||
place = base.cr.playGame.getPlace()
|
||||
if place:
|
||||
|
|
|
@ -3,18 +3,47 @@ from direct.distributed.DistributedNodeAI import DistributedNodeAI
|
|||
|
||||
class DistributedLawnDecorAI(DistributedNodeAI):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedLawnDecorAI")
|
||||
|
||||
def __init__(self, air):
|
||||
DistributedNodeAI.__init__(self, air)
|
||||
self.plot = 0
|
||||
self.h = 0
|
||||
self.pos = (0, 0, 0)
|
||||
self.ownerIndex = 0
|
||||
|
||||
def setPlot(self, todo0):
|
||||
pass
|
||||
def setPlot(self, plot):
|
||||
self.plot = plot
|
||||
|
||||
def setHeading(self, todo0):
|
||||
pass
|
||||
def getPlot(self):
|
||||
return self.plot
|
||||
|
||||
def setHeading(self, h):
|
||||
self.setH(h)
|
||||
self.h = h
|
||||
|
||||
def getHeading(self):
|
||||
return self.h
|
||||
|
||||
def setPosition(self, x, y, z):
|
||||
self.setPos(x, y, z)
|
||||
self.pos = (x, y, z)
|
||||
|
||||
def d_setPosition(self, x, y, z):
|
||||
self.sendUpdate('setPos', [x, y, z])
|
||||
self.sendUpdate('setPosition', [x, y, z])
|
||||
|
||||
def b_setPosition(self, x, y, z):
|
||||
self.setPosition(x, y, z)
|
||||
self.d_setPosition(x, y, z)
|
||||
|
||||
def getPosition(self):
|
||||
return self.pos
|
||||
|
||||
def getOwnerIndex(self):
|
||||
return self.ownerIndex
|
||||
|
||||
def setPosition(self, todo0, todo1, todo2):
|
||||
pass
|
||||
|
||||
def setOwnerIndex(self, todo0):
|
||||
pass
|
||||
def setOwnerIndex(self, index):
|
||||
self.ownerIndex = index
|
||||
|
||||
def plotEntered(self):
|
||||
pass
|
||||
|
|
|
@ -192,6 +192,9 @@ class LoadEstateFSM(FSM):
|
|||
|
||||
def __gotEstate(self, estate):
|
||||
self.estate = estate
|
||||
|
||||
self.estate.toons = self.toonIds
|
||||
self.estate.updateToons()
|
||||
|
||||
# Gotcha! Now we need to load houses:
|
||||
self.demand('LoadHouses')
|
||||
|
|
Loading…
Reference in a new issue