mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 18:31:55 -04:00
*** empty log message ***
This commit is contained in:
parent
dccf761538
commit
05e09cc0cf
@ -32,7 +32,8 @@ COLOR_TYPES = ['wall_color', 'window_color',
|
|||||||
# The list of dna components maintained in the style attribute dictionary
|
# The list of dna components maintained in the style attribute dictionary
|
||||||
DNA_TYPES = ['wall', 'window', 'sign', 'door', 'cornice', 'toon_landmark',
|
DNA_TYPES = ['wall', 'window', 'sign', 'door', 'cornice', 'toon_landmark',
|
||||||
'prop', 'street']
|
'prop', 'street']
|
||||||
BUILDING_TYPES = ['10_10', '20', '10_20', '20_10', '10_10_10']
|
BUILDING_TYPES = ['10_10', '20', '10_20', '20_10', '10_10_10',
|
||||||
|
'5_10', '5_15', '5_20', '5_10_10']
|
||||||
# The list of neighborhoods to edit
|
# The list of neighborhoods to edit
|
||||||
NEIGHBORHOODS = ['toontown_central',
|
NEIGHBORHOODS = ['toontown_central',
|
||||||
'donalds_dock',
|
'donalds_dock',
|
||||||
@ -137,10 +138,10 @@ except NameError:
|
|||||||
# Load the generic storage file
|
# Load the generic storage file
|
||||||
loadDNAFile(DNASTORE, 'phase_4/dna/storage.dna', CSDefault, 1)
|
loadDNAFile(DNASTORE, 'phase_4/dna/storage.dna', CSDefault, 1)
|
||||||
# Load all the neighborhood specific storage files
|
# Load all the neighborhood specific storage files
|
||||||
loadDNAFile(DNASTORE, 'phase_4/dna/storage_TT.dna', CSDefault, 1)
|
#loadDNAFile(DNASTORE, 'phase_4/dna/storage_TT.dna', CSDefault, 1)
|
||||||
loadDNAFile(DNASTORE, 'phase_6/dna/storage_DD.dna', CSDefault, 1)
|
#loadDNAFile(DNASTORE, 'phase_6/dna/storage_DD.dna', CSDefault, 1)
|
||||||
loadDNAFile(DNASTORE, 'phase_6/dna/storage_MM.dna', CSDefault, 1)
|
#loadDNAFile(DNASTORE, 'phase_6/dna/storage_MM.dna', CSDefault, 1)
|
||||||
loadDNAFile(DNASTORE, 'phase_8/dna/storage_BR.dna', CSDefault, 1)
|
#loadDNAFile(DNASTORE, 'phase_8/dna/storage_BR.dna', CSDefault, 1)
|
||||||
loadDNAFile(DNASTORE, 'phase_8/dna/storage_DG.dna', CSDefault, 1)
|
loadDNAFile(DNASTORE, 'phase_8/dna/storage_DG.dna', CSDefault, 1)
|
||||||
__builtin__.dnaLoaded = 1
|
__builtin__.dnaLoaded = 1
|
||||||
|
|
||||||
@ -759,27 +760,43 @@ class LevelEditor(NodePath, PandaObject):
|
|||||||
self.accept('space', self.initNodePath, [dnaNode, 'space'])
|
self.accept('space', self.initNodePath, [dnaNode, 'space'])
|
||||||
self.accept('insert', self.initNodePath, [dnaNode, 'insert'])
|
self.accept('insert', self.initNodePath, [dnaNode, 'insert'])
|
||||||
|
|
||||||
|
def getRandomBuildingType(self, buildingType):
|
||||||
|
# Select a list of wall heights
|
||||||
|
chance = randint(1,100)
|
||||||
|
if buildingType == 'random20':
|
||||||
|
if chance <= 35:
|
||||||
|
return '10_10'
|
||||||
|
elif chance <= 65:
|
||||||
|
return '5_15'
|
||||||
|
else:
|
||||||
|
return '20'
|
||||||
|
elif buildingType == 'random25':
|
||||||
|
if chance <= 35:
|
||||||
|
return '5_10_10'
|
||||||
|
else:
|
||||||
|
return '5_20'
|
||||||
|
elif buildingType == 'random30':
|
||||||
|
if chance <= 40:
|
||||||
|
return '10_20'
|
||||||
|
elif (chance > 80):
|
||||||
|
return '10_10_10'
|
||||||
|
else:
|
||||||
|
return '20_10'
|
||||||
|
else:
|
||||||
|
return buildingType
|
||||||
|
|
||||||
def setRandomBuildingStyle(self, dnaNode, name = 'building'):
|
def setRandomBuildingStyle(self, dnaNode, name = 'building'):
|
||||||
""" Initialize a new DNA Flat building to a random building style """
|
""" Initialize a new DNA Flat building to a random building style """
|
||||||
buildingType = self.getCurrent('building_type')
|
randomBuildingType = self.getCurrent('building_type')
|
||||||
# Select a list of wall heights
|
# Select a list of wall heights
|
||||||
if buildingType == 'random20':
|
dict = {}
|
||||||
chance = randint(1,100)
|
while not dict:
|
||||||
if chance <= 65:
|
buildingType = self.getRandomBuildingType(randomBuildingType)
|
||||||
buildingType = '10_10'
|
buildingStyle = 'building_style_' + buildingType
|
||||||
else:
|
|
||||||
buildingType = '20'
|
|
||||||
elif buildingType == 'random30':
|
|
||||||
chance = randint(1,100)
|
|
||||||
if chance <= 40:
|
|
||||||
buildingType = '10_20'
|
|
||||||
elif (chance > 80):
|
|
||||||
buildingType = '10_10_10'
|
|
||||||
else:
|
|
||||||
buildingType = '20_10'
|
|
||||||
|
|
||||||
# The building_style attribute dictionary for this number of stories
|
# The building_style attribute dictionary for this number of stories
|
||||||
dict = self.getAttribute('building_style_' + buildingType).getDict()
|
dict = self.getAttribute(buildingStyle).getDict()
|
||||||
|
|
||||||
style = self.getRandomDictionaryEntry(dict)
|
style = self.getRandomDictionaryEntry(dict)
|
||||||
self.styleManager.setDNAFlatBuildingStyle(
|
self.styleManager.setDNAFlatBuildingStyle(
|
||||||
dnaNode, style, width = self.getRandomWallWidth(), name = name)
|
dnaNode, style, width = self.getRandomWallWidth(), name = name)
|
||||||
@ -1914,6 +1931,10 @@ class LevelEditor(NodePath, PandaObject):
|
|||||||
""" Return specified attribute for current neighborhood """
|
""" Return specified attribute for current neighborhood """
|
||||||
return self.styleManager.getAttribute(attribute)
|
return self.styleManager.getAttribute(attribute)
|
||||||
|
|
||||||
|
def hasAttribute(self, attribute):
|
||||||
|
""" Return specified attribute for current neighborhood """
|
||||||
|
return self.styleManager.hasAttribute(attribute)
|
||||||
|
|
||||||
def getCurrent(self, attribute):
|
def getCurrent(self, attribute):
|
||||||
""" Return neighborhood's current selection for specified attribute """
|
""" Return neighborhood's current selection for specified attribute """
|
||||||
return self.getAttribute(attribute).getCurrent()
|
return self.getAttribute(attribute).getCurrent()
|
||||||
@ -2804,6 +2825,20 @@ class LevelStyleManager:
|
|||||||
levelAttribute = levelAttribute[self.getEditMode()]
|
levelAttribute = levelAttribute[self.getEditMode()]
|
||||||
return levelAttribute
|
return levelAttribute
|
||||||
|
|
||||||
|
# UTILITY FUNCTIONS
|
||||||
|
def hasAttribute(self, attribute):
|
||||||
|
""" Return specified attribute for current neighborhood """
|
||||||
|
if not self.attributeDictionary.has_key(attribute):
|
||||||
|
return 0
|
||||||
|
else:
|
||||||
|
levelAttribute = self.attributeDictionary[attribute]
|
||||||
|
# Get attribute for current neighborhood
|
||||||
|
if (type(levelAttribute) == types.DictionaryType):
|
||||||
|
editMode = self.getEditMode()
|
||||||
|
return levelAttribute.has_key(editMode)
|
||||||
|
else:
|
||||||
|
return 1
|
||||||
|
|
||||||
def getCatalogCode(self, category, i):
|
def getCatalogCode(self, category, i):
|
||||||
return DNASTORE.getCatalogCode(category, i)
|
return DNASTORE.getCatalogCode(category, i)
|
||||||
|
|
||||||
@ -3203,7 +3238,7 @@ class LevelEditorPanel(Pmw.MegaToplevel):
|
|||||||
label_text = 'Toon bldg type:',
|
label_text = 'Toon bldg type:',
|
||||||
entry_width = 30,
|
entry_width = 30,
|
||||||
selectioncommand = self.setFlatBuildingType,
|
selectioncommand = self.setFlatBuildingType,
|
||||||
scrolledlist_items = ['random20', 'random30'] + BUILDING_TYPES
|
scrolledlist_items = ['random20', 'random25', 'random30'] + BUILDING_TYPES
|
||||||
)
|
)
|
||||||
self.toonBuildingType = 'random20'
|
self.toonBuildingType = 'random20'
|
||||||
self.toonBuildingSelector.selectitem(self.toonBuildingType)
|
self.toonBuildingSelector.selectitem(self.toonBuildingType)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user