invasions: Joey pls. Clean is gud.
This commit is contained in:
parent
5e3571ebd9
commit
99b339e29b
3 changed files with 19 additions and 32 deletions
|
@ -37,6 +37,8 @@ rpc-server-endpoint http://localhost:8080/
|
|||
eventlog-host 127.0.0.1
|
||||
want-parties #f
|
||||
want-cheesy-expirations #t
|
||||
want-mega-invasions #t
|
||||
mega-invasion-cog-type le
|
||||
|
||||
|
||||
# DC Files
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
# Server settings
|
||||
want-dev #f
|
||||
want-cheesy-expirations #t
|
||||
want-mega-invasions #t
|
||||
mega-invasion-cog-type le
|
||||
|
||||
# Shared secret for CSMUD
|
||||
# ##### NB! Update config/public_client.prc too! #####
|
||||
|
|
|
@ -26,13 +26,16 @@ class SuitInvasionManagerAI:
|
|||
self.suitName = None
|
||||
self.numSuits = 0
|
||||
self.spawnedSuits = 0
|
||||
self.randomInvasionProbability = 0.45
|
||||
self.megaInvasionProbability = 0.6
|
||||
self.megaInvasionCog = 'le' # Make sure to change this when holding a mega-invasion event. This is currently set to Legal Eagles from the 4th of July
|
||||
if config.GetBool('want-random-invasions', True):
|
||||
self.randomInvasionProbability = config.GetFloat('random-invasion-probability', 0.45)
|
||||
if config.GetBool('want-mega-invasions', False):
|
||||
self.megaInvasionProbability = config.GetFloat('mega-invasion-probability', 0.6)
|
||||
self.megaInvasionCog = config.GetString('mega-invasion-cog-type', '')
|
||||
if not self.megaInvasionCog:
|
||||
raise AttributeError("No mega invasion cog specified, but mega invasions are on!")
|
||||
if self.megaInvasionCog not in SuitDNA.suitHeadTypes:
|
||||
raise AttributeError("Invalid cog type specified for mega invasion!")
|
||||
elif config.GetBool('want-random-invasions', True):
|
||||
taskMgr.doMethodLater(randint(1800, 5400), self.__randomInvasionTick, 'random-invasion-tick')
|
||||
# Temporary hack for Mega-Invasions. Comment this out when not in use.
|
||||
taskMgr.doMethodLater(randint(1800, 5400), self.__megaInvasionTick, 'mega-invasion-tick')
|
||||
|
||||
def __randomInvasionTick(self, task=None):
|
||||
"""
|
||||
|
@ -54,34 +57,14 @@ class SuitInvasionManagerAI:
|
|||
if random() <= self.randomInvasionProbability:
|
||||
# We want an invasion!
|
||||
self.notify.debug('Invasion probability hit! Starting invasion.')
|
||||
suitName = choice(SuitDNA.suitHeadTypes)
|
||||
numSuits = randint(1000, 3000)
|
||||
if config.GetBool('want-mega-invasions', False):
|
||||
suitName = self.megaInvasionCog
|
||||
numSuits = randint(1500, 15000)
|
||||
else:
|
||||
suitName = choice(SuitDNA.suitHeadTypes)
|
||||
numSuits = randint(1000, 3000)
|
||||
self.startInvasion(suitName, numSuits, False)
|
||||
return task.again
|
||||
|
||||
def __megaInvasionTick(self, task=None):
|
||||
"""
|
||||
Each hour, have a tick to check if we want to start an invasion in
|
||||
the current district. This works by having a random invasion
|
||||
probability, and each tick it will generate a random float between
|
||||
0 and 1, and then if it's less than or equal to the probablity, it
|
||||
will spawn the invasion.
|
||||
|
||||
This is a temporary hack for mega-invasions.
|
||||
"""
|
||||
# Generate a new tick delay.
|
||||
task.delayTime = randint(1800, 5400)
|
||||
if self.getInvading():
|
||||
# We're already running an invasion. Don't start a new one.
|
||||
self.notify.debug('Mega-Invasion tested but already running invasion!')
|
||||
return task.again
|
||||
if random() <= self.megaInvasionProbability:
|
||||
# We want an invasion!
|
||||
self.notify.debug('Mega Invasion probability hit! Starting mega-invasion.')
|
||||
suitName = self.megaInvasionCog
|
||||
numSuits = randint(1500, 15000)
|
||||
self.startInvasion(suitName, numSuits, randint(0, 2))
|
||||
return task.again
|
||||
|
||||
def getInvading(self):
|
||||
""" Tell the caller if an invasion is currently running. """
|
||||
|
|
Loading…
Reference in a new issue