3 const float MAX_ACTION_DETECTION_ANGLE_RAD = 1.3;
4 const float MAX_ACTION_DETECTION_DISTANCE = 2.0;
19 if ( MemoryPointExists(
"kit_spawn_position" ) )
22 position = GetMemoryPointPos(
"kit_spawn_position" );
36 string shelter_type =
"";
40 shelter_type =
"ShelterLeather";
44 shelter_type =
"ShelterFabric";
48 shelter_type =
"ShelterStick";
52 if (shelter_type !=
"")
59 player.ServerReplaceItemWithNew(lambda);
61 PluginAdminLog admin_log = PluginAdminLog.Cast(
GetPlugin(PluginAdminLog) );
64 string playerPrefix = admin_log.GetPlayerPrefix(playerBase, player.GetIdentity());
65 admin_log.DirectAdminLogPrint(playerPrefix +
" built " + shelter_type +
" with Hands ");
87 vector ref_dir = GetDirection();
97 if ( ref_dir.
Length() != 0 )
99 float angle =
Math.
Acos( cam_dir * ref_dir );
112 vector player_pos = player.GetPosition();
114 vector ref_dir = GetDirection();
119 min = -GetMemoryPointPos(
"BoundingBox_min" );
120 max = -GetMemoryPointPos(
"BoundingBox_max" );
122 vector dir_to_object = object_pos - player_pos;
123 dir_to_object[1] = 0;
124 float len = dir_to_object.
Length();
130 vector test_angles = dir_to_object_angle - ref_dir_angle;
134 if(test_position[0] > max[0] || test_position[0] < min[0] || test_position[2] > max[2] || test_position[2] < min[2] )
144 if ( MemoryPointExists( selection ) )
146 vector selection_pos = ModelToWorld( GetMemoryPointPos( selection ) );
147 float distance =
vector.
Distance( selection_pos, player.GetPosition() );
182 constructionKit.ThrowPhysically(null,
vector.
Zero);
193 item.SetQuantityMax();
195 item.SetQuantityMax();
ActionBuildShelter ActionContinuousBase BuildShelterFromShelterSiteLambda(EntityAI old_item, string new_item_type, PlayerBase player)
ActionFoldBaseBuildingObjectCB ActionContinuousBaseCB ActionFoldBaseBuildingObject()
ActionPlaceObjectCB ActiondeployObjectCB ActionPlaceObject()
void AddAction(typename actionName)
void DropAttachmentAndCargoItems()
Construction GetConstruction()
ItemBase CreateConstructionKit()
PluginBase GetPlugin(typename plugin_type)
override void OnDebugSpawn()
override bool IsPlayerInside(PlayerBase player, string selection)
override bool DestroyOnFall()
override string GetConstructionKitType()
override bool CanPutIntoHands(EntityAI parent)
override void OnPartBuiltServer(notnull Man player, string part_name, int action_id)
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 void OnItemFallRebuilding()
override int GetMeleeTargetType()
override bool HasProperDistance(string selection, PlayerBase player)
override vector GetKitSpawnPosition()
override bool CanBeRepairedToPristine()
Super root of all classes in Enforce script.
Instanced construction part data classes for dynamic data, statics now stored on EntityType level in ...
EntityAI CreateInInventory(string type)
creates entity somewhere in inventory
script counterpart to engine's class Inventory
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.
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
static proto float Acos(float c)
Returns angle in radians from cosinus.
vector GetPosition()
Get the world position of the Effect.