diff options
author | Stijn Buys <ingar@osirion.org> | 2010-11-13 18:42:15 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2010-11-13 18:42:15 +0000 |
commit | 8506f3a8af135c55fdf9adae2859dfa210a2aa0f (patch) | |
tree | d952fcefb529159fde6d49d3b77c0275341b9019 /src/game/base/shipmodel.cc | |
parent | a2c7b459910ca386117cc115a40da77be5224225 (diff) |
adds a ship key for world entities which applies ship model settings to a world entity
Diffstat (limited to 'src/game/base/shipmodel.cc')
-rw-r--r-- | src/game/base/shipmodel.cc | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/game/base/shipmodel.cc b/src/game/base/shipmodel.cc index d9a9ed7..412fd14 100644 --- a/src/game/base/shipmodel.cc +++ b/src/game/base/shipmodel.cc @@ -339,4 +339,38 @@ void ShipModel::buy(core::EntityControlable *buyer, core::Entity *seller) } +void ShipModel::apply(core::Entity *entity) const +{ + // apply template settings if available + if (model_template()) + model_template()->apply(entity); + + // apply entity settings + if (label().size()) + entity->set_label(label()); + + if (name().size()) + entity->set_name(name()); + + if (modelname().size()) + entity->set_modelname(modelname()); + + if (radius()) + entity->set_radius(radius()); +} + +void ShipModel::apply(Ship *ship) const +{ + // apply ship model settings + apply (static_cast<core::Entity *>(ship)); + + ship->set_mass(mass()); + ship->set_impulse_force(impulse_force()); + ship->set_thrust_force(thrust_force()); + ship->set_strafe_force(strafe_force()); + ship->set_turn_force(turn_force()); + ship->set_roll_force(roll_force()); + ship->set_jumpdrive(jumpdrive()); +} + } |