__vehiclemanager (version 1.10)
index
d:\cruisecontrol\game-client-system\game\scripts\__vehiclemanager.py

VehicleManager handles everything related to an vehicle. It creates, destroys (static and dynamic)
instances of the vehicle. It manages changing parts and the clients vehicle parts that he currently
has available to him.
This class does not handle:
- purchasing
- exchangin parts with other players
- sponsoring system
- vehicle parts (resource) information

 
Modules
       
PhysicsManager
SceneManager
SystemHandler
settings
unittest
xmlrpclib

 
Classes
       
exceptions.Exception(exceptions.BaseException)
VehicleManagerError
unittest.TestCase(__builtin__.object)
TestVehicleManager

 
class TestVehicleManager(unittest.TestCase)
    
Method resolution order:
TestVehicleManager
unittest.TestCase
__builtin__.object

Methods defined here:
setTestVehicleData(self)
testLoadDynamicVehicle(self)
VehicleManager and retraving dynamic vehicles from server, then destroy them
testLoadPlayerParts(self)
VehicleManager and retraving all player parts information from server
testLoadStaticVehicle(self)
VehicleManager and retraving static vehicles from server, then destroy them
testLoadVehicles(self)
VehicleManager and retraving all vehicles information from server

Methods inherited from unittest.TestCase:
__call__(self, *args, **kwds)
__init__(self, methodName='runTest')
Create an instance of the class that will use the named test
method when executed. Raises a ValueError if the instance does
not have a method with the specified name.
__repr__(self)
__str__(self)
assertAlmostEqual = failUnlessAlmostEqual(self, first, second, places=7, msg=None)
Fail if the two objects are unequal as determined by their
difference rounded to the given number of decimal places
(default 7) and comparing to zero.
 
Note that decimal places (from zero) are usually not the same
as significant digits (measured from the most signficant digit).
assertAlmostEquals = failUnlessAlmostEqual(self, first, second, places=7, msg=None)
Fail if the two objects are unequal as determined by their
difference rounded to the given number of decimal places
(default 7) and comparing to zero.
 
Note that decimal places (from zero) are usually not the same
as significant digits (measured from the most signficant digit).
assertEqual = failUnlessEqual(self, first, second, msg=None)
Fail if the two objects are unequal as determined by the '=='
operator.
assertEquals = failUnlessEqual(self, first, second, msg=None)
Fail if the two objects are unequal as determined by the '=='
operator.
assertFalse = failIf(self, expr, msg=None)
Fail the test if the expression is true.
assertNotAlmostEqual = failIfAlmostEqual(self, first, second, places=7, msg=None)
Fail if the two objects are equal as determined by their
difference rounded to the given number of decimal places
(default 7) and comparing to zero.
 
Note that decimal places (from zero) are usually not the same
as significant digits (measured from the most signficant digit).
assertNotAlmostEquals = failIfAlmostEqual(self, first, second, places=7, msg=None)
Fail if the two objects are equal as determined by their
difference rounded to the given number of decimal places
(default 7) and comparing to zero.
 
Note that decimal places (from zero) are usually not the same
as significant digits (measured from the most signficant digit).
assertNotEqual = failIfEqual(self, first, second, msg=None)
Fail if the two objects are equal as determined by the '=='
operator.
assertNotEquals = failIfEqual(self, first, second, msg=None)
Fail if the two objects are equal as determined by the '=='
operator.
assertRaises = failUnlessRaises(self, excClass, callableObj, *args, **kwargs)
Fail unless an exception of class excClass is thrown
by callableObj when invoked with arguments args and keyword
arguments kwargs. If a different type of exception is
thrown, it will not be caught, and the test case will be
deemed to have suffered an error, exactly as for an
unexpected exception.
assertTrue = failUnless(self, expr, msg=None)
Fail the test unless the expression is true.
assert_ = failUnless(self, expr, msg=None)
Fail the test unless the expression is true.
countTestCases(self)
debug(self)
Run the test without collecting errors in a TestResult
defaultTestResult(self)
fail(self, msg=None)
Fail immediately, with the given message.
failIf(self, expr, msg=None)
Fail the test if the expression is true.
failIfAlmostEqual(self, first, second, places=7, msg=None)
Fail if the two objects are equal as determined by their
difference rounded to the given number of decimal places
(default 7) and comparing to zero.
 
Note that decimal places (from zero) are usually not the same
as significant digits (measured from the most signficant digit).
failIfEqual(self, first, second, msg=None)
Fail if the two objects are equal as determined by the '=='
operator.
failUnless(self, expr, msg=None)
Fail the test unless the expression is true.
failUnlessAlmostEqual(self, first, second, places=7, msg=None)
Fail if the two objects are unequal as determined by their
difference rounded to the given number of decimal places
(default 7) and comparing to zero.
 
