More cleanup

This commit is contained in:
John 2015-08-31 12:32:04 +03:00
parent 0a0b8b4019
commit a2ec779622
8 changed files with 111 additions and 97 deletions

View file

@ -129,12 +129,13 @@ class DistributedAvatar(DistributedActor, Avatar):
return return
def hpChange(self, quietly = 0): def hpChange(self, quietly = 0):
if hasattr(self, 'doId'): if (not hasattr(self, 'doId')) or self.hp == None:
if self.hp != None and self.maxHp != None: return
messenger.send(self.uniqueName('hpChange'), [self.hp, self.maxHp, quietly])
if self.hp != None and self.hp > 0: if self.maxHp != None:
messenger.send(self.uniqueName('positiveHP')) messenger.send(self.uniqueName('hpChange'), [self.hp, self.maxHp, quietly])
return if self.hp > 0:
messenger.send(self.uniqueName('positiveHP'))
def died(self): def died(self):
pass pass

View file

@ -58,11 +58,7 @@ class DistributedAvatarAI(DistributedNodeAI.DistributedNodeAI):
return OTPGlobals.AvatarDefaultRadius return OTPGlobals.AvatarDefaultRadius
def checkAvOnShard(self, avId): def checkAvOnShard(self, avId):
senderId = self.air.getAvatarIdFromSender() self.sendUpdateToAvatarId(self.air.getAvatarIdFromSender(), 'confirmAvOnShard', [avId, avId in self.air.doId2do])
onShard = False
if simbase.air.doId2do.get(avId):
onShard = True
self.sendUpdateToAvatarId(senderId, 'confirmAvOnShard', [avId, onShard])
def setParentStr(self, parentToken): def setParentStr(self, parentToken):
if parentToken: if parentToken:

View file

@ -1,4 +1,5 @@
from panda3d.core import * from panda3d.core import *
QuietZone = 1 QuietZone = 1
UberZone = 2 UberZone = 2
WallBitmask = BitMask32(1) WallBitmask = BitMask32(1)
@ -41,22 +42,22 @@ CESnowMan = 14
CEGreenToon = 15 CEGreenToon = 15
CEGhost = 'g' CEGhost = 'g'
CEName2Id = { CEName2Id = {
'normal': CENormal, 'normal': CENormal,
'bighead': CEBigHead, 'bighead': CEBigHead,
'smallhead': CESmallHead, 'smallhead': CESmallHead,
'biglegs': CEBigLegs, 'biglegs': CEBigLegs,
'smalllegs': CESmallLegs, 'smalllegs': CESmallLegs,
'bigtoon': CEBigToon, 'bigtoon': CEBigToon,
'smalltoon': CESmallToon, 'smalltoon': CESmallToon,
'flatportrait': CEFlatPortrait, 'flatportrait': CEFlatPortrait,
'flatprofile': CEFlatProfile, 'flatprofile': CEFlatProfile,
'transparent': CETransparent, 'transparent': CETransparent,
'nocolor': CENoColor, 'nocolor': CENoColor,
'invisible': CEInvisible, 'invisible': CEInvisible,
'pumpkin': CEPumpkin, 'pumpkin': CEPumpkin,
'bigwhite': CEBigWhite, 'bigwhite': CEBigWhite,
'snowman': CESnowMan, 'snowman': CESnowMan,
'greentoon': CEGreenToon 'greentoon': CEGreenToon
} }
BigToonScale = 1.5 BigToonScale = 1.5
SmallToonScale = 0.5 SmallToonScale = 0.5
@ -98,7 +99,6 @@ def setInterfaceFont(path):
global InterfaceFont global InterfaceFont
InterfaceFontPath = path InterfaceFontPath = path
InterfaceFont = None InterfaceFont = None
return
def getSignFont(): def getSignFont():
global SignFont global SignFont
@ -165,7 +165,6 @@ def setDialogClasses(dialogClass, globalDialogClass):
GlobalDialogClass = globalDialogClass GlobalDialogClass = globalDialogClass
NetworkLatency = 1.0 NetworkLatency = 1.0
maxLoginWidth = 9.1
STAND_INDEX = 0 STAND_INDEX = 0
WALK_INDEX = 1 WALK_INDEX = 1
RUN_INDEX = 2 RUN_INDEX = 2
@ -200,12 +199,10 @@ HideGameHotKeyOSX = 'meta-h'
HideGameHotKeyRepeatOSX = 'meta-h-repeat' HideGameHotKeyRepeatOSX = 'meta-h-repeat'
MinimizeGameHotKeyOSX = 'meta-m' MinimizeGameHotKeyOSX = 'meta-m'
MinimizeGameHotKeyRepeatOSX = 'meta-m-repeat' MinimizeGameHotKeyRepeatOSX = 'meta-m-repeat'
GlobalDialogColor = (1, GlobalDialogColor = (1, 1, 0.75, 1)
1,
0.75,
1)
DefaultBackgroundColor = (0.3, 0.3, 0.3, 1) DefaultBackgroundColor = (0.3, 0.3, 0.3, 1)
toonBodyScales = {'mouse': 0.6, toonBodyScales = {
'mouse': 0.6,
'cat': 0.73, 'cat': 0.73,
'duck': 0.66, 'duck': 0.66,
'rabbit': 0.74, 'rabbit': 0.74,
@ -213,8 +210,10 @@ toonBodyScales = {'mouse': 0.6,
'dog': 0.85, 'dog': 0.85,
'monkey': 0.68, 'monkey': 0.68,
'bear': 0.85, 'bear': 0.85,
'pig': 0.77} 'pig': 0.77
toonHeadScales = {'mouse': Point3(1.0), }
toonHeadScales = {
'mouse': Point3(1.0),
'cat': Point3(1.0), 'cat': Point3(1.0),
'duck': Point3(1.0), 'duck': Point3(1.0),
'rabbit': Point3(1.0), 'rabbit': Point3(1.0),
@ -222,11 +221,15 @@ toonHeadScales = {'mouse': Point3(1.0),
'dog': Point3(1.0), 'dog': Point3(1.0),
'monkey': Point3(1.0), 'monkey': Point3(1.0),
'bear': Point3(1.0), 'bear': Point3(1.0),
'pig': Point3(1.0)} 'pig': Point3(1.0)
legHeightDict = {'s': 1.5, }
legHeightDict = {
's': 1.5,
'm': 2.0, 'm': 2.0,
'l': 2.75} 'l': 2.75
torsoHeightDict = {'s': 1.5, }
torsoHeightDict = {
's': 1.5,
'm': 1.75, 'm': 1.75,
'l': 2.25, 'l': 2.25,
'ss': 1.5, 'ss': 1.5,
@ -234,8 +237,10 @@ torsoHeightDict = {'s': 1.5,
'ls': 2.25, 'ls': 2.25,
'sd': 1.5, 'sd': 1.5,
'md': 1.75, 'md': 1.75,
'ld': 2.25} 'ld': 2.25
headHeightDict = {'dls': 0.75, }
headHeightDict = {
'dls': 0.75,
'dss': 0.5, 'dss': 0.5,
'dsl': 0.5, 'dsl': 0.5,
'dll': 0.75, 'dll': 0.75,
@ -268,7 +273,8 @@ headHeightDict = {'dls': 0.75,
'sls': 0.75, 'sls': 0.75,
'sss': 0.5, 'sss': 0.5,
'ssl': 0.5, 'ssl': 0.5,
'sll': 0.75} 'sll': 0.75
}
RandomButton = 'Randomize' RandomButton = 'Randomize'
TypeANameButton = 'Type Name' TypeANameButton = 'Type Name'
PickANameButton = 'Pick-A-Name' PickANameButton = 'Pick-A-Name'

View file

@ -208,24 +208,12 @@ class DistributedDoor(DistributedObject.DistributedObject, DelayDeletable):
self.hideDoorParts() self.hideDoorParts()
self.setTriggerName() self.setTriggerName()
# Check if we are dealing with a DDL HQ door... if self.doorType == DoorTypes.EXT_HQ and ZoneUtil.getHoodId(self.zoneId) == ToontownGlobals.DonaldsDreamland:
if self.doorType == DoorTypes.EXT_HQ and \
ZoneUtil.getHoodId(self.zoneId) == ToontownGlobals.DonaldsDreamland:
# Get the doorTrigger...
building = self.getBuilding() building = self.getBuilding()
doorTrigger = building.find('**/%s' % self.getTriggerName()) doorTrigger = building.find('**/%s' % self.getTriggerName())
# Check if the doorTrigger hasn't been 'fixed' already...
if not doorTrigger.getTag('fixed'): if not doorTrigger.getTag('fixed'):
doorTrigger.setY(doorTrigger, 0.25 if not self.doorIndex else -0.25)
# Reposition the doorTrigger based on its index...
if self.doorIndex == 0:
doorTrigger.setY(doorTrigger, 0.25)
else:
doorTrigger.setY(doorTrigger, -0.25)
# We are done :) Tag the door as fixed.
doorTrigger.setTag('fixed', 'true') doorTrigger.setTag('fixed', 'true')
self.accept(self.getEnterTriggerEvent(), self.doorTrigger) self.accept(self.getEnterTriggerEvent(), self.doorTrigger)

View file

@ -1,15 +1,21 @@
from pandac.PandaModules import VBase3, BitMask32 from pandac.PandaModules import VBase3, BitMask32
GameTime = 60 GameTime = 60
NumBarrels = 4 NumBarrels = 4
BarrelStartingPositions = (VBase3(4.3, 4, 0), BarrelStartingPositions = (
VBase3(4.3, 4, 0),
VBase3(4.3, -4, 0), VBase3(4.3, -4, 0),
VBase3(-4.3, 4, 0), VBase3(-4.3, 4, 0),
VBase3(-4.3, -4, 0)) VBase3(-4.3, -4, 0)
ToonStartingPositions = (VBase3(0, 16, 0), )
ToonStartingPositions = (
VBase3(0, 16, 0),
VBase3(0, -16, 0), VBase3(0, -16, 0),
VBase3(-16, 0, 0), VBase3(-16, 0, 0),
VBase3(16, 0, 0)) VBase3(16, 0, 0)
CogStartingPositions = (VBase3(35, 18, 0), )
CogStartingPositions = (
VBase3(35, 18, 0),
VBase3(35, 0, 0), VBase3(35, 0, 0),
VBase3(35, -18, 0), VBase3(35, -18, 0),
VBase3(-35, 18, 0), VBase3(-35, 18, 0),
@ -20,8 +26,10 @@ CogStartingPositions = (VBase3(35, 18, 0),
VBase3(35, 9, 0), VBase3(35, 9, 0),
VBase3(-35, 9, 0), VBase3(-35, 9, 0),
VBase3(35, -9, 0), VBase3(35, -9, 0),
VBase3(-35, -9, 0)) VBase3(-35, -9, 0)
CogReturnPositions = (VBase3(-35, 28, 0), )
CogReturnPositions = (
VBase3(-35, 28, 0),
VBase3(-14, 28, 0), VBase3(-14, 28, 0),
VBase3(14, 28, 0), VBase3(14, 28, 0),
VBase3(35, 28, 0), VBase3(35, 28, 0),
@ -30,7 +38,8 @@ CogReturnPositions = (VBase3(-35, 28, 0),
VBase3(-14, -28, 0), VBase3(-14, -28, 0),
VBase3(14, -28, 0), VBase3(14, -28, 0),
VBase3(-35, -28, 0), VBase3(-35, -28, 0),
VBase3(-35, 0, 0)) VBase3(-35, 0, 0)
)
StageHalfWidth = 25 StageHalfWidth = 25
StageHalfHeight = 18 StageHalfHeight = 18
NoGoal = 0 NoGoal = 0
@ -38,11 +47,13 @@ BarrelGoal = 1
ToonGoal = 2 ToonGoal = 2
RunAwayGoal = 3 RunAwayGoal = 3
InvalidGoalId = -1 InvalidGoalId = -1
GoalStr = {NoGoal: 'NoGoal', GoalStr = {
NoGoal: 'NoGoal',
BarrelGoal: 'BarrelGoal', BarrelGoal: 'BarrelGoal',
ToonGoal: 'ToonGoal', ToonGoal: 'ToonGoal',
RunAwayGoal: 'RunAwayGoal', RunAwayGoal: 'RunAwayGoal',
InvalidGoalId: 'InvalidGoa'} InvalidGoalId: 'InvalidGoa'
}
BarrelBitmask = BitMask32(512) BarrelBitmask = BitMask32(512)
BarrelOnGround = -1 BarrelOnGround = -1
NoBarrelCarried = -1 NoBarrelCarried = -1
@ -61,7 +72,8 @@ def getMaxScore():
return result return result
NumCogsTable = [{2000: 5, NumCogsTable = [
{2000: 5,
1000: 5, 1000: 5,
5000: 5, 5000: 5,
4000: 5, 4000: 5,
@ -84,8 +96,10 @@ NumCogsTable = [{2000: 5,
5000: 11, 5000: 11,
4000: 11, 4000: 11,
3000: 11, 3000: 11,
9000: 11}] 9000: 11}
CogSpeedTable = [{2000: 6.0, ]
CogSpeedTable = [
{2000: 6.0,
1000: 6.4, 1000: 6.4,
5000: 6.8, 5000: 6.8,
4000: 7.2, 4000: 7.2,
@ -108,12 +122,10 @@ CogSpeedTable = [{2000: 6.0,
5000: 6.8, 5000: 6.8,
4000: 7.2, 4000: 7.2,
3000: 7.6, 3000: 7.6,
9000: 8.0}] 9000: 8.0}
]
ToonSpeed = 9.0 ToonSpeed = 9.0
PerfectBonus = [8, PerfectBonus = [8, 6, 4, 2]
6,
4,
2]
def calculateCogs(numPlayers, safezone): def calculateCogs(numPlayers, safezone):
result = 5 result = 5

View file

@ -7,39 +7,45 @@ MinWall = (-20.0, -15.0)
MaxWall = (20.0, 15.0) MaxWall = (20.0, 15.0)
TireRadius = 1.5 TireRadius = 1.5
WallMargin = 1 + TireRadius WallMargin = 1 + TireRadius
StartingPositions = (Point3(MinWall[0] + WallMargin, MinWall[1] + WallMargin, TireRadius), StartingPositions = (
Point3(MinWall[0] + WallMargin, MinWall[1] + WallMargin, TireRadius),
Point3(MaxWall[0] - WallMargin, MaxWall[1] - WallMargin, TireRadius), Point3(MaxWall[0] - WallMargin, MaxWall[1] - WallMargin, TireRadius),
Point3(MinWall[0] + WallMargin, MaxWall[1] - WallMargin, TireRadius), Point3(MinWall[0] + WallMargin, MaxWall[1] - WallMargin, TireRadius),
Point3(MaxWall[0] - WallMargin, MinWall[1] + WallMargin, TireRadius)) Point3(MaxWall[0] - WallMargin, MinWall[1] + WallMargin, TireRadius)
)
NumMatches = 3 NumMatches = 3
NumRounds = 2 NumRounds = 2
PointsDeadCenter = {0: 5, PointsDeadCenter = {
0: 5,
1: 5, 1: 5,
2: 5, 2: 5,
3: 4, 3: 4,
4: 3} 4: 3
}
PointsInCorner = 1 PointsInCorner = 1
FarthestLength = math.sqrt((MaxWall[0] - TireRadius) * (MaxWall[0] - TireRadius) + (MaxWall[1] - TireRadius) * (MaxWall[1] - TireRadius)) FarthestLength = math.sqrt((MaxWall[0] - TireRadius) * (MaxWall[0] - TireRadius) + (MaxWall[1] - TireRadius) * (MaxWall[1] - TireRadius))
BonusPointsForPlace = (3, BonusPointsForPlace = (3, 2, 1, 0)
2,
1,
0)
ExpandFeetPerSec = 5 ExpandFeetPerSec = 5
ScoreCountUpRate = 0.15 ScoreCountUpRate = 0.15
ShowScoresDuration = 4.0 ShowScoresDuration = 4.0
NumTreasures = {ToontownGlobals.ToontownCentral: 2, NumTreasures = {
ToontownGlobals.ToontownCentral: 2,
ToontownGlobals.DonaldsDock: 2, ToontownGlobals.DonaldsDock: 2,
ToontownGlobals.DaisyGardens: 2, ToontownGlobals.DaisyGardens: 2,
ToontownGlobals.MinniesMelodyland: 2, ToontownGlobals.MinniesMelodyland: 2,
ToontownGlobals.TheBrrrgh: 1, ToontownGlobals.TheBrrrgh: 1,
ToontownGlobals.DonaldsDreamland: 1} ToontownGlobals.DonaldsDreamland: 1
NumPenalties = {ToontownGlobals.ToontownCentral: 0, }
NumPenalties = {
ToontownGlobals.ToontownCentral: 0,
ToontownGlobals.DonaldsDock: 1, ToontownGlobals.DonaldsDock: 1,
ToontownGlobals.DaisyGardens: 1, ToontownGlobals.DaisyGardens: 1,
ToontownGlobals.MinniesMelodyland: 1, ToontownGlobals.MinniesMelodyland: 1,
ToontownGlobals.TheBrrrgh: 2, ToontownGlobals.TheBrrrgh: 2,
ToontownGlobals.DonaldsDreamland: 2} ToontownGlobals.DonaldsDreamland: 2
Obstacles = {ToontownGlobals.ToontownCentral: (), }
Obstacles = {
ToontownGlobals.ToontownCentral: (),
ToontownGlobals.DonaldsDock: ((0, 0),), ToontownGlobals.DonaldsDock: ((0, 0),),
ToontownGlobals.DaisyGardens: ((MinWall[0] / 2, 0), (MaxWall[0] / 2, 0)), ToontownGlobals.DaisyGardens: ((MinWall[0] / 2, 0), (MaxWall[0] / 2, 0)),
ToontownGlobals.MinniesMelodyland: ((0, MinWall[1] / 2), (0, MaxWall[1] / 2)), ToontownGlobals.MinniesMelodyland: ((0, MinWall[1] / 2), (0, MaxWall[1] / 2)),
@ -50,10 +56,13 @@ Obstacles = {ToontownGlobals.ToontownCentral: (),
ToontownGlobals.DonaldsDreamland: ((MinWall[0] / 2, MinWall[1] / 2), ToontownGlobals.DonaldsDreamland: ((MinWall[0] / 2, MinWall[1] / 2),
(MinWall[0] / 2, MaxWall[1] / 2), (MinWall[0] / 2, MaxWall[1] / 2),
(MaxWall[0] / 2, MinWall[1] / 2), (MaxWall[0] / 2, MinWall[1] / 2),
(MaxWall[0] / 2, MaxWall[1] / 2))} (MaxWall[0] / 2, MaxWall[1] / 2))
ObstacleShapes = {ToontownGlobals.ToontownCentral: True, }
ObstacleShapes = {
ToontownGlobals.ToontownCentral: True,
ToontownGlobals.DonaldsDock: True, ToontownGlobals.DonaldsDock: True,
ToontownGlobals.DaisyGardens: True, ToontownGlobals.DaisyGardens: True,
ToontownGlobals.MinniesMelodyland: True, ToontownGlobals.MinniesMelodyland: True,
ToontownGlobals.TheBrrrgh: False, ToontownGlobals.TheBrrrgh: False,
ToontownGlobals.DonaldsDreamland: False} ToontownGlobals.DonaldsDreamland: False
}

View file

@ -15,7 +15,8 @@ AttackMult = 1.0
AttackMultNerfed = 0.5 AttackMultNerfed = 0.5
HitCountDamage = 35 HitCountDamage = 35
HitCountDamageNerfed = 50 HitCountDamageNerfed = 50
BarrelDefs = {8000: {'type': DistributedHealBarrelAI, BarrelDefs = {
8000: {'type': DistributedHealBarrelAI,
'pos': Point3(15, 23, 0), 'pos': Point3(15, 23, 0),
'hpr': Vec3(-45, 0, 0), 'hpr': Vec3(-45, 0, 0),
'rewardPerGrab': 50, 'rewardPerGrab': 50,
@ -43,7 +44,8 @@ BarrelDefs = {8000: {'type': DistributedHealBarrelAI,
'gagLevelMax': 0, 'gagLevelMax': 0,
'gagTrack': 5, 'gagTrack': 5,
'rewardPerGrab': 10, 'rewardPerGrab': 10,
'rewardPerGrabMax': 0}} 'rewardPerGrabMax': 0}
}
def setBarrelAttr(barrel, entId): def setBarrelAttr(barrel, entId):
for defAttr, defValue in BarrelDefs[entId].iteritems(): for defAttr, defValue in BarrelDefs[entId].iteritems():

View file

@ -943,6 +943,9 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo
self.addStat(ToontownGlobals.STAT_SAD) self.addStat(ToontownGlobals.STAT_SAD)
def b_setMaxHp(self, maxHp): def b_setMaxHp(self, maxHp):
if self.maxHp == maxHp:
return
if (maxHp > ToontownGlobals.MaxHpLimit): if (maxHp > ToontownGlobals.MaxHpLimit):
self.air.writeServerEvent('suspicious', self.doId, 'Toon tried to go over the HP limit.') self.air.writeServerEvent('suspicious', self.doId, 'Toon tried to go over the HP limit.')
self.d_setMaxHp(ToontownGlobals.MaxHpLimit) self.d_setMaxHp(ToontownGlobals.MaxHpLimit)
@ -952,10 +955,7 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo
self.setMaxHp(maxHp) self.setMaxHp(maxHp)
def d_setMaxHp(self, maxHp): def d_setMaxHp(self, maxHp):
if (maxHp > ToontownGlobals.MaxHpLimit): self.sendUpdate('setMaxHp', [maxHp])
self.air.writeServerEvent('suspicious', self.doId, 'Toon tried to go over the HP limit.')
else:
self.sendUpdate('setMaxHp', [maxHp])
def b_setTutorialAck(self, tutorialAck): def b_setTutorialAck(self, tutorialAck):
self.d_setTutorialAck(tutorialAck) self.d_setTutorialAck(tutorialAck)