48 RegisterNetSyncVariableBool(
"m_IsOpened");
49 RegisterNetSyncVariableInt(
"m_GateState");
97 for (
int i = 0; i < req_parts.Count(); i++)
104 if( i != req_parts.Count() )
130 if (combinationLock && combinationLock.IsLocked())
136 if (codeLock && codeLock.
IsLocked())
148 output =
"#str_cfgvehicles_construction_part_gate";
158 return combinationLock;
202 if (!super.CanDisplayAttachmentSlot(slot_id))
230 if (!super.CanDisplayAttachmentCategory(category_name))
248 super.OnStoreSave( ctx );
258 if ( !super.OnStoreLoad( ctx, version ) )
293 super.AfterStoreLoad();
312 super.OnVariablesSynchronized();
333 super.OnPartBuiltServer(player, part_name, action_id);
346 if (construtionPart.
IsGate())
353 combinationLock.UnlockOnServer(player,
this);
364 super.OnPartDismantledServer(player, part_name, action_id);
372 override void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
374 super.OnPartDestroyedServer(player, part_name, action_id);
378 if (constrution_part.
IsGate() && destroyed_by_connected_part)
391 if (part_name ==
"wall_base_down")
397 if (part_name ==
"wall_base_up")
413 if (!super.CanReceiveAttachment(attachment, slotId))
417 if ( !
g_Game.IsDedicatedServer() )
457 if(!super.CanPutIntoHands(parent))
494 SetAnimationPhase(
"Wall_Interact_Rotate", value );
495 SetAnimationPhase(
"Wall_Barbedwire_1_Mounted_Rotate", value );
496 SetAnimationPhase(
"Wall_Barbedwire_2_Mounted_Rotate", value );
497 SetAnimationPhase(
"Wall_Camonet_Rotate", value );
498 SetAnimationPhase(
"Wall_Gate_Rotate", value );
499 SetAnimationPhase(
"Wall_Base_Down_Rotate", value );
500 SetAnimationPhase(
"Wall_Base_Up_Rotate", value );
501 SetAnimationPhase(
"Wall_Wood_Down_Rotate", value );
502 SetAnimationPhase(
"Wall_Wood_Up_Rotate", value );
503 SetAnimationPhase(
"Wall_Metal_Down_Rotate", value );
504 SetAnimationPhase(
"Wall_Metal_Up_Rotate", value );
516 if (!
g_Game.IsHeadlessOrDedicatedServer())
536 SetAnimationPhase(
"Wall_Interact_Rotate", value );
537 SetAnimationPhase(
"Wall_Barbedwire_1_Mounted_Rotate", value );
538 SetAnimationPhase(
"Wall_Barbedwire_2_Mounted_Rotate", value );
539 SetAnimationPhase(
"Wall_Camonet_Rotate", value );
540 SetAnimationPhase(
"Wall_Gate_Rotate", value );
541 SetAnimationPhase(
"Wall_Base_Down_Rotate", value );
542 SetAnimationPhase(
"Wall_Base_Up_Rotate", value );
543 SetAnimationPhase(
"Wall_Wood_Down_Rotate", value );
544 SetAnimationPhase(
"Wall_Wood_Up_Rotate", value );
545 SetAnimationPhase(
"Wall_Metal_Down_Rotate", value );
546 SetAnimationPhase(
"Wall_Metal_Up_Rotate", value );
558 if (!
g_Game.IsHeadlessOrDedicatedServer())
574 SetAffectPathgraph(
false, !
IsOpened());
589 if ( GetAnimationPhase(
"Wall_Gate_Rotate" ) == 0 )
592 if ( !
g_Game.IsHeadlessOrDedicatedServer() )
608 rotation_angle = 100;
611 super.CreateAreaDamage( slot_name, rotation_angle );
619 string slot_name_mounted;
622 GetBarbedWire1().GetInventory().GetCurrentAttachmentSlotInfo(slot_id,slot_name);
623 slot_name_mounted = slot_name +
"_Mounted";
630 super.CreateAreaDamage( slot_name_mounted, rotation_angle );
635 GetBarbedWire2().GetInventory().GetCurrentAttachmentSlotInfo(slot_id,slot_name);
636 slot_name_mounted = slot_name +
"_Mounted";
643 super.CreateAreaDamage( slot_name_mounted, rotation_angle );
663 vector player_pos = player.GetPosition();
665 vector ref_dir = GetDirection();
675 vector dir_to_fence = fence_pos - player_pos;
677 float len = dir_to_fence.
Length();
683 vector test_angles = dir_to_fence_angle - ref_dir_angle;
687 if(test_position[0] < b1[0] || test_position[0] > b2[0] || test_position[2] < 0.2 || test_position[2] > 2.2 )
700 vector player_pos = player.GetPosition();
701 vector ref_dir = GetDirection();
704 vector fence_player_dir = player.GetDirection();
706 fence_player_dir[1] = 0;
711 if ( ref_dir.
Length() != 0 )
713 float angle =
Math.
Acos( fence_player_dir * ref_dir );
726 vector ref_dir = GetDirection();
736 if ( ref_dir.
Length() != 0 )
738 float angle =
Math.
Acos( cam_dir * ref_dir );
751 if ( MemoryPointExists( selection ) )
753 vector selection_pos = ModelToWorld( GetMemoryPointPos( selection ) );
754 float distance =
vector.
Distance( selection_pos, player.GetPosition() );
775 if ( !
g_Game.IsHeadlessOrDedicatedServer() )
784 if ( !
g_Game.IsHeadlessOrDedicatedServer() )
793 if ( !
g_Game.IsHeadlessOrDedicatedServer() )
823 wire.SetMountedState(
false );
828 lock.UnlockOnServer(null,
this);
854 if ( !wall_base_down.
IsBuilt() )
868 if ( selection_name ==
"wall_camonet_attach" )
901 #ifdef DIAG_DEVELOPER
909 excludes.Insert(
"_metal_");
913 excludes.Insert(
"_wood_");
916 #ifdef DIAG_DEVELOPER
924 excludes.Insert(
"platform");
928 excludes.Insert(
"gate");
937 super.OnDebugSpawn();
939 GetInventory().CreateInInventory(
"CamoNet");
941 for (
int i = 0; i < 2; ++i)
943 BarbedWire wire = BarbedWire.Cast(GetInventory().CreateInInventory(
"BarbedWire"));
944 wire.SetMountedState(
true);
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
ActionFoldBaseBuildingObjectCB ActionContinuousBaseCB ActionFoldBaseBuildingObject()
ActionPlaceObjectCB ActiondeployObjectCB ActionPlaceObject()
void AddAction(typename actionName)
Construction GetConstruction()
class BaseBuildingBase extends ItemBase bsbDebugPrint(string s)
void SynchronizeBaseState()
PlayerSpawnPreset slotName
override bool CanDisplayAttachmentCategory(string category_name)
override void PostAreaDamageActions()
const string ATTACHMENT_SLOT_BARBEDWIRE_DOWN
override void OnDebugSpawn()
override bool IsPlayerInside(PlayerBase player, string selection)
override void OnVariablesSynchronized()
override bool TranslateSlotFromSelection(string selection_name, out int slot_id)
override void UpdateNavmesh()
void SetOpenedState(bool state)
override bool CanDisplayAttachmentSlot(int slot_id)
override bool DestroyOnFall()
EffectSound m_SoundGate_Start
override string GetConstructionKitType()
const string SOUND_GATE_CLOSE_END
ATTACHMENT_COMBINATION_LOCK
const string ATTACHMENT_SLOT_BARBEDWIRE_UP
void SetGateState(int state)
override bool NameOverride(out string output)
const string ATT_CATEGORY_ATTACHMENTS
const int GATE_STATE_NONE
override bool CanPutIntoHands(EntityAI parent)
override array< string > OnDebugSpawnBuildExcludes()
Excludes certain parts from being built by OnDebugSpawn, uses Contains to compare.
override void UpdateVisuals()
void GateAttachmentsSanityCheck()
const float GATE_ROTATION_ANGLE_DEG
const string ATTACHMENT_SLOT_CODE_LOCK
const string ATTACHMENT_SLOT_CAMONET
void SoundGateOpenStart()
const string SOUND_GATE_CLOSE_START
override void OnPartBuiltServer(notnull Man player, string part_name, int action_id)
bool HasFullyConstructedGate()
bool GateAttachmentConditions(int slotId)
EffectSound m_SoundGate_End
override void SetActions()
const string MEM_POINT_SPAWN
const float GATE_ROTATION_TIME_APPROX
const string ATT_CATEGORY_MATERIAL
const int GATE_STATE_FULL
void HandleDropAttachment(ItemBase item)
void SoundGateCloseStart()
const float MAX_ACTION_DETECTION_ANGLE_RAD
override bool IsFacingCamera(string selection)
override bool IsFacingPlayer(PlayerBase player, string selection)
const float MAX_ACTION_DETECTION_DISTANCE
override void AfterStoreLoad()
override bool CanUseConstructionBuild()
override bool OnStoreLoad(ParamsReadContext ctx, int version)
override int GetMeleeTargetType()
override bool HasProperDistance(string selection, PlayerBase player)
BarbedWire GetBarbedWire1()
const string ATTACHMENT_SLOT_COMBINATION_LOCK
CombinationLock GetCombinationLock()
override void OnPartDestroyedServer(Man player, string part_name, int action_id, bool destroyed_by_connected_part=false)
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
override void OnStoreSave(ParamsWriteContext ctx)
void UpdateBarbedWireAreaDamagePos(float rotation_angle=0, bool to_delete=false)
const string SOUND_GATE_OPEN_START
override vector GetKitSpawnPosition()
DigitalCodeLock GetCodeLock()
override bool CanBeRepairedToPristine()
const int GATE_STATE_PARTIAL
override void CreateAreaDamage(string slot_name, float rotation_angle=0)
override bool IsActionTargetVisible()
override void OnPartDismantledServer(notnull Man player, string part_name, int action_id)
BarbedWire GetBarbedWire2()
Super root of all classes in Enforce script.
ConstructionPart GetGateConstructionPart()
void SetActionInitiator(PlayerBase action_initiator)
array< string > GetRequiredParts()
Instanced construction part data classes for dynamic data, statics now stored on EntityType level in ...
void UnlockOnServer(EntityAI parent)
Unlock AND drop.
Wrapper class for managing sound through SEffectManager.
static proto native int GetSlotIdFromString(string slot_name)
converts string to slot_id
static proto native owned string GetSlotName(int id)
converts slot_id to string
provides access to slot configuration
static bool IsBaseBuildingLogEnable()
proto bool Write(void value_out)
proto bool Read(void value_in)
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
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.
Serializer ParamsReadContext
Serializer ParamsWriteContext
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.