def create(self, mapName): global _V_START_POS global _V_START_ANGLES try: LOG_DEBUG('OfflineMapCreator.Create( %s )' % mapName) g_appLoader.showBattle() cfgType = 'basic' self.__loadCfg(cfgType, mapName) BigWorld.worldDrawEnabled(False) BigWorld.setWatcher('Visibility/GUI', False) self.__spaceId = BigWorld.createSpace() self.__isActive = True self.__arenaTypeID = self._arenaTypeIDByArenaName.get(mapName) self.__accountID = BigWorld.createEntity('Account', self.__spaceId, 0, _V_START_POS, (_V_START_ANGLES[2], _V_START_ANGLES[1], _V_START_ANGLES[0]), dict()) self.__spaceMappingId = BigWorld.addSpaceGeometryMapping(self.__spaceId, None, 'spaces/' + mapName) self.__vEntityId = BigWorld.createEntity('Avatar', self.__spaceId, 0, _V_START_POS, (_V_START_ANGLES[2], _V_START_ANGLES[1], _V_START_ANGLES[0]), dict()) BigWorld.player(BigWorld.entities[self.__vEntityId]) self.__setupCamera() BigWorld.worldDrawEnabled(True) except: LOG_DEBUG('OfflineMapCreator.Create( %s ): FAILED with: ' % mapName) LOG_CURRENT_EXCEPTION() self.cancel() return
def BigWorld_connect(baseFunc, server, loginParams, progressFn): if server == OFFLINE_SERVER_ADDRES: LOG_DEBUG('BigWorld.connect') progressFn(1, LOGIN_STATUS.LOGGED_ON, '{}') BigWorld.createEntity('Account', BigWorld.createSpace(), 0, (0, 0, 0), (0, 0, 0), {}) else: baseFunc(server, loginParams, progressFn)
def __onFakeShadowLoaded(self, resourceRefs): modelName = _CFG['shadow_model_name'] fakeShadowModel = None if modelName not in resourceRefs.failedIDs and resourceRefs.has_key( modelName): fakeShadowModel = resourceRefs[modelName] if fakeShadowModel is None: LOG_ERROR('Could not load model %s' % modelName) return else: shadowProxyNodes = [ udo for udo in BigWorld.userDataObjects.values() if isinstance(udo, TankHangarShadowProxy.TankHangarShadowProxy) ] if len(shadowProxyNodes) == 1: shadowProxy = shadowProxyNodes[0] shadowXFormPosition = shadowProxy.position shadowXFormOrientation = (shadowProxy.roll, shadowProxy.pitch, shadowProxy.yaw) else: LOG_DEBUG('Too many TankHangarShadowProxies? Or not enough.') return self.__fakeShadowId = BigWorld.createEntity( 'OfflineEntity', self.__spaceId, 0, shadowXFormPosition, shadowXFormOrientation, dict()) entity = BigWorld.entity(self.__fakeShadowId) entity.model = fakeShadowModel entity.model.position = shadowProxy.position entity.model.yaw = shadowProxy.yaw self.modifyFakeShadowScale(self.__fakeShadowScale) self.modifyFakeShadowAsset(self.__fakeShadowAsset) return
def create(self): if self.__flagEntity is not None: LOG_ERROR('Flags: Wrong usage of offline flags') return else: self.__entityID = BigWorld.createEntity('OfflineFlag', BigWorld.player().spaceID, 0, self.__position, Vector3(0.0, 0.0, 0.0), dict({'flagID': self.__flagID})) return
def create(self, mapName): global _V_START_POS global _V_START_ANGLES try: LOG_DEBUG('OfflineMapCreator.Create( %s )' % mapName) g_appLoader.showBattlePage() cfgType = 'basic' self.__loadCfg(cfgType, mapName) BigWorld.worldDrawEnabled(False) BigWorld.setWatcher('Visibility/GUI', False) self.__spaceId = BigWorld.createSpace() self.__isActive = True self.__arenaTypeID = self.__getArenaTypeId(mapName) self.__spaceMappingId = BigWorld.addSpaceGeometryMapping(self.__spaceId, None, 'spaces/' + mapName) self.__vEntityId = BigWorld.createEntity('Avatar', self.__spaceId, 0, _V_START_POS, (_V_START_ANGLES[2], _V_START_ANGLES[1], _V_START_ANGLES[0]), {}) avatar = BigWorld.entities[self.__vEntityId] avatar.arenaUniqueID = 0 avatar.arenaTypeID = self.__arenaTypeID avatar.arenaBonusType = constants.ARENA_BONUS_TYPE.UNKNOWN avatar.arenaGuiType = constants.ARENA_GUI_TYPE.UNKNOWN avatar.arenaExtraData = {} avatar.weatherPresetID = 0 BigWorld.player(avatar) self.__setupCamera() BigWorld.worldDrawEnabled(True) except: LOG_DEBUG('OfflineMapCreator.Create( %s ): FAILED with: ' % mapName) LOG_CURRENT_EXCEPTION() self.cancel() return
def testAllocate(spaceID): import items.vehicles vehicleDesc = items.vehicles.VehicleDescr( typeName=items.vehicles.g_cache.vehicle(0, 1).name) entityId = BigWorld.createEntity('OfflineEntity', spaceID, 0, BigWorld.camera().position, (0, 0, 0), dict()) return CrashedTrackController(vehicleDesc, BigWorld.entity(entityId))
def create(self, isPremium, onSpaceLoadedCallback=None): global _CFG BigWorld.worldDrawEnabled(False) BigWorld.wg_setSpecialFPSMode() self.__onLoadedCallback = onSpaceLoadedCallback self.__spaceId = BigWorld.createSpace() isIGR = self.igrCtrl.getRoomType() == constants.IGR_TYPE.PREMIUM spacePath = _getHangarPath(isPremium, isIGR) spaceType = _getHangarType(isPremium) spaceVisibilityMask = _getHangarVisibilityMask(isPremium) LOG_DEBUG( 'load hangar: hangar type = <{0:>s}>, space = <{1:>s}>'.format( spaceType, spacePath)) safeSpacePath = _getDefaultHangarPath(False) if ResMgr.openSection(spacePath) is None: LOG_ERROR( 'Failed to load hangar from path: %s; default hangar will be loaded instead' % spacePath) spacePath = safeSpacePath try: self.__spaceMappingId = BigWorld.addSpaceGeometryMapping( self.__spaceId, None, spacePath, spaceVisibilityMask) BigWorld.enableLowFrequencyAnimation(self.__spaceId, True) except Exception: try: LOG_CURRENT_EXCEPTION() spacePath = safeSpacePath self.__spaceMappingId = BigWorld.addSpaceGeometryMapping( self.__spaceId, None, spacePath, spaceVisibilityMask) BigWorld.enableLowFrequencyAnimation(self.__spaceId, True) except Exception: BigWorld.releaseSpace(self.__spaceId) self.__spaceMappingId = None self.__spaceId = None LOG_CURRENT_EXCEPTION() return self.__spacePath = spacePath self.__spaceVisibilityMask = spaceVisibilityMask spaceKey = _getHangarKey(spacePath) _CFG = copy.deepcopy(_HANGAR_CFGS[spaceKey]) self.turretAndGunAngles.init() self.__vEntityId = BigWorld.createEntity( 'HangarVehicle', self.__spaceId, 0, _CFG['v_start_pos'], (_CFG['v_start_angles'][2], _CFG['v_start_angles'][1], _CFG['v_start_angles'][0]), dict()) self.__cameraManager = HangarCameraManager(self.__spaceId) self.__cameraManager.init() self.__waitCallback = BigWorld.callback(0.1, self.__waitLoadingSpace) BigWorld.wg_enableGUIBackground(True, False) BigWorld.wg_setGUIBackground(_LOGIN_BLACK_BG_IMG) self.mapActivities.generateOfflineActivities(spacePath) BigWorld.pauseDRRAutoscaling(True) vsePlans = _CFG.get('vse_plans', None) if vsePlans is not None: self._vsePlans.load(vsePlans) self._vsePlans.start() return
def create(self, isPremium, onSpaceLoadedCallback = None): global _EVENT_HANGAR_PATHS global _CFG BigWorld.worldDrawEnabled(False) BigWorld.wg_setSpecialFPSMode() self.__onLoadedCallback = onSpaceLoadedCallback self.__spaceId = BigWorld.createSpace() type = self.getSpaceType(isPremium) _CFG = copy.copy(_DEFAULT_CFG[type]) spacePath = _DEFAULT_CFG[type]['path'] LOG_DEBUG('load hangar: hangar type = <{0:>s}>, space = <{1:>s}>'.format(type, spacePath)) if game_control.g_instance.igr.getRoomType() == constants.IGR_TYPE.PREMIUM: if _CFG.get(self.__igrHangarPathKey) is not None: spacePath = _CFG[self.__igrHangarPathKey] if _EVENT_HANGAR_PATHS.has_key(isPremium): spacePath = _EVENT_HANGAR_PATHS[isPremium] safeSpacePath = _DEFAULT_CFG[type]['path'] if ResMgr.openSection(spacePath) is None: LOG_ERROR('Failed to load hangar from path: %s; default hangar will be loaded instead' % spacePath) spacePath = safeSpacePath try: self.__spaceMappingId = BigWorld.addSpaceGeometryMapping(self.__spaceId, None, spacePath) except: try: LOG_CURRENT_EXCEPTION() spacePath = safeSpacePath self.__spaceMappingId = BigWorld.addSpaceGeometryMapping(self.__spaceId, None, spacePath) except: BigWorld.releaseSpace(self.__spaceId) self.__spaceMappingId = None self.__spaceId = None LOG_CURRENT_EXCEPTION() return spacePathLC = spacePath.lower() if _HANGAR_CFGS.has_key(spacePathLC): self.__loadConfig(_CFG, _HANGAR_CFGS[spacePathLC], _CFG) self.__vEntityId = BigWorld.createEntity('HangarVehicle', self.__spaceId, 0, _CFG['v_start_pos'], (_CFG['v_start_angles'][2], _CFG['v_start_angles'][1], _CFG['v_start_angles'][0]), dict()) self.__vAppearance = _VehicleAppearance(self.__spaceId, self.__vEntityId, self) self.__yawCameraFilter = HangarCameraYawFilter(math.radians(_CFG['cam_yaw_constr'][0]), math.radians(_CFG['cam_yaw_constr'][1]), _CFG['cam_sens']) self.__setupCamera() distConstrs = _CFG['cam_dist_constr'] previewConstr = _CFG.get('preview_cam_dist_constr', distConstrs) if distConstrs is not None: if previewConstr is not None: self.__camDistConstr = (distConstrs, previewConstr) else: self.__camDistConstr = (distConstrs, distConstrs) else: self.__camDistConstr = ((0.0, 0.0), (0.0, 0.0)) self.__waitCallback = BigWorld.callback(0.1, self.__waitLoadingSpace) self.__destroyFunc = None MapActivities.g_mapActivities.generateOfflineActivities(spacePath) g_keyEventHandlers.add(self.handleKeyEvent) g_mouseEventHandlers.add(self.handleMouseEventGlobal) g_postProcessing.enable('hangar') BigWorld.pauseDRRAutoscaling(True) return
def entitiesFromChunk(sectionName): import ResMgr sects = ResMgr.openSection(sectionName) if sects != None: for sect in sects.values(): if sect.name == 'entity': type = sect.readString('type') pos = sect.readVector3('transform/row3') dict = {} for props in sect['properties'].values(): try: dict[str(props.name)] = eval(props.asString) except: dict[str(props.name)] = props.asString BigWorld.createEntity(type, BigWorld.player().spaceID, 0, pos, (0, 0, 0), dict) return
def create(self, isPremium, onSpaceLoadedCallback=None): global _EVENT_HANGAR_PATHS global _CFG global g_hangarInputHandler BigWorld.worldDrawEnabled(False) BigWorld.wg_setSpecialFPSMode() self.__onLoadedCallback = onSpaceLoadedCallback self.__spaceId = BigWorld.createSpace() type = self.getSpaceType(isPremium) _CFG = copy.copy(_DEFAULT_CFG[type]) spacePath = _DEFAULT_CFG[type]['path'] LOG_DEBUG( 'load hangar: hangar type = <{0:>s}>, space = <{1:>s}>'.format( type, spacePath)) if _EVENT_HANGAR_PATHS.has_key(isPremium): spacePath = _EVENT_HANGAR_PATHS[isPremium] safeSpacePath = _DEFAULT_CFG[type]['path'] if ResMgr.openSection(spacePath) is None: LOG_ERROR( 'Failed to load hangar from path: %s; default hangar will be loaded instead' % spacePath) spacePath = safeSpacePath try: self.__spaceMappingId = BigWorld.addSpaceGeometryMapping( self.__spaceId, None, spacePath) except: try: LOG_CURRENT_EXCEPTION() spacePath = safeSpacePath self.__spaceMappingId = BigWorld.addSpaceGeometryMapping( self.__spaceId, None, spacePath) except: BigWorld.releaseSpace(self.__spaceId) self.__spaceMappingId = None self.__spaceId = None LOG_CURRENT_EXCEPTION() return spacePathLC = spacePath.lower() if _HANGAR_CFGS.has_key(spacePathLC): self.__loadConfig(_CFG, _HANGAR_CFGS[spacePathLC], _CFG) self.__vEntityId = BigWorld.createEntity( 'OfflineEntity', self.__spaceId, 0, _CFG['v_start_pos'], (_CFG['v_start_angles'][2], _CFG['v_start_angles'][1], _CFG['v_start_angles'][0]), dict()) self.__vAppearance = _VehicleAppearance(self.__spaceId, self.__vEntityId) self.__setupCamera() self.__waitCallback = BigWorld.callback(0.1, self.__waitLoadingSpace) MapActivities.g_mapActivities.generateHangarActivities(spacePath) inputHandler = getattr(BigWorld.player(), 'inputHandler', None) if inputHandler is not None: self.__savedInputHandler = inputHandler g_hangarInputHandler.hangarSpace = weakref.proxy(self) BigWorld.player().inputHandler = g_hangarInputHandler return
def onEntityComponentAdded(self, entityComponent, transformComponent): scaleMatrix = math_utils.createRTMatrix( transformComponent.worldRotation, transformComponent.worldPosition) scaleMatrix.invert() scaleMatrix.preMultiply(transformComponent.worldTransform) scaleCoeffs = scaleMatrix.applyVector((1, 1, 1)) state = {'scale': scaleCoeffs} state.update(entityComponent.state) rotationRPY = Math.Vector3(transformComponent.worldTransform.roll, transformComponent.worldTransform.pitch, transformComponent.worldTransform.yaw) entityComponent.entityID = BigWorld.createEntity( entityComponent.entityClass.__name__, self.spaceID, 0, transformComponent.worldPosition, rotationRPY, state)
def create(self, isPremium, onSpaceLoadedCallback=None): global _CFG BigWorld.worldDrawEnabled(False) BigWorld.wg_setSpecialFPSMode() self.__onLoadedCallback = onSpaceLoadedCallback self.__spaceId = BigWorld.createSpace() isIGR = self.igrCtrl.getRoomType() == constants.IGR_TYPE.PREMIUM spacePath = _getHangarPath(isPremium, isIGR) spaceType = _getHangarType(isPremium) LOG_DEBUG( 'load hangar: hangar type = <{0:>s}>, space = <{1:>s}>'.format( spaceType, spacePath)) safeSpacePath = _getDefaultHangarPath(False) if ResMgr.openSection(spacePath) is None: LOG_ERROR( 'Failed to load hangar from path: %s; default hangar will be loaded instead' % spacePath) spacePath = safeSpacePath try: self.__spaceMappingId = BigWorld.addSpaceGeometryMapping( self.__spaceId, None, spacePath) except Exception: try: LOG_CURRENT_EXCEPTION() spacePath = safeSpacePath self.__spaceMappingId = BigWorld.addSpaceGeometryMapping( self.__spaceId, None, spacePath) except Exception: BigWorld.releaseSpace(self.__spaceId) self.__spaceMappingId = None self.__spaceId = None LOG_CURRENT_EXCEPTION() return spaceKey = _getHangarKey(spacePath) _CFG = copy.deepcopy(_HANGAR_CFGS[spaceKey]) self.__vEntityId = BigWorld.createEntity( 'HangarVehicle', self.__spaceId, 0, _CFG['v_start_pos'], (_CFG['v_start_angles'][2], _CFG['v_start_angles'][1], _CFG['v_start_angles'][0]), dict()) self.__cameraManager = HangarCameraManager(self.__spaceId) self.__cameraManager.init() self.__waitCallback = BigWorld.callback(0.1, self.__waitLoadingSpace) self.__gfxOptimizerMgr = GraphicsOptimizationManager() size = BigWorld.screenSize() self.__optimizerID = self.__gfxOptimizerMgr.registerOptimizationArea( 0, 0, size[0], size[1]) MapActivities.g_mapActivities.generateOfflineActivities(spacePath) BigWorld.pauseDRRAutoscaling(True) return
def addBotToArena(self, compactDescr, team, name): vDesc = getVehicleDesc(compactDescr, False) position, rotation = self._getBotPoint() vehicleID = BigWorld.createEntity('Vehicle', self.avatar.spaceID, 0, position, rotation, getEntityDesc(vDesc, team, name)) self.vehicles[vehicleID] = VehicleController(vehicleID, self) self.avatar.updateArena( ARENA_UPDATE.VEHICLE_ADDED, packVehicleArenaInfo(vehicleID, vehicleType=vDesc, name=name, team=team))
def __onFakeShadowLoaded(self, resourceRefs): fakeShadowModel = resourceRefs[_CFG['shadow_model_name']] shadowProxyNodes = [ udo for udo in BigWorld.userDataObjects.values() if isinstance(udo, TankHangarShadowProxy.TankHangarShadowProxy) ] if len(shadowProxyNodes) == 1: shadowProxy = shadowProxyNodes[0] shadowXFormPosition = shadowProxy.position shadowXFormOrientation = (shadowProxy.roll, shadowProxy.pitch, shadowProxy.yaw) else: LOG_DEBUG('Too many TankHangarShadowProxies? Or not enough.') return self.__fakeShadowId = BigWorld.createEntity('OfflineEntity', self.__spaceId, 0, shadowXFormPosition, shadowXFormOrientation, dict()) entity = BigWorld.entity(self.__fakeShadowId) entity.model = fakeShadowModel self.modifyFakeShadowScale(self.__fakeShadowScale) self.modifyFakeShadowAsset(self.__fakeShadowAsset)
def observerStart(self, connectionManager=None, lobbyContext=None): LOG_DEBUG('Observer Start') self.isStarted = True # constants.IS_DEVELOPMENT = True self.lobbyContext.setServerSettings( {'roamingSettings': [0, 0, [], []]}) BigWorld.clearEntitiesAndSpaces() self.connectionManager.onConnected() LOG_DEBUG('createEntity') BigWorld.worldDrawEnabled(False) LOG_DEBUG( BigWorld.createEntity('Avatar', BigWorld.createSpace(), 0, (0, 0, 0), (0, 0, 0), {}))
def create(self, isPremium, onSpaceLoadedCallback = None): global _EVENT_HANGAR_PATHS global _CFG global g_hangarInputHandler BigWorld.worldDrawEnabled(False) BigWorld.wg_setSpecialFPSMode() self.__onLoadedCallback = onSpaceLoadedCallback self.__spaceId = BigWorld.createSpace() type = self.getSpaceType(isPremium) _CFG = copy.copy(_DEFAULT_CFG[type]) spacePath = _DEFAULT_CFG[type]['path'] LOG_DEBUG('load hangar: hangar type = <{0:>s}>, space = <{1:>s}>'.format(type, spacePath)) if _EVENT_HANGAR_PATHS.has_key(isPremium): spacePath = _EVENT_HANGAR_PATHS[isPremium] safeSpacePath = _DEFAULT_CFG[type]['path'] if ResMgr.openSection(spacePath) is None: LOG_ERROR('Failed to load hangar from path: %s; default hangar will be loaded instead' % spacePath) spacePath = safeSpacePath try: self.__spaceMappingId = BigWorld.addSpaceGeometryMapping(self.__spaceId, None, spacePath) except: try: LOG_CURRENT_EXCEPTION() spacePath = safeSpacePath self.__spaceMappingId = BigWorld.addSpaceGeometryMapping(self.__spaceId, None, spacePath) except: BigWorld.releaseSpace(self.__spaceId) self.__spaceMappingId = None self.__spaceId = None LOG_CURRENT_EXCEPTION() return spacePathLC = spacePath.lower() if _HANGAR_CFGS.has_key(spacePathLC): self.__loadConfig(_CFG, _HANGAR_CFGS[spacePathLC], _CFG) self.__vEntityId = BigWorld.createEntity('OfflineEntity', self.__spaceId, 0, _CFG['v_start_pos'], (_CFG['v_start_angles'][2], _CFG['v_start_angles'][1], _CFG['v_start_angles'][0]), dict()) self.__vAppearance = _VehicleAppearance(self.__spaceId, self.__vEntityId) self.__setupCamera() self.__waitCallback = BigWorld.callback(0.1, self.__waitLoadingSpace) MapActivities.g_mapActivities.generateHangarActivities(spacePath) inputHandler = getattr(BigWorld.player(), 'inputHandler', None) if inputHandler is not None: self.__savedInputHandler = inputHandler g_hangarInputHandler.hangarSpace = weakref.proxy(self) BigWorld.player().inputHandler = g_hangarInputHandler return
def create(self, isPremium, onSpaceLoadedCallback=None): global _EVENT_HANGAR_PATHS global _CFG BigWorld.worldDrawEnabled(False) BigWorld.wg_setSpecialFPSMode() self.__onLoadedCallback = onSpaceLoadedCallback self.__spaceId = BigWorld.createSpace() type = getSpaceType(isPremium) _CFG = copy.copy(_DEFAULT_CFG[type]) spacePath = _DEFAULT_CFG[type]['path'] LOG_DEBUG( 'load hangar: hangar type = <{0:>s}>, space = <{1:>s}>'.format( type, spacePath)) visibilityMask = 4294967295L if self.igrCtrl.getRoomType() == constants.IGR_TYPE.PREMIUM: if _CFG.get(self.__igrHangarPathKey) is not None: spacePath = _CFG[self.__igrHangarPathKey] if isPremium in _EVENT_HANGAR_PATHS: spacePath = _EVENT_HANGAR_PATHS[isPremium] if isPremium in _EVENT_HANGAR_VISIBILITY_MASK: visibilityMask = _EVENT_HANGAR_VISIBILITY_MASK[isPremium] safeSpacePath = _DEFAULT_CFG[type]['path'] if ResMgr.openSection(spacePath) is None: LOG_ERROR( 'Failed to load hangar from path: %s; default hangar will be loaded instead' % spacePath) spacePath = safeSpacePath visibilityMask = 4294967295L BigWorld.wg_setSpaceItemsVisibilityMask(self.__spaceId, visibilityMask) try: self.__spaceMappingId = BigWorld.addSpaceGeometryMapping( self.__spaceId, None, spacePath) except: try: LOG_CURRENT_EXCEPTION() spacePath = safeSpacePath self.__spaceMappingId = BigWorld.addSpaceGeometryMapping( self.__spaceId, None, spacePath) except: BigWorld.releaseSpace(self.__spaceId) self.__spaceMappingId = None self.__spaceId = None LOG_CURRENT_EXCEPTION() return spacePathLC = spacePath.lower() if spacePathLC in _HANGAR_CFGS: loadConfig(_CFG, _HANGAR_CFGS[spacePathLC], _CFG) self.__vEntityId = BigWorld.createEntity( 'HangarVehicle', self.__spaceId, 0, _CFG['v_start_pos'], (_CFG['v_start_angles'][2], _CFG['v_start_angles'][1], _CFG['v_start_angles'][0]), dict()) self.__vAppearance = _VehicleAppearance(self.__spaceId, self.__vEntityId, self) self.__yawCameraFilter = HangarCameraYawFilter( math.radians(_CFG['cam_yaw_constr'][0]), math.radians(_CFG['cam_yaw_constr'][1]), _CFG['cam_sens']) self.__setupCamera() distConstrs = _CFG['cam_dist_constr'] previewConstr = _CFG.get('preview_cam_dist_constr', distConstrs) if distConstrs is not None: if previewConstr is not None: self.__camDistConstr = (distConstrs, previewConstr) else: self.__camDistConstr = (distConstrs, distConstrs) else: self.__camDistConstr = ((0.0, 0.0), (0.0, 0.0)) self.__waitCallback = BigWorld.callback(0.1, self.__waitLoadingSpace) self.__destroyFunc = None MapActivities.g_mapActivities.generateOfflineActivities(spacePath) g_keyEventHandlers.add(self.handleKeyEvent) g_mouseEventHandlers.add(self.handleMouseEventGlobal) g_postProcessing.enable('hangar') BigWorld.pauseDRRAutoscaling(True) return
def createFakeAvatar(): entityID = BigWorld.createEntity('OfflineEntity', BigWorld.camera().spaceID, 0, (0, 0, 0), (0, 0, 0), {}) entity = BigWorld.entity(entityID) BigWorld.player = lambda: entity
def testAllocate(spaceID): import items.vehicles vehicleDesc = items.vehicles.VehicleDescr(typeName=items.vehicles.g_cache.vehicle(0, 1).name) entityId = BigWorld.createEntity('OfflineEntity', spaceID, 0, BigWorld.camera().position, (0, 0, 0), dict()) return CrashedTrackController(vehicleDesc, BigWorld.entity(entityId))