Merge branch 'features/ttn' of https://github.com/stevetts/tts_src into features/ttn

This commit is contained in:
Loudrob 2015-07-17 10:30:54 -04:00
commit 2de7c4d6ca
5 changed files with 22 additions and 12 deletions

View file

@ -1264,6 +1264,7 @@ dclass DistributedHouse : DistributedObject {
setAvatarId(uint32 toonId = 0) required broadcast db; setAvatarId(uint32 toonId = 0) required broadcast db;
setName(string toonName = "") required broadcast db; setName(string toonName = "") required broadcast db;
setColor(uint8 colorIndex = 0) required broadcast db; setColor(uint8 colorIndex = 0) required broadcast db;
setGender(uint8 = 0) required broadcast db;
setAtticItems(blob = "") required db; setAtticItems(blob = "") required db;
setInteriorItems(blob = "") required db; setInteriorItems(blob = "") required db;
setAtticWallpaper(blob = "") required db; setAtticWallpaper(blob = "") required db;

View file

@ -9,9 +9,9 @@ DNA2Furniture = {
'chairA': 100, 'chairA': 100,
'chair': 110, 'chair': 110,
'regular_bed': 200, 'regular_bed': (200, 210),
'FireplaceSq': 400, 'FireplaceSq': 400,
'closetBoy': 500, 'closetBoy': (500, 510),
'lamp_short': 600, 'lamp_short': 600,
'lamp_tall': 610, 'lamp_tall': 610,
'couch_1person': 700, 'couch_1person': 700,
@ -28,7 +28,7 @@ DNA2Furniture = {
'bookcase_low': 1130, 'bookcase_low': 1130,
'ending_table': 1200, 'ending_table': 1200,
'jellybeanBank': 1300, 'jellybeanBank': 1300,
'trunkBoy': 4000 'trunkBoy': (4000, 4010)
} }
@ -39,8 +39,9 @@ class DNAFurnitureReaderAI:
# house to the default furniture arrangement. # house to the default furniture arrangement.
notify = directNotify.newCategory("DNAFurnitureReaderAI") notify = directNotify.newCategory("DNAFurnitureReaderAI")
def __init__(self, dnaData, phonePos): def __init__(self, dnaData, gender, phonePos):
self.dnaData = dnaData self.dnaData = dnaData
self.gender = gender
self.phonePos = phonePos self.phonePos = phonePos
self.itemList = None self.itemList = None
@ -70,6 +71,8 @@ class DNAFurnitureReaderAI:
itemId = DNA2Furniture[code] itemId = DNA2Furniture[code]
if itemId is None: if itemId is None:
continue continue
if hasattr(itemId, '__getitem__'):
itemId = itemId[self.gender]
x, y, z = child.getPos() x, y, z = child.getPos()
h, p, r = child.getHpr() h, p, r = child.getHpr()

View file

@ -21,7 +21,7 @@ class DistributedHouseAI(DistributedObjectAI):
self.name = '' self.name = ''
self.color = 0 self.color = 0
self.housePos = 0 self.housePos = 0
self.gender = 1 self.gender = 0
self.isInteriorInitialized = 1 self.isInteriorInitialized = 1
self.atticItems = CatalogItemList(store=Customization) self.atticItems = CatalogItemList(store=Customization)
@ -55,12 +55,6 @@ class DistributedHouseAI(DistributedObjectAI):
if self.avatarId: if self.avatarId:
self.mailbox = DistributedMailboxAI(self.air, self) self.mailbox = DistributedMailboxAI(self.air, self)
self.mailbox.generateWithRequired(self.zoneId) self.mailbox.generateWithRequired(self.zoneId)
if not self.isInteriorInitialized:
self.notify.info('Initializing interior...')
self.interior.initialize()
self.b_setInteriorInitialized(1)
self.sendUpdate('setHouseReady', []) self.sendUpdate('setHouseReady', [])
def delete(self): def delete(self):
@ -305,3 +299,9 @@ class DistributedHouseAI(DistributedObjectAI):
self.atticWallpaper.append(item) self.atticWallpaper.append(item)
self.d_setAtticWallpaper(self.atticWallpaper.getBlob()) self.d_setAtticWallpaper(self.atticWallpaper.getBlob())
self.interior.furnitureManager.loadFromHouse() self.interior.furnitureManager.loadFromHouse()
def initializeInterior(self):
if (not self.isInteriorInitialized):
self.notify.info('Initializing interior...')
self.interior.initialize()
self.b_setInteriorInitialized(1)

View file

@ -70,7 +70,7 @@ class DistributedHouseInteriorAI(DistributedObjectAI):
dnaData = loadDNAFileAI(dnaStorage, dnaFile) dnaData = loadDNAFileAI(dnaStorage, dnaFile)
# Read it into furniture... # Read it into furniture...
furnitureReader = DNAFurnitureReaderAI(dnaData, [-11, 2, 0, 0, 0, 0]) furnitureReader = DNAFurnitureReaderAI(dnaData, self.house.gender, [-11, 2, 0, 0, 0, 0])
# Set furniture: # Set furniture:
self.furnitureManager.setItems(furnitureReader.getBlob()) self.furnitureManager.setItems(furnitureReader.getBlob())

View file

@ -3,6 +3,7 @@ from direct.distributed.DistributedObjectAI import DistributedObjectAI
from direct.fsm.FSM import FSM from direct.fsm.FSM import FSM
from toontown.estate.DistributedEstateAI import DistributedEstateAI from toontown.estate.DistributedEstateAI import DistributedEstateAI
from toontown.estate.DistributedHouseAI import DistributedHouseAI from toontown.estate.DistributedHouseAI import DistributedHouseAI
from toontown.toon import ToonDNA
import HouseGlobals import HouseGlobals
import functools import functools
@ -48,12 +49,16 @@ class LoadHouseFSM(FSM):
self.demand('Off') self.demand('Off')
def enterCreateHouse(self): def enterCreateHouse(self):
style = ToonDNA.ToonDNA()
style.makeFromNetString(self.toon['setDNAString'][0])
self.mgr.air.dbInterface.createObject( self.mgr.air.dbInterface.createObject(
self.mgr.air.dbId, self.mgr.air.dbId,
self.mgr.air.dclassesByName['DistributedHouseAI'], self.mgr.air.dclassesByName['DistributedHouseAI'],
{ {
'setName' : [self.toon['setName'][0]], 'setName' : [self.toon['setName'][0]],
'setAvatarId' : [self.toon['ID']], 'setAvatarId' : [self.toon['ID']],
'setGender': [0 if style.getGender() == 'm' else 1]
}, },
self.__handleCreate) self.__handleCreate)
@ -90,6 +95,7 @@ class LoadHouseFSM(FSM):
def __gotHouse(self, house): def __gotHouse(self, house):
self.house = house self.house = house
house.initializeInterior()
self.estate.houses[self.houseIndex] = self.house self.estate.houses[self.houseIndex] = self.house