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

View File

@ -77,12 +77,15 @@ class DistributedLevelAI(DistributedObjectAI.DistributedObjectAI,
if __debug__:
# level editors should call this func to tweak attributes of level
# entities
def setAttribChange(self, entId, attribName, value):
def setAttribChange(self, entId, attribName, valueStr):
# send a copy to the client-side level obj
self.sendUpdate('setAttribChange',
[entId, attribName, repr(value)])
[entId, attribName, valueStr])
entity = self.getEntity(entId)
# 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

View File

@ -76,6 +76,13 @@ class LevelSpec:
return self.specDict['scenarios'][scenario][0]
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):
pass