DayZ 1.24
Loading...
Searching...
No Matches
ActionWritePaper.c
Go to the documentation of this file.
2{
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 {
23 if (m_ActionData.m_MainItem.ConfigIsExisting("writingColor"))
24 paper_item = ItemBase.Cast(m_ActionData.m_Target.GetObject());
25 else
27 Param1<string> text = new Param1<string>(paper_item.GetWrittenNoteData().GetNoteText());
28 paper_item.RPCSingleParam(ERPCs.RPC_WRITE_NOTE, text, true, m_ActionData.m_Player.GetIdentity());
29 }
30 }
31};
32
34{
35 const float TARGET_DISTANCE = 2;
36
38 {
40 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_VIEWNOTE;
41 m_FullBody = true;
42 m_StanceMask = DayZPlayerConstants.STANCEMASK_CROUCH | DayZPlayerConstants.STANCEMASK_ERECT | DayZPlayerConstants.STANCEMASK_PRONE;
43 m_Text = "#write_note";
44 }
45
47 {
49 m_ConditionTarget = new CCTNone;//CCTNonRuined(TARGET_DISTANCE);
50 }
51
52 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
53 {
54 if ((item && item.ConfigIsExisting("writingColor") && target.GetObject() && Paper.Cast(target.GetObject())) || (target.GetObject() && target.GetObject().ConfigIsExisting("writingColor") && item && Paper.Cast(item)))
55 return true;
56 return false;
57 }
58
60 {
61 if (action_data.m_Target.GetObject().ConfigIsExisting("writingColor"))
62 action_data.m_MainItem.GetWrittenNoteData().InitNoteInfo(ItemBase.Cast(action_data.m_Target.GetObject()), action_data.m_MainItem);
63 else
64 ItemBase.Cast(action_data.m_Target.GetObject()).GetWrittenNoteData().InitNoteInfo(action_data.m_MainItem, ItemBase.Cast(action_data.m_Target.GetObject()));
65 }
66
68 {
69 if (action_data.m_Target.GetObject().ConfigIsExisting("writingColor"))
70 action_data.m_MainItem.GetWrittenNoteData().InitNoteInfo(ItemBase.Cast(action_data.m_Target.GetObject()), action_data.m_MainItem);
71 else
72 ItemBase.Cast(action_data.m_Target.GetObject()).GetWrittenNoteData().InitNoteInfo(action_data.m_MainItem, ItemBase.Cast(action_data.m_Target.GetObject()));
73 }
74
76 {
77 super.OnUpdate(action_data);
78
79 if (!GetGame().IsDedicatedServer())
80 {
81 if (action_data.m_State == UA_FINISHED && GetGame().GetUIManager() && !GetGame().GetUIManager().IsMenuOpen(MENU_NOTE))
82 ActionManagerClient.Cast(action_data.m_Player.GetActionManager()).RequestEndAction();
83 }
84 }
85
87 {
88 if (action_data.m_Callback)
89 action_data.m_Callback.InternalCommand(DayZPlayerConstants.CMD_ACTIONINT_INTERRUPT);
90 }
91};
bool m_FullBody
Definition ActionBase.c:52
string m_Text
Definition ActionBase.c:49
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
int m_StanceMask
Definition ActionBase.c:53
ERPCs
Definition ERPCs.c:2
ActionData m_ActionData
PlayerBase m_Player
Definition ActionBase.c:33
ref ActionTarget m_Target
Definition ActionBase.c:32
ref CABase m_ActionComponent
Definition ActionBase.c:30
ItemBase m_MainItem
Definition ActionBase.c:28
override void RequestEndAction()
override void EndActionComponent()
override void OnStateChange(int pOldState, int pCurrentState)
override void CreateActionComponent()
override void OnUpdate(ActionData action_data)
const float TARGET_DISTANCE
override void OnStartServer(ActionData action_data)
override void CreateConditionComponents()
override void OnEndRequest(ActionData action_data)
override void OnStartClient(ActionData action_data)
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
override WrittenNoteData GetWrittenNoteData()
Definition Paper.c:30
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597
proto native CGame GetGame()
const int MENU_NOTE
Definition constants.c:180
const int UA_FINISHED
Definition constants.c:436
static const int STATE_NONE
undef state - not running anymore
Definition human.c:348
proto native void EnableStateChangeCallback()
enables state change callback OnStateChange
static const int STATE_LOOP_LOOP
Definition human.c:352