41 RegisterNetSyncVariableBool(
"m_IsOpened" );
42 RegisterNetSyncVariableInt(
"m_GateState" );
85 for (
int i = 0; i < req_parts.Count(); i++)
92 if( i != req_parts.Count() )
118 if ( combination_lock && combination_lock.IsLocked() )
130 output =
"#str_cfgvehicles_construction_part_gate";
140 return combination_lock;
145 CamoNet camonet = CamoNet.Cast( FindAttachmentBySlotName(
"Wall_Camonet" ) );
151 BarbedWire barbedwire = BarbedWire.Cast( FindAttachmentBySlotName(
"Wall_Barbedwire_1" ) );
157 BarbedWire barbedwire = BarbedWire.Cast( FindAttachmentBySlotName(
"Wall_Barbedwire_2" ) );
164 if ( MemoryPointExists(
"kit_spawn_position" ) )
167 position = GetMemoryPointPos(
"kit_spawn_position" );
169 return ModelToWorld( position );
178 if (!super.CanDisplayAttachmentSlot(slot_id))
183 if ( slot_name ==
"Att_CombinationLock" )
199 if ( category_name ==
"Attachments" || category_name ==
"Material" )
214 super.OnStoreSave( ctx );
224 if ( !super.OnStoreLoad( ctx, version ) )
259 super.AfterStoreLoad();
278 super.OnVariablesSynchronized();
301 super.OnPartBuiltServer( player, part_name, action_id );
314 if ( constrution_part.
IsGate() )
319 combination_lock.UnlockServer( player ,
this );
323 super.OnPartDismantledServer( player, part_name, action_id );
331 override void OnPartDestroyedServer( Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false )
333 super.OnPartDestroyedServer( player, part_name, action_id );
337 if ( constrution_part.
IsGate() && destroyed_by_connected_part )
349 if ( part_name ==
"wall_base_down" )
354 if ( part_name ==
"wall_base_up" )
369 if ( !super.CanReceiveAttachment(attachment, slotId) )
373 if ( !
g_Game.IsDedicatedServer() )
408 if( !super.CanPutIntoHands( parent ) )
453 SetAnimationPhase(
"Wall_Interact_Rotate", value );
454 SetAnimationPhase(
"Wall_Barbedwire_1_Mounted_Rotate", value );
455 SetAnimationPhase(
"Wall_Barbedwire_2_Mounted_Rotate", value );
456 SetAnimationPhase(
"Wall_Camonet_Rotate", value );
457 SetAnimationPhase(
"Wall_Gate_Rotate", value );
458 SetAnimationPhase(
"Wall_Base_Down_Rotate", value );
459 SetAnimationPhase(
"Wall_Base_Up_Rotate", value );
460 SetAnimationPhase(
"Wall_Wood_Down_Rotate", value );
461 SetAnimationPhase(
"Wall_Wood_Up_Rotate", value );
462 SetAnimationPhase(
"Wall_Metal_Down_Rotate", value );
463 SetAnimationPhase(
"Wall_Metal_Up_Rotate", value );
475 if (!
g_Game.IsDedicatedServer())
495 SetAnimationPhase(
"Wall_Interact_Rotate", value );
496 SetAnimationPhase(
"Wall_Barbedwire_1_Mounted_Rotate", value );
497 SetAnimationPhase(
"Wall_Barbedwire_2_Mounted_Rotate", value );
498 SetAnimationPhase(
"Wall_Camonet_Rotate", value );
499 SetAnimationPhase(
"Wall_Gate_Rotate", value );
500 SetAnimationPhase(
"Wall_Base_Down_Rotate", value );
501 SetAnimationPhase(
"Wall_Base_Up_Rotate", value );
502 SetAnimationPhase(
"Wall_Wood_Down_Rotate", value );
503 SetAnimationPhase(
"Wall_Wood_Up_Rotate", value );
504 SetAnimationPhase(
"Wall_Metal_Down_Rotate", value );
505 SetAnimationPhase(
"Wall_Metal_Up_Rotate", value );
517 if (!
g_Game.IsDedicatedServer())
543 if ( GetAnimationPhase(
"Wall_Gate_Rotate" ) == 0 )
546 if ( !
g_Game.IsDedicatedServer() )
562 rotation_angle = 100;
565 super.CreateAreaDamage( slot_name, rotation_angle );
573 string slot_name_mounted;
576 GetBarbedWire1().GetInventory().GetCurrentAttachmentSlotInfo(slot_id,slot_name);
577 slot_name_mounted = slot_name +
"_Mounted";
584 super.CreateAreaDamage( slot_name_mounted, rotation_angle );
589 GetBarbedWire2().GetInventory().GetCurrentAttachmentSlotInfo(slot_id,slot_name);
590 slot_name_mounted = slot_name +
"_Mounted";
597 super.CreateAreaDamage( slot_name_mounted, rotation_angle );
617 vector player_pos = player.GetPosition();
619 vector ref_dir = GetDirection();
629 vector dir_to_fence = fence_pos - player_pos;
631 float len = dir_to_fence.
Length();
637 vector test_angles = dir_to_fence_angle - ref_dir_angle;
641 if(test_position[0] < b1[0] || test_position[0] > b2[0] || test_position[2] < 0.2 || test_position[2] > 2.2 )
654 vector player_pos = player.GetPosition();
655 vector ref_dir = GetDirection();
658 vector fence_player_dir = player.GetDirection();
660 fence_player_dir[1] = 0;
665 if ( ref_dir.
Length() != 0 )
667 float angle =
Math.
Acos( fence_player_dir * ref_dir );
680 vector ref_dir = GetDirection();
690 if ( ref_dir.
Length() != 0 )
692 float angle =
Math.
Acos( cam_dir * ref_dir );
705 if ( MemoryPointExists( selection ) )
707 vector selection_pos = ModelToWorld( GetMemoryPointPos( selection ) );
708 float distance =
vector.
Distance( selection_pos, player.GetPosition() );
729 if ( !
g_Game.IsDedicatedServer() )
738 if ( !
g_Game.IsDedicatedServer() )
747 if ( !
g_Game.IsDedicatedServer() )
776 wire.SetMountedState(
false );
781 lock.UnlockServer(null,
this);
803 if ( !wall_base_down.
IsBuilt() )
817 if ( selection_name ==
"wall_camonet_attach" )
858 #ifdef DIAG_DEVELOPER
866 excludes.Insert(
"_metal_");
870 excludes.Insert(
"_wood_");
873 #ifdef DIAG_DEVELOPER
881 excludes.Insert(
"platform");
885 excludes.Insert(
"gate");
894 super.OnDebugSpawn();
896 GetInventory().CreateInInventory(
"CamoNet");
898 for (
int i = 0; i < 2; ++i)
900 BarbedWire wire = BarbedWire.Cast(GetInventory().CreateInInventory(
"BarbedWire"));
901 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()
override void OnDebugSpawn()
override bool CanDisplayAttachmentCategory(string category_name)
override array< string > OnDebugSpawnBuildExcludes()
Excludes certain parts from being built by OnDebugSpawn, uses Contains to compare.
string ATTSLOT_BARBEDWIRE_UP
const float MAX_ACTION_DETECTION_ANGLE_RAD
override bool IsFacingPlayer(PlayerBase player, string selection)
void GateAttachmentsSanityCheck()
override void OnStoreSave(ParamsWriteContext ctx)
override bool IsFacingCamera(string selection)
override bool CanBeRepairedToPristine()
const string ATTACHMENT_SLOT_COMBINATION_LOCK
override bool HasProperDistance(string selection, PlayerBase player)
CombinationLock GetCombinationLock()
override void PostAreaDamageActions()
bool HasFullyConstructedGate()
const float GATE_ROTATION_TIME_APPROX
override void UpdateVisuals()
override void OnPartDismantledServer(notnull Man player, string part_name, int action_id)
BarbedWire GetBarbedWire2()
override bool IsPlayerInside(PlayerBase player, string selection)
const string SOUND_GATE_CLOSE_START
string ATTSLOT_BARBEDWIRE_DOWN
override int GetMeleeTargetType()
ATTACHMENT_COMBINATION_LOCK
void HandleDropAttachment(ItemBase item)
override void OnPartBuiltServer(notnull Man player, string part_name, int action_id)
const int GATE_STATE_NONE
override bool CanDisplayAttachmentSlot(int slot_id)
const string SOUND_GATE_CLOSE_END
override void OnPartDestroyedServer(Man player, string part_name, int action_id, bool destroyed_by_connected_part=false)
override void CreateAreaDamage(string slot_name, float rotation_angle=0)
override void AfterStoreLoad()
void UpdateBarbedWireAreaDamagePos(float rotation_angle=0, bool to_delete=false)
const string SOUND_GATE_OPEN_START
override bool CanPutIntoHands(EntityAI parent)
const float GATE_ROTATION_ANGLE_DEG
override bool NameOverride(out string output)
bool GateAttachmentConditions(int slotId)
EffectSound m_SoundGate_Start
override bool CanUseConstructionBuild()
const float MAX_ACTION_DETECTION_DISTANCE
void SoundGateCloseStart()
override bool OnStoreLoad(ParamsReadContext ctx, int version)
override bool TranslateSlotFromSelection(string selection_name, out int slot_id)
const int GATE_STATE_FULL
override string GetConstructionKitType()
BarbedWire GetBarbedWire1()
void SoundGateOpenStart()
override void OnVariablesSynchronized()
const int GATE_STATE_PARTIAL
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
override vector GetKitSpawnPosition()
EffectSound m_SoundGate_End
void SetGateState(int state)
override void SetActions()
void SetOpenedState(bool state)
Super root of all classes in Enforce script.
void SetActionInitiator(PlayerBase action_initiator)
array< string > GetRequiredParts()
Wrapper class for managing sound through SEffectManager.
provides access to slot configuration
static proto native owned string GetSlotName(int id)
static proto native int GetSlotIdFromString(string slot_name)
static bool IsBaseBuildingLogEnable()
proto bool Write(void value_out)
proto bool Read(void value_in)
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
proto float Normalize()
Normalizes vector.
proto vector AnglesToVector()
Converts spherical coordinates (yaw, pitch, roll in degrees) to unit length vector.
proto vector VectorToAngles()
Converts vector to spherical coordinates with radius = 1.
proto native float Length()
Returns length of vector (magnitude).
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.