Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
actionungagself.c
Go to the documentation of this file.
2{
3 void ActionUngagSelf()
4 {
6 m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_COVERHEAD_SELF;
7 m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT | DayZPlayerConstants.STANCEMASK_CROUCH;
8 m_Text = "#ungag";
9 }
10
11 override void CreateConditionComponents()
12 {
15 }
16
17 override bool HasTarget()
18 {
19 return false;
20 }
21
22 override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
23 {
24 if ( IsWearingGag(player) && null == player.GetHumanInventory().GetEntityInHands())
25 return true;
26
27 return false;
28 }
29
30 override void OnFinishProgressServer( ActionData action_data )
31 {
32 EntityAI attachment;
33 Class.CastTo(attachment, action_data.m_Player.GetInventory().FindAttachment(InventorySlots.MASK));
34 if ( attachment && attachment.GetType() == "MouthRag" )
35 {
36 UngagSelfLambda lamb = new UngagSelfLambda(attachment, "Rag", action_data.m_Player);
37 lamb.SetTransferParams(true, true, true, false, 1);
38 action_data.m_Player.ServerReplaceItemElsewhereWithNewInHands(lamb);
39 }
40 }
41
42 bool IsWearingGag( PlayerBase player )
43 {
44 EntityAI attachment;
45 Class.CastTo(attachment, player.GetInventory().FindAttachment(InventorySlots.MASK));
46 if ( attachment && attachment.GetType() == "MouthRag" )
47 {
48 return true;
49 }
50 return false;
51 }
52};
53
55{
56 MouthRag gag;
57 EntityAI m_OriginalOwner;
58
59 void UngagSelfLambda (EntityAI old_item, string new_item_type, PlayerBase player)
60 {
61 gag = MouthRag.Cast(m_OldItem);
62 if (gag)
63 gag.SetIncomingLambaBool(true);
65 targetHnd.SetHands(player, null);
66 OverrideNewLocation(targetHnd);
67 m_OriginalOwner = m_OldItem.GetHierarchyRoot();
68 }
69
70 override void OnSuccess (EntityAI new_item)
71 {
72 super.OnSuccess(new_item);
73
74 PlayerBase player;
75 if (Class.CastTo(player,m_OriginalOwner))
76 {
77 player.CheckForGag();
78 }
79 }
80
81 override void OnAbort ()
82 {
83 if (gag)
84 gag.SetIncomingLambaBool(false);
85 }
86};
int m_StanceMask
Definition actionbase.c:62
string m_Text
Definition actionbase.c:58
ref CCIBase m_ConditionItem
Definition actionbase.c:64
ref CCTBase m_ConditionTarget
Definition actionbase.c:65
Super root of all classes in Enforce script.
Definition enscript.c:11
InventoryLocation.
provides access to slot configuration
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:602