def __init__(self, app=None, dt=None): self.app = app or ShowBase() self.app.accept('escape', sys.exit) self.root_node = self.app.render self._dt = 0.1 if dt is None else dt # setup visualization camera vfov = 45 hfov = vfov * float(self.app.win.getSize()[0]) / float( self.app.win.getSize()[1]) self.app.camLens.setFov(hfov, vfov) self.app.camLens.set_near_far(0.01, 10000.0) # 1cm to 10km # The VirtualFileSystem, which has already initialized, doesn't see the mount # directives in the config(s) yet. We have to force it to load those manually: vfs = VirtualFileSystem.getGlobalPtr() mounts = ConfigVariableList('vfs-mount') for mount_desc in mounts: mount_desc = mount_desc.split(' ') physical_filename, mount_point = mount_desc[:2] physical_filename = os.path.expandvars(physical_filename) mount_point = os.path.expandvars(mount_point) if len(mount_desc) > 2: options = mount_desc[2] else: options = '' vfs.mount(Filename(physical_filename), Filename(mount_point), *parse_options(options))
def announceGenerate(self): DistributedObjectGlobalUD.announceGenerate(self) self.notify.info('HolidayManager going online') self.__checkHolidays() self.holidayCheckTask = taskMgr.doMethodLater(15, self.__checkHolidays, 'checkHolidays') self.holdayTimerTask = taskMgr.doMethodLater(15, self.__runHolidayTimer, 'holidayTimerTask') if self.wantRandomizedSchedules: self.randomScheduleTask = taskMgr.doMethodLater( 60, self.__runRandomizedSchedules, 'randomShceduleTask') self.d_requestRegister() # Load holidays from PRC if self.wantHolidays: debugHolidays = ConfigVariableList('debug-holiday') for holiday in debugHolidays: holidaySplit = holiday.split(';') holidayId = int(holidaySplit[0]) endTime = int(holidaySplit[1]) config = 0 if len(holidaySplit) > 2: config = int(holidaySplit[2]) self.startHoliday(holidayId, configId=config, time=endTime)
"""LEConfig module: contains the level editor configuration variables""" from panda3d.core import ConfigVariableList, ConfigVariableString, ConfigVariableDouble, ConfigVariableInt fgd_files = ConfigVariableList( "fgd-file", "List of FGD files that are to be loaded by the level editor") default_material = ConfigVariableString( "default-material", #"materials/dev/dev_measuregeneric01.mat", "maps/smiley.txo", "The default material to use for solids") default_point_entity = ConfigVariableString("default-point-entity", "prop_static", "The default point entity") default_solid_entity = ConfigVariableString( "default-solid-entity", "func_wall", "The default solid/brush entity. Brushes that get tied to entities are this " "entity by default.") default_texture_scale = ConfigVariableDouble( "default-texture-scale", 1.0, "The default texture scale for solid faces.") default_lightmap_scale = ConfigVariableInt( "default-lightmap-scale", 16, "The default lightmap scale for solid faces. Lower value = more detailed") default_prop_model = ConfigVariableString( "default-prop-model", "models/misc/smiley.bam",
from panda3d.core import * from panda3d.direct import * from toontown.toonbase import ToonPythonUtil import __builtin__ import os if __debug__: loadPrcFile('config/dev.prc') # The VirtualFileSystem, which has already initialized, doesn't see the mount # directives in the config(s) yet. We have to force it to load those manually: from panda3d.core import VirtualFileSystem, ConfigVariableList, Filename vfs = VirtualFileSystem.getGlobalPtr() mounts = ConfigVariableList('vfs-mount') for mount in mounts: mountfile, mountpoint = (mount.split(' ', 2) + [None, None, None])[:2] vfs.mount(Filename(mountfile), Filename(mountpoint), 0) import glob for file in glob.glob('resources/*.mf'): mf = Multifile() mf.openReadWrite(Filename(file)) names = mf.getSubfileNames() for name in names: ext = os.path.splitext(name)[1] if ext not in ['.jpg', '.jpeg', '.ogg', '.rgb']: mf.removeSubfile(name) vfs.mount(mf, Filename('/'), 0) from direct.directnotify.DirectNotifyGlobal import directNotify from otp.otpbase.Settings import Settings
from panda3d.core import * from otp.otpbase import PythonUtil import __builtin__, os, time, sys isHalloween = time.localtime().tm_mon == 10 and time.localtime().tm_mday >= 24 isAprilFoolsWeek = time.localtime().tm_mon == 3 and time.localtime().tm_mday >= 31 or time.localtime().tm_mon == 4 and time.localtime().tm_mday <= 8 and time.localtime().tm_mday != 1 isAprilFools = time.localtime().tm_mon == 4 and time.localtime().tm_mday == 1 isWinter = time.localtime().tm_mon == 12 if isAprilFools: loadPrcFileData('Extra Gamefiles', 'vfs-mount-extra cto.mf /') loadPrcFileData('April Fools!', 'window-title Cogtown Origins') from toontown.toonbase.GameSettings import GameSettings gameSettings = GameSettings() gameSettings.loadFromSettings() from panda3d.core import VirtualFileSystem, ConfigVariableList, Filename vfs = VirtualFileSystem.getGlobalPtr() mounts = ConfigVariableList('vfs-mount') for mount in mounts: mountfile, mountpoint = (mount.split(' ', 2) + [None, None, None])[:2] if mountfile == 'phase_14.mf': mf = Multifile() mf.openRead(Filename(mountfile)) mf.setEncryptionFlag(True) mf.setEncryptionPassword('b010e0f0e020616a9a61df0f5330823db1bd028f8c2f2b2ba3693776517e480a') vfs.mount(mf, Filename(mountpoint), 0) else: vfs.mount(Filename(mountfile), Filename(mountpoint), 0) mounts = ConfigVariableList('vfs-mount-extra') for mount in mounts: mountfile, mountpoint = (mount.split(' ', 2) + [None, None, None])[:2] vfs.mount(Filename(mountfile), Filename(mountpoint), 0)