Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
actioncollectbloodtarget.c
Go to the documentation of this file.
2 {
3  override void CreateActionComponent()
4  {
5  m_ActionData.m_ActionComponent = new CAContinuousTime(UATimeSpent.COLLECT_BLOOD);
6  }
7 };
8 
10 {
12  {
13  m_CallbackClass = ActionCollectBloodTargetCB;
14  m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_SALINEBLOODBAGTARGET;
15  m_FullBody = true;
16  m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT | DayZPlayerConstants.STANCEMASK_CROUCH;
18  m_Text = "#collect_persons_blood";
19  }
20 
21  override void CreateConditionComponents()
22  {
24  m_ConditionTarget = new CCTMan( UAMaxDistances.DEFAULT );
25  }
26 
27  override void OnEndServer( ActionData action_data )
28  {
29  PlayerBase ntarget = PlayerBase.Cast( action_data.m_Target.GetObject() );
30 
31  if ( !ntarget )
32  return;
33 
34  Param1<float> nacdata;
35  Class.CastTo( nacdata, action_data.m_ActionComponent.GetACData() );
36  float delta = 0;
37  if ( nacdata )
38  delta = ( nacdata.param1 / UATimeSpent.COLLECT_BLOOD );
39 
40  if ( delta > 0 )
41  {
42  ActionCollectBloodTargetLambda lambda = new ActionCollectBloodTargetLambda(action_data.m_MainItem, "BloodBagFull", action_data.m_Player, m_SpecialtyWeight, ntarget, delta);
43  action_data.m_Player.ServerReplaceItemInHandsWithNew(lambda);
44  }
45  //action_data.m_Player.GetItemInHands().SetQuantity();
46  }
47 };
48 
50 {
51  float m_SpecialtyWeight;
52  float m_percentFilled;
53  PlayerBase m_Target;
54 
55  void ActionCollectBloodTargetLambda(EntityAI old_item, string new_item_type, PlayerBase player, float specialtyWeight, PlayerBase target, float delta) { m_SpecialtyWeight = specialtyWeight; m_Target = target; m_percentFilled = delta; }
56 
57  override void CopyOldPropertiesToNew(notnull EntityAI old_item, EntityAI new_item)
58  {
59  float maxQuantity;
60  float quantitySet;
61  super.CopyOldPropertiesToNew(old_item, new_item);
62 
63  if ( new_item )
64  {
65  ItemBase old_item_IB = ItemBase.Cast(old_item);
66  ItemBase new_item_IB = ItemBase.Cast(new_item);
67 
68  ItemBase.Cast( old_item ).TransferModifiers( m_Target );
69  MiscGameplayFunctions.TransferItemProperties( old_item_IB, new_item_IB, true, false, true );
70  ItemBase.Cast( new_item ).SetLiquidType( m_Target.GetStatBloodType().Get() );
71  m_Player.GetSoftSkillsManager().AddSpecialty( m_SpecialtyWeight );
72 
73  maxQuantity = ItemBase.Cast( new_item ).GetQuantityMax();
74  quantitySet = m_percentFilled * maxQuantity;
75  ItemBase.Cast( new_item ).SetQuantity( quantitySet );
76  m_Target.AddHealth( "", "Blood", -quantitySet );
77 
78  if ( m_Player.HasBloodTypeVisible() )
79  BloodContainerBase.Cast( new_item ).SetBloodTypeVisible( true );
80  PluginTransmissionAgents plugin = PluginTransmissionAgents.Cast(GetPlugin(PluginTransmissionAgents));
81  plugin.TransmitAgents(m_Target, new_item, AGT_UACTION_TO_ITEM);
82  }
83  else
84  {
85  Debug.LogError("ActionCollectBloodTargetLambda: failed to create new item","static");
86  }
87  }
88 };
ItemBase
Definition: inventoryitem.c:730
m_Target
ref ActionTarget m_Target
Definition: actionbase.c:17
BloodContainerBase
Definition: bloodbagempty.c:1
CAContinuousTime
Definition: cacontinuoustime.c:1
CCTMan
Definition: cctman.c:1
UASoftSkillsWeight
Definition: actionconstants.c:118
AGT_UACTION_TO_ITEM
const int AGT_UACTION_TO_ITEM
Definition: constants.c:474
ActionCollectBloodTarget
Definition: actioncollectbloodtarget.c:9
UAMaxDistances
Definition: actionconstants.c:104
ReplaceItemWithNewLambda
adds automatic QuickBar handling
Definition: miscgameplayfunctions.c:1
GetPlugin
PluginBase GetPlugin(typename plugin_type)
Definition: pluginmanager.c:316
m_FullBody
protected bool m_FullBody
Definition: actionbase.c:52
ActionCollectBloodTargetCB
Definition: actioncollectbloodtarget.c:1
PlayerBase
Definition: playerbaseclient.c:1
ActionData
Definition: actionbase.c:20
ActionCollectBloodTargetLambda
Definition: actioncollectbloodtarget.c:49
DayZPlayerConstants
DayZPlayerConstants
defined in C++
Definition: dayzplayer.c:601
m_Player
DayZPlayer m_Player
Definition: hand_events.c:42
UATimeSpent
Definition: actionconstants.c:26
ActionContinuousBaseCB
Definition: actioncontinuousbase.c:1
m_Text
protected string m_Text
Definition: actionbase.c:49
Debug
Definition: debug.c:13
m_ConditionItem
ref CCIBase m_ConditionItem
Definition: actionbase.c:55
ActionContinuousBase
Definition: actioncontinuousbase.c:132
CCINonRuined
Definition: ccinonruined.c:1
m_ConditionTarget
ref CCTBase m_ConditionTarget
Definition: actionbase.c:56
Class
Super root of all classes in Enforce script.
Definition: enscript.c:10
m_SpecialtyWeight
protected float m_SpecialtyWeight
Definition: actionbase.c:68
m_StanceMask
protected int m_StanceMask
Definition: actionbase.c:53
EntityAI
Definition: building.c:5