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 ( !
GetGame().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 ( !
GetGame().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 ( !
GetGame().IsDedicatedServer() )
543 if ( GetAnimationPhase(
"Wall_Gate_Rotate" ) == 0 )
546 if ( !
GetGame().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 ( !
GetGame().IsDedicatedServer() )
738 if ( !
GetGame().IsDedicatedServer() )
747 if ( !
GetGame().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 bool CanDisplayAttachmentCategory(string category_name)
override void PostAreaDamageActions()
override void OnDebugSpawn()
override bool IsPlayerInside(PlayerBase player, string selection)
override void OnVariablesSynchronized()
override bool TranslateSlotFromSelection(string selection_name, out int slot_id)
void SetOpenedState(bool state)
override bool CanDisplayAttachmentSlot(int slot_id)
EffectSound m_SoundGate_Start
override string GetConstructionKitType()
const string SOUND_GATE_CLOSE_END
ATTACHMENT_COMBINATION_LOCK
void SetGateState(int state)
override bool NameOverride(out string output)
const int GATE_STATE_NONE
string ATTSLOT_BARBEDWIRE_DOWN
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
string ATTSLOT_BARBEDWIRE_UP
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 float GATE_ROTATION_TIME_APPROX
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()
override bool CanBeRepairedToPristine()
const int GATE_STATE_PARTIAL
override void CreateAreaDamage(string slot_name, float rotation_angle=0)
override void OnPartDismantledServer(notnull Man player, string part_name, int action_id)
BarbedWire GetBarbedWire2()
override ScriptCallQueue GetCallQueue(int call_category)
proto native vector GetCurrentCameraDirection()
Super root of all classes in Enforce script.
void SetActionInitiator(PlayerBase action_initiator)
array< string > GetRequiredParts()
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 void Remove(func fn)
remove specific call from queue
proto void CallLater(func fn, int delay=0, bool repeat=false, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
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
proto native CGame GetGame()
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.
class JsonUndergroundAreaTriggerData GetPosition