Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
blob: d6e72c943d40e34a592777add817d65ce839a882 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*
   base/cargopod.cc
   This file is part of the Osirion project and is distributed under
   the terms and conditions of the GNU General Public License version 2
*/

#include "base/cargopod.h"
#include "base/game.h"

namespace game
{

const Template *CargoPod::cargopod_template = 0;

CargoPod::CargoPod() : EntityDynamic()
{
	entity_moduletypeid = cargopod_enttype;
	set_name("Cargo pod");
	set_label("cargopod");
		
	set_flag(core::Entity::KeepAlive);
	
	// setting radius to 0 allows it to be set by the template
	set_radius(0);
	
	// use template settings if available
	if (cargopod_template) {
		cargopod_template->apply(this);
	}
	
	// radius fallback
	if (!radius()) {
		if (model()->radius()) {
			set_radius(model()->radius());
		} else {
			set_radius(0.1f);
		}
	}
		
	// activate physics
	set_mass(radius());
	reset();
	
	// increased dampening for cargo pods
	const float damp = Game::g_damping->value();
	body()->setDamping(damp * 2.0f, damp * 2.0f);
}

CargoPod::~CargoPod()
{

}

void CargoPod::upkeep(const unsigned long timestamp)
{
	// cargo pods dissapear on upkeep
	die();
}

} // namespace game