DayZ 1.26
DayZ Explorer by KGB
Загрузка...
Поиск...
Не найдено
Файл ActionForceConsume.c

См. исходные тексты.

Структуры данных

class  ActionForceConsumeCB
 

Функции

void ActionForceConsume ()
 
override void CreateConditionComponents ()
 
override void OnStartServer (ActionData action_data)
 
override void OnEndServer (ActionData action_data)
 
override bool ActionCondition (PlayerBase player, ActionTarget target, ItemBase item)
 
void PlaySound (PlayerBase player)
 

Переменные

ActionForceConsumeCB SOUND_REPEAT_INTERVAL = 1.5
 

Функции

◆ ActionCondition()

override bool ActionCondition ( PlayerBase player,
ActionTarget target,
ItemBase item )
50 {
51 if (!super.ActionCondition(player, target, item))
52 return false;
53
54 PlayerBase targetPlayer = PlayerBase.Cast(target.GetObject());
55 if (!targetPlayer || !targetPlayer.CanEatAndDrink())
56 return false;
57
58 float angleDiff = Math.AbsFloat(player.GetDirection().VectorToAngles()[0] - targetPlayer.GetDirection().VectorToAngles()[0]);
59 if (angleDiff < 135 || angleDiff > 225) // not in 90 deg cone angle facing the other player
60 return false;
61
62 if (targetPlayer.GetPerformedActionID() != -1 || targetPlayer.GetActivePrimarySymptomID() == SymptomIDs.SYMPTOM_VOMIT)
63 return false;
64
65 return ( (item.GetQuantity() > item.GetQuantityMin()) && !item.GetIsFrozen() );
66 }
Definition EnMath.c:7
Definition EntityAI.c:95
Definition PlayerBaseClient.c:2
static proto float AbsFloat(float f)
Returns absolute value.

Перекрестные ссылки Math::AbsFloat().

◆ ActionForceConsume()

void ActionForceConsume ( )
14 {
15 m_CallbackClass = ActionForceConsumeCB;
16 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_FORCEFEED;
17 m_StanceMask = DayZPlayerConstants.STANCEIDX_ERECT | DayZPlayerConstants.STANCEIDX_CROUCH;
18 m_FullBody = true;
19 m_Text = "#feed";
20 }
int m_CommandUID
Definition ActionBase.c:31
int m_StanceMask
Definition ActionBase.c:33
Definition ActionForceConsume.c:2
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:602

Перекрестные ссылки m_CommandUID и m_StanceMask.

◆ CreateConditionComponents()

override void CreateConditionComponents ( )
23 {
24 m_ConditionTarget = new CCTMan(UAMaxDistances.DEFAULT);
25 m_ConditionItem = new CCINonRuined();
26 }
Definition CCINonRuined.c:2
Definition CCTMan.c:2
Definition ActionConstants.c:106
const float DEFAULT
Definition ActionConstants.c:108

Перекрестные ссылки UAMaxDistances::DEFAULT.

◆ OnEndServer()

override void OnEndServer ( ActionData action_data)
38 {
39 super.OnEndServer(action_data);
40
41 if (action_data.m_MainItem && (action_data.m_MainItem.GetQuantity() <= 0.01))
42 {
43 action_data.m_MainItem.SetQuantity(0);
44 }
45
46 GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).Remove(PlaySound);
47 }
void PlaySound()
Definition HungerSoundHandler.c:38
proto native CGame GetGame()
const int CALL_CATEGORY_GAMEPLAY
Definition tools.c:10

Перекрестные ссылки CALL_CATEGORY_GAMEPLAY, GetGame() и PlaySound().

◆ OnStartServer()

override void OnStartServer ( ActionData action_data)
29 {
30 super.OnStartServer(action_data);
31
32 PlayerBase player = PlayerBase.Cast(action_data.m_Target.GetObject());
33 if (player)
34 GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(PlaySound, SOUND_REPEAT_INTERVAL * 1000, true, player);
35 }
ActionForceConsumeCB SOUND_REPEAT_INTERVAL

Перекрестные ссылки CALL_CATEGORY_GAMEPLAY, GetGame(), PlaySound() и SOUND_REPEAT_INTERVAL.

◆ PlaySound()

void PlaySound ( PlayerBase player)
protected
69 {
70 if (player)
71 player.RequestSoundEventEx(EPlayerSoundEventID.FORCE_FEED);
72 }
EPlayerSoundEventID
Definition PlayerSoundEventHandler.c:2

Переменные

◆ SOUND_REPEAT_INTERVAL

ActionForceConsumeCB SOUND_REPEAT_INTERVAL = 1.5

Используется в OnStartServer().