DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
Loading...
Searching...
No Matches
ActionUnpackGift.c
Go to the documentation of this file.
2{
3 override void CreateActionComponent()
4 {
6 }
7};
8
10{
12 {
14 m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_OPENITEM;
15 //m_FullBody = true;
16 m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT | DayZPlayerConstants.STANCEMASK_CROUCH;
18 m_Text = "#STR_Unwrap";
19 }
20
22 {
25 }
26
27 override bool HasTarget()
28 {
29 return false;
30 }
31
32 override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
33 {
34 return true;
35 }
36
37 override void OnFinishProgressServer( ActionData action_data )
38 {
39 ItemBase item = ItemBase.Cast(action_data.m_MainItem);
40
41 CargoBase cargo = item.GetInventory().GetCargo();
42
45
46 float dmg = item.GetHealth01("","");
47
48 if( dmg > 0.25 )
49 {
50 Object paper = GetGame().CreateObjectEx("GiftWrapPaper",action_data.m_Player.GetPosition(),ECE_PLACE_ON_SURFACE,RF_DEFAULT);
51 paper.SetHealth01("","", dmg - 0.25 );
52 }
53
54 for(int i = cargo.GetItemCount() - 1; i >= 0 ; i--)
55 {
56 EntityAI cargo_item = cargo.GetItem(i);
57
58 GameInventory.SetGroundPosByOwner(action_data.m_Player,cargo_item,il_dst);
59 cargo_item.GetInventory().GetCurrentInventoryLocation(il_src);
60
62 action_data.m_Player.ServerTakeToDst( il_src, il_dst );
63 else
64 action_data.m_Player.LocalTakeToDst( il_src, il_dst );
65 }
66
67 item.DeleteSafe();
68 }
69};
protected float m_SpecialtyWeight
Definition ActionBase.c:68
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
protected string m_Text
Definition ActionBase.c:49
protected int m_StanceMask
Definition ActionBase.c:53
class ActionTargets ActionTarget
const int ECE_PLACE_ON_SURFACE
const int RF_DEFAULT
protected ActionData m_ActionData
ItemBase m_MainItem
Definition ActionBase.c:28
PlayerBase m_Player
Definition ActionBase.c:33
ref CABase m_ActionComponent
Definition ActionBase.c:30
override void CreateActionComponent()
override void OnFinishProgressServer(ActionData action_data)
override void CreateConditionComponents()
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
override bool HasTarget()
proto native bool IsDedicatedServer()
Robust check which is preferred than the above, as it is valid much sooner.
proto native Object CreateObjectEx(string type, vector pos, int iFlags, int iRotation=RF_DEFAULT)
Creates object of certain type.
represents base for cargo storage for entities
Definition Cargo.c:7
proto native int GetItemCount()
proto native EntityAI GetItem(int index)
script counterpart to engine's class Inventory
Definition Inventory.c:77
static bool SetGroundPosByOwner(EntityAI owner, notnull EntityAI item, out InventoryLocation ground)
Definition Inventory.c:1199
InventoryLocation.
const float UNPACK
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:602
proto native CGame GetGame()