Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
actiongivebloodtarget.c
Go to the documentation of this file.
2 {
3  override void CreateActionComponent()
4  {
5  m_ActionData.m_ActionComponent = new CAContinuousQuantityBloodTransfer(UAQuantityConsumed.BLOOD, UATimeSpent.BLOOD);
6  }
7 };
8 
10 {
12  {
13  m_CallbackClass = ActionGiveBloodTargetCB;
15 
16  m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_SALINEBLOODBAGTARGET;
17  m_FullBody = true;
18  m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT | DayZPlayerConstants.STANCEMASK_CROUCH;
19  m_Text = "#give_blood_person";
20  }
21 
22  override void CreateConditionComponents()
23  {
26  }
27 
28  override ActionData CreateActionData()
29  {
30  ActionGiveBloodData action_data = new ActionGiveBloodData;
31  return action_data;
32  }
33 
34  override bool SetupAction(PlayerBase player, ActionTarget target, ItemBase item, out ActionData action_data, Param extra_data = NULL )
35  {
36  if ( super.SetupAction(player, target, item, action_data, extra_data ) )
37  {
38  ActionGiveBloodData action_data_b = ActionGiveBloodData.Cast( action_data );
39  action_data_b.m_ItemBloodType = action_data.m_MainItem.GetLiquidType();
40  action_data_b.m_BloodAmount = action_data.m_MainItem.GetQuantity();
41  action_data_b.m_Agents = action_data.m_MainItem.GetAgents();
42  return true;
43  }
44  return false;
45  }
46 
47  override void OnEndAnimationLoopServer( ActionData action_data )
48  {
49  //OnFinishProgressServer(action_data);
50 
51  if ( action_data.m_MainItem.IsKindOf("BloodSyringe") )
52  {
53  SyringeLambda lambda = new SyringeLambda(action_data.m_MainItem, "Syringe", action_data.m_Player);
54  lambda.SetTransferParams(true, true, true);
55  MiscGameplayFunctions.TurnItemIntoItemEx(action_data.m_Player, lambda);
56  }
57 
58  action_data.m_Player.GetSoftSkillsManager().AddSpecialty( m_SpecialtyWeight );
59  }
60 
61  override void OnEndServer(ActionData action_data)
62  {
63  ActionGiveBloodData action_data_b = ActionGiveBloodData.Cast( action_data );
64  float blood_obtained = action_data_b.m_BloodAmount - action_data_b.m_MainItem.GetQuantity();
65  PlayerBase player_target = PlayerBase.Cast(action_data_b.m_Target.GetObject());
66 
67 
68  PluginTransmissionAgents plugin = PluginTransmissionAgents.Cast(GetPlugin(PluginTransmissionAgents));
69  plugin.TransmitAgents(action_data.m_MainItem, player_target, AGT_UACTION_TO_PLAYER,blood_obtained );
70 
71 
72  int bloodtypetarget = player_target.GetStatBloodType().Get();
73  bool bloodmatch = BloodTypes.MatchBloodCompatibility(action_data_b.m_ItemBloodType, bloodtypetarget);
74 
75  if ( !bloodmatch )
76  {
77 
78 
79  if (blood_obtained > PlayerConstants.HEMOLYTIC_RISK_SHOCK_THRESHOLD)
80  {
81  player_target.m_UnconsciousEndTime = -60;
82  player_target.SetHealth("","Shock",0);
83 
84  if (blood_obtained > PlayerConstants.HEMOLYTIC_REACTION_THRESHOLD)
85  {
86  player_target.m_ModifiersManager.ActivateModifier(eModifiers.MDF_HEMOLYTIC_REACTION);
87  }
88  }
89  }
90 
91  if ( action_data_b.m_MainItem && action_data_b.m_MainItem.GetQuantity() <= 0.01 )
92  {
93  action_data_b.m_MainItem.SetQuantity(0);
94  }
95 
96  if (!(action_data_b.m_Agents & eAgents.CHEMICAL_POISON))//does bloodbag NOT contain nerve agent ?
97  {
98  float remove_count_agents = blood_obtained * ActionGiveBloodSelf.CHEM_AGENT_BLOOD_REMOVAL_MODIFIER;
99  player_target.InsertAgent(eAgents.CHEMICAL_POISON, -remove_count_agents);
100 
101  }
102  }
103 };
ItemBase
Definition: inventoryitem.c:730
AGT_UACTION_TO_PLAYER
const int AGT_UACTION_TO_PLAYER
Definition: constants.c:473
Param
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Definition: param.c:11
ActionGiveBloodSelf
Definition: actiongivebloodself.c:16
CCTMan
Definition: cctman.c:1
UASoftSkillsWeight
Definition: actionconstants.c:118
UAQuantityConsumed
Definition: actionconstants.c:3
ActionGiveBloodData
Definition: actiongivebloodself.c:1
SyringeLambda
Definition: actiongivebloodself.c:117
UAMaxDistances
Definition: actionconstants.c:104
GetPlugin
PluginBase GetPlugin(typename plugin_type)
Definition: pluginmanager.c:316
m_FullBody
protected bool m_FullBody
Definition: actionbase.c:52
PlayerBase
Definition: playerbaseclient.c:1
eAgents
eAgents
Definition: eagents.c:2
PlayerConstants
Definition: playerconstants.c:1
ActionTarget
class ActionTargets ActionTarget
ActionData
Definition: actionbase.c:20
BloodTypes
Definition: bloodtype.c:1
DayZPlayerConstants
DayZPlayerConstants
defined in C++
Definition: dayzplayer.c:601
eModifiers
eModifiers
Definition: emodifiers.c:1
UATimeSpent
Definition: actionconstants.c:26
ActionContinuousBaseCB
Definition: actioncontinuousbase.c:1
CAContinuousQuantityBloodTransfer
Definition: cacontinuousquantitybloodtransfer.c:1
m_Text
protected string m_Text
Definition: actionbase.c:49
ActionGiveBloodTargetCB
Definition: actiongivebloodtarget.c:1
m_ConditionItem
ref CCIBase m_ConditionItem
Definition: actionbase.c:55
ActionContinuousBase
Definition: actioncontinuousbase.c:132
ActionGiveBloodTarget
Definition: actiongivebloodtarget.c:9
CCINonRuined
Definition: ccinonruined.c:1
m_ConditionTarget
ref CCTBase m_ConditionTarget
Definition: actionbase.c:56
m_SpecialtyWeight
protected float m_SpecialtyWeight
Definition: actionbase.c:68
m_StanceMask
protected int m_StanceMask
Definition: actionbase.c:53