DNA: Finish C++ reader implementation

This commit is contained in:
loblao 2015-03-15 13:26:22 -03:00
parent d975331905
commit e06dde7709
6 changed files with 25 additions and 30 deletions

View file

@ -153,11 +153,11 @@ class DistributedDoor(DistributedObject.DistributedObject, DelayDeletable):
pass
def setTriggerName(self):
if self.doorType in self.specialDoorTypes:
if self.doorType in self.specialDoorTypes or self.doorType == DoorTypes.INT_HQ:
building = self.getBuilding()
doorTrigger = building.find('**/door_' + str(self.doorIndex) + '/**/door_trigger*')
try:
doorTrigger.node().setName(self.getTriggerName())
doorTrigger.setName(self.getTriggerName())
except:
pass

View file

@ -17,33 +17,20 @@ class DNABulkLoader:
def loadDNABulk(dnaStorage, file):
dnaLoader = DNALoader()
fileu = '../resources/' + file
fileo = 'resources/' + file
try:
dnaLoader.loadDNAFile(dnaStorage, fileu)
except:
dnaLoader.loadDNAFile(dnaStorage, fileo)
def loadDNAFile(dnaStorage, file):
print 'Reading DNA file...', file
dnaLoader = DNALoader()
fileu = '../resources/' + file
fileo = 'resources/' + file
try:
node = dnaLoader.loadDNAFile(dnaStorage, fileu)
except:
node = dnaLoader.loadDNAFile(dnaStorage, fileo)
if node.node().getNumChildren() > 0:
return node.node()
return None
def loadDNAFileAI(dnaStorage, file):
dnaLoader = DNALoader()
fileu = '../resources/' + file
fileo = 'resources/' + file
try:
data = dnaLoader.loadDNAFileAI(dnaStorage, fileu)
except:
data = dnaLoader.loadDNAFileAI(dnaStorage, fileo)
return data
def setupDoor(a, b, c, d, e, f):

View file

@ -49,7 +49,8 @@ class DNAFurnitureReaderAI:
CatalogItem.Location))
# Find the interior node:
for child in self.dnaData.children:
for i in xrange(self.dnaData.getNumChildren()):
child = self.dnaData.at(i)
if child.getName() == 'interior':
interior = child
break
@ -58,7 +59,8 @@ class DNAFurnitureReaderAI:
self.itemList.append(CatalogFurnitureItem(1399, posHpr=self.phonePos))
# Every child in the interior node is a prop, thus:
for child in interior.children:
for i in xrange(interior.getNumChildren()):
child = interior.at(i)
code = child.getCode()
if code not in DNA2Furniture:

View file

@ -213,10 +213,11 @@ class DistributedEstateAI(DistributedObjectAI):
def announceGenerate(self):
DistributedObjectAI.announceGenerate(self)
for index, garden in self.__pendingGardens.items():
started = garden[0]
self.gardenManager.handleSingleGarden(self.toons[index], garden[1:])
self.placeStarterGarden(self.toons[index])
# Commented out because I had to reach estate to debug doors (Nacib)
#for index, garden in self.__pendingGardens.items():
# started = garden[0]
# self.gardenManager.handleSingleGarden(self.toons[index], garden[1:])
# self.placeStarterGarden(self.toons[index])
self.__pendingGardens = {}
def destroy(self):

View file

@ -54,7 +54,11 @@ class DistributedHouseDoor(DistributedDoor.DistributedDoor):
self.doPostAnnounceGenerate()
self.bHasFlat = not self.findDoorNode('door*flat', True).isEmpty()
self.hideDoorParts()
self.setTriggerName()
building = self.getBuilding()
doorTrigger = building.find('**/door_trigger*')
doorTrigger.setName(self.getTriggerName())
self.accept(self.getEnterTriggerEvent(), self.doorTrigger)
self.acceptOnce('clearOutToonInterior', self.doorTrigger)
self.zoneDoneLoading = 0

View file

@ -24,14 +24,15 @@ if __debug__:
loadPrcFile('config/general.prc')
loadPrcFile('config/release/dev.prc')
defaultText = '''door = base.cr.doFind('tedDoor')
bldg = door.getBuilding()
doorTrigger = bldg.find('**/door_' + str(door.doorIndex) + '/**/door_trigger*')
defaultText = '''door = base.cr.doFind('tedHouseDoor')
doorTrigger = door.getBuilding().find('**/door_trigger*')
doorTrigger.show()
doorTrigger.node().setName(self.getTriggerName())
doorTrigger.node().setName(door.getTriggerName())
print doorTrigger
print door.getEnterTriggerEvent()
print messenger.whoAccepts('enterdoor_trigger_20')'''
print messenger.whoAccepts(door.getEnterTriggerEvent())'''
def __inject_wx(_):
code = textbox.GetValue()