Note that decimal places (from zero) are usually not the same
as significant digits (measured from the most signficant digit).
failUnlessEqual(self, first, second, msg=None)
Fail if the two objects are unequal as determined by the '=='
operator.
failUnlessRaises(self, excClass, callableObj, *args, **kwargs)
Fail unless an exception of class excClass is thrown
by callableObj when invoked with arguments args and keyword
arguments kwargs. If a different type of exception is
thrown, it will not be caught, and the test case will be
deemed to have suffered an error, exactly as for an
unexpected exception.
id(self)
run(self, result=None)
setUp(self)
Hook method for setting up the test fixture before exercising it.
shortDescription(self)
Returns a one-line description of the test, or None if no
description has been provided.
 
The default implementation of this method returns the first line of
the specified test method's docstring.
tearDown(self)
Hook method for deconstructing the test fixture after testing it.

Data descriptors inherited from unittest.TestCase:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes inherited from unittest.TestCase:
failureException = <type 'exceptions.AssertionError'>
Assertion failed.

 
class VehicleManagerError(exceptions.Exception)
    
Method resolution order:
VehicleManagerError
exceptions.Exception
exceptions.BaseException
__builtin__.object

Data descriptors defined here:
__weakref__
list of weak references to the object (if defined)

Methods inherited from exceptions.Exception:
__init__(...)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Data and other attributes inherited from exceptions.Exception:
__new__ = <built-in method __new__ of type object at 0x1E1CABE0>
T.__new__(S, ...) -> a new object with type S, a subtype of T

Methods inherited from exceptions.BaseException:
__delattr__(...)
x.__delattr__('name') <==> del x.name
__getattribute__(...)
x.__getattribute__('name') <==> x.name
__getitem__(...)
x.__getitem__(y) <==> x[y]
__reduce__(...)
__repr__(...)
x.__repr__() <==> repr(x)
__setattr__(...)
x.__setattr__('name', value) <==> x.name = value
__setstate__(...)
__str__(...)
x.__str__() <==> str(x)

Data descriptors inherited from exceptions.BaseException:
__dict__
args
message
exception message

 
Functions
       
getDynamicVehicle(playerName, vehicleName, instanceName, useEffects=False)
Returns a dynamic vehicle beloning to user having alias 'playerName' and vehicle id is 'vehicleName'. 
By a dynamic vehicle we mean a vehicle that is interactive and drivable. This is the drivable car.
Raises VehicleManagerError if playerName does not exist or the player does not have vehicle 'vehicleName'
getPartTypes(type=None)
Returns all the part types from server if type is not None. Else we return only that defined part type. 
Where type is one of these: "engine", "tire", "chassis", "brake", "suspension", "steer", "axis".
Raises VehicleManagerError if type is not supported.
Returns in the format if None {<type>:{<name>:{<info>},<name>:{<info>}} } else {<name>:{<info>},<name>:{<info>}}
getStaticVehicle(playerName, vehicleName, instanceName)
Returns a static vehicle beloning to user having alias 'playerName' and vehicle id is 'vehicleName'. 
By static we mean a vehicle that does not interact with the enviroment (no physical representation) 
only using graphical entities to represent its parts.
The main idea is to use it in garage or for eye candy.
Raises VehicleManagerError if playerName does not exist or the player does not have vehicle 'vehicleName'
getVehicleNames(forceUpdate=False)
Returns an list of vehicles available to the player
getVehiclePartTypes()
Returns an list of the different parts names used on the vehicle .
getVehicleProperties(playerName, vehicleName)
Returns dictionary of vehicle data according to the world server. This is used to create
different players vehicles.
The playerName is an player in our game world vehicleName is the name of our vehicle we want information on
Returns None if vehicleName does not exist or is not owned by player 'playerName'.
isVehicleLoaded(vehicleName)
Checks if an vehicle (either physical or static) is loaded into the system
setVehicleProperty(vehicleName, type, partName)
Sets the property of type to part on vehicle vehicleName. Where part and type
is a name identifiers known by the server.
It will then retreave the entire definition of the vehicle and replace the currently 
loaded one.
The vehicleName must be the name of an "owned" vehicle by the user.
Supported types are 'axis', 'suspension', 'chassi', 'engine', 'tire', 'brake', 'steering'. 
Supported names are dependent on defined names owned by user.
Raises VehicleManagerError if vehicleName, type or part is not recoginzed or not owned by the user.

 
Data
        __author__ = 'Kjartan A Jonsson'
__copyright__ = 'Copyright (c) 2007 aGameCompany'
__license__ = 'aGameCompany'
__version__ = '$Revision: 1.10 $'

 
Author
        Kjartan A Jonsson