Dayz  1.11.153731
Dayz Code Explorer by Zeroy
FenceKit.c
Go to the documentation of this file.
1 class FenceKit extends KitBase
2 {
3  override bool CanReceiveAttachment(EntityAI attachment, int slotId)
4  {
5  if ( !super.CanReceiveAttachment(attachment, slotId) )
6  return false;
7 
8  ItemBase att = ItemBase.Cast(GetInventory().FindAttachment(slotId));
9  if (att)
10  return false;
11 
12  return true;
13  }
14 
15  //================================================================
16  // ADVANCED PLACEMENT
17  //================================================================
18 
19  override void OnPlacementComplete( Man player, vector position = "0 0 0", vector orientation = "0 0 0" )
20  {
21  super.OnPlacementComplete( player, position, orientation );
22 
23  if ( GetGame().IsServer() )
24  {
25  //Create fence
26 
27  Fence fence = Fence.Cast( GetGame().CreateObjectEx( "Fence", GetPosition(), ECE_PLACE_ON_SURFACE ) );
28  fence.SetPosition( position );
29  fence.SetOrientation( orientation );
30 
31  //make the kit invisible, so it can be destroyed from deploy UA when action ends
33 
34  SetIsDeploySound( true );
35  }
36  }
37 
38  override bool DoPlacingHeightCheck()
39  {
40  return true;
41  }
42 
43  override float HeightCheckOverride()
44  {
45  return 2.54;
46  }
47 
48  override void DisassembleKit(ItemBase item)
49  {
50  if (!IsHologram())
51  {
52  ItemBase stick = ItemBase.Cast(GetGame().CreateObjectEx("WoodenStick",GetPosition(),ECE_PLACE_ON_SURFACE));
54  stick.SetQuantity(2);
55  Rope rope = Rope.Cast(item);
56  CreateRope(rope);
57  }
58  }
59 }
ItemBase
Definition: InventoryItem.c:445
GetGame
proto native CGame GetGame()
KitBase
Definition: FenceKit.c:1
MiscGameplayFunctions::TransferItemProperties
static void TransferItemProperties(EntityAI source, notnull EntityAI target, bool transfer_agents=true, bool transfer_variables=true, bool transfer_health=true, bool exclude_quantity=false)
will transform item' variables, agents and other local scripted properties as well as any relevant no...
Definition: MiscGameplayFunctions.c:226
SetIsDeploySound
void SetIsDeploySound(bool is_deploy_sound)
Definition: ItemBase.c:3978
IsHologram
bool IsHologram()
Definition: EntityAI.c:1106
vector
Definition: EnConvert.c:95
KitBase::HeightCheckOverride
override float HeightCheckOverride()
Definition: FenceKit.c:43
KitBase::DoPlacingHeightCheck
override bool DoPlacingHeightCheck()
Definition: FenceKit.c:38
MiscGameplayFunctions
Definition: MiscGameplayFunctions.c:201
ECE_PLACE_ON_SURFACE
const int ECE_PLACE_ON_SURFACE
Definition: CentralEconomy.c:33
HideAllSelections
void HideAllSelections()
Sets all animation values to 1, making them INVISIBLE if they are configured in models....
Definition: EntityAI.c:881
EntityAI
Base native class of all vehicles in game.
Definition: Building.c:4
GetInventory
proto native GameInventory GetInventory()
KitBase::DisassembleKit
override void DisassembleKit(ItemBase item)
Definition: FenceKit.c:48
KitBase::CanReceiveAttachment
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
Definition: FenceKit.c:3
KitBase::OnPlacementComplete
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
Definition: FenceKit.c:19