DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
Loading...
Searching...
No Matches
ActionFillOil.c
Go to the documentation of this file.
2{
3 private const float TIME_TO_REPEAT = 0.05;
4
5 override void CreateActionComponent()
6 {
8 }
9};
10
12{
14 {
16 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_EMPTY_VESSEL;
17 m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT | DayZPlayerConstants.STANCEMASK_CROUCH;
18 m_FullBody = true;
20 m_LockTargetOnUse = false;
21 m_Text = "#refill_car";
22 }
23
25 {
28 }
29
30 override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
31 {
32 if( !target || !IsTransport(target) )
33 return false;
34
35 if( item.GetQuantity() <= 0 )
36 return false;
37
38 Car car = Car.Cast( target.GetObject() );
39 if( !car )
40 return false;
41
42 if( car.GetFluidFraction( CarFluid.OIL ) >= 0.98 )
43 return false;
44
45 array<string> selections = new array<string>;
46 target.GetObject().GetActionComponentNameList(target.GetComponentIndex(), selections);
47
48 CarScript carS = CarScript.Cast(car);
49 if( carS )
50 {
51 for (int s = 0; s < selections.Count(); s++)
52 {
53 if ( selections[s] == carS.GetActionCompNameOil() )
54 {
55 float dist = vector.Distance( carS.GetRefillPointPosWS(), player.GetPosition() );
56
57 if ( dist < carS.GetActionDistanceOil() )
58 return true;
59 }
60 }
61 }
62
63 return false;
64 }
65
66 override void OnEndAnimationLoopServer( ActionData action_data )
67 {
68 if ( action_data.m_MainItem && action_data.m_MainItem.GetQuantity() <= 0.01 )
69 {
70 action_data.m_MainItem.SetQuantity(0);
71 }
72 }
73};
protected float m_SpecialtyWeight
Definition ActionBase.c:68
protected bool m_LockTargetOnUse
Definition ActionBase.c:51
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
protected bool IsTransport(ActionTarget target)
Definition ActionBase.c:922
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
protected string m_Text
Definition ActionBase.c:49
protected bool m_FullBody
Definition ActionBase.c:52
protected int m_StanceMask
Definition ActionBase.c:53
class ActionTargets ActionTarget
CarFluid
Type of vehicle's fluid. (native, do not change or extend)
Definition Car.c:19
protected ActionData m_ActionData
ItemBase m_MainItem
Definition ActionBase.c:28
ref CABase m_ActionComponent
Definition ActionBase.c:30
private const float TIME_TO_REPEAT
override void CreateActionComponent()
override void CreateConditionComponents()
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
void ActionFillOil()
override void OnEndAnimationLoopServer(ActionData action_data)
const float POUR_LIQUID
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:602