19 if ( !target )
return false;
21 Object target_object = target.GetObject();
22 string action_selection = target_object.GetActionComponentName( target.GetComponentIndex() );
25 if ( target_object && building && action_selection.
Contains( OvenIndoor.OVENPOINT_ACTION_SELECTION ) )
29 vector fire_point_pos_world, fire_point_rot_world;
30 int fire_point_index = OvenIndoor.GetFirePointIndex( action_selection );
31 if ( OvenIndoor.CanPlaceFireplaceInSelectedSpot( building, fire_point_index, fire_point_pos_world, fire_point_rot_world ) )
34 if ( building.HasSelection( OvenIndoor.OVENPOINT_PLACE_ROT + fire_point_index.ToString() ) )
36 vector diff = fire_point_rot_world - fire_point_pos_world;
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;
49 float fire_point_dist =
vector.
Distance( fire_point_pos_world, player.GetPosition() );
50 if ( fire_point_dist <= 2 )
52 player.SetLastFirePoint( fire_point_pos_world );
53 player.SetLastFirePointIndex( fire_point_index );
54 player.SetLastFirePointRot( rot_deg );
69 lambda.SetTransferParams(
true,
true,
true );
70 action_data.m_Player.ServerReplaceItemInHandsWithNewElsewhere( lambda );
93 OverrideNewLocation( gnd );
99 vector smoke_point_pos = target.GetSelectionPositionMS( OvenIndoor.OVENPOINT_SMOKE_POSITION +
m_FirePointIndex.ToString() );
100 vector smoke_point_pos_world = target.ModelToWorld( smoke_point_pos );
106 super.CopyOldPropertiesToNew( old_item, new_item );
108 OvenIndoor fireplace_indoor = OvenIndoor.Cast( new_item );
109 if ( fireplace_indoor )
117 fireplace_indoor.SetOrientation( fprot );
118 Print(fireplace_indoor.GetOrientation());
124 fireplace_indoor.Synchronize();
ActionPlaceFireplaceIndoor m_FirePointIndex
void FireplaceToIndoorOvenLambda(EntityAI old_item, string new_item_type, PlayerBase player, vector pos, Object target)
class ActionTargets ActionTarget
override void CopyOldPropertiesToNew(notnull EntityAI old_item, EntityAI new_item)
bool IsInReach(PlayerBase player, ActionTarget target, float maxDistance=1.0)
ref CCIBase m_ConditionItem
ref CCTBase m_ConditionTarget
override void OnExecuteServer(ActionData action_data)
void ActionPlaceOvenIndoor()
override bool IsLockTargetOnUse()
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
override void CreateConditionComponents()
void ActionSingleUseBase()
proto native void SetGround(EntityAI e, vector mat[4])
sets current inventory location type to Ground with transformation mat
static float Dot(vector v1, vector v2)
Returns Dot product of vector v1 and vector v2.
proto float Normalize()
Normalizes vector. Returns length.
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
DayZPlayerConstants
defined in C++
proto void Print(void var)
Prints content of variable to console/log.
static void MatrixIdentity4(out vector mat[4])
Creates identity matrix.
static proto float Acos(float c)
Returns angle in radians from cosinus.
static const float RAD2DEG
bool Contains(string sample)
Returns true if sample is substring of string.