general: loads to a connecting screen!

This commit is contained in:
Open Toontown 2019-11-02 21:22:48 -04:00
parent 27bd82aa36
commit 46e7a352b6
23 changed files with 295 additions and 23 deletions

View file

@ -97,3 +97,6 @@ audio-music-active #t
audio-master-sfx-volume 1
audio-master-music-volume 1
server-type prod
# TEMP
fake-playtoken dev

4
libtoontown/__init__.py Normal file
View file

@ -0,0 +1,4 @@
from libpandadna import *
from pets.CPetBrain import CPetBrain
from pets.CPetChase import CPetChase
from pets.CPetFlee import CPetFlee

View file

@ -0,0 +1,35 @@
import math
from direct.directnotify import DirectNotifyGlobal
from panda3d.core import *
class CPetBrain:
notify = DirectNotifyGlobal.directNotify.newCategory('CPetBrain')
def __init__(self):
pass
@staticmethod
def isAttendingUs(pathA, pathB):
v4 = pathB.getPos(pathA)
pathAB = ((v4[1] * v4[1]) + (v4[0] * v4[0]) + (v4[2] * v4[2]))
if not (pathAB > 100.0):
return True
v6 = pathA.getPos(pathB)
pathAA = ((v6[1] * v6[1]) + (v6[0] * v6[0]) + (v6[2] * v6[2]))
if pathAA == 0.0:
v6 = Vec3(0, 0, 0)
else:
pathAB = pathAA - 1.0
if pathAB >= 9.999999949504854e-13 or pathAB <= -9.999999949504854e-13:
pathAD = 1.0 / math.sqrt(pathAA)
v6 *= pathAD
v8 = Vec3.forward()
pathAC = ((v8[1] * v6[1]) + (v8[0] * v6[0]) + (v8[2] * v6[2]))
if pathAC < 0.8:
return True
else:
return False

View file

@ -0,0 +1,81 @@
import math
from direct.directnotify import DirectNotifyGlobal
from direct.showbase.PythonUtil import reduceAngle
from panda3d.core import *
from libotp import *
class CPetChase(CImpulse):
notify = DirectNotifyGlobal.directNotify.newCategory('CPetChase')
def __init__(self, target=None, minDist=None, moveAngle=None):
CImpulse.__init__(self)
self.target = target
if minDist is None:
minDist = 5.0
self.minDist = minDist
if moveAngle is None:
moveAngle = 20.0
self.moveAngle = moveAngle
self.lookAtNode = NodePath('lookatNode')
self.lookAtNode.hide()
self.vel = None
self.rotVel = None
def setTarget(self, target):
self.target = target
def getTarget(self):
return self.target
def setMinDist(self, minDist):
self.minDist = minDist
def destroy(self):
self.lookAtNode.removeNode()
del self.lookAtNode
del self.target
del self.vel
del self.rotVel
def setMover(self, mover):
CImpulse.setMover(self, mover)
self.lookAtNode.reparentTo(self.nodePath)
self.vel = self.VecType(0)
self.rotVel = self.VecType(0)
def process(self, dt):
CImpulse.process(self, dt)
me = self.nodePath
target = self.target
targetPos = target.getPos(me)
x = targetPos[0]
y = targetPos[1]
distance = math.sqrt(x * x + y * y)
self.lookAtNode.lookAt(target)
relH = reduceAngle(self.lookAtNode.getH(me))
epsilon = 0.005
rotSpeed = self.mover.getRotSpeed()
if relH < -epsilon:
vH = -rotSpeed
elif relH > epsilon:
vH = rotSpeed
else:
vH = 0
if abs(vH * dt) > abs(relH):
vH = relH / dt
if distance > self.minDist and abs(relH) < self.moveAngle:
vForward = self.mover.getFwdSpeed()
else:
vForward = 0
distanceLeft = distance - self.minDist
if distance > self.minDist and vForward * dt > distanceLeft:
vForward = distanceLeft / dt
if vForward:
self.vel.setY(vForward)
self.mover.addShove(self.vel)
if vH:
self.rotVel.setX(vH)
self.mover.addRotShove(self.rotVel)

View file

@ -0,0 +1,66 @@
from direct.directnotify import DirectNotifyGlobal
from direct.showbase.PythonUtil import reduceAngle
from panda3d.core import *
from libotp import *
class CPetFlee(CImpulse):
notify = DirectNotifyGlobal.directNotify.newCategory('CPetFlee')
def __init__(self, chaser=None, maxDist=50.0, moveAngle=20.0):
CImpulse.__init__(self)
self.chaser = chaser
self.maxDist = maxDist
self.moveAngle = moveAngle
self.lookAtNode = NodePath('lookatNode')
self.lookAtNode.hide()
self.vel = None
self.rotVel = None
def destroy(self):
self.lookAtNode.removeNode()
del self.lookAtNode
del self.chaser
del self.vel
del self.rotVel
def setChaser(self, chaser):
self.chaser = chaser
def _setMover(self, mover):
CImpulse._setMover(self, mover)
self.lookAtNode.reparentTo(self.nodePath)
self.vel = self.VecType(0)
self.rotVel = self.VecType(0)
def _process(self, dt):
CImpulse._process(self, dt)
me = self.nodePath
chaser = self.chaser
chaserPos = chaser.getPos(me)
chaserPos.setZ(0)
distance = self.VecType(chaserPos).length()
self.lookAtNode.lookAt(chaser)
relH = reduceAngle(self.lookAtNode.getH(me) + 180.0)
epsilon = 0.005
rotSpeed = self.mover.getRotSpeed()
if relH < -epsilon:
vH = -rotSpeed
elif relH > epsilon:
vH = rotSpeed
else:
vH = 0
if abs(vH * dt) > abs(relH):
vH = relH / dt
if distance < self.maxDist and abs(relH) < self.moveAngle:
vForward = self.mover.getFwdSpeed()
else:
vForward = 0
distanceLeft = self.maxDist - distance
if distanceLeft > 0.0 and vForward * dt > distanceLeft:
vForward = distanceLeft / dt
self.vel.setY(vForward)
self.rotVel.setX(vH)
self.mover.addShove(self.vel)
self.mover.addRotShove(self.rotVel)

View file

View file

@ -3,7 +3,7 @@ from direct.showbase import GarbageReport, ContainerReport, MessengerLeakDetecto
from direct.distributed import DistributedObject
from direct.directnotify import DirectNotifyGlobal
from direct.showbase.InputStateGlobal import inputState
from direct.showbase.ObjectCount import ObjectCount
from otp.otpbase.ObjectCount import ObjectCount
from direct.task import Task
from direct.task.TaskProfiler import TaskProfiler
from otp.avatar import Avatar

View file

@ -0,0 +1,48 @@
from direct.showbase.Job import Job
import gc
class ObjectCount(Job):
""" logs a count of the number of each type of object found in gc.get_objects() """
def __init__(self, name, immediate=False, doneCallback=None):
Job.__init__(self, name)
self._doneCallback = doneCallback
jobMgr.add(self)
if immediate:
jobMgr.finish(self)
def destroy(self):
self._doneCallback = None
Job.destroy(self)
def finished(self):
if self._doneCallback:
self._doneCallback(self)
self.destroy()
def run(self):
objs = gc.get_objects()
yield None
type2count = {}
for obj in objs:
tn = safeTypeName(obj)
type2count.setdefault(tn, 0)
type2count[tn] += 1
yield None
# prevent garbage cycle
del objs
yield None
count2type = invertDictLossless(type2count)
yield None
counts = count2type.keys()
yield None
counts.sort()
yield None
counts.reverse()
yield None
print '===== ObjectCount: \'%s\' =====' % (self.getJobName())
for count in counts:
types = count2type[count]
for type in types:
print '%s: %s' % (count, type)
yield None
yield Job.Done

View file

@ -1,3 +1,5 @@
import __builtin__
# class 'decorator' that records the stack at the time of creation
# be careful with this, it creates a StackTrace, and that can take a
# lot of CPU
@ -19,3 +21,37 @@ def recordCreationStack(cls):
cls.getCreationStackTraceCompactStr = getCreationStackTraceCompactStr
cls.printCreationStackTrace = printCreationStackTrace
return cls
def pdir(obj, str = None, width = None,
fTruncate = 1, lineWidth = 75, wantPrivate = 0):
# Remove redundant class entries
uniqueLineage = []
for l in getClassLineage(obj):
if type(l) == types.ClassType:
if l in uniqueLineage:
break
uniqueLineage.append(l)
# Pretty print out directory info
uniqueLineage.reverse()
for obj in uniqueLineage:
_pdir(obj, str, width, fTruncate, lineWidth, wantPrivate)
print
def quantize(value, divisor):
# returns new value that is multiple of (1. / divisor)
return float(int(value * int(divisor))) / int(divisor)
def quantizeVec(vec, divisor):
# in-place
vec[0] = quantize(vec[0], divisor)
vec[1] = quantize(vec[1], divisor)
vec[2] = quantize(vec[2], divisor)
def isClient():
if hasattr(__builtin__, 'simbase') and not hasattr(__builtin__, 'base'):
return False
return True
__builtin__.pdir = pdir
__builtin__.isClient = isClient

View file

@ -3,7 +3,8 @@ from direct.distributed.ClockDelta import *
from direct.interval.IntervalGlobal import *
import HolidayDecorator
from toontown.toonbase import ToontownGlobals
from pandac.PandaModules import Vec4, loadDNAFile, CSDefault, TransformState, NodePath, TransparencyAttrib
from pandac.PandaModules import Vec4, CSDefault, TransformState, NodePath, TransparencyAttrib
from libtoontown import loadDNAFile
from toontown.hood import GSHood
class CrashedLeaderBoardDecorator(HolidayDecorator.HolidayDecorator):

View file

@ -6,7 +6,8 @@ from toontown.toonbase import ToontownGlobals
from toontown.safezone import Playground
from toontown.town import Street
from toontown.estate import Estate
from pandac.PandaModules import Vec4, loadDNAFile, CSDefault, TransformState, NodePath, TransparencyAttrib
from pandac.PandaModules import Vec4, CSDefault, TransformState, NodePath, TransparencyAttrib
from libtoontown import loadDNAFile
class HalloweenHolidayDecorator(HolidayDecorator.HolidayDecorator):
notify = DirectNotifyGlobal.directNotify.newCategory('HalloweenHolidayDecorator')

View file

@ -1,6 +1,7 @@
from toontown.toonbase import ToontownGlobals
from direct.interval.IntervalGlobal import Parallel, Sequence, Func, Wait
from pandac.PandaModules import Vec4, loadDNAFile, CSDefault, TransformState, NodePath, TransparencyAttrib
from pandac.PandaModules import Vec4, CSDefault, TransformState, NodePath, TransparencyAttrib
from libtoontown import loadDNAFile
class HolidayDecorator:

View file

@ -3,10 +3,10 @@ from direct.fsm import FSM
from direct.gui.DirectGui import DirectFrame, DGG
from direct.interval.IntervalGlobal import LerpScaleInterval, LerpColorScaleInterval, Parallel, Sequence, Wait
class DinerStatusIndicator(NodePath.NodePath, FSM.FSM):
class DinerStatusIndicator(NodePath, FSM.FSM):
def __init__(self, parent, pos = None, scale = None):
NodePath.NodePath.__init__(self, 'DinerStatusIndicator')
NodePath.__init__(self, 'DinerStatusIndicator')
if parent:
self.reparentTo(parent)
if pos:

View file

@ -86,7 +86,7 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
self.toons = {}
if self.http.getVerifySsl() != HTTPClient.VSNoVerify:
self.http.setVerifySsl(HTTPClient.VSNoDateCheck)
prepareAvatar(self.http)
#prepareAvatar(self.http)
self.__forbidCheesyEffects = 0
self.friendManager = None
self.speedchatRelay = None

View file

@ -9,7 +9,7 @@ from toontown.toonbase import ToontownGlobals
import VineGameGlobals
import VineSpider
class SwingVine(NodePath.NodePath):
class SwingVine(NodePath):
notify = DirectNotifyGlobal.directNotify.newCategory('SwingVine')
defaultNormal = Vec3(1, 0, 0)
SwingAnimPeriod = 6.0

View file

@ -5,7 +5,7 @@ from pandac.PandaModules import *
import VineGameGlobals
from direct.interval.SoundInterval import SoundInterval
class VineBat(NodePath.NodePath, DirectObject):
class VineBat(NodePath, DirectObject):
notify = DirectNotifyGlobal.directNotify.newCategory('VineBat')
notify.setDebug(True)
RADIUS = 1.7

View file

@ -4,7 +4,7 @@ from direct.directnotify import DirectNotifyGlobal
from pandac.PandaModules import *
import VineGameGlobals
class VineSpider(NodePath.NodePath, DirectObject):
class VineSpider(NodePath, DirectObject):
RADIUS = 1.7
def __init__(self):

View file

@ -5,7 +5,7 @@ from pandac.PandaModules import Point3, TextNode, Vec4
from toontown.minigame import TravelGameGlobals
from toontown.toonbase import TTLocalizer
from direct.interval.IntervalGlobal import Parallel, Sequence, LerpFunc, Func, Wait, SoundInterval
from direct.showbase.PythonUtil import pdir
from otp.otpbase.PythonUtil import pdir
class VoteResultsTrolleyPanel(DirectFrame):
notify = DirectNotifyGlobal.directNotify.newCategory('VoteResultsTrolleyPanel')

View file

@ -2,7 +2,7 @@ import math
from pandac.PandaModules import *
from direct.distributed.ClockDelta import *
from direct.interval.IntervalGlobal import *
from direct.showbase.PythonUtil import quantizeVec
from otp.otpbase.PythonUtil import quantizeVec
from direct.task.Task import Task
from toontown.toontowngui import TTDialog
from toontown.toonbase.ToonBaseGlobal import *

View file

@ -4,7 +4,6 @@ import tokenize
import copy
from direct.interval.IntervalGlobal import *
from direct.directnotify import DirectNotifyGlobal
from direct.showbase import AppRunnerGlobal
from pandac.PandaModules import *
from direct.showbase import DirectObject
import BlinkingArrows
@ -1067,13 +1066,8 @@ class NPCMoviePlayer(DirectObject.DirectObject):
searchPath = DSearchPath()
if AppRunnerGlobal.appRunner:
searchPath.appendDirectory(Filename.expandFrom('$TT_3_ROOT/phase_3/etc'))
else:
searchPath.appendDirectory(Filename('phase_3/etc'))
searchPath.appendDirectory(Filename.fromOsSpecific(os.path.expandvars('$TOONTOWN/src/quest')))
searchPath.appendDirectory(Filename.fromOsSpecific('toontown/src/quest'))
searchPath.appendDirectory(Filename('.'))
if __debug__:
searchPath.appendDirectory(Filename('resources/phase_3/etc'))
scriptFile = Filename('QuestScripts.txt')
found = vfs.resolveFilename(scriptFile, searchPath)
if not found:

View file

@ -1,6 +1,7 @@
import math
import random
from pandac.PandaModules import NametagGroup, CFSpeech, VBase3, CollisionPlane, CollisionNode, CollisionSphere, CollisionTube, NodePath, Plane, Vec3, Vec2, Point3, BitMask32, CollisionHandlerEvent, TextureStage, VBase4, BoundingSphere
from pandac.PandaModules import VBase3, CollisionPlane, CollisionNode, CollisionSphere, CollisionTube, NodePath, Plane, Vec3, Vec2, Point3, BitMask32, CollisionHandlerEvent, TextureStage, VBase4, BoundingSphere
from libotp import NametagGroup, CFSpeech
from direct.interval.IntervalGlobal import Sequence, Wait, Func, LerpHprInterval, Parallel, LerpPosInterval, Track, ActorInterval, ParallelEndTogether, LerpFunctionInterval, LerpScaleInterval, LerpPosHprInterval, SoundInterval
from direct.task import Task
from direct.fsm import FSM

View file

@ -4,7 +4,8 @@ from toontown.toon import NPCToons
from toontown.toonbase import TTLocalizer
from direct.task.Task import Task
from direct.distributed import ClockDelta
from pandac.PandaModules import CFSpeech, CFTimeout, Point3
from pandac.PandaModules import Point3
from libotp import CFSpeech, CFTimeout
from toontown.toontowngui import TTDialog
from otp.otpbase import OTPLocalizer
from toontown.parties import PartyGlobals

View file

@ -1,6 +1,6 @@
from direct.distributed.DistributedObject import DistributedObject
from direct.distributed.DistributedObjectGlobal import DistributedObjectGlobal
from pandac.PandaModules import CFSpeech, CFTimeout
from libotp import CFSpeech, CFTimeout
from toontown.toonbase import ToontownGlobals
from toontown.toonbase import TTLocalizer
from toontown.toon import ToonDNA