editor changes are distributed

This commit is contained in:
Darren Ranalli 2003-09-30 20:47:50 +00:00
parent dea5eaccfb
commit 4e8ac61955
3 changed files with 18 additions and 4 deletions

View File

@ -383,6 +383,11 @@ class DistributedLevel(DistributedObject.DistributedObject,
if __debug__: if __debug__:
# level editing stuff # level editing stuff
def setAttribChange(self, entId, attribName, valueStr): def setAttribChange(self, entId, attribName, valueStr):
entity = self.getEntity(entId)
# the entity might be AI-only
if entity is None:
return
try: try:
value = eval(valueStr) value = eval(valueStr)
except Exception, e: except Exception, e:
@ -390,7 +395,6 @@ class DistributedLevel(DistributedObject.DistributedObject,
(lineInfo()[2], entId, attribName, valueStr, e)) (lineInfo()[2], entId, attribName, valueStr, e))
raise e raise e
entity = self.getEntity(entId)
entity.handleAttribChange(attribName, value) entity.handleAttribChange(attribName, value)
""" """

View File

@ -77,13 +77,16 @@ class DistributedLevelAI(DistributedObjectAI.DistributedObjectAI,
if __debug__: if __debug__:
# level editors should call this func to tweak attributes of level # level editors should call this func to tweak attributes of level
# entities # entities
def setAttribChange(self, entId, attribName, value): def setAttribChange(self, entId, attribName, valueStr):
# send a copy to the client-side level obj # send a copy to the client-side level obj
self.sendUpdate('setAttribChange', self.sendUpdate('setAttribChange',
[entId, attribName, repr(value)]) [entId, attribName, valueStr])
entity = self.getEntity(entId) entity = self.getEntity(entId)
entity.handleAttribChange(attribName, value) # the entity might be client-side-only
if entity is not None:
value = eval(valueStr)
entity.handleAttribChange(attribName, value)
# send a copy of the entire spec for any new users that # send a copy of the entire spec for any new users that
# might come in # might come in

View File

@ -76,6 +76,13 @@ class LevelSpec:
return self.specDict['scenarios'][scenario][0] return self.specDict['scenarios'][scenario][0]
if __debug__: if __debug__:
def setAttribEditEventName(self, event):
self.attribEditEventName = event
def setAttribEdit(self, entId, attrib, value):
# broadcast the change to someone else that knows what to do
# with it
messenger.send(self.attribEditEventName, [entId, attrib, value])
def setAttribChange(self, entId, attrib, value): def setAttribChange(self, entId, attrib, value):
pass pass