Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
actionreadpaper.c
Go to the documentation of this file.
2 {
3  override void CreateActionComponent()
4  {
6  m_ActionData.m_ActionComponent = new CAContinuousTime(-1.0);
7  }
8 
9  override void EndActionComponent()
10  {
11  }
12 
13  override void OnStateChange(int pOldState, int pCurrentState)
14  {
15  if (pCurrentState == STATE_NONE && (!GetGame().IsDedicatedServer()))
16  {
17  if (GetGame().GetUIManager() && GetGame().GetUIManager().IsMenuOpen(MENU_NOTE))
18  GetGame().GetUIManager().FindMenu(MENU_NOTE).Close();
19  }
20  else if (pCurrentState == STATE_LOOP_LOOP && pOldState != STATE_LOOP_LOOP && (!GetGame().IsMultiplayer() || GetGame().IsServer()))
21  {
22  ItemBase paper_item = ItemBase.Cast(m_ActionData.m_MainItem);
23  Param1<string> text = new Param1<string>(paper_item.GetWrittenNoteData().GetNoteText());
24  paper_item.RPCSingleParam(ERPCs.RPC_READ_NOTE, text, true,m_ActionData.m_Player.GetIdentity());
25  }
26  }
27 };
28 
30 {
31  void ActionReadPaper()
32  {
33  m_CallbackClass = ActionReadPaperCB;
34  m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_VIEWNOTE;
35  m_FullBody = true;
36  m_StanceMask = DayZPlayerConstants.STANCEMASK_CROUCH | DayZPlayerConstants.STANCEMASK_ERECT | DayZPlayerConstants.STANCEMASK_PRONE;
37  m_Text = "#read";
38  }
39 
40  override void CreateConditionComponents()
41  {
44  }
45 
46  override bool HasTarget()
47  {
48  return false;
49  }
50 
51  override void OnUpdate(ActionData action_data)
52  {
53  super.OnUpdate(action_data);
54 
55  if(!GetGame().IsDedicatedServer())
56  {
57  if (action_data.m_State == UA_FINISHED && GetGame().GetUIManager() && !GetGame().GetUIManager().IsMenuOpen(MENU_NOTE))
58  {
59  ActionManagerClient.Cast(action_data.m_Player.GetActionManager()).RequestEndAction();
60  }
61  }
62  }
63 
64  override void OnEndRequest(ActionData action_data)
65  {
66  if (action_data.m_Callback)
67  {
68  action_data.m_Callback.InternalCommand(DayZPlayerConstants.CMD_ACTIONINT_INTERRUPT);
69  }
70  }
71 };
ItemBase
Definition: inventoryitem.c:730
GetGame
proto native CGame GetGame()
CAContinuousTime
Definition: cacontinuoustime.c:1
EnableStateChangeCallback
proto native void EnableStateChangeCallback()
enables state change callback OnStateChange
CCTNone
Definition: cctnone.c:1
m_FullBody
protected bool m_FullBody
Definition: actionbase.c:52
UA_FINISHED
const int UA_FINISHED
Definition: constants.c:436
ActionData
Definition: actionbase.c:20
ActionReadPaper
Definition: actionreadpaper.c:29
DayZPlayerConstants
DayZPlayerConstants
defined in C++
Definition: dayzplayer.c:601
ActionContinuousBaseCB
Definition: actioncontinuousbase.c:1
ActionManagerClient
Definition: actionmanagerclient.c:4
m_Text
protected string m_Text
Definition: actionbase.c:49
m_ConditionItem
ref CCIBase m_ConditionItem
Definition: actionbase.c:55
ERPCs
ERPCs
Definition: erpcs.c:1
ActionContinuousBase
Definition: actioncontinuousbase.c:132
CCINonRuined
Definition: ccinonruined.c:1
MENU_NOTE
const int MENU_NOTE
Definition: constants.c:180
m_ConditionTarget
ref CCTBase m_ConditionTarget
Definition: actionbase.c:56
m_StanceMask
protected int m_StanceMask
Definition: actionbase.c:53
ActionReadPaperCB
Definition: actionreadpaper.c:1