3 const float MAX_ACTION_DETECTION_ANGLE_RAD = 1.3;
4 const float MAX_ACTION_DETECTION_DISTANCE = 2.0;
23 if ( MemoryPointExists(
"kit_spawn_position" ) )
26 position = GetMemoryPointPos(
"kit_spawn_position" );
28 return ModelToWorld( position );
40 string shelter_type =
"";
44 shelter_type =
"ShelterLeather";
48 shelter_type =
"ShelterFabric";
52 shelter_type =
"ShelterStick";
58 if (shelter_type !=
"")
61 MiscGameplayFunctions.TurnItemIntoItem(
this, shelter_type,
PlayerBase.Cast(player));
63 PluginAdminLog admin_log = PluginAdminLog.Cast(
GetPlugin(PluginAdminLog) );
66 string playerPrefix = admin_log.GetPlayerPrefix(
PlayerBase.Cast(player), player.GetIdentity());
67 admin_log.DirectAdminLogPrint(playerPrefix +
" built " + shelter_type +
" with Hands ");
95 vector ref_dir = GetDirection();
105 if ( ref_dir.
Length() != 0 )
107 float angle =
Math.
Acos( cam_dir * ref_dir );
120 vector player_pos = player.GetPosition();
122 vector ref_dir = GetDirection();
127 min = -GetMemoryPointPos(
"BoundingBox_min" );
128 max = -GetMemoryPointPos(
"BoundingBox_max" );
130 vector dir_to_object = object_pos - player_pos;
131 dir_to_object[1] = 0;
132 float len = dir_to_object.
Length();
138 vector test_angles = dir_to_object_angle - ref_dir_angle;
142 if(test_position[0] > max[0] || test_position[0] < min[0] || test_position[2] > max[2] || test_position[2] < min[2] )
152 if ( MemoryPointExists( selection ) )
154 vector selection_pos = ModelToWorld( GetMemoryPointPos( selection ) );
155 float distance =
vector.
Distance( selection_pos, player.GetPosition() );
ActionFoldBaseBuildingObjectCB ActionContinuousBaseCB ActionFoldBaseBuildingObject()
ActionPlaceObjectCB ActiondeployObjectCB ActionPlaceObject()
void AddAction(typename actionName)
Construction GetConstruction()
PluginBase GetPlugin(typename plugin_type)
override bool IsPlayerInside(PlayerBase player, string selection)
override string GetConstructionKitType()
override bool CanPutIntoHands(EntityAI parent)
override void OnPartBuiltServer(notnull Man player, string part_name, int action_id)
override bool CanUseHandConstruction()
override void SetActions()
override bool MustBeBuiltFromOutside()
const float MAX_ACTION_DETECTION_ANGLE_RAD
override bool IsFacingCamera(string selection)
const float MAX_ACTION_DETECTION_DISTANCE
override int GetMeleeTargetType()
override bool HasProperDistance(string selection, PlayerBase player)
override vector GetKitSpawnPosition()
override bool CanBeRepairedToPristine()
proto native vector GetCurrentCameraDirection()
proto native float Length()
Returns length of vector (magnitude)
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.
proto vector VectorToAngles()
Converts vector to spherical coordinates with radius = 1.
proto vector AnglesToVector()
Converts spherical coordinates (yaw, pitch, roll in degrees) to unit length vector.
proto native CGame GetGame()
static proto float Acos(float c)
Returns angle in radians from cosinus.
class JsonUndergroundAreaTriggerData GetPosition