DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
ActionCollectBloodTarget.c
См. документацию.
8
10{
12 {
14 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_SALINEBLOODBAGTARGET;
15 m_FullBody = true;
16 m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT | DayZPlayerConstants.STANCEMASK_CROUCH;
17 m_SpecialtyWeight = UASoftSkillsWeight.PRECISE_HIGH;
18 m_Text = "#collect_persons_blood";
19 }
20
26
27 override void OnEndServer( ActionData action_data )
28 {
29 super.OnEndServer(action_data);
30
31 PlayerBase ntarget = PlayerBase.Cast( action_data.m_Target.GetObject() );
32
33 if ( !ntarget )
34 return;
35
36 Param1<float> nacdata;
37 Class.CastTo( nacdata, action_data.m_ActionComponent.GetACData() );
38 float delta = 0;
39 if ( nacdata )
40 delta = ( nacdata.param1 / UATimeSpent.COLLECT_BLOOD );
41
42 if ( delta > 0 )
43 {
44 ActionCollectBloodTargetLambda lambda = new ActionCollectBloodTargetLambda(action_data.m_MainItem, "BloodBagFull", action_data.m_Player, m_SpecialtyWeight, ntarget, delta);
45 action_data.m_Player.ServerReplaceItemInHandsWithNew(lambda);
46 }
47 }
48};
49
51{
55
56 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; }
57
58 override void CopyOldPropertiesToNew(notnull EntityAI old_item, EntityAI new_item)
59 {
60 float maxQuantity;
61 float quantitySet;
62 super.CopyOldPropertiesToNew(old_item, new_item);
63
64 if ( new_item )
65 {
66 ItemBase old_item_IB = ItemBase.Cast(old_item);
67 ItemBase new_item_IB = ItemBase.Cast(new_item);
68
69 ItemBase.Cast( old_item ).TransferModifiers( m_Target );
70 MiscGameplayFunctions.TransferItemProperties( old_item_IB, new_item_IB, true, false, true );
71 ItemBase.Cast( new_item ).SetLiquidType( m_Target.GetStatBloodType().Get() );
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};
ActionBase ActionData
Определения ActionBase.c:30
PluginBase GetPlugin(typename plugin_type)
Определения PluginManager.c:316
float m_SpecialtyWeight
Определения ActionBase.c:77
int m_StanceMask
Определения ActionBase.c:62
string m_Text
Определения ActionBase.c:58
ref CCIBase m_ConditionItem
Определения ActionBase.c:64
bool m_FullBody
Определения ActionBase.c:61
ref CCTBase m_ConditionTarget
Определения ActionBase.c:65
ActionData m_ActionData
Определения AnimatedActionBase.c:3
void ActionCollectBloodTarget()
Определения ActionCollectBloodTarget.c:11
override void OnEndServer(ActionData action_data)
Определения ActionCollectBloodTarget.c:27
override void CreateConditionComponents()
Определения ActionCollectBloodTarget.c:21
override void CreateActionComponent()
Определения ActionCollectBloodTarget.c:3
void ActionCollectBloodTargetLambda(EntityAI old_item, string new_item_type, PlayerBase player, float specialtyWeight, PlayerBase target, float delta)
Определения ActionCollectBloodTarget.c:56
override void CopyOldPropertiesToNew(notnull EntityAI old_item, EntityAI new_item)
Определения ActionCollectBloodTarget.c:58
void ActionContinuousBase()
Определения ActionContinuousBase.c:124
int m_CommandUID
Определения AnimatedActionBase.c:143
Определения CCINonRuined.c:2
Определения CCTMan.c:2
Super root of all classes in Enforce script.
Определения EnScript.c:11
static void LogError(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message as error message.
Определения Debug.c:245
Определения Debug.c:2
Определения Building.c:6
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
Определения InventoryItem.c:731
Определения PlayerBaseClient.c:2
void ReplaceItemWithNewLambda(EntityAI old_item, string new_item_type, PlayerBase player)
Определения ReplaceItemWithNewLambda.c:9
PlayerBase m_Player
Определения ReplaceItemWithNewLambda.c:6
const float DEFAULT
Определения ActionConstants.c:112
const float COLLECT_BLOOD
Определения ActionConstants.c:48
Определения ActionConstants.c:28
DayZPlayerConstants
defined in C++
Определения dayzplayer.c:602
const int AGT_UACTION_TO_ITEM
Определения constants.c:503
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.