GARDENING, BITCHES

This commit is contained in:
Zach 2015-05-24 18:23:54 -05:00
parent 044381e312
commit 8bf8cf5f55
33 changed files with 744 additions and 201 deletions

View file

@ -1307,11 +1307,15 @@ struct decorItem {
}; };
struct lawnItem { struct lawnItem {
int8 plot;
uint8 type; uint8 type;
uint8 hardPoint; uint8 species;
uint8 variety;
int8 waterLevel; int8 waterLevel;
int8 growthLevel; int8 growthLevel;
uint16 optional; uint16 optional;
uint64 plantedAt;
uint64 wateredAt;
}; };
dclass DistributedEstate : DistributedObject { dclass DistributedEstate : DistributedObject {
@ -1329,17 +1333,17 @@ dclass DistributedEstate : DistributedObject {
setRentalTimeStamp(uint32 timestamp = 0) required airecv db; setRentalTimeStamp(uint32 timestamp = 0) required airecv db;
setRentalType(uint8 type = 0) required airecv db; setRentalType(uint8 type = 0) required airecv db;
setSlot0ToonId(uint32 toonId = 0) required airecv db; setSlot0ToonId(uint32 toonId = 0) required airecv db;
setSlot0Items(lawnItem items[] = []) required airecv db; setSlot0Items(lawnItem items[] = []) required broadcast ownrecv db;
setSlot1ToonId(uint32 toonId = 0) required airecv db; setSlot1ToonId(uint32 toonId = 0) required airecv db;
setSlot1Items(lawnItem items[] = []) required airecv db; setSlot1Items(lawnItem items[] = []) required broadcast ownrecv db;
setSlot2ToonId(uint32 toonId = 0) required airecv db; setSlot2ToonId(uint32 toonId = 0) required airecv db;
setSlot2Items(lawnItem items[] = []) required airecv db; setSlot2Items(lawnItem items[] = []) required broadcast ownrecv db;
setSlot3ToonId(uint32 toonId = 0) required airecv db; setSlot3ToonId(uint32 toonId = 0) required airecv db;
setSlot3Items(lawnItem items[] = []) required airecv db; setSlot3Items(lawnItem items[] = []) required broadcast ownrecv db;
setSlot4ToonId(uint32 toonId = 0) required airecv db; setSlot4ToonId(uint32 toonId = 0) required airecv db;
setSlot4Items(lawnItem items[] = []) required airecv db; setSlot4Items(lawnItem items[] = []) required broadcast ownrecv db;
setSlot5ToonId(uint32 toonId = 0) required airecv db; setSlot5ToonId(uint32 toonId = 0) required airecv db;
setSlot5Items(lawnItem items[] = []) required airecv db; setSlot5Items(lawnItem items[] = []) required broadcast ownrecv db;
setIdList(uint32 []) broadcast ram; setIdList(uint32 []) broadcast ram;
completeFlowerSale(uint8) airecv clsend; completeFlowerSale(uint8) airecv clsend;
completeFishSale(uint8) airecv clsend; completeFishSale(uint8) airecv clsend;
@ -2714,23 +2718,27 @@ dclass DistributedLawbotChair : DistributedObject {
}; };
dclass DistributedLawnDecor : DistributedNode { dclass DistributedLawnDecor : DistributedNode {
setEstate(uint32) required broadcast ram;
setPlot(int8) required broadcast ram; setPlot(int8) required broadcast ram;
setHeading(int16/10) required broadcast ram; setHeading(int16/10) required broadcast ram;
setPosition(int16/10, int16/10, int16/10) required broadcast ram; setPosition(int16/10, int16/10, int16/10) required broadcast ram;
setOwnerIndex(int8) required broadcast ram; setOwnerIndex(int8) required broadcast ram;
plotEntered() airecv clsend; plotEntered() airecv clsend;
removeItem() airecv clsend; removeItem(uint32) airecv clsend;
setMovie(uint8, uint32) broadcast ram; setMovie(uint8, uint32) broadcast ram;
movieDone() airecv clsend; movieDone() airecv clsend;
interactionDenied(uint32) broadcast ram; interactionDenied(uint32) broadcast ram;
}; };
dclass DistributedGardenPlot : DistributedLawnDecor { dclass DistributedGardenPlot : DistributedLawnDecor {
plantFlower(uint8, uint8) airecv clsend; plantedItem(uint32) broadcast ram;
plantGagTree(uint8, uint8) airecv clsend; finishPlanting(uint32) airecv clsend;
plantStatuary(uint8) airecv clsend; finishRemoving(uint32) airecv clsend;
plantToonStatuary(uint8, uint16) airecv clsend; plantFlower(uint8, uint8, uint32) airecv clsend;
plantNothing(uint8) airecv clsend; plantGagTree(uint8, uint8, uint32) airecv clsend;
plantStatuary(uint8, uint32) airecv clsend;
plantToonStatuary(uint8, uint16, uint32) airecv clsend;
plantNothing(uint8, uint32) airecv clsend;
}; };
dclass DistributedGardenBox : DistributedLawnDecor { dclass DistributedGardenBox : DistributedLawnDecor {
@ -2738,6 +2746,7 @@ dclass DistributedGardenBox : DistributedLawnDecor {
}; };
dclass DistributedStatuary : DistributedLawnDecor { dclass DistributedStatuary : DistributedLawnDecor {
setOwnerPlot(uint32) required broadcast ram;
setTypeIndex(uint8) required broadcast ram; setTypeIndex(uint8) required broadcast ram;
setWaterLevel(int8) required broadcast ram; setWaterLevel(int8) required broadcast ram;
setGrowthLevel(int8) required broadcast ram; setGrowthLevel(int8) required broadcast ram;
@ -2755,10 +2764,11 @@ dclass DistributedChangingStatuary : DistributedStatuary {
}; };
dclass DistributedPlantBase : DistributedLawnDecor { dclass DistributedPlantBase : DistributedLawnDecor {
setOwnerPlot(uint32) required broadcast ram;
setTypeIndex(uint8) required broadcast ram; setTypeIndex(uint8) required broadcast ram;
setWaterLevel(int8) required broadcast ram; setWaterLevel(int8) required broadcast ram;
setGrowthLevel(int8) required broadcast ram; setGrowthLevel(int8) required broadcast ram;
waterPlant() airecv clsend; waterPlant(uint32) airecv clsend;
waterPlantDone() airecv clsend; waterPlantDone() airecv clsend;
}; };
@ -2769,7 +2779,7 @@ dclass DistributedFlower : DistributedPlantBase {
dclass DistributedGagTree : DistributedPlantBase { dclass DistributedGagTree : DistributedPlantBase {
setWilted(int8) required broadcast ram; setWilted(int8) required broadcast ram;
requestHarvest() airecv clsend; requestHarvest(uint32) airecv clsend;
}; };
struct golfData { struct golfData {

View file

@ -629,6 +629,7 @@ class LocalAvatar(DistributedAvatar.DistributedAvatar, DistributedSmoothNode.Dis
self.posCamera(1, 0.7) self.posCamera(1, 0.7)
def unsetCameraPosForPetInteraction(self): def unsetCameraPosForPetInteraction(self):
if hasattr(self, 'prevIdealPos'):
self.setIdealCameraPos(self.prevIdealPos) self.setIdealCameraPos(self.prevIdealPos)
del self.prevIdealPos del self.prevIdealPos
self.posCamera(1, 0.7) self.posCamera(1, 0.7)

View file

@ -1,6 +1,6 @@
from direct.distributed import DistributedObject from direct.distributed.DistributedObject import DistributedObject
class Account(DistributedObject.DistributedObject): class Account(DistributedObject):
def __init__(self, cr): def __init__(self, cr):
pass DistributedObject.__init__(self, cr)

View file

@ -2,7 +2,7 @@
from pandac.PandaModules import * from pandac.PandaModules import *
hashVal = 30166307 hashVal = 1929413177
from toontown.coghq import DistributedCashbotBossSafe, DistributedCashbotBossCrane, DistributedBattleFactory, DistributedCashbotBossTreasure, DistributedCogHQDoor, DistributedSellbotHQDoor, DistributedFactoryElevatorExt, DistributedMintElevatorExt, DistributedLawOfficeElevatorExt, DistributedLawOfficeElevatorInt, LobbyManager, DistributedMegaCorp, DistributedFactory, DistributedLawOffice, DistributedLawOfficeFloor, DistributedLift, DistributedDoorEntity, DistributedSwitch, DistributedButton, DistributedTrigger, DistributedCrushableEntity, DistributedCrusherEntity, DistributedStomper, DistributedStomperPair, DistributedLaserField, DistributedGolfGreenGame, DistributedSecurityCamera, DistributedMover, DistributedElevatorMarker, DistributedBarrelBase, DistributedGagBarrel, DistributedBeanBarrel, DistributedHealBarrel, DistributedGrid, ActiveCell, DirectionalCell, CrusherCell, DistributedCrate, DistributedSinkingPlatform, BattleBlocker, DistributedMint, DistributedMintRoom, DistributedMintBattle, DistributedStage, DistributedStageRoom, DistributedStageBattle, DistributedLawbotBossGavel, DistributedLawbotCannon, DistributedLawbotChair, DistributedCogKart, DistributedCountryClub, DistributedCountryClubRoom, DistributedMoleField, DistributedCountryClubBattle, DistributedMaze, DistributedFoodBelt, DistributedBanquetTable, DistributedGolfSpot from toontown.coghq import DistributedCashbotBossSafe, DistributedCashbotBossCrane, DistributedBattleFactory, DistributedCashbotBossTreasure, DistributedCogHQDoor, DistributedSellbotHQDoor, DistributedFactoryElevatorExt, DistributedMintElevatorExt, DistributedLawOfficeElevatorExt, DistributedLawOfficeElevatorInt, LobbyManager, DistributedMegaCorp, DistributedFactory, DistributedLawOffice, DistributedLawOfficeFloor, DistributedLift, DistributedDoorEntity, DistributedSwitch, DistributedButton, DistributedTrigger, DistributedCrushableEntity, DistributedCrusherEntity, DistributedStomper, DistributedStomperPair, DistributedLaserField, DistributedGolfGreenGame, DistributedSecurityCamera, DistributedMover, DistributedElevatorMarker, DistributedBarrelBase, DistributedGagBarrel, DistributedBeanBarrel, DistributedHealBarrel, DistributedGrid, ActiveCell, DirectionalCell, CrusherCell, DistributedCrate, DistributedSinkingPlatform, BattleBlocker, DistributedMint, DistributedMintRoom, DistributedMintBattle, DistributedStage, DistributedStageRoom, DistributedStageBattle, DistributedLawbotBossGavel, DistributedLawbotCannon, DistributedLawbotChair, DistributedCogKart, DistributedCountryClub, DistributedCountryClubRoom, DistributedMoleField, DistributedCountryClubBattle, DistributedMaze, DistributedFoodBelt, DistributedBanquetTable, DistributedGolfSpot

View file

@ -175,6 +175,10 @@ class ConnectionRepository(
return retVal return retVal
def removeObject(self, di):
if self.doId2do.get(di):
del self.doId2do[di]
def generateGlobalObject(self, doId, dcname, values=None): def generateGlobalObject(self, doId, dcname, values=None):
def applyFieldValues(distObj, dclass, values): def applyFieldValues(distObj, dclass, values):
for i in range(dclass.getNumInheritedFields()): for i in range(dclass.getNumInheritedFields()):

View file

@ -2177,14 +2177,16 @@ def weightedChoice(choiceList, rng=random.random, sum=None):
rand = rng() rand = rng()
accum = rand * sum accum = rand * sum
ite = None
for weight, item in choiceList: for weight, item in choiceList:
accum -= weight accum -= weight
if accum <= 0.: if accum <= 0.:
return item return item
ite = item
# rand is ~1., and floating-point error prevented accum from hitting 0. # rand is ~1., and floating-point error prevented accum from hitting 0.
# Or you passed in a 'sum' that was was too large. # Or you passed in a 'sum' that was was too large.
# Return the last item. # Return the last item.
return item return ite
def randFloat(a, b=0., rng=random.random): def randFloat(a, b=0., rng=random.random):
"""returns a random float in [a, b] """returns a random float in [a, b]

View file

@ -79,6 +79,7 @@ class CatalogGardenItem(CatalogItem.CatalogItem):
def cleanupPicture(self): def cleanupPicture(self):
CatalogItem.CatalogItem.cleanupPicture(self) CatalogItem.CatalogItem.cleanupPicture(self)
if hasattr(self, 'model') and self.model:
self.model.detachNode() self.model.detachNode()
self.model = None self.model = None
return return

View file

@ -30,15 +30,14 @@ class CatalogGardenStarterItem(CatalogItem.CatalogItem):
return TTLocalizer.GardenStarterTypeName return TTLocalizer.GardenStarterTypeName
def recordPurchase(self, avatar, optional): def recordPurchase(self, avatar, optional):
print 'rental-- record purchase'
if avatar: if avatar:
print 'starter garden-- has avater'
estate = simbase.air.estateManager.toon2estate.get(avatar) estate = simbase.air.estateManager.toon2estate.get(avatar)
if estate: if estate:
print 'starter garden-- has estate' av = simbase.air.doId2do.get(avatar)
if av:
av.b_setGardenStarted(True)
print('garden saved')
estate.placeStarterGarden(avatar) estate.placeStarterGarden(avatar)
else:
print 'starter garden-- something not there'
return ToontownGlobals.P_ItemAvailable return ToontownGlobals.P_ItemAvailable
def getPicture(self, avatar): def getPicture(self, avatar):

View file

@ -59,6 +59,16 @@ class TTCodeRedemptionMgrAI(DistributedObjectAI):
'items': [ 'items': [
CatalogClothingItem.CatalogClothingItem(1753, 0) CatalogClothingItem.CatalogClothingItem(1753, 0)
] ]
},
'toonstatue': {
'items': [
CatalogToonStatueItem.CatalogToonStatueItem(105, endPoseIndex=108)
]
},
'donaldstatue': {
'items': [
CatalogGardenItem.CatalogGardenItem(100, 1)
]
} }
} }

View file

@ -4,9 +4,13 @@ from toontown.estate.DistributedStatuaryAI import DistributedStatuaryAI
class DistributedChangingStatuaryAI(DistributedStatuaryAI): class DistributedChangingStatuaryAI(DistributedStatuaryAI):
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedChangingStatuaryAI") notify = DirectNotifyGlobal.directNotify.newCategory("DistributedChangingStatuaryAI")
def __init__(self, air, species): def __init__(self, air):
DistributedStatuaryAI.__init__(self, air)
self.air = air self.air = air
self.species = species self.growthLevel = -1
def setGrowthLevel(self, growth): def setGrowthLevel(self, growthLevel):
self.growth = growth self.growthLevel = growthLevel
def getGrowthLevel(self):
return self.growthLevel

View file

@ -105,6 +105,10 @@ class DistributedEstate(DistributedObject.DistributedObject):
self.flowerSellBox.removeNode() self.flowerSellBox.removeNode()
del self.flowerSellBox del self.flowerSellBox
self.flowerSellBox = None self.flowerSellBox = None
if self.fishSellBox:
self.fishSellBox.removeNode()
del self.fishSellBox
self.fishSellBox = None
GardenDropGame.GardenDropGame().endGame() GardenDropGame.GardenDropGame().endGame()
return return

View file

@ -14,24 +14,36 @@ from DistributedTargetAI import *
import CannonGlobals import CannonGlobals
import TableGlobals import TableGlobals
import HouseGlobals import HouseGlobals
import GardenGlobals
from DistributedGardenPlotAI import DistributedGardenPlotAI
from DistributedGardenBoxAI import DistributedGardenBoxAI
from DistributedFlowerAI import DistributedFlowerAI
from DistributedGagTreeAI import DistributedGagTreeAI
from DistributedStatuaryAI import DistributedStatuaryAI
from DistributedToonStatuaryAI import DistributedToonStatuaryAI
import time import time
import random import random
from toontown.fishing import FishGlobals from toontown.fishing import FishGlobals
class Rental: class Rental:
def __init__(self, estate): def __init__(self, estate):
self.estate = estate self.estate = estate
self.objects = set() self.objects = set()
def destroy(self): def destroy(self):
del self.estate del self.estate
for object in self.objects: for obj in self.objects:
if not object.isDeleted(): if not obj.isDeleted():
object.requestDelete() obj.requestDelete()
taskMgr.remove(object.uniqueName('delete')) taskMgr.remove(obj.uniqueName('delete'))
self.objects = set() self.objects = set()
class CannonRental(Rental): class CannonRental(Rental):
def __init__(self, estate):
Rental.__init__(self, estate)
def generateObjects(self): def generateObjects(self):
target = DistributedTargetAI(self.estate.air) target = DistributedTargetAI(self.estate.air)
target.generateWithRequired(self.estate.zoneId) target.generateWithRequired(self.estate.zoneId)
@ -93,8 +105,12 @@ class CannonRental(Rental):
av.toonUp(3) av.toonUp(3)
return 1 return 1
class TableRental(Rental):
# Once we make rental game tables. # Once we make rental game tables.
class TableRental(Rental):
def __init__(self, estate):
Rental.__init__(self, estate)
def generateObjects(self): def generateObjects(self):
for drop in TableGlobals.tableDrops: for drop in TableGlobals.tableDrops:
table = None table = None
@ -108,10 +124,13 @@ class TableRental(Rental):
class DistributedEstateAI(DistributedObjectAI): class DistributedEstateAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedEstateAI") notify = DirectNotifyGlobal.directNotify.newCategory("DistributedEstateAI")
def __init__(self, air): def __init__(self, air):
DistributedObjectAI.__init__(self, air) DistributedObjectAI.__init__(self, air)
self.toons = [0, 0, 0, 0, 0, 0] self.toons = [0, 0, 0, 0, 0, 0]
self.items = [[], [], [], [], [], []] self.items = [[], [], [], [], [], []]
self.boxes = [[], [], [], [], [], []]
self.plots = [[], [], [], [], [], []]
self.decorData = [] self.decorData = []
self.cloudType = 0 self.cloudType = 0
self.dawnTime = 0 self.dawnTime = 0
@ -123,7 +142,6 @@ class DistributedEstateAI(DistributedObjectAI):
self.pond = None self.pond = None
self.spots = [] self.spots = []
self.targets = [] self.targets = []
self.owner = None self.owner = None
def generate(self): def generate(self):
@ -165,11 +183,70 @@ class DistributedEstateAI(DistributedObjectAI):
self.createTreasurePlanner() self.createTreasurePlanner()
def generateRegisteredObjects(self, slot):
if len(self.plots[slot]) > 0:
for item in self.items[slot]:
plotData = GardenGlobals.estatePlots[slot][item[0]]
if item[1] == GardenGlobals.FLOWER_TYPE:
newItem = DistributedFlowerAI(self.air)
newItem.setEstate(self.doId)
newItem.setOwnerPlot(self.plots[slot][item[0]].doId)
newItem.setPlot(item[0])
newItem.setHeading(plotData[2])
newItem.setPosition(plotData[0], plotData[1], 1.3)
newItem.setOwnerIndex(slot)
newItem.setWaterLevel(item[4])
newItem.setGrowthLevel(item[5])
newItem.setTypeIndex(item[2])
newItem.setVariety(item[3])
elif item[1] == GardenGlobals.GAG_TREE_TYPE:
newItem = DistributedGagTreeAI(self.air)
newItem.setEstate(self.doId)
newItem.setOwnerPlot(self.plots[slot][item[0]].doId)
newItem.setPlot(item[0])
newItem.setHeading(plotData[2])
newItem.setPosition(plotData[0], plotData[1], 1.3)
newItem.setOwnerIndex(slot)
newItem.setTypeIndex(item[2])
newItem.setWaterLevel(item[4])
newItem.setGrowthLevel(item[5])
elif item[1] == GardenGlobals.STATUARY_TYPE:
newItem = DistributedStatuaryAI(self.air)
newItem.setEstate(self.doId)
newItem.setOwnerPlot(self.plots[slot][item[0]].doId)
newItem.setPlot(item[0])
newItem.setHeading(plotData[2])
newItem.setPosition(plotData[0], plotData[1], 1.3)
newItem.setOwnerIndex(slot)
newItem.setTypeIndex(item[2])
newItem.setWaterLevel(item[4])
newItem.setGrowthLevel(item[5])
elif item[1] == GardenGlobals.TOON_STATUARY_TYPE:
newItem = DistributedToonStatuaryAI(self.air)
newItem.setEstate(self.doId)
newItem.setOwnerPlot(self.plots[slot][item[0]].doId)
newItem.setPlot(item[0])
newItem.setHeading(plotData[2])
newItem.setPosition(plotData[0], plotData[1], 1.3)
newItem.setOwnerIndex(slot)
newItem.setTypeIndex(item[2])
newItem.setWaterLevel(item[4])
newItem.setGrowthLevel(item[5])
newItem.setOptional(item[6])
else:
continue
newItem.generateWithRequired(self.zoneId)
self.plots[slot][item[0]].planted = newItem
self.plots[slot][item[0]].sendUpdate('plantedItem', [newItem.doId])
self.plots[slot][item[0]].sendUpdate('setMovie', [GardenGlobals.MOVIE_PLANT, 999999999])
def destroy(self): def destroy(self):
for house in self.houses: for house in self.houses:
if house: if house:
house.requestDelete() house.requestDelete()
del self.houses[:] del self.houses[:]
if self.pond: if self.pond:
self.pond.requestDelete() self.pond.requestDelete()
for spot in self.spots: for spot in self.spots:
@ -327,7 +404,7 @@ class DistributedEstateAI(DistributedObjectAI):
self.items[0] = items self.items[0] = items
def d_setSlot0Items(self, items): def d_setSlot0Items(self, items):
self.sendUpdate('setSlot5Items', [items]) self.sendUpdate('setSlot0Items', [items])
def b_setSlot0Items(self, items): def b_setSlot0Items(self, items):
self.setSlot0Items(items) self.setSlot0Items(items)
@ -353,11 +430,11 @@ class DistributedEstateAI(DistributedObjectAI):
self.items[1] = items self.items[1] = items
def d_setSlot1Items(self, items): def d_setSlot1Items(self, items):
self.sendUpdate('setSlot2Items', [items]) self.sendUpdate('setSlot1Items', [items])
def b_setSlot1Items(self, items): def b_setSlot1Items(self, items):
self.setSlot2Items(items) self.setSlot1Items(items)
self.d_setSlot2Items(items) self.d_setSlot1Items(items)
def getSlot1Items(self): def getSlot1Items(self):
return self.items[1] return self.items[1]
@ -477,7 +554,7 @@ class DistributedEstateAI(DistributedObjectAI):
def b_setIdList(self, idList): def b_setIdList(self, idList):
self.setIdList(idList) self.setIdList(idList)
self.d_setIdLst(idList) self.d_setIdList(idList)
def completeFlowerSale(self, todo0): def completeFlowerSale(self, todo0):
pass pass
@ -517,6 +594,46 @@ class DistributedEstateAI(DistributedObjectAI):
def gameTableOver(self): def gameTableOver(self):
pass pass
def placeStarterGarden(self, avatar):
avId = avatar.doId
slot = self.toons.index(avId)
plotPos = GardenGlobals.estatePlots[slot]
boxPos = GardenGlobals.estateBoxes[slot]
for p, n in enumerate(boxPos):
x, y, h, i = n
newBox = DistributedGardenBoxAI(self.air)
newBox.setEstate(self.doId)
newBox.setTypeIndex(i)
newBox.setPlot(p)
newBox.setOwnerIndex(slot)
newBox.setPosition(x, y, 0)
newBox.setHeading(h)
newBox.generateWithRequired(self.zoneId)
self.boxes[slot].append(newBox)
for p, n in enumerate(plotPos):
i = n[3]
if i in [GardenGlobals.GAG_TREE_TYPE, GardenGlobals.STATUARY_TYPE]:
x, y, h = n[:3]
newPlot = DistributedGardenPlotAI(self.air)
newPlot.setEstate(self.doId)
newPlot.setPlot(p)
newPlot.setOwnerIndex(slot)
newPlot.setPosition(x, y, 0)
newPlot.setHeading(h)
newPlot.generateWithRequired(self.zoneId)
self.plots[slot].append(newPlot)
elif i == GardenGlobals.FLOWER_TYPE:
x, y, h = n[:3]
newPlot = DistributedGardenPlotAI(self.air)
newPlot.setEstate(self.doId)
newPlot.setPlot(p)
newPlot.setOwnerIndex(slot)
newPlot.setPosition(x, y, 1.3)
newPlot.setHeading(h)
newPlot.generateWithRequired(self.zoneId)
self.plots[slot].append(newPlot)
self.generateRegisteredObjects(slot)
def updateToons(self): def updateToons(self):
self.d_setSlot0ToonId(self.toons[0]) self.d_setSlot0ToonId(self.toons[0])
self.d_setSlot1ToonId(self.toons[1]) self.d_setSlot1ToonId(self.toons[1])

View file

@ -17,7 +17,7 @@ class DistributedFlower(DistributedPlantBase.DistributedPlantBase, FlowerBase.Fl
self.stickUp = 1.07 self.stickUp = 1.07
if DIRT_AS_WATER_INDICATOR: if DIRT_AS_WATER_INDICATOR:
self.stickUp += DIRT_MOUND_HEIGHT self.stickUp += DIRT_MOUND_HEIGHT
self.collSphereRadius = 2.2 self.collSphereRadius = 2.8
self.shadowScale = 0.5 self.shadowScale = 0.5
self.collSphereOffset = 0.0 self.collSphereOffset = 0.0
self.dirtMound = None self.dirtMound = None
@ -34,6 +34,9 @@ class DistributedFlower(DistributedPlantBase.DistributedPlantBase, FlowerBase.Fl
DistributedPlantBase.DistributedPlantBase.setTypeIndex(self, typeIndex) DistributedPlantBase.DistributedPlantBase.setTypeIndex(self, typeIndex)
self.setSpecies(typeIndex) self.setSpecies(typeIndex)
def getTypeIndex(self):
return self.typeIndex
def showWiltOrBloom(self): def showWiltOrBloom(self):
if not self.model: if not self.model:
return return
@ -129,7 +132,7 @@ class DistributedFlower(DistributedPlantBase.DistributedPlantBase, FlowerBase.Fl
base.localAvatar.removeShovelRelatedDoId(self.doId) base.localAvatar.removeShovelRelatedDoId(self.doId)
base.localAvatar.setInGardenAction(self) base.localAvatar.setInGardenAction(self)
base.cr.playGame.getPlace().detectedGardenPlotUse() base.cr.playGame.getPlace().detectedGardenPlotUse()
self.sendUpdate('removeItem', []) self.sendUpdate('removeItem', [base.localAvatar.doId])
def setWaterLevel(self, waterLevel): def setWaterLevel(self, waterLevel):
DistributedPlantBase.DistributedPlantBase.setWaterLevel(self, waterLevel) DistributedPlantBase.DistributedPlantBase.setWaterLevel(self, waterLevel)
@ -137,6 +140,9 @@ class DistributedFlower(DistributedPlantBase.DistributedPlantBase, FlowerBase.Fl
if self.model: if self.model:
self.adjustWaterIndicator() self.adjustWaterIndicator()
def getWaterLevel(self):
return self.waterLevel
def setGrowthLevel(self, growthLevel): def setGrowthLevel(self, growthLevel):
origGrowthLevel = self.growthLevel origGrowthLevel = self.growthLevel
self.growthLevel = growthLevel self.growthLevel = growthLevel
@ -144,6 +150,9 @@ class DistributedFlower(DistributedPlantBase.DistributedPlantBase, FlowerBase.Fl
self.loadModel() self.loadModel()
self.makeMovieNode() self.makeMovieNode()
def getGrowthLevel(self):
return self.growthLevel
def makeMovieNode(self): def makeMovieNode(self):
self.movieNode = self.rotateNode.attachNewNode('moviePos') self.movieNode = self.rotateNode.attachNewNode('moviePos')
self.movieNode.setPos(0, 3, 0) self.movieNode.setPos(0, 3, 0)

View file

@ -4,14 +4,20 @@ from toontown.estate.DistributedPlantBaseAI import DistributedPlantBaseAI
class DistributedFlowerAI(DistributedPlantBaseAI): class DistributedFlowerAI(DistributedPlantBaseAI):
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedFlowerAI") notify = DirectNotifyGlobal.directNotify.newCategory("DistributedFlowerAI")
def __init__(self, air, species, variety): def __init__(self, air):
DistributedPlantBaseAI.__init__(self, air)
self.air = air self.air = air
self.species = species
self.variety = variety
self.typeIndex = None self.typeIndex = None
def setTypeIndex(self, index): def setTypeIndex(self, typeIndex):
self.typeIndex = index DistributedPlantBaseAI.setTypeIndex(self, typeIndex)
self.typeIndex = typeIndex
def getTypeIndex(self):
return self.typeIndex
def setVariety(self, variety): def setVariety(self, variety):
self.variety = variety self.variety = variety
def getVariety(self):
return self.variety

View file

@ -141,6 +141,8 @@ class DistributedGagTree(DistributedPlantBase.DistributedPlantBase):
self.confirmDialog.destroy() self.confirmDialog.destroy()
self.confirmDialog = None self.confirmDialog = None
if value > 0: if value > 0:
base.localAvatar.showGardeningGui()
base.localAvatar.removeShovelRelatedDoId(self.doId)
self.doPicking() self.doPicking()
else: else:
self.finishInteraction() self.finishInteraction()
@ -149,7 +151,7 @@ class DistributedGagTree(DistributedPlantBase.DistributedPlantBase):
def doPicking(self): def doPicking(self):
if not self.canBePicked(): if not self.canBePicked():
return return
self.sendUpdate('removeItem', []) self.sendUpdate('removeItem', [base.localAvatar.doId])
def createBackupFruits(self): def createBackupFruits(self):
if not hasattr(self, 'fruits'): if not hasattr(self, 'fruits'):
@ -182,7 +184,13 @@ class DistributedGagTree(DistributedPlantBase.DistributedPlantBase):
for fruit in self.backupFruits: for fruit in self.backupFruits:
fruit.show() fruit.show()
self.sendUpdate('requestHarvest', []) self.sendUpdate('requestHarvest', [base.localAvatar.doId])
def hideItems(self):
seq = Parallel()
for item in self.fruits:
seq.append(LerpFunc(item.setAlphaScale, fromData=1, toData=0, duration=1))
seq.start()
def getTrack(self): def getTrack(self):
return self.gagTrack return self.gagTrack
@ -259,6 +267,7 @@ class DistributedGagTree(DistributedPlantBase.DistributedPlantBase):
self.movie.append(Func(toon.loop, 'neutral')) self.movie.append(Func(toon.loop, 'neutral'))
if avId == localAvatar.doId: if avId == localAvatar.doId:
self.movie.append(Func(self.finishInteraction)) self.movie.append(Func(self.finishInteraction))
self.movie.append(Func(self.hideItems))
self.movie.append(Func(self.movieDone)) self.movie.append(Func(self.movieDone))
self.movie.append(Func(self.doResultDialog)) self.movie.append(Func(self.doResultDialog))
self.movie.start() self.movie.start()

View file

@ -1,17 +1,34 @@
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from toontown.estate.DistributedPlantBaseAI import DistributedPlantBaseAI from toontown.estate.DistributedPlantBaseAI import DistributedPlantBaseAI
import GardenGlobals
class DistributedGagTreeAI(DistributedPlantBaseAI): class DistributedGagTreeAI(DistributedPlantBaseAI):
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedGagTreeAI") notify = DirectNotifyGlobal.directNotify.newCategory("DistributedGagTreeAI")
def __init__(self, air, gagTrack, gagLevel): def __init__(self, air):
DistributedPlantBaseAI.__init__(self, air)
self.air = air self.air = air
self.track = gagTrack
self.level = level
self.wilted = 0 self.wilted = 0
def announceGenerate(self):
DistributedPlantBaseAI.announceGenerate(self)
def delete(self):
DistributedPlantBaseAI.delete(self)
def disable(self):
DistributedPlantBaseAI.disable(self)
def setWilted(self, wilted): def setWilted(self, wilted):
self.wilted = wilted self.wilted = wilted
def requestHarvest(self): def getWilted(self):
pass return self.wilted
def requestHarvest(self, doId):
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])

View file

@ -30,7 +30,7 @@ class DistributedGardenBox(DistributedLawnDecor.DistributedLawnDecor):
elif self.typeIndex == GardenGlobals.BOX_TWO: elif self.typeIndex == GardenGlobals.BOX_TWO:
self.defaultModel = 'phase_5.5/models/estate/planterC' self.defaultModel = 'phase_5.5/models/estate/planterC'
else: else:
self.defaultModel = 'phase_5.5/models/estate/planterD' self.defaultModel = 'phase_5.5/models/estate/planterB'
self.collSphereOffset = 0.0 self.collSphereOffset = 0.0
self.collSphereRadius = self.collSphereRadius * 1.41 self.collSphereRadius = self.collSphereRadius * 1.41
self.plotScale = Vec3(1.0, 1.0, 1.0) self.plotScale = Vec3(1.0, 1.0, 1.0)

View file

@ -5,8 +5,12 @@ class DistributedGardenBoxAI(DistributedLawnDecorAI):
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedGardenBoxAI") notify = DirectNotifyGlobal.directNotify.newCategory("DistributedGardenBoxAI")
def __init__(self, air): def __init__(self, air):
DistributedLawnDecorAI.__init__(self, air)
self.air = air self.air = air
self.typeIndex = 0 self.typeIndex = 0
def setTypeIndex(self, index): def setTypeIndex(self, index):
self.typeIndex = index self.typeIndex = index
def getTypeIndex(self):
return self.typeIndex

View file

@ -25,6 +25,7 @@ class DistributedGardenPlot(DistributedLawnDecor.DistributedLawnDecor):
self.defaultModel = 'phase_5.5/models/estate/dirt_mound' self.defaultModel = 'phase_5.5/models/estate/dirt_mound'
self.colorScaler = Vec4(1, 1, 1, 1) self.colorScaler = Vec4(1, 1, 1, 1)
self.plantingGui = None self.plantingGui = None
self.planted = None
return return
def delete(self): def delete(self):
@ -83,6 +84,8 @@ class DistributedGardenPlot(DistributedLawnDecor.DistributedLawnDecor):
return self.getPlantingText() return self.getPlantingText()
def handleEnterPlot(self, entry = None): def handleEnterPlot(self, entry = None):
#Force Gardens -Zach
base.localAvatar.setGardenStarted(True)
dist = self.getDistance(localAvatar) dist = self.getDistance(localAvatar)
if self.canBePlanted(): if self.canBePlanted():
base.localAvatar.addShovelRelatedDoId(self.doId) base.localAvatar.addShovelRelatedDoId(self.doId)
@ -110,6 +113,8 @@ class DistributedGardenPlot(DistributedLawnDecor.DistributedLawnDecor):
retval = True retval = True
if not base.localAvatar.doId == self.getOwnerId(): if not base.localAvatar.doId == self.getOwnerId():
retval = False retval = False
if hasattr(self, 'planted') and self.planted:
retval = False
return retval return retval
def plantSomething(self): def plantSomething(self):
@ -139,12 +144,12 @@ class DistributedGardenPlot(DistributedLawnDecor.DistributedLawnDecor):
if recipeKey >= 0: if recipeKey >= 0:
species, variety = GardenGlobals.getSpeciesVarietyGivenRecipe(recipeKey) species, variety = GardenGlobals.getSpeciesVarietyGivenRecipe(recipeKey)
if species >= 0 and variety >= 0: if species >= 0 and variety >= 0:
self.sendUpdate('plantFlower', [species, variety]) self.sendUpdate('plantFlower', [species, variety, base.localAvatar.doId])
successPlanting = True successPlanting = True
else: else:
self.notify.debug('%s %d is not a valid recipe' % (recipeStr, special)) self.notify.debug('%s %d is not a valid recipe' % (recipeStr, special))
burntBeans = len(recipeStr) burntBeans = len(recipeStr)
self.sendUpdate('plantNothing', [burntBeans]) self.sendUpdate('plantNothing', [burntBeans, base.localAvatar.doId])
if successPlanting: if successPlanting:
flowerName = GardenGlobals.getFlowerVarietyName(species, variety) flowerName = GardenGlobals.getFlowerVarietyName(species, variety)
stringToShow = TTLocalizer.getResultPlantedSomethingSentence(flowerName) stringToShow = TTLocalizer.getResultPlantedSomethingSentence(flowerName)
@ -204,11 +209,11 @@ class DistributedGardenPlot(DistributedLawnDecor.DistributedLawnDecor):
if species >= 205 and species <= 208: if species >= 205 and species <= 208:
successToonStatue = True successToonStatue = True
else: else:
self.sendUpdate('plantStatuary', [species]) self.sendUpdate('plantStatuary', [species, base.localAvatar.doId])
else: else:
self.notify.debug('%s %d is not a valid recipe' % (recipeStr, special)) self.notify.debug('%s %d is not a valid recipe' % (recipeStr, special))
burntBeans = len(recipeStr) burntBeans = len(recipeStr)
self.sendUpdate('plantNothing', [burntBeans]) self.sendUpdate('plantNothing', [burntBeans, base.localAvatar.doId])
if successPlanting: if successPlanting:
itemName = GardenGlobals.PlantAttributes[species]['name'] itemName = GardenGlobals.PlantAttributes[species]['name']
stringToShow = TTLocalizer.getResultPlantedSomethingSentence(itemName) stringToShow = TTLocalizer.getResultPlantedSomethingSentence(itemName)
@ -247,7 +252,7 @@ class DistributedGardenPlot(DistributedLawnDecor.DistributedLawnDecor):
base.localAvatar.showGardeningGui() base.localAvatar.showGardeningGui()
base.localAvatar.removeShovelRelatedDoId(self.doId) base.localAvatar.removeShovelRelatedDoId(self.doId)
if willPlant: if willPlant:
self.sendUpdate('plantToonStatuary', [species, dnaCode]) self.sendUpdate('plantToonStatuary', [species, dnaCode, base.localAvatar.doId])
else: else:
self.popupItemPlantingGui() self.popupItemPlantingGui()
return return
@ -266,11 +271,21 @@ class DistributedGardenPlot(DistributedLawnDecor.DistributedLawnDecor):
base.localAvatar.showGardeningGui() base.localAvatar.showGardeningGui()
base.localAvatar.removeShovelRelatedDoId(self.doId) base.localAvatar.removeShovelRelatedDoId(self.doId)
if willPlant: if willPlant:
self.sendUpdate('plantGagTree', [gagTrack, gagLevel]) self.sendUpdate('plantGagTree', [gagTrack, gagLevel, base.localAvatar.doId])
else: else:
self.finishInteraction() self.finishInteraction()
return return
def plantedItem(self, doId):
self.planted = doId
def removePlanted(self):
if self.planted:
item = base.cr.doId2do.get(self.planted)
if item:
item.delete()
self.planted = None
def setMovie(self, mode, avId): def setMovie(self, mode, avId):
if mode == GardenGlobals.MOVIE_PLANT: if mode == GardenGlobals.MOVIE_PLANT:
self.doPlaceItemTrack(avId) self.doPlaceItemTrack(avId)
@ -301,8 +316,8 @@ class DistributedGardenPlot(DistributedLawnDecor.DistributedLawnDecor):
self.movie.append(Func(toon.detachShovel)) self.movie.append(Func(toon.detachShovel))
if self.model: if self.model:
pos = self.model.getPos() pos = self.model.getPos()
pos.setZ(pos[2] - 1) pos.setZ(pos[2] + 1)
animProp = LerpPosInterval(self.model, 3, self.model.getPos(), pos) animProp = LerpPosInterval(self.model, 3, pos, self.model.getPos())
shrinkProp = LerpScaleInterval(self.model, 3, scale=self.plotScale, startScale=0.01) shrinkProp = LerpScaleInterval(self.model, 3, scale=self.plotScale, startScale=0.01)
objAnimShrink = ParallelEndTogether(animProp, shrinkProp) objAnimShrink = ParallelEndTogether(animProp, shrinkProp)
self.movie.append(objAnimShrink) self.movie.append(objAnimShrink)
@ -310,10 +325,16 @@ class DistributedGardenPlot(DistributedLawnDecor.DistributedLawnDecor):
self.movie.append(Func(toon.loop, 'neutral')) self.movie.append(Func(toon.loop, 'neutral'))
if avId == localAvatar.doId: if avId == localAvatar.doId:
self.movie.append(Func(self.finishInteraction)) self.movie.append(Func(self.finishInteraction))
self.movie.append(Func(self.movieDone)) self.movie.append(Func(self.removePlanted))
self.movie.start() self.movie.start()
def doPlaceItemTrack(self, avId, item = None): def doPlaceItemTrack(self, avId, item = None):
if avId == 999999999:
pos = self.model.getPos()
pos.setZ(pos[2] - 1)
self.model.setPos(pos)
self.model.setScale(0.01)
return
toon = base.cr.doId2do.get(avId) toon = base.cr.doId2do.get(avId)
if not toon: if not toon:
return return
@ -327,14 +348,24 @@ class DistributedGardenPlot(DistributedLawnDecor.DistributedLawnDecor):
self.movie = Sequence(self.startCamIval(avId), moveTrack, Func(shovel.show), placeItemTrack) self.movie = Sequence(self.startCamIval(avId), moveTrack, Func(shovel.show), placeItemTrack)
if avId == localAvatar.doId: if avId == localAvatar.doId:
self.expectingReplacement = 1 self.expectingReplacement = 1
self.movie.append(Func(self.movieDone)) self.movie.append(Func(self.sendUpdate, 'finishPlanting', [avId]))
self.movie.start() self.movie.start()
def generatePlaceItemTrack(self, toon, item): def generatePlaceItemTrack(self, toon, item):
sound = loader.loadSfx('phase_5.5/audio/sfx/burrow.ogg') sound = loader.loadSfx('phase_5.5/audio/sfx/burrow.ogg')
sound.setPlayRate(0.5) sound.setPlayRate(0.5)
placeItemTrack = Parallel() placeItemTrack = Parallel()
placeItemTrack.append(Sequence(ActorInterval(toon, 'start-dig'), Parallel(ActorInterval(toon, 'loop-dig', loop=1, duration=5.13), Sequence(Wait(0.25), SoundInterval(sound, node=toon, duration=0.55), Wait(0.8), SoundInterval(sound, node=toon, duration=0.55), Wait(1.35), SoundInterval(sound, node=toon, duration=0.55))), ActorInterval(toon, 'start-dig', playRate=-1), Func(toon.loop, 'neutral'), Func(toon.detachShovel))) placeItemTrack.append(Sequence(ActorInterval(toon, 'start-dig'),
Parallel(ActorInterval(toon, 'loop-dig', loop=1, duration=5.13),
Sequence(Wait(0.25),
SoundInterval(sound, node=toon, duration=0.55),
Wait(0.8),
SoundInterval(sound, node=toon, duration=0.55),
Wait(1.35),
SoundInterval(sound, node=toon, duration=0.55))),
ActorInterval(toon, 'start-dig', playRate=-1),
Func(toon.loop, 'neutral'),
Func(toon.detachShovel)))
if self.model: if self.model:
pos = self.model.getPos() pos = self.model.getPos()
pos.setZ(pos[2] - 1) pos.setZ(pos[2] - 1)
@ -343,7 +374,12 @@ class DistributedGardenPlot(DistributedLawnDecor.DistributedLawnDecor):
objAnimShrink = ParallelEndTogether(animProp, shrinkProp) objAnimShrink = ParallelEndTogether(animProp, shrinkProp)
placeItemTrack.append(objAnimShrink) placeItemTrack.append(objAnimShrink)
if item: if item:
placeItemTrack.append(Sequence(Func(item.reparentTo, toon.rightHand), Wait(0.55), Func(item.wrtReparentTo, render), Parallel(LerpHprInterval(item, hpr=self.getHpr(render), duration=1.2), ProjectileInterval(item, endPos=self.getPos(render), duration=1.2, gravityMult=0.45)), Func(item.removeNode))) placeItemTrack.append(Sequence(Func(item.reparentTo, toon.rightHand),
Wait(0.55),
Func(item.wrtReparentTo, render),
Parallel(LerpHprInterval(item, hpr=self.getHpr(render), duration=1.2),
ProjectileInterval(item, endPos=self.getPos(render), duration=1.2, gravityMult=0.45)),
Func(item.removeNode)))
return placeItemTrack return placeItemTrack
def makeMovieNode(self): def makeMovieNode(self):

View file

@ -1,35 +1,186 @@
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from toontown.estate.DistributedLawnDecorAI import DistributedLawnDecorAI from toontown.estate.DistributedLawnDecorAI import DistributedLawnDecorAI
import DistributedToonStatuaryAI from DistributedToonStatuaryAI import DistributedToonStatuaryAI
import DistributedStatuaryAI from DistributedStatuaryAI import DistributedStatuaryAI
from DistributedGagTreeAI import DistributedGagTreeAI
from DistributedFlowerAI import DistributedFlowerAI
import GardenGlobals
import datetime
slots2plots = {
0: GardenGlobals.plots0,
1: GardenGlobals.plots1,
2: GardenGlobals.plots2,
3: GardenGlobals.plots3,
4: GardenGlobals.plots4,
5: GardenGlobals.plots5
}
class DistributedGardenPlotAI(DistributedLawnDecorAI): class DistributedGardenPlotAI(DistributedLawnDecorAI):
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedGardenPlotAI") notify = DirectNotifyGlobal.directNotify.newCategory("DistributedGardenPlotAI")
def __init__(self, air): def __init__(self, air):
DistributedLawnDecorAI.__init__(self, air)
self.air = air self.air = air
self.planted = None self.planted = None
def plantFlower(self, species, variety): def announceGenerate(self):
flower = DistributedFlowerAI.DistributedFlowerAI(self.air, species, variety) DistributedLawnDecorAI.announceGenerate(self)
self.planted = flower
def plantGagTree(self, gagTrack, gagLevel): def delete(self):
tree = DistributedGagTreeAI.DistributedGagTreeAI(self.air, gagTrack, gagLevel) DistributedLawnDecorAI.delete(self)
self.planted = tree
def plantStatuary(self, species): def disable(self):
statue = DistributedStatuaryAI.DistributedStatuaryAI(self.air, species) DistributedLawnDecorAI.disable(self)
self.planted = statue
def plantToonStatuary(self, species, dnaCode): def finishPlanting(self, avId):
statue = DistributedToonStatuaryAI.DistributedToonStatuaryAI(self.air, species, dnaCode) self.planted.generateWithRequired(self.zoneId)
self.planted = statue self.addData()
self.sendUpdate('plantedItem', [self.planted.doId])
self.planted.sendUpdate('setMovie', [GardenGlobals.MOVIE_FINISHPLANTING, avId])
def plantNothing(self, burntBeans): def finishRemoving(self, avId):
avId = self.air.getAvatarIdFromSender() self.removeData()
av = self.air.doId2do[avId] self.planted.removeNode()
money = av.getMoney() self.planted.delete()
av.setMoney(money - burntBeans) simbase.air.removeObject(self.planted.doId)
av.d_setMoney(money - burntBeans) self.planted = None
self.sendUpdate('setMovie', [GardenGlobals.MOVIE_FINISHREMOVING, avId])
def addData(self):
estate = simbase.air.doId2do.get(self.getEstate())
plantedAt = int(datetime.datetime.now().strftime('%Y%m%d%H%M'))
if isinstance(self.planted, DistributedFlowerAI):
data = [
self.getPlot(),
GardenGlobals.FLOWER_TYPE,
self.planted.getTypeIndex(),
self.planted.getVariety(),
self.planted.getWaterLevel(),
self.planted.getGrowthLevel(),
0,
plantedAt,
plantedAt
]
elif isinstance(self.planted, DistributedGagTreeAI):
data = [
self.getPlot(),
GardenGlobals.GAG_TREE_TYPE,
self.planted.getTypeIndex(),
0,
self.planted.getWaterLevel(),
self.planted.getGrowthLevel(),
0,
plantedAt,
plantedAt
]
elif isinstance(self.planted, DistributedToonStatuaryAI):
data = [
self.getPlot(),
GardenGlobals.TOON_STATUARY_TYPE,
self.planted.getTypeIndex(),
0,
self.planted.getWaterLevel(),
self.planted.getGrowthLevel(),
self.planted.getOptional(),
plantedAt,
plantedAt
]
elif isinstance(self.planted, DistributedStatuaryAI):
data = [
self.getPlot(),
GardenGlobals.STATUARY_TYPE,
self.planted.getTypeIndex(),
0,
self.planted.getWaterLevel(),
self.planted.getGrowthLevel(),
0,
plantedAt,
plantedAt
]
else:
return
estate.items[self.getOwnerIndex()].append(tuple(data))
estate.updateItems()
def removeData(self):
estate = simbase.air.doId2do.get(self.getEstate())
dataIndex = -1
for n, item in enumerate(estate.items[self.getOwnerIndex()]):
if item[0] == self.getPlot():
dataIndex = n
if dataIndex >= 0:
del estate.items[self.getOwnerIndex()][dataIndex]
estate.updateItems()
def plantFlower(self, species, variety, toon):
#free for now
#av = simbase.air.doId2do.get(toon)
#av.takeMoney(GardenGlobals.getNumBeansRequired(species, variety))
self.planted = DistributedFlowerAI(self.air)
self.planted.setEstate(self.getEstate())
self.planted.setOwnerPlot(self.doId)
self.planted.setPlot(self.getPlot())
self.planted.setHeading(self.getHeading())
self.planted.setPosition(*self.getPosition())
self.planted.setOwnerIndex(self.getOwnerIndex())
self.planted.setWaterLevel(0)
self.planted.setGrowthLevel(0)
self.planted.setTypeIndex(species)
self.planted.setVariety(variety)
self.sendUpdate('setMovie', [GardenGlobals.MOVIE_PLANT, toon])
def plantGagTree(self, track, level, toon):
#free for now
#av = simbase.air.doId2do.get(toon)
#av.inventory.useItem(track, level)
#av.d_setInventory(av.inventory.makeNetString())
self.planted = DistributedGagTreeAI(self.air)
self.planted.setEstate(self.getEstate())
self.planted.setOwnerPlot(self.doId)
self.planted.setPlot(self.getPlot())
self.planted.setHeading(self.getHeading())
self.planted.setPosition(*self.getPosition())
self.planted.setOwnerIndex(self.getOwnerIndex())
self.planted.setTypeIndex(GardenGlobals.getTreeTypeIndex(track, level))
self.planted.setWaterLevel(0)
self.planted.setGrowthLevel(0)
self.sendUpdate('setMovie', [GardenGlobals.MOVIE_PLANT, toon])
def plantStatuary(self, species, toon):
#free for now
#av = simbase.air.doId2do.get(toon)
#av.takeMoney(GardenGlobals.getNumBeansRequired(species, 0))
self.planted = DistributedStatuaryAI(self.air)
self.planted.setEstate(self.getEstate())
self.planted.setOwnerPlot(self.doId)
self.planted.setPlot(self.getPlot())
self.planted.setHeading(self.getHeading())
self.planted.setPosition(*self.getPosition())
self.planted.setOwnerIndex(self.getOwnerIndex())
self.planted.setTypeIndex(species)
self.planted.setWaterLevel(0)
self.planted.setGrowthLevel(0)
self.sendUpdate('setMovie', [GardenGlobals.MOVIE_PLANT, toon])
def plantToonStatuary(self, species, dnaCode, toon):
#free for now
#av = simbase.air.doId2do.get(toon)
#av.takeMoney(GardenGlobals.getNumBeansRequired(species, 0))
self.planted = DistributedToonStatuaryAI(self.air)
self.planted.setEstate(self.getEstate())
self.planted.setOwnerPlot(self.doId)
self.planted.setPlot(self.getPlot())
self.planted.setHeading(self.getHeading())
self.planted.setPosition(*self.getPosition())
self.planted.setOwnerIndex(self.getOwnerIndex())
self.planted.setTypeIndex(species)
self.planted.setWaterLevel(0)
self.planted.setGrowthLevel(0)
self.planted.setOptional(dnaCode)
self.sendUpdate('setMovie', [GardenGlobals.MOVIE_PLANT, toon])
def plantNothing(self, burntBeans, toon):
av = simbase.air.doId2do.get(toon)
av.takeMoney(burntBeans)
self.planted = None self.planted = None

View file

@ -50,7 +50,6 @@ class DistributedLawnDecor(DistributedNode.DistributedNode, NodePath, ShadowCast
return return
def setHeading(self, h): def setHeading(self, h):
self.notify.debug('setting h')
DistributedNode.DistributedNode.setH(self, h) DistributedNode.DistributedNode.setH(self, h)
def generateInit(self): def generateInit(self):
@ -122,7 +121,6 @@ class DistributedLawnDecor(DistributedNode.DistributedNode, NodePath, ShadowCast
self.accept(self.exitMessageName, self.handleExitPlot) self.accept(self.exitMessageName, self.handleExitPlot)
def handleEnterPlot(self, optional = None): def handleEnterPlot(self, optional = None):
self.notify.debug('handleEnterPlot %d' % self.doId)
self.sendUpdate('plotEntered', []) self.sendUpdate('plotEntered', [])
def handleExitPlot(self, optional = None): def handleExitPlot(self, optional = None):
@ -144,6 +142,12 @@ class DistributedLawnDecor(DistributedNode.DistributedNode, NodePath, ShadowCast
taskMgr.remove(self.uniqueName('adjust tree')) taskMgr.remove(self.uniqueName('adjust tree'))
return return
def setEstate(self, estate):
self.estate = estate
def getEstate(self):
return self.estate
def setPos(self, x, y, z): def setPos(self, x, y, z):
DistributedNode.DistributedNode.setPos(self, x, y, z) DistributedNode.DistributedNode.setPos(self, x, y, z)
self.stick2Ground() self.stick2Ground()
@ -193,12 +197,12 @@ class DistributedLawnDecor(DistributedNode.DistributedNode, NodePath, ShadowCast
def stickParts(self): def stickParts(self):
pass pass
def setPlot(self, plot):
self.plot = plot
def setH(self, h): def setH(self, h):
DistributedNode.DistributedNode.setH(self, h) DistributedNode.DistributedNode.setH(self, h)
def setPlot(self, plot):
self.plot = plot
def getPlot(self): def getPlot(self):
return self.plot return self.plot
@ -238,7 +242,7 @@ class DistributedLawnDecor(DistributedNode.DistributedNode, NodePath, ShadowCast
base.localAvatar.hideShovelButton() base.localAvatar.hideShovelButton()
base.localAvatar.hideWateringCanButton() base.localAvatar.hideWateringCanButton()
self.startInteraction() self.startInteraction()
self.sendUpdate('removeItem', []) self.sendUpdate('removeItem', [base.localAvatar.doId])
def generateToonMoveTrack(self, toon): def generateToonMoveTrack(self, toon):
node = NodePath('tempNode') node = NodePath('tempNode')
@ -257,7 +261,10 @@ class DistributedLawnDecor(DistributedNode.DistributedNode, NodePath, ShadowCast
finalY = node.getY(render) finalY = node.getY(render)
finalZ = node.getZ(render) finalZ = node.getZ(render)
node.removeNode() node.removeNode()
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')) 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 return toonTrack
def unprint(self, string): def unprint(self, string):
@ -281,13 +288,16 @@ class DistributedLawnDecor(DistributedNode.DistributedNode, NodePath, ShadowCast
def startCamIval(self, avId): def startCamIval(self, avId):
track = Sequence() track = Sequence()
if avId == localAvatar.doId: if avId == localAvatar.doId:
track = Sequence(Func(base.localAvatar.disableSmartCameraViews), Func(base.localAvatar.setCameraPosForPetInteraction)) track = Sequence(Func(base.localAvatar.disableSmartCameraViews),
Func(base.localAvatar.setCameraPosForPetInteraction))
return track return track
def stopCamIval(self, avId): def stopCamIval(self, avId):
track = Sequence() track = Sequence()
if avId == localAvatar.doId: if avId == localAvatar.doId:
track = Sequence(Func(base.localAvatar.unsetCameraPosForPetInteraction), Wait(0.8), Func(base.localAvatar.enableSmartCameraViews)) track = Sequence(Func(base.localAvatar.unsetCameraPosForPetInteraction),
Wait(0.8),
Func(base.localAvatar.enableSmartCameraViews))
return track return track
def canBeWatered(self): def canBeWatered(self):
@ -322,6 +332,8 @@ class DistributedLawnDecor(DistributedNode.DistributedNode, NodePath, ShadowCast
if not toon: if not toon:
return return
self.finishMovies() self.finishMovies()
if avId == localAvatar.doId:
self.startInteraction()
self.model.setTransparency(1) self.model.setTransparency(1)
self.model.setAlphaScale(1) self.model.setAlphaScale(1)
shovel = toon.attachShovel() shovel = toon.attachShovel()
@ -329,9 +341,11 @@ class DistributedLawnDecor(DistributedNode.DistributedNode, NodePath, ShadowCast
moveTrack = self.generateToonMoveTrack(toon) moveTrack = self.generateToonMoveTrack(toon)
digupTrack = self.generateDigupTrack(toon) digupTrack = self.generateDigupTrack(toon)
self.movie = Sequence(self.startCamIval(avId), moveTrack, Func(shovel.show), digupTrack) self.movie = Sequence(self.startCamIval(avId), moveTrack, Func(shovel.show), digupTrack)
self.movie.append(Func(base.cr.removeObject, self.doId))
if avId == localAvatar.doId: if avId == localAvatar.doId:
self.expectingReplacement = 1 self.expectingReplacement = 1
self.movie.append(Func(self.movieDone)) plotAv = base.cr.doId2do.get(self.getOwnerPlot())
self.movie.append(Func(plotAv.sendUpdate, 'finishRemoving', [avId]))
self.movie.start() self.movie.start()
def generateDigupTrack(self, toon): def generateDigupTrack(self, toon):
@ -340,7 +354,22 @@ class DistributedLawnDecor(DistributedNode.DistributedNode, NodePath, ShadowCast
pos = self.model.getPos() pos = self.model.getPos()
pos.setZ(pos[2] - 1) pos.setZ(pos[2] - 1)
track = Parallel() track = Parallel()
track.append(Sequence(ActorInterval(toon, 'start-dig'), Parallel(ActorInterval(toon, 'loop-dig', loop=1, duration=5.13), Sequence(Wait(0.25), SoundInterval(sound, node=toon, duration=0.55), Wait(0.8), SoundInterval(sound, node=toon, duration=0.55), Wait(1.35), SoundInterval(sound, node=toon, duration=0.55))), ActorInterval(toon, 'start-dig', playRate=-1), LerpFunc(self.model.setAlphaScale, fromData=1, toData=0, duration=1), Func(toon.loop, 'neutral'), Func(toon.detachShovel))) sq = Sequence(ActorInterval(toon, 'start-dig'),
Parallel(ActorInterval(toon, 'loop-dig', loop=1, duration=5.13),
Sequence(Wait(0.25),
SoundInterval(sound, node=toon, duration=0.55),
Wait(0.8),
SoundInterval(sound, node=toon, duration=0.55),
Wait(1.35),
SoundInterval(sound, node=toon, duration=0.55))),
ActorInterval(toon, 'start-dig', playRate=-1),
LerpFunc(self.model.setAlphaScale, fromData=1, toData=0, duration=1))
if hasattr(self, 'signModel'):
sq.append(Parallel(LerpFunc(self.signModel.setAlphaScale, fromData=1, toData=0, duration=1),
LerpScaleInterval(self.signModel, 1, 0, 1)))
sq.append(Func(toon.loop, 'neutral'))
sq.append(Func(toon.detachShovel))
track.append(sq)
return track return track
def doFinishPlantingTrack(self, avId): def doFinishPlantingTrack(self, avId):

View file

@ -1,41 +1,68 @@
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedNodeAI import DistributedNodeAI from direct.distributed.DistributedNodeAI import DistributedNodeAI
import GardenGlobals
class DistributedLawnDecorAI(DistributedNodeAI): class DistributedLawnDecorAI(DistributedNodeAI):
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedLawnDecorAI") notify = DirectNotifyGlobal.directNotify.newCategory("DistributedLawnDecorAI")
def __init__(self, air): def __init__(self, air):
DistributedNodeAI.__init__(self, air)
self.air = air self.air = air
self.plot = None self.plot = None
self.heading = 0 self.ownerIndex = None
self.pos = (0, 0, 0)
self.ownerIndex = 0 def announceGenerate(self):
DistributedNodeAI.announceGenerate(self)
def delete(self):
DistributedNodeAI.delete(self)
def disable(self):
DistributedNodeAI.disable(self)
def setEstate(self, estate):
self.estate = estate
def getEstate(self):
return self.estate
def setPlot(self, plot): def setPlot(self, plot):
self.plot = plot self.plot = plot
def setHeading(self, h): def getPlot(self):
self.heading = h return self.plot
self.sendUpdate('setH', [h])
def setPosition(self, x, y, z):
self.pos = (x, y, z)
self.sendUpdate('setPos', [x, y, z])
def setOwnerIndex(self, index): def setOwnerIndex(self, index):
self.ownerIndex = index self.ownerIndex = index
def getOwnerIndex(self):
return self.ownerIndex
def setPosition(self, x, y, z):
self.position = (x, y, z)
def getPosition(self):
return self.position
def setHeading(self, heading):
self.heading = heading
def getHeading(self):
return self.heading
def plotEntered(self): def plotEntered(self):
pass pass
def removeItem(self): def removeItem(self, avId):
pass self.inUseBy = avId
self.d_setMovie(GardenGlobals.MOVIE_REMOVE, avId)
def setMovie(self, todo0, todo1): def d_setMovie(self, mode, avId):
pass self.sendUpdate('setMovie', [mode, avId])
def movieDone(self): def movieDone(self):
pass if hasattr(self, 'inUseBy'):
del self.inUseBy
def interactionDenied(self, todo0): def interactionDenied(self, todo0):
pass pass

View file

@ -44,6 +44,12 @@ class DistributedPlantBase(DistributedLawnDecor.DistributedLawnDecor):
DistributedLawnDecor.DistributedLawnDecor.setupShadow(self) DistributedLawnDecor.DistributedLawnDecor.setupShadow(self)
self.adjustWaterIndicator() self.adjustWaterIndicator()
def setOwnerPlot(self, owner):
self.ownerPlot = owner
def getOwnerPlot(self):
return self.ownerPlot
def setTypeIndex(self, typeIndex): def setTypeIndex(self, typeIndex):
self.typeIndex = typeIndex self.typeIndex = typeIndex
self.attributes = GardenGlobals.PlantAttributes[typeIndex] self.attributes = GardenGlobals.PlantAttributes[typeIndex]
@ -63,7 +69,9 @@ class DistributedPlantBase(DistributedLawnDecor.DistributedLawnDecor):
self.waterLevel = waterLevel self.waterLevel = waterLevel
def getWaterLevel(self): def getWaterLevel(self):
if hasattr(self, 'waterLevel'):
return self.waterLevel return self.waterLevel
return 0
def setGrowthLevel(self, growthLevel): def setGrowthLevel(self, growthLevel):
self.growthLevel = growthLevel self.growthLevel = growthLevel
@ -97,11 +105,11 @@ class DistributedPlantBase(DistributedLawnDecor.DistributedLawnDecor):
def handleWatering(self): def handleWatering(self):
self.startInteraction() self.startInteraction()
self.sendUpdate('waterPlant') self.sendUpdate('waterPlant', [localAvatar.doId])
def __handleWatering(self, plantToWaterId): def __handleWatering(self, plantToWaterId):
if plantToWaterId == self.doId: if plantToWaterId == self.doId:
self.sendUpdate('waterPlant') self.sendUpdate('waterPlant', [localAvatar.doId])
else: else:
self.notify.debug('not sending water plant') self.notify.debug('not sending water plant')

View file

@ -1,26 +1,81 @@
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from toontown.estate.DistributedLawnDecorAI import DistributedLawnDecorAI from toontown.estate.DistributedLawnDecorAI import DistributedLawnDecorAI
import GardenGlobals
import datetime
class DistributedPlantBaseAI(DistributedLawnDecorAI): class DistributedPlantBaseAI(DistributedLawnDecorAI):
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedPlantBaseAI") notify = DirectNotifyGlobal.directNotify.newCategory("DistributedPlantBaseAI")
def __init__(self, air): def __init__(self, air):
DistributedLawnDecorAI.__init__(self, air)
self.air = air self.air = air
self.typeIndex = 0 self.growthLevel = -1
self.water = 0
self.growth = 0
def setTypeIndex(self, index): def announceGenerate(self):
self.typeIndex = index DistributedLawnDecorAI.announceGenerate(self)
def delete(self):
DistributedLawnDecorAI.delete(self)
def disable(self):
DistributedLawnDecorAI.disable(self)
def setOwnerPlot(self, owner):
self.ownerPlot = owner
def getOwnerPlot(self):
return self.ownerPlot
def setTypeIndex(self, typeIndex):
self.typeIndex = typeIndex
self.attributes = GardenGlobals.PlantAttributes[typeIndex]
self.name = self.attributes['name']
self.plantType = self.attributes['plantType']
self.growthThresholds = self.attributes['growthThresholds']
self.maxWaterLevel = self.attributes['maxWaterLevel']
self.minWaterLevel = self.attributes['minWaterLevel']
def getTypeIndex(self):
return self.typeIndex
def setWaterLevel(self, water): def setWaterLevel(self, water):
self.water = water self.waterLevel = water
def getWaterLevel(self):
return self.waterLevel
def setGrowthLevel(self, growth): def setGrowthLevel(self, growth):
self.growth = growth self.growthLevel = growth
def waterPlant(self): def getGrowthLevel(self):
pass return self.growthLevel
def waterPlant(self, avId):
self.lastWateredBy = avId
newLevel = self.waterLevel + 1
if newLevel > self.maxWaterLevel:
self.setWaterLevel(self.maxWaterLevel)
else:
self.setWaterLevel(newLevel)
self.sendUpdate('setMovie', [GardenGlobals.MOVIE_WATER, avId])
self.sendUpdate('setWaterLevel', [self.getWaterLevel()])
def waterPlantDone(self): def waterPlantDone(self):
pass if hasattr(self, 'lastWateredBy'):
av = simbase.air.doId2do.get(self.lastWateredBy)
skill = av.getWateringCanSkill()
skill += GardenGlobals.WateringCanAttributes[av.wateringCan]['skillPts'] / 100
av.b_setWateringCanSkill(skill)
del self.lastWateredBy
estate = simbase.air.doId2do.get(self.getEstate())
dataIndex = -1
for n, item in enumerate(estate.items[self.getOwnerIndex()]):
if item[0] == self.getPlot():
dataIndex = n
if dataIndex >= 0:
dtime = int(datetime.datetime.now().strftime('%Y%m%d%H%M'))
data = list(estate.items[self.getOwnerIndex()][dataIndex])
data[4] = self.getWaterLevel()
data[8] = dtime
estate.items[self.getOwnerIndex()][dataIndex] = tuple(data)
estate.updateItems()

View file

@ -37,6 +37,12 @@ class DistributedStatuary(DistributedLawnDecor.DistributedLawnDecor):
attrib = GardenGlobals.PlantAttributes[self.typeIndex] attrib = GardenGlobals.PlantAttributes[self.typeIndex]
self.stick2Ground() self.stick2Ground()
def setOwnerPlot(self, owner):
self.ownerPlot = owner
def getOwnerPlot(self):
return self.ownerPlot
def setTypeIndex(self, typeIndex): def setTypeIndex(self, typeIndex):
self.typeIndex = typeIndex self.typeIndex = typeIndex
self.name = GardenGlobals.PlantAttributes[typeIndex]['name'] self.name = GardenGlobals.PlantAttributes[typeIndex]['name']

View file

@ -4,18 +4,30 @@ from toontown.estate.DistributedLawnDecorAI import DistributedLawnDecorAI
class DistributedStatuaryAI(DistributedLawnDecorAI): class DistributedStatuaryAI(DistributedLawnDecorAI):
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedStatuaryAI") notify = DirectNotifyGlobal.directNotify.newCategory("DistributedStatuaryAI")
def __init__(self, air, species): def __init__(self, air):
DistributedLawnDecorAI.__init__(self, air)
self.air = air self.air = air
self.species = species
self.typeIndex = 0
self.water = 0
self.growth = 0
def setTypeIndex(self, index): def setTypeIndex(self, typeIndex):
self.typeIndex = index self.typeIndex = typeIndex
def setWaterLevel(self, water): def getTypeIndex(self):
self.water = water return self.typeIndex
def setGrowthLevel(self, growth): def setOwnerPlot(self, owner):
self.growth = growth self.ownerPlot = owner
def getOwnerPlot(self):
return self.ownerPlot
def setWaterLevel(self, waterLevel):
self.waterLevel = waterLevel
def getWaterLevel(self):
return self.waterLevel
def setGrowthLevel(self, growthLevel):
self.growthLevel = growthLevel
def getGrowthLevel(self):
return self.growthLevel

View file

@ -4,10 +4,12 @@ from toontown.estate.DistributedStatuaryAI import DistributedStatuaryAI
class DistributedToonStatuaryAI(DistributedStatuaryAI): class DistributedToonStatuaryAI(DistributedStatuaryAI):
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedToonStatuaryAI") notify = DirectNotifyGlobal.directNotify.newCategory("DistributedToonStatuaryAI")
def __init__(self, air, species, dnaCode): def __init__(self, air):
DistributedStatuaryAI.__init__(self, air)
self.air = air self.air = air
self.species = species
self.dnaCode = dnaCode
def setOptional(self, opt): def setOptional(self, optional):
self.optional = opt self.optional = optional
def getOptional(self):
return self.optional

View file

@ -8,6 +8,7 @@ import functools
class LoadHouseFSM(FSM): class LoadHouseFSM(FSM):
notify = DirectNotifyGlobal.directNotify.newCategory('LoadHouseFSM') notify = DirectNotifyGlobal.directNotify.newCategory('LoadHouseFSM')
def __init__(self, mgr, estate, houseIndex, toon, callback): def __init__(self, mgr, estate, houseIndex, toon, callback):
FSM.__init__(self, 'LoadHouseFSM') FSM.__init__(self, 'LoadHouseFSM')
self.mgr = mgr self.mgr = mgr

View file

@ -12,6 +12,7 @@ INVALID_TYPE = -1
GAG_TREE_TYPE = 0 GAG_TREE_TYPE = 0
FLOWER_TYPE = 1 FLOWER_TYPE = 1
STATUARY_TYPE = 2 STATUARY_TYPE = 2
TOON_STATUARY_TYPE = 3
WATERING_CAN_SMALL = 0 WATERING_CAN_SMALL = 0
WATERING_CAN_MEDIUM = 1 WATERING_CAN_MEDIUM = 1
WATERING_CAN_LARGE = 2 WATERING_CAN_LARGE = 2
@ -682,7 +683,7 @@ def validatePlantAttributes(notify):
notify.debug('plant attributes are ok') notify.debug('plant attributes are ok')
plots0 = ((0, plots0 = [(0,
0, 0,
0.0, 0.0,
FLOWER_TYPE), FLOWER_TYPE),
@ -757,45 +758,45 @@ plots0 = ((0,
(-100, (-100,
-43, -43,
-90.0, -90.0,
STATUARY_TYPE)) STATUARY_TYPE)]
plots1 = ((0, plots1 = [(85.0,
0, -67.0,
0.0, 0.0,
FLOWER_TYPE), FLOWER_TYPE),
(1, (75,
0, -72,
0.0, 0.0,
FLOWER_TYPE), FLOWER_TYPE),
(2, (89.865,
0, -71.7725,
0.0, 0.0,
FLOWER_TYPE), FLOWER_TYPE),
(2, (91.0,
1, -74.0,
0.0, 0.0,
FLOWER_TYPE), FLOWER_TYPE),
(2, (92.135,
2, -76.2275,
0.0, 0.0,
FLOWER_TYPE), FLOWER_TYPE),
(3, (75.865,
0, -78.7725,
0.0, 0.0,
FLOWER_TYPE), FLOWER_TYPE),
(3, (77,
1, -81,
0.0, 0.0,
FLOWER_TYPE), FLOWER_TYPE),
(3, (78.135,
2, -83.2275,
0.0, 0.0,
FLOWER_TYPE), FLOWER_TYPE),
(4, (86.6518,
0, -86.6576,
0.0, 0.0,
FLOWER_TYPE), FLOWER_TYPE),
(4, (89.3482,
1, -85.3424,
0.0, 0.0,
FLOWER_TYPE), FLOWER_TYPE),
(62, (62,
@ -833,8 +834,8 @@ plots1 = ((0,
(47, (47,
-82, -82,
-30.0, -30.0,
STATUARY_TYPE)) STATUARY_TYPE)]
plots2 = ((0, plots2 = [(0,
0, 0,
0.0, 0.0,
FLOWER_TYPE), FLOWER_TYPE),
@ -909,8 +910,8 @@ plots2 = ((0,
(-97, (-97,
-114, -114,
-60.0, -60.0,
STATUARY_TYPE)) STATUARY_TYPE)]
plots3 = ((0, plots3 = [(0,
0, 0,
0.0, 0.0,
FLOWER_TYPE), FLOWER_TYPE),
@ -985,8 +986,8 @@ plots3 = ((0,
(117, (117,
27, 27,
102.0, 102.0,
STATUARY_TYPE)) STATUARY_TYPE)]
plots4 = ((0, plots4 = [(0,
0, 0,
0.0, 0.0,
FLOWER_TYPE), FLOWER_TYPE),
@ -1061,8 +1062,8 @@ plots4 = ((0,
(16, (16,
87, 87,
-140.0, -140.0,
STATUARY_TYPE)) STATUARY_TYPE)]
plots5 = ((0, plots5 = [(0,
0, 0,
0.0, 0.0,
FLOWER_TYPE), FLOWER_TYPE),
@ -1137,7 +1138,7 @@ plots5 = ((0,
(-55, (-55,
70, 70,
213.0, 213.0,
STATUARY_TYPE)) STATUARY_TYPE)]
estatePlots = (plots0, estatePlots = (plots0,
plots1, plots1,
plots2, plots2,
@ -1147,7 +1148,7 @@ estatePlots = (plots0,
BOX_ONE = 1 BOX_ONE = 1
BOX_TWO = 2 BOX_TWO = 2
BOX_THREE = 3 BOX_THREE = 3
flowerBoxes0 = ((-62.5, flowerBoxes0 = [(-62.5,
-52.5, -52.5,
182.0, 182.0,
BOX_ONE), BOX_ONE),
@ -1166,8 +1167,8 @@ flowerBoxes0 = ((-62.5,
(-57, (-57,
-33, -33,
0.0, 0.0,
BOX_TWO)) BOX_TWO)]
flowerBoxes1 = ((85.0, flowerBoxes1 = [(85.0,
-67.0, -67.0,
26.0, 26.0,
BOX_ONE), BOX_ONE),
@ -1186,8 +1187,8 @@ flowerBoxes1 = ((85.0,
(88, (88,
-86, -86,
206.0, 206.0,
BOX_TWO)) BOX_TWO)]
flowerBoxes2 = ((-62, flowerBoxes2 = [(-62,
-112, -112,
350.0, 350.0,
BOX_ONE), BOX_ONE),
@ -1206,8 +1207,8 @@ flowerBoxes2 = ((-62,
(-71, (-71,
-129, -129,
169.0, 169.0,
BOX_TWO)) BOX_TWO)]
flowerBoxes3 = ((72, flowerBoxes3 = [(72,
5, 5,
265.0, 265.0,
BOX_ONE), BOX_ONE),
@ -1226,8 +1227,8 @@ flowerBoxes3 = ((72,
(54, (54,
12, 12,
86.0, 86.0,
BOX_TWO)) BOX_TWO)]
flowerBoxes4 = ((35.5, flowerBoxes4 = [(35.5,
70, 70,
152.0, 152.0,
BOX_ONE), BOX_ONE),
@ -1246,8 +1247,8 @@ flowerBoxes4 = ((35.5,
(47, (47,
86, 86,
-19.0, -19.0,
BOX_TWO)) BOX_TWO)]
flowerBoxes5 = ((-26.5, flowerBoxes5 = [(-26.5,
37.5, 37.5,
318.0, 318.0,
BOX_ONE), BOX_ONE),
@ -1266,7 +1267,7 @@ flowerBoxes5 = ((-26.5,
(-45, (-45,
31, 31,
124.0, 124.0,
BOX_TWO)) BOX_TWO)]
estateBoxes = (flowerBoxes0, estateBoxes = (flowerBoxes0,
flowerBoxes1, flowerBoxes1,
flowerBoxes2, flowerBoxes2,

View file

@ -110,7 +110,6 @@ HALF_DAY_PERIOD = 105
HALF_NIGHT_PERIOD = 30 HALF_NIGHT_PERIOD = 30
FIREWORKS_MOVIE_CLEAR = 0 FIREWORKS_MOVIE_CLEAR = 0
FIREWORKS_MOVIE_GUI = 1 FIREWORKS_MOVIE_GUI = 1
HouseEmblemPrices = ( HouseEmblemPrices = (
(50, 20), # bungalo (50, 20), # bungalo
(200, 75), # tiki (200, 75), # tiki

View file

@ -127,9 +127,12 @@ class SpecialsPhoto(NodePath):
rotate = pitch.attachNewNode('rotate') rotate = pitch.attachNewNode('rotate')
scale = rotate.attachNewNode('scale') scale = rotate.attachNewNode('scale')
actor.reparentTo(scale) actor.reparentTo(scale)
if actor.getTightBounds():
bMin, bMax = actor.getTightBounds() bMin, bMax = actor.getTightBounds()
center = (bMin + bMax) / 2.0 center = (bMin + bMax) / 2.0
actor.setPos(-center[0], -center[1], -center[2]) actor.setPos(-center[0], -center[1], -center[2])
else:
actor.setPos(0, 0, 0)
pitch.setY(2.5) pitch.setY(2.5)
return frame return frame

View file

@ -5111,3 +5111,19 @@ def remCode(code):
return 'Player can now reuse the code %s' % code return 'Player can now reuse the code %s' % code
else: else:
return "Player hasn't redeemed this code!" return "Player hasn't redeemed this code!"
@magicWord(category=CATEGORY_PROGRAMMER, types=[int])
def shovelSkill(skill):
"""
Update shovel skill.
"""
av = spellbook.getTarget()
av.b_setShovelSkill(skill)
@magicWord(category=CATEGORY_PROGRAMMER, types=[int])
def canSkill(skill):
"""
Update watering can skill.
"""
av = spellbook.getTarget()
av.b_setWateringCanSkill(skill)