DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
Loading...
Searching...
No Matches
ActionUngagSelf.c
Go to the documentation of this file.
2{
4 {
6 m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_COVERHEAD_SELF;
7 //m_FullBody = true;
8 m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT | DayZPlayerConstants.STANCEMASK_CROUCH;
9 m_Text = "#ungag";
10 }
11
13 {
16 }
17
18 override bool HasTarget()
19 {
20 return false;
21 }
22
23 override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
24 {
25 if ( IsWearingGag(player) && null == player.GetHumanInventory().GetEntityInHands())
26 return true;
27
28 return false;
29 }
30
31 override void OnFinishProgressServer( ActionData action_data )
32 {
33 EntityAI attachment;
34 Class.CastTo(attachment, action_data.m_Player.GetInventory().FindAttachment(InventorySlots.MASK));
35 if ( attachment && attachment.GetType() == "MouthRag" )
36 {
37 UngagSelfLambda lamb = new UngagSelfLambda(attachment, "Rag", action_data.m_Player);
38 lamb.SetTransferParams(true, true, true, false, 1);
39 action_data.m_Player.ServerReplaceItemElsewhereWithNewInHands(lamb);
40 }
41 //action_data.m_Player.GetSoftSkillsManager().AddSpecialty( m_SpecialtyWeight );
42 }
43
44 bool IsWearingGag( PlayerBase player )
45 {
46 EntityAI attachment;
47 Class.CastTo(attachment, player.GetInventory().FindAttachment(InventorySlots.MASK));
48 if ( attachment && attachment.GetType() == "MouthRag" )
49 {
50 return true;
51 }
52 return false;
53 }
54};
55
57{
58 MouthRag gag;
59
60 void UngagSelfLambda (EntityAI old_item, string new_item_type, PlayerBase player)
61 {
62 gag = MouthRag.Cast(m_OldItem);
63 if (gag)
64 gag.SetIncomingLambaBool(true);
66 targetHnd.SetHands(player, null);
67 OverrideNewLocation(targetHnd);
68 }
69
70 /*override void OnSuccess (EntityAI new_item)
71 {
72
73 }
74 */
75 override void OnAbort ()
76 {
77 if (gag)
78 gag.SetIncomingLambaBool(false);
79 }
80};
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
PlayerBase m_Player
Definition ActionBase.c:33
override void OnFinishProgressServer(ActionData action_data)
override void CreateConditionComponents()
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
override bool HasTarget()
bool IsWearingGag(PlayerBase player)
Super root of all classes in Enforce script.
Definition EnScript.c:11
InventoryLocation.
proto native void SetHands(notnull EntityAI parent, EntityAI e)
sets current inventory location type to Hands
provides access to slot configuration
override void OnAbort()
void UngagSelfLambda(EntityAI old_item, string new_item_type, PlayerBase player)
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:602
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.