DayZ
1.29
DayZ Explorer by KGB
Загрузка...
Поиск...
Не найдено
Wreck_SantasSleigh.c
См. документацию.
1
//Christmas Event: Santa's Sleigh
2
class
Wreck_SantasSleigh
extends
CrashBase
3
{
4
XmasSleighLight
m_SleighLight
;
5
6
int
m_MaxDeersAmount
= 4;
7
int
m_MinDeersAmount
= 2;
8
int
m_MaxDeersSpawnRange
= 25;
9
int
m_MinDeersSpawnRange
= 5;
10
11
void
Wreck_SantasSleigh
()
12
{
13
if
(!
g_Game
.IsDedicatedServer())
14
{
15
//particles - Aurora trail
16
m_ParticleEfx =
ParticleManager
.GetInstance().PlayOnObject(
ParticleList
.
AURORA_SANTA_WRECK
,
this
,
vector
.
Zero
,
vector
.
Zero
,
true
);
17
18
//lights - green light
19
m_SleighLight
= XmasSleighLight.Cast(
ScriptedLightBase
.CreateLight(XmasSleighLight,
vector
.
Zero
));
20
m_SleighLight
.AttachOnMemoryPoint(
this
,
"light"
);
21
}
22
}
23
24
// needs to have the soundset registered in CrashBase.Init()
25
override
string
GetSoundSet
()
26
{
27
return
"SledgeCrash_Distant_SoundSet"
;
28
}
29
30
override
void
EEOnCECreate
()
31
{
32
super.EEOnCECreate();
33
SpawnRandomDeerLater
();
34
}
35
36
override
void
EEDelete
(
EntityAI
parent)
37
{
38
super.EEDelete(parent);
39
40
if
( !
g_Game
.IsDedicatedServer() )
41
{
42
if
(
m_SleighLight
)
43
m_SleighLight
.Destroy();
44
}
45
}
46
47
void
SpawnRandomDeerLater
()
48
{
49
//SpawnRandomDeers();
50
g_Game
.GetCallQueue(
CALL_CATEGORY_GAMEPLAY
).CallLater(
SpawnRandomDeers
, 0);
51
}
52
53
//Spawn a random amount of (dead) deers around the sleigh
54
void
SpawnRandomDeers
()
55
{
56
EntityAI
deer;
57
vector
crash_pos =
GetPosition
();
58
59
int
deersAmount =
Math
.
RandomIntInclusive
(
m_MinDeersAmount
,
m_MaxDeersAmount
);
60
61
for
(
int
i = 0; i <
m_MaxDeersAmount
; i++)
62
{
63
vector
deer_pos =
RandomizePosition
(crash_pos);
64
deer =
EntityAI
.Cast(
g_Game
.CreateObject(
"Animal_RangiferTarandus"
, deer_pos,
false
,
true
));
65
deer.SetHealth01(
""
,
""
, 0);
66
vector
orientation = deer.GetOrientation();
67
deer.SetOrientation(
Vector
(
Math
.
RandomIntInclusive
(0,360),orientation[1],orientation[2]));
68
}
69
70
//spawns xmas reindeer
71
deer_pos =
RandomizePosition
(crash_pos);
72
deer =
EntityAI
.Cast(
g_Game
.CreateObject(
"Animal_RangiferTarandus_Xmas"
, deer_pos,
false
,
true
));
73
deer.SetHealth01(
""
,
""
, 0);
74
vector
redorientation = deer.GetOrientation();
75
deer.SetOrientation(
Vector
(
Math
.
RandomIntInclusive
(0,360),redorientation[1],redorientation[2]));
76
77
}
78
79
//Return a new vector scattered around origin.
80
vector
RandomizePosition
(
vector
origin)
81
{
82
int
randX;
83
int
randZ;
84
85
randX =
Math
.
RandomIntInclusive
(
m_MinDeersSpawnRange
,
m_MaxDeersSpawnRange
);
86
if
(
Math
.
RandomIntInclusive
(0,1) < 1)
87
randX = -randX;
88
89
randZ =
Math
.
RandomIntInclusive
(
m_MinDeersSpawnRange
,
m_MaxDeersSpawnRange
);
90
if
(
Math
.
RandomIntInclusive
(0,1) < 1)
91
randZ = -randZ;
92
93
origin[0] = origin[0] + randX;
94
origin[2] = origin[2] + randZ;
95
96
return
origin;
97
98
}
99
}
g_Game
DayZGame g_Game
Определения
DayZGame.c:3942
RandomizePosition
void RandomizePosition()
Определения
MapNavigationBehaviour.c:93
ParticleManager
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
Определения
ParticleManager.c:88
CrashBase::GetSoundSet
override string GetSoundSet()
Определения
Wreck_SantasSleigh.c:25
CrashBase::m_MinDeersSpawnRange
int m_MinDeersSpawnRange
Определения
Wreck_SantasSleigh.c:9
CrashBase::SpawnRandomDeers
void SpawnRandomDeers()
Определения
Wreck_SantasSleigh.c:54
CrashBase::RandomizePosition
vector RandomizePosition(vector origin)
Определения
Wreck_SantasSleigh.c:80
CrashBase::EEDelete
override void EEDelete(EntityAI parent)
Определения
Wreck_SantasSleigh.c:36
CrashBase::EEOnCECreate
override void EEOnCECreate()
Определения
Wreck_SantasSleigh.c:30
CrashBase::m_SleighLight
XmasSleighLight m_SleighLight
Определения
Wreck_SantasSleigh.c:4
CrashBase::SpawnRandomDeerLater
void SpawnRandomDeerLater()
Определения
Wreck_SantasSleigh.c:47
CrashBase::m_MinDeersAmount
int m_MinDeersAmount
Определения
Wreck_SantasSleigh.c:7
CrashBase::Wreck_SantasSleigh
void Wreck_SantasSleigh()
Определения
Wreck_SantasSleigh.c:11
CrashBase::m_MaxDeersAmount
int m_MaxDeersAmount
Определения
Wreck_SantasSleigh.c:6
CrashBase::m_MaxDeersSpawnRange
int m_MaxDeersSpawnRange
Определения
Wreck_SantasSleigh.c:8
CrashBase
Определения
Wreck_MI8.c:3
EntityAI
Определения
3_Game/DayZ/Entities/InventoryItem.c:2
Math
Определения
EnMath.c:7
ParticleList::AURORA_SANTA_WRECK
static const int AURORA_SANTA_WRECK
Определения
ParticleList.c:274
ParticleList
Определения
ParticleList.c:12
ScriptedLightBase
Определения
PointLightBase.c:2
vector::Zero
static const vector Zero
Определения
EnConvert.c:123
vector
Определения
EnConvert.c:119
Vector
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
Math::RandomIntInclusive
static int RandomIntInclusive(int min, int max)
Returns a random int number between and min [inclusive] and max [inclusive].
Определения
EnMath.c:54
GetPosition
vector GetPosition()
Get the world position of the Effect.
Определения
Effect.c:473
CALL_CATEGORY_GAMEPLAY
const int CALL_CATEGORY_GAMEPLAY
Определения
3_Game/DayZ/tools/tools.c:10
Ishodniki
scripts
4_World
DayZ
Entities
Building
Wrecks
Wreck_SantasSleigh.c
Создано системой
1.13.2