DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
PileOfWoodenPlanks.c
См. документацию.
1class PileOfWoodenPlanks extends ItemBase
2{
4 {
5 if ( GetGame().IsServer() )
6 {
7 SetAllowDamage(false);
8 }
9 }
10
11 // Shows/Hides selections. Call this in init or after every quantity change.
13 {
14 RemoveProxyPhysics( "stage_1" );
15 RemoveProxyPhysics( "stage_2" );
16 RemoveProxyPhysics( "stage_3" );
17
18 // Show/Hide selections according to the current quantity
19 if ( this )
20 {
21 float quantity = GetQuantity();
22 float quantity_max = GetQuantityMax();
23
24 if ( quantity > GetQuantityMax() *0.66 )
25 {
26 // Show 3/3 amount of planks
27 ShowSelection ( "stage_3" );
28 HideSelection ( "stage_2" );
29 HideSelection ( "stage_1" );
30
31 AddProxyPhysics( "stage_3" );
32 }
33
34 if ( quantity > quantity_max *0.33 && quantity <= quantity_max *0.66 )
35 {
36 // Show 2/3 amount of planks
37 HideSelection ( "stage_3" );
38 ShowSelection ( "stage_2" );
39 HideSelection ( "stage_1" );
40
41 AddProxyPhysics( "stage_2" );
42 }
43
44 if ( quantity > 0 && quantity <= quantity_max *0.33 )
45 {
46 // Show 1/3 amount of planks
47 HideSelection ( "stage_3" );
48 HideSelection ( "stage_2" );
49 ShowSelection ( "stage_1" );
50
51 AddProxyPhysics( "stage_1" );
52 }
53
54 if ( quantity == 0 )
55 {
56 // Show 0 planks. Object should be deleted now.
57 HideSelection ( "stage_3" );
58 HideSelection ( "stage_2" );
59 HideSelection ( "stage_1" );
60 }
61 }
62 }
63
64 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
65 {
66 super.EEItemLocationChanged(oldLoc, newLoc);
68 }
69
70 // Removes a number of long planks. Note that one (4m) long plank has the length of 3x normal planks!
71 // Returns the number of removed long planks
72 int RemovePlanks( int needed_planks )
73 {
74 // Make sure to not give more long planks than we have available
75 int available_planks = needed_planks;
76 if ( available_planks > GetQuantity() )
77 {
78 available_planks = GetQuantity();
79 }
80
81 // Remove long planks from this object
82 AddQuantity( -available_planks, true ); // Autodelete enabled
83
84 // Return the number of removed long planks
85 return available_planks;
86 }
87
88 override bool SetQuantity(float value, bool destroy_config = true, bool destroy_forced = false, bool allow_client = false, bool clamp_to_stack_max = true)
89 {
90 bool result = super.SetQuantity(value, destroy_config, destroy_forced, allow_client, clamp_to_stack_max);
92
93 return result;
94 }
95
96 override bool CanPutIntoHands( EntityAI parent )
97 {
98 return false;
99 }
100
101 override bool CanPutInCargo (EntityAI parent)
102 {
103 return false;
104 }
105}
bool AddQuantity(float value, bool destroy_config=true, bool destroy_forced=false)
add item quantity[related to varQuantity... config entry], destroy_config = true > if the quantity re...
Определения ItemBase.c:8060
override float GetQuantity()
Определения ItemBase.c:8154
override int GetQuantityMax()
Определения ItemBase.c:8106
Определения Building.c:6
InventoryLocation.
Определения InventoryLocation.c:29
override bool CanPutIntoHands(EntityAI parent)
Определения PileOfWoodenPlanks.c:96
void PileOfWoodenPlanks()
Определения PileOfWoodenPlanks.c:3
override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
Определения PileOfWoodenPlanks.c:64
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
Определения PileOfWoodenPlanks.c:88
void UpdateSelections()
Определения PileOfWoodenPlanks.c:12
override bool CanPutInCargo(EntityAI parent)
Определения PileOfWoodenPlanks.c:101
int RemovePlanks(int needed_planks)
Определения PileOfWoodenPlanks.c:72
Определения InventoryItem.c:731
proto native CGame GetGame()