Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
actionworldliquidactionswitch.c
Go to the documentation of this file.
1//can be eventually extended to allow switching for multiple action types?
4{
5 bool m_switch_to;
7 {
8 m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT | DayZPlayerConstants.STANCEMASK_CROUCH | DayZPlayerConstants.STANCEMASK_PRONE;
9 }
10
11 override void CreateConditionComponents()
12 {
15 }
16
17 /*override string GetText()
18 {
19 //return "#switch_to" + " " + m_switch_to;
20 if (!m_switch_to)
21 return "#switch_to_liquid_drain";
22 return "#switch_to_liquid_pour";
23 }*/
24
25 override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
26 {
27 ItemBase target_item = ItemBase.Cast(target.GetObject());
28 if (Barrel_ColorBase.Cast(target_item) && !target_item.IsOpen())
29 return false;
30
31 if ( target_item && item && Liquid.CanFillContainer( item, target_item.GetLiquidType(),true ) && Liquid.CanFillContainer( target_item, item.GetLiquidType(), true ) && !GetGame().IsInventoryOpen() ) //TODO find better condition than IsKindOf
32 {
33 if ( target_item.GetQuantity() > target_item.GetQuantityMin() && item.GetQuantity() < item.GetQuantityMax() && !player.GetLiquidTendencyDrain() && Liquid.CanFillContainer( item, target_item.GetLiquidType() ) )
34 {
35 if ( Liquid.CanFillContainer( target_item, item.GetLiquidType() ) )
36 {
37 m_switch_to = 0;//"#liquid_drain";
38 return true;
39 }
40 else
41 {
42 player.SetLiquidTendencyDrain(true);
43 return false;
44 }
45 }
46 if ( item.GetQuantity() > item.GetQuantityMin() && target_item.GetQuantity() < target_item.GetQuantityMax() && player.GetLiquidTendencyDrain() && Liquid.CanFillContainer( target_item, item.GetLiquidType() ) )
47 {
48 if ( Liquid.CanFillContainer( item, target_item.GetLiquidType() ) )
49 {
50 m_switch_to = 1;//"#liquid_pour";
51 return true;
52 }
53 else
54 {
55 player.SetLiquidTendencyDrain(false);
56 return false;
57 }
58 }
59 }
60 return false;
61 }
62
63 override void Start( ActionData action_data ) //Setup on start of action
64 {
65 super.Start( action_data );
66 bool state;
67 state = action_data.m_Player.GetLiquidTendencyDrain();
68 action_data.m_Player.SetLiquidTendencyDrain(!state);
69
70 //Print(action_data.m_Player.GetLiquidTendencyDrain());
71 }
72
73 override bool IsLocal()
74 {
75 return true;
76 }
77
78 override bool IsInstant()
79 {
80 return true;
81 }
82
83 override bool RemoveForceTargetAfterUse()
84 {
85 return false;
86 }
87};
int m_StanceMask
Definition actionbase.c:62
ref CCIBase m_ConditionItem
Definition actionbase.c:64
ref CCTBase m_ConditionTarget
Definition actionbase.c:65
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:602
void Start()
Plays all elements this effects consists of.
Definition effect.c:157
proto native CGame GetGame()