3 const int GATE_STATE_NONE = 0;
4 const int GATE_STATE_PARTIAL = 1;
5 const int GATE_STATE_FULL = 2;
7 const string ATTACHMENT_SLOT_COMBINATION_LOCK =
"Att_CombinationLock";
8 const string SOUND_GATE_OPEN_START =
"DoorWoodTowerOpen_SoundSet";
9 const string SOUND_GATE_CLOSE_START =
"DoorWoodTowerClose_start_SoundSet";
10 const string SOUND_GATE_CLOSE_END =
"DoorWoodTowerClose_end_SoundSet";
13 const float GATE_ROTATION_ANGLE_DEG = 100;
14 const float GATE_ROTATION_TIME_APPROX = 2000;
16 const float MAX_ACTION_DETECTION_ANGLE_RAD = 1.3;
17 const float MAX_ACTION_DETECTION_DISTANCE = 2.0;
22 string ATTSLOT_CAMONET =
"Wall_Camonet";
23 string ATTSLOT_BARBEDWIRE_DOWN =
"Wall_Barbedwire_1";
24 string ATTSLOT_BARBEDWIRE_UP =
"Wall_Barbedwire_2";
28 protected bool m_ToDiscard =
false;
30 protected bool m_IsOpenedClient =
false;
31 protected int m_GateState = 0;
41 RegisterNetSyncVariableBool(
"m_IsOpened");
42 RegisterNetSyncVariableInt(
"m_GateState");
122 if (m_GateState != GATE_STATE_NONE)
124 output =
"#str_cfgvehicles_construction_part_gate";
145 BarbedWire
barbedwire = BarbedWire.Cast(FindAttachmentBySlotName(
"Wall_Barbedwire_1"));
151 BarbedWire
barbedwire = BarbedWire.Cast(FindAttachmentBySlotName(
"Wall_Barbedwire_2"));
158 if (MemoryPointExists(
"kit_spawn_position"))
161 position = GetMemoryPointPos(
"kit_spawn_position");
207 ctx.Write(m_GateState);
214 if (!
super.OnStoreLoad(
ctx, version))
221 if (!
ctx.Read(m_ToDiscard))
228 else if (!
ctx.Read(m_GateState))
249 super.AfterStoreLoad();
266 super.OnVariablesSynchronized();
272 if (m_IsOpenedClient)
357 if (!
GetGame().IsDedicatedServer())
370 if (
attachment.Type() != ATTACHMENT_WOODEN_LOG)
376 if (
attachment.IsInherited(ATTACHMENT_COMBINATION_LOCK))
388 if (!
super.CanPutIntoHands(parent))
425 SetAnimationPhase(
"Wall_Interact_Rotate",
value);
426 SetAnimationPhase(
"Wall_Barbedwire_1_Mounted_Rotate",
value);
427 SetAnimationPhase(
"Wall_Barbedwire_2_Mounted_Rotate",
value);
428 SetAnimationPhase(
"Wall_Camonet_Rotate",
value);
429 SetAnimationPhase(
"Wall_Gate_Rotate",
value);
430 SetAnimationPhase(
"Wall_Base_Down_Rotate",
value);
431 SetAnimationPhase(
"Wall_Base_Up_Rotate",
value);
432 SetAnimationPhase(
"Wall_Wood_Down_Rotate",
value);
433 SetAnimationPhase(
"Wall_Wood_Up_Rotate",
value);
434 SetAnimationPhase(
"Wall_Metal_Down_Rotate",
value);
435 SetAnimationPhase(
"Wall_Metal_Up_Rotate",
value);
447 if (!
GetGame().IsDedicatedServer())
467 SetAnimationPhase(
"Wall_Interact_Rotate",
value);
468 SetAnimationPhase(
"Wall_Barbedwire_1_Mounted_Rotate",
value);
469 SetAnimationPhase(
"Wall_Barbedwire_2_Mounted_Rotate",
value);
470 SetAnimationPhase(
"Wall_Camonet_Rotate",
value);
471 SetAnimationPhase(
"Wall_Gate_Rotate",
value);
472 SetAnimationPhase(
"Wall_Base_Down_Rotate",
value);
473 SetAnimationPhase(
"Wall_Base_Up_Rotate",
value);
474 SetAnimationPhase(
"Wall_Wood_Down_Rotate",
value);
475 SetAnimationPhase(
"Wall_Wood_Up_Rotate",
value);
476 SetAnimationPhase(
"Wall_Metal_Down_Rotate",
value);
477 SetAnimationPhase(
"Wall_Metal_Up_Rotate",
value);
489 if (!
GetGame().IsDedicatedServer())
505 if (GetAnimationPhase(
"Wall_Gate_Rotate") == GATE_ROTATION_ANGLE_DEG)
515 if (GetAnimationPhase(
"Wall_Gate_Rotate") == 0)
518 if (!
GetGame().IsDedicatedServer())
627 if (
angle >= MAX_ACTION_DETECTION_ANGLE_RAD)
650 if (
angle >= MAX_ACTION_DETECTION_ANGLE_RAD)
659 if (MemoryPointExists(selection))
663 if (
distance >= MAX_ACTION_DETECTION_DISTANCE)
681 if (!
GetGame().IsDedicatedServer())
682 PlaySoundSet(m_SoundGate_Start, SOUND_GATE_OPEN_START, 0.1, 0.1);
688 if (!
GetGame().IsDedicatedServer())
689 PlaySoundSet(m_SoundGate_Start, SOUND_GATE_CLOSE_START, 0.1, 0.1);
695 if (!
GetGame().IsDedicatedServer())
696 PlaySoundSet(m_SoundGate_End, SOUND_GATE_CLOSE_END, 0.1, 0.1);
722 wire.SetMountedState(
false);
745 if (
slot_name == ATTSLOT_BARBEDWIRE_DOWN)
824 super.OnDebugSpawn();
826 GetInventory().CreateInInventory(
"CamoNet");
828 for (
int i = 0;
i < 2; ++
i)
830 BarbedWire
wire = BarbedWire.Cast(GetInventory().CreateInInventory(
"BarbedWire"));
831 wire.SetMountedState(
true);
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
ActionFoldBaseBuildingObjectCB ActionContinuousBaseCB ActionFoldBaseBuildingObject()
void AddAction(typename actionName)
Construction GetConstruction()
class BaseBuildingBase extends ItemBase bsbDebugPrint(string s)
void SynchronizeBaseState()
class JsonUndergroundAreaTriggerData GetPosition
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()
void SetGateState(int state)
override bool NameOverride(out string output)
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
void SoundGateOpenStart()
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 int GATE_STATE_FULL
void HandleDropAttachment(ItemBase item)
void SoundGateCloseStart()
override bool IsFacingCamera(string selection)
override bool IsFacingPlayer(PlayerBase player, string selection)
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()
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)
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()
Super root of all classes in Enforce script.
Wrapper class for managing sound through SEffectManager.
provides access to slot configuration
static proto native owned string GetSlotName(int id)
converts slot_id to string
static proto native int GetSlotIdFromString(string slot_name)
converts string to slot_id
static bool IsBaseBuildingLogEnable()
Serialization general interface. Serializer API works with:
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
proto native CGame GetGame()
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.