blob: 10c9fe5800189129c06565cb7434b90ec76fd5f7 (
plain) (
blame)
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
62
|
// Minecart.cpp
// Implements the cMinecart class representing a minecart in the world
#include "Globals.h"
#include "Minecart.h"
#include "World.h"
#include "ClientHandle.h"
cMinecart::cMinecart(ePayload a_Payload, double a_X, double a_Y, double a_Z) :
super(etMinecart, a_X, a_Y, a_Z),
m_Payload(a_Payload)
{
}
void cMinecart::Initialize(cWorld * a_World)
{
super::Initialize(a_World);
a_World->BroadcastSpawn(*this);
}
void cMinecart::SpawnOn(cClientHandle & a_ClientHandle)
{
char Type = 0;
switch (m_Payload)
{
case mpNone: Type = 10; break;
case mpChest: Type = 11; break;
case mpFurnace: Type = 12; break;
default:
{
ASSERT(!"Unknown payload, cannot spawn on client");
return;
}
}
a_ClientHandle.SendSpawnVehicle(*this, Type);
}
void cMinecart::Tick(float a_Dt, MTRand & a_TickRandom)
{
// TODO: the physics
}
|