There's at least one bug I will need to fix before I can release the latest DAD mode version, it's hard to fix because it occurs sporadically for particular spawned resurrection entities and I have no idea why it is happening.
class REDict:
def __init__(self,DADP):
self.unusedAreaID = 0
self.DAD = DADP
self.REs = {}
self.REPulseTimers = {}
self.REsWhichNeedToBeMoved = {}
self.disabledREs = []
self.usedREs = []
def flagREAsUsed(self,RE):
self.usedREs.append(RE)
def hasREBeenUsed(self,RE):
return RE in self.usedREs
def getListOfTeamsREs(self,team):
teamsREs = []
for RE in self.REs.values():
if RE.GetTeamNumber() == team: teamsREs.append(RE)
return teamsREs
def cleanup(self):
self.DAD = None
self.REs = None
self.REPulseTimers = None
self.REsWhichNeedToBeMoved = None
self.disabledREs = None
self.usedREs = None
def spawnNewResurrectionEntity(self,victim,team,afterSpawnMoveTo=None):
newAreasID = str(self.unusedAreaID)
self.unusedAreaID += 1
self.spawnResurrectionEntity(newAreasID,team,afterSpawnMoveTo)
def spawnResurrectionEntity(self,areaID,team,afterSpawnMoveTo=None):
skinNumber = 1
if team == GEGlobal.TEAM_MI6: skinNumber = 0
self.DAD.tokenManager.SetupCaptureArea(areaID,
radius = 35,
model="models/gameplay/gravestone.mdl",
limit=1,
#glow_color=self.DAD.getSidesColour(team),
#glow_dist=0,
skin=skinNumber,
rqd_team=team)
if afterSpawnMoveTo != None: self.needsToBeMoved(areaID,afterSpawnMoveTo)
def makeREGlow(self,RE):
self.DAD.tokenManager.SetupCaptureArea(RE.GetGroupName(),glow_dist=350)
def disableREGlow(self,RE):
self.DAD.tokenManager.SetupCaptureArea(RE.GetGroupName(),glow_dist=0)
#
def REUsable(self,area):
return area in self.REs.values() and not area in self.disabledREs and not area in self.usedREs
def newRESpawned(self,area):
self.disabledREs.append(area)
idP = area.GetGroupName()
self.REs[idP] = area
self.REPulseTimers[idP] = DieAnotherDay.REDict.RingPulseTimer(self.DAD,area)
self.disabledREs.remove(area)
def deleteRE(self,RE):
idP = RE.GetGroupName()
del self.REs[idP]
del self.REPulseTimers[idP]
if self.REsWhichNeedToBeMoved.has_key(idP): del self.REsWhichNeedToBeMoved[id]
if RE in self.disabledREs: self.disabledREs.remove(RE)
if RE in self.usedREs: self.usedREs.remove(RE)
self.DAD.tokenManager.RemoveCaptureArea(idP)
def doesREExsist(self,area):
return area in self.REs.values()
def deleteREAfterDelay(self,RE,delay):
timer = DieAnotherDay.ExtCallbackTimer(self.DAD.timerTracker,self.deleteREAfterDelayCallback,RE)
timer.start(delay)
def deleteREAfterDelayCallback(self,timer,update_type,RE):
if update_type == Timer.UPDATE_FINISH: self.deleteRE(RE)
def deleteAll(self):
for REID in self.REs: self.DAD.tokenManager.RemoveCaptureArea(REID)
self.REs = {}
self.REPulseTimers = {}
self.REsWhichNeedToBeMoved = {}
self.disabledREs = []
self.unusedAreaID = 0
def isREDisabled(self,REArea):
return REArea in self.disabledREs
def makeREInvisible(self,RE):
# Make RE Invisible
self.DAD.tokenManager.SetupCaptureArea(RE.GetGroupName(),model="") #glow_dist=0
def afterDelayChangeRERadarIcon(self,RE,icon,colour,delay):
timer = DieAnotherDay.ExtCallbackTimer(self.DAD.timerTracker,self.changeRERadarIconAfterDelayCB,{"REArea":RE,"icon":icon,"colour":colour})
timer.start(delay)
def changeRERadarIconAfterDelayCB(self,timer,update_type,parameters):
if update_type == Timer.UPDATE_FINISH: self.changeRERadarIcon(parameters["REArea"],parameters["icon"],parameters["colour"])
def changeRERadarIcon(self,RE,newIcon,colour):
self.DAD.radar.DropRadarContact(RE)
self.DAD.radar.AddRadarContact(RE,GEGlobal.RADAR_TYPE_OBJECTIVE,True,newIcon,colour)
def getMRELocations(self):
foundLocations = []
for RE in self.REs:
if RE.GetTeamNumber() == GEGlobal.TEAM_MI6: foundLocations.append(RE.GetAbsOrigin())
return foundLocations
def getJRELocations(self):
foundLocations = []
for RE in self.REs:
if RE.GetTeamNumber() == GEGlobal.TEAM_JANUS: foundLocations.append(RE.GetAbsOrigin())
return foundLocations
def needsToBeMoved(self,areasID,moveTo):
self.REsWhichNeedToBeMoved[areasID] = moveTo
def moved(self,RE):
REID = RE.GetGroupName()
if self.REsWhichNeedToBeMoved.has_key(REID): del self.REsWhichNeedToBeMoved[REID]
def getMoveToLocation(self,area):
REID = area.GetGroupName()
if self.REsWhichNeedToBeMoved.has_key(REID): return self.REsWhichNeedToBeMoved[REID]
return None
def isPulsating(self,RE):
return self.REPulseTimers[RE.GetGroupName()].isPulsating()
def startPulsatingRings(self,REArea):
self.REPulseTimers[REArea.GetGroupName()].start()
def stopPulsatingRings(self,idP):
self.REPulseTimers[idP].stop()