DayZ 1.24
Loading...
Searching...
No Matches
ActionPlaceFireplaceIndoor Class Reference
Inheritance diagram for ActionPlaceFireplaceIndoor:
[legend]
Collaboration diagram for ActionPlaceFireplaceIndoor:
[legend]

Private Member Functions

void ActionPlaceFireplaceIndoor ()
 
override void CreateConditionComponents ()
 
override bool ActionCondition (PlayerBase player, ActionTarget target, ItemBase item)
 
override void OnExecuteServer (ActionData action_data)
 

Detailed Description

Definition at line 1 of file ActionPlaceFireplaceIndoor.c.

Constructor & Destructor Documentation

◆ ActionPlaceFireplaceIndoor()

void ActionPlaceFireplaceIndoor::ActionPlaceFireplaceIndoor ( )
inlineprivate

Definition at line 3 of file ActionPlaceFireplaceIndoor.c.

4 {
5 m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_OPENDOORFW;
6 m_StanceMask = DayZPlayerConstants.STANCEMASK_CROUCH | DayZPlayerConstants.STANCEMASK_ERECT;
8 m_Text = "#place_object";
9 }
string m_Text
Definition ActionBase.c:49
float m_SpecialtyWeight
Definition ActionBase.c:68
int m_StanceMask
Definition ActionBase.c:53
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597

References AnimatedActionBase::m_CommandUID, m_SpecialtyWeight, m_StanceMask, m_Text, and UASoftSkillsWeight::PRECISE_LOW.

Member Function Documentation

◆ ActionCondition()

override bool ActionPlaceFireplaceIndoor::ActionCondition ( PlayerBase player,
ActionTarget target,
ItemBase item )
inlineprivate

Definition at line 17 of file ActionPlaceFireplaceIndoor.c.

18 {
19 if (!target) return false;
20
21 Object target_object = target.GetObject();
22 string action_selection = target_object.GetActionComponentName(target.GetComponentIndex());
24
25 if (target_object && building && action_selection.Contains(FireplaceIndoor.FIREPOINT_ACTION_SELECTION))
26 {
27 if (!IsInReach(player, target, UAMaxDistances.DEFAULT)) return false;
28
30 int fire_point_index = FireplaceIndoor.GetFirePointIndex(action_selection);
31 if (FireplaceIndoor.CanPlaceFireplaceInSelectedSpot(building, fire_point_index, fire_point_pos_world, fire_point_rot_world))
32 {
33 float rot_deg = 0.0;
34 if (building.HasSelection(FireplaceIndoor.FIREPOINT_PLACE_ROT + fire_point_index.ToString()))
35 {
37 diff[1] = 0.0;
38 diff.Normalize();
39 float dotp = vector.Dot("0 0 1", diff);
41 if ((diff[0] < 0) && (diff[2] < 0))
42 rot_deg = 360.0 - rot_deg;
43 else if ((diff[0] < 0) && (diff[2] > 0))
44 rot_deg = 360.0 - rot_deg;
45
46 //Debug.DrawArrow( fire_point_pos_world, fire_point_pos_world + diff );
47 }
48
50 if (fire_point_dist <= 2)
51 {
52 player.SetLastFirePoint(fire_point_pos_world);
53 player.SetLastFirePointIndex(fire_point_index);
54 player.SetLastFirePointRot(rot_deg);
55 return true;
56 }
57 }
58 }
59
60 return false;
61 }
bool IsInReach(PlayerBase player, ActionTarget target, float maxDistance=1.0)
Definition ActionBase.c:856
Definition EnMath.c:7
const float DEFAULT
static float Dot(vector v1, vector v2)
Returns Dot product of vector v1 and vector v2.
Definition EnConvert.c:271
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
static proto float Acos(float c)
Returns angle in radians from cosinus.
static const float RAD2DEG
Definition EnMath.c:16

References Math::Acos(), UAMaxDistances::DEFAULT, vector::Distance(), vector::Dot(), IsInReach(), and Math::RAD2DEG.

◆ CreateConditionComponents()

override void ActionPlaceFireplaceIndoor::CreateConditionComponents ( )
inlineprivate

Definition at line 11 of file ActionPlaceFireplaceIndoor.c.

12 {
15 }
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56

References m_ConditionItem, and m_ConditionTarget.

◆ OnExecuteServer()

override void ActionPlaceFireplaceIndoor::OnExecuteServer ( ActionData action_data)
inlineprivate

Definition at line 63 of file ActionPlaceFireplaceIndoor.c.

64 {
66
67 //replace fireplace with lambda
68 FireplaceToIndoorsLambda lambda = new FireplaceToIndoorsLambda(fireplace_in_hands, "FireplaceIndoor", action_data.m_Player, action_data.m_Player.GetLastFirePoint(), action_data.m_Target.GetObject());
69 lambda.SetTransferParams(true, true, true);
70 action_data.m_Player.ServerReplaceItemInHandsWithNewElsewhere(lambda);
71
72 //add to soft skills
73 action_data.m_Player.GetSoftSkillsManager().AddSpecialty(m_SpecialtyWeight);
74 }
void FireplaceToIndoorsLambda(EntityAI old_item, string new_item_type, PlayerBase player, vector pos, Object target)

References FireplaceToIndoorsLambda(), and m_SpecialtyWeight.


The documentation for this class was generated from the following file: