Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
watchtowerkit.c
Go to the documentation of this file.
1 class WatchtowerKit extends KitBase
2 {
3  override bool CanReceiveAttachment(EntityAI attachment, int slotId)
4  {
5  ItemBase att = ItemBase.Cast(GetInventory().FindAttachment(slotId));
6  if (att)
7  return false;
8 
9  return super.CanReceiveAttachment(attachment, slotId);
10  }
11 
12  //================================================================
13  // ADVANCED PLACEMENT
14  //================================================================
15 
16  override void OnPlacementComplete( Man player, vector position = "0 0 0", vector orientation = "0 0 0" )
17  {
18  super.OnPlacementComplete( player, position, orientation );
19 
20  if ( GetGame().IsServer() )
21  {
22  //Create watchtower
23  Watchtower watchtower = Watchtower.Cast( GetGame().CreateObjectEx( "Watchtower", GetPosition(), ECE_PLACE_ON_SURFACE ) );
24  watchtower.SetPosition( position );
25  watchtower.SetOrientation( orientation );
26 
27  //make the kit invisible, so it can be destroyed from deploy UA when action ends
28  HideAllSelections();
29 
30  SetIsDeploySound( true );
31  }
32  }
33 
34  override bool DoPlacingHeightCheck()
35  {
36  return true;
37  }
38 
39  override float HeightCheckOverride()
40  {
41  return 2.83;//9.56;
42  }
43 
44  override void DisassembleKit(ItemBase item)
45  {
46  if (!IsHologram())
47  {
48  ItemBase stick = ItemBase.Cast(GetGame().CreateObjectEx("WoodenStick",GetPosition(),ECE_PLACE_ON_SURFACE));
49  MiscGameplayFunctions.TransferItemProperties(this, stick);
50  stick.SetQuantity(4);
51  Rope rope = Rope.Cast(item);
52  CreateRope(rope);
53  }
54  }
55 
56  //Debug menu Spawn Ground Special
57  override void OnDebugSpawn()
58  {
59  SpawnEntityOnGroundPos("Shovel", GetPosition());
60  SpawnEntityOnGroundPos("Hammer", GetPosition());
61  SpawnEntityOnGroundPos("Hammer", GetPosition());
62  SpawnEntityOnGroundPos("Hammer", GetPosition());
63  SpawnEntityOnGroundPos("Hammer", GetPosition());
64  SpawnEntityOnGroundPos("Pliers", GetPosition());
65 
66  for (int i0 = 0; i0 < 30; i0++)
67  {
68  SpawnEntityOnGroundPos("WoodenPlank", GetPosition());
69  }
70 
71  for (int i1 = 0; i1 < 10; i1++)
72  {
73  SpawnEntityOnGroundPos("WoodenLog", GetPosition());
74  }
75 
76  for (int i2 = 0; i2 < 15; i2++)
77  {
78  SpawnEntityOnGroundPos("Nail", GetPosition());
79  }
80 
81  for (int i3 = 0; i3 < 9; i3++)
82  {
83  SpawnEntityOnGroundPos("CamoNet", GetPosition());
84  }
85 
86  for (int i4 = 0; i4 < 6; i4++)
87  {
88  SpawnEntityOnGroundPos("BarbedWire", GetPosition());
89  }
90  }
91 }
ItemBase
Definition: inventoryitem.c:730
GetGame
proto native CGame GetGame()
KitBase
Definition: fencekit.c:1
DoPlacingHeightCheck
override bool DoPlacingHeightCheck()
Definition: trap_smallfish.c:186
SetIsDeploySound
void SetIsDeploySound(bool is_deploy_sound)
Definition: itembase.c:4293
ECE_PLACE_ON_SURFACE
const int ECE_PLACE_ON_SURFACE
Definition: centraleconomy.c:37
OnPlacementComplete
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
Definition: explosivesbase.c:133
OnDebugSpawn
class Hatchback_02_Blue extends Hatchback_02 OnDebugSpawn
Definition: hatchback_02.c:404
GetPosition
class JsonUndergroundAreaTriggerData GetPosition
Definition: undergroundarealoader.c:9
vector
Definition: enconvert.c:105
IsHologram
override bool IsHologram()
Definition: itembase.c:962
CanReceiveAttachment
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
Definition: basebuildingbase.c:895
EntityAI
Definition: building.c:5