Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
staticflagpole.c
Go to the documentation of this file.
1/*
2For use in events/by modders, not part of standard gameplay
3Example object spawner json use:
4
5{
6 "Objects": [
7 {
8 "name": "StaticFlagPole",
9 "pos": [
10 3000,
11 57,
12 3000
13 ],
14 "ypr": [
15 0.0,
16 0.0,
17 0.0
18 ],
19 "scale": 1,
20 "customString": "Flag_Bohemia"
21 }
22 ]
23}
24
25*/
26
27class StaticFlagPole extends TerritoryFlag
28{
29 override void OnPartDismantledServer( notnull Man player, string part_name, int action_id )
30 {
31 }
32
33 override void OnPartDestroyedServer( Man player, string part_name, int action_id, bool destroyed_by_connected_part = false )
34 {
35 }
36
37 override void OnSpawnByObjectSpawner(ITEM_SpawnerObject item)
38 {
39 FullyBuild();
40
41 if (item.customString != string.Empty)
42 {
43 EntityAI flag = GetInventory().CreateInInventory(item.customString);
44 if (flag)
45 {
46 AnimateFlagEx(0);
47 AddRefresherTime01(1);
48 }
49 }
50 }
51
52 // version of FullyBuild which does not require a player
53 override void FullyBuild()
54 {
55 array<ConstructionPart> parts = GetConstruction().GetConstructionParts().GetValueArray();
56
57 foreach (ConstructionPart part : parts)
58 {
59 ConstructionPart construtionPart = GetConstruction().GetConstructionPart(part.GetPartName());
60
61 if (construtionPart.IsBase())
62 {
63 SetBaseState(true);
65 }
66
67 RegisterPartForSync(construtionPart.GetId());
68 RegisterActionForSync(construtionPart.GetId(), AT_BUILD_PART);
70 SetPartFromSyncData(construtionPart); // server part of sync, client will be synced from SetPartsFromSyncData
73 GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(ResetActionSyncData, 100, false, this);
74 }
75
76 GetConstruction().UpdateVisuals();
77 }
78}
const int AT_BUILD_PART
Definition _constants.c:6
void FullyBuild()
void UpdateNavmesh()
void RegisterPartForSync(int part_id)
void RegisterActionForSync(int part_id, int action_id)
void ResetActionSyncData()
void OnPartDismantledServer(notnull Man player, string part_name, int action_id)
Construction GetConstruction()
void OnPartDestroyedServer(Man player, string part_name, int action_id, bool destroyed_by_connected_part=false)
void SetPartFromSyncData(ConstructionPart part)
ItemBase CreateConstructionKit()
void SynchronizeBaseState()
void SetBaseState(bool has_base)
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
void UpdateVisuals()
proto native CGame GetGame()
const int CALL_CATEGORY_GAMEPLAY
Definition tools.c:10