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
def hpChange(self, quietly = 0):
if hasattr(self, 'doId'):
if self.hp != None and self.maxHp != None:
messenger.send(self.uniqueName('hpChange'), [self.hp, self.maxHp, quietly])
if self.hp != None and self.hp > 0:
messenger.send(self.uniqueName('positiveHP'))
return
if (not hasattr(self, 'doId')) or self.hp == None:
return
if self.maxHp != None:
messenger.send(self.uniqueName('hpChange'), [self.hp, self.maxHp, quietly])
if self.hp > 0:
messenger.send(self.uniqueName('positiveHP'))
def died(self):
pass

View file

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

View file

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

View file

@ -208,24 +208,12 @@ class DistributedDoor(DistributedObject.DistributedObject, DelayDeletable):
self.hideDoorParts()
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:
# Get the doorTrigger...
if self.doorType == DoorTypes.EXT_HQ and ZoneUtil.getHoodId(self.zoneId) == ToontownGlobals.DonaldsDreamland:
building = self.getBuilding()
doorTrigger = building.find('**/%s' % self.getTriggerName())
# Check if the doorTrigger hasn't been 'fixed' already...
if not doorTrigger.getTag('fixed'):
# 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.setY(doorTrigger, 0.25 if not self.doorIndex else -0.25)
doorTrigger.setTag('fixed', 'true')
self.accept(self.getEnterTriggerEvent(), self.doorTrigger)

View file

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

View file

@ -7,39 +7,45 @@ MinWall = (-20.0, -15.0)
MaxWall = (20.0, 15.0)
TireRadius = 1.5
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(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
NumRounds = 2
PointsDeadCenter = {0: 5,
PointsDeadCenter = {
0: 5,
1: 5,
2: 5,
3: 4,
4: 3}
4: 3
}
PointsInCorner = 1
FarthestLength = math.sqrt((MaxWall[0] - TireRadius) * (MaxWall[0] - TireRadius) + (MaxWall[1] - TireRadius) * (MaxWall[1] - TireRadius))
BonusPointsForPlace = (3,
2,
1,
0)
BonusPointsForPlace = (3, 2, 1, 0)
ExpandFeetPerSec = 5
ScoreCountUpRate = 0.15
ShowScoresDuration = 4.0
NumTreasures = {ToontownGlobals.ToontownCentral: 2,
NumTreasures = {
ToontownGlobals.ToontownCentral: 2,
ToontownGlobals.DonaldsDock: 2,
ToontownGlobals.DaisyGardens: 2,
ToontownGlobals.MinniesMelodyland: 2,
ToontownGlobals.TheBrrrgh: 1,
ToontownGlobals.DonaldsDreamland: 1}
NumPenalties = {ToontownGlobals.ToontownCentral: 0,
ToontownGlobals.DonaldsDreamland: 1
}
NumPenalties = {
ToontownGlobals.ToontownCentral: 0,
ToontownGlobals.DonaldsDock: 1,
ToontownGlobals.DaisyGardens: 1,
ToontownGlobals.MinniesMelodyland: 1,
ToontownGlobals.TheBrrrgh: 2,
ToontownGlobals.DonaldsDreamland: 2}
Obstacles = {ToontownGlobals.ToontownCentral: (),
ToontownGlobals.DonaldsDreamland: 2
}
Obstacles = {
ToontownGlobals.ToontownCentral: (),
ToontownGlobals.DonaldsDock: ((0, 0),),
ToontownGlobals.DaisyGardens: ((MinWall[0] / 2, 0), (MaxWall[0] / 2, 0)),
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),
(MinWall[0] / 2, MaxWall[1] / 2),
(MaxWall[0] / 2, MinWall[1] / 2),
(MaxWall[0] / 2, MaxWall[1] / 2))}
ObstacleShapes = {ToontownGlobals.ToontownCentral: True,
(MaxWall[0] / 2, MaxWall[1] / 2))
}
ObstacleShapes = {
ToontownGlobals.ToontownCentral: True,
ToontownGlobals.DonaldsDock: True,
ToontownGlobals.DaisyGardens: True,
ToontownGlobals.MinniesMelodyland: True,
ToontownGlobals.TheBrrrgh: False,
ToontownGlobals.DonaldsDreamland: False}
ToontownGlobals.DonaldsDreamland: False
}

View file

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

View file

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