Objects database notes

From Post-Apocalyptic RPG wiki

Jump to: navigation, search

Class design.png This article covers outdated class design information!

Class design articles are stored at the wiki for legacy reasons. Most of them are outdated and they will not be updated in the future. Class design should rather be embedded into actual Code proposals.

Info that we currently store about objects

attribute relevant to class or instance currently stored in
map image/anim class object xml includes
id instance map xml
weight class code
bulk class code
capacity class code
is_open, locked instance/class map xml
dialog instance/class map xml
door target instance map xml
name class/instance map xml
object type instance map xml
description text class/instance map xml
coords instance map xml
dialog yml instance/class map xml

Reference to object DB can be injected to either createObject in scripts/objects/__init__.py or createObject in engine.py. Second seems to be preferable. The idea is to use object DB to detect object's python class (by default equal to object type, but several types can be of the same python class) and default attribute values which can be overridden with values passed as parameters to createObject.

Candidates for being moved to objects xml/yaml db:

attribute object classes notes
type all primary key; this contains the object type e.g. "rusty .44 magnum pistol" or "reinforced crate"
python_class all many object types may share the same python_class as long as their behaviour model is the same (only attributes differ)
name all name will typically be the same for all the objects of the same type; if custom name is needed it can be specified in the map file
description all see name
weight carryable only
bulk carryable only
inventory image carryable only
capacity container only
is_open openable only
locked lockable only
## Example YAML
OBJECT: dagger
  name: dagger
  description: A handmade dagger. Ugly thing, but still deadly in skilled hands.
  weight: 0.3
  bulk: very_small    #corresponding numerical value = 3^1
  inventory_image: gui/inv_images/inv_litem.png
Personal tools