44 RegisterNetSyncVariableInt(
"m_SyncParts01" );
45 RegisterNetSyncVariableInt(
"m_SyncParts02" );
46 RegisterNetSyncVariableInt(
"m_SyncParts03" );
47 RegisterNetSyncVariableInt(
"m_InteractedPartId" );
48 RegisterNetSyncVariableInt(
"m_PerformedActionId" );
49 RegisterNetSyncVariableBool(
"m_HasBase" );
54 if (ConfigIsExisting(
"hybridAttachments"))
59 if (ConfigIsExisting(
"mountables"))
70 return "disableBaseDamage";
80 return EInventoryIconVisibility.HIDE_VICINITY;
95 super.OnVariablesSynchronized();
119 if ( part_id >= 1 && part_id <= 31 )
121 offset = part_id - 1;
126 else if ( part_id >= 32 && part_id <= 62 )
128 offset = ( part_id % 32 );
133 else if ( part_id >= 63 && part_id <= 93 )
135 offset = ( part_id % 63 );
148 if ( part_id >= 1 && part_id <= 31 )
150 offset = part_id - 1;
155 else if ( part_id >= 32 && part_id <= 62 )
157 offset = ( part_id % 32 );
162 else if ( part_id >= 63 && part_id <= 93 )
164 offset = ( part_id % 63 );
177 if ( part_id >= 1 && part_id <= 31 )
179 offset = part_id - 1;
187 else if ( part_id >= 32 && part_id <= 62 )
189 offset = ( part_id % 32 );
197 else if ( part_id >= 63 && part_id <= 93 )
199 offset = ( part_id % 63 );
231 switch( build_action_id )
244 bool is_base = part.
IsBase();
247 if ( is_part_built_sync )
288 for (
int i = 0; i < construction_parts.Count(); ++i )
290 string key = construction_parts.GetKey( i );
304 for (
int i = 0; i < construction_parts.Count(); ++i )
306 string key = construction_parts.GetKey( i );
309 if ( value.
GetId() ==
id )
349 return construction_kit;
387 super.OnStoreSave( ctx );
399 if ( !super.OnStoreLoad( ctx, version ) )
433 super.AfterStoreLoad();
459 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
465 string part_name = zone;
470 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
472 if ( construction_part && construction.IsPartConstructed( part_name ) )
475 construction.DestroyConnectedParts(part_name);
481 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
483 barbed_wire.SetMountedState(
false );
495 super.EEOnAfterLoad();
513 super.EEItemAttached( item, slot_name );
522 super.EEItemDetached( item, slot_name );
531 bsbDebugPrint(
"inv: OnSetSlotLock " +
GetDebugName(
this ) +
" slot=" + slot_name +
" locked=" + locked +
" was_locked=" + was_locked );
550 if (construtionPart.
IsBase())
611 if (construtionPart.
IsBase())
651 if (construtionPart.
IsBase())
695 for (
int i = 0; i < attachment_slots.Count(); i++ )
697 string slot_name = attachment_slots.Get( i );
716 string slot_name_mounted = slot_name +
"_Mounted";
717 EntityAI attachment = FindAttachmentBySlotName( slot_name );
722 if ( attachment.IsInherited( BarbedWire ) )
724 BarbedWire barbed_wire = BarbedWire.Cast( attachment );
725 if ( barbed_wire.IsMounted() )
738 SetAnimationPhase( slot_name_mounted, 0 );
739 SetAnimationPhase( slot_name, 1 );
743 SetAnimationPhase( slot_name_mounted, 1 );
744 SetAnimationPhase( slot_name, 0 );
749 SetAnimationPhase( slot_name_mounted, 1 );
750 SetAnimationPhase( slot_name, 1 );
767 for (
int i = 0; i < attachment_slots.Count(); i++ )
769 string slot_name = attachment_slots.Get( i );
797 string slot_name_mounted = slot_name +
"_Mounted";
798 EntityAI attachment = FindAttachmentBySlotName( slot_name );
802 RemoveProxyPhysics( slot_name_mounted );
803 RemoveProxyPhysics( slot_name );
811 AddProxyPhysics( slot_name_mounted );
816 AddProxyPhysics( slot_name );
823 SetAffectPathgraph(
true,
false );
842 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
844 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
858 string config_path =
"CfgVehicles" +
" " + entity.GetType() +
" " +
"attachments";
859 if (
GetGame().ConfigIsExisting( config_path ) )
900 return super.CanReceiveAttachment(attachment, slotId);
905 int attachment_count = GetInventory().AttachmentCount();
906 if ( attachment_count > 0 )
908 if (
HasBase() && attachment_count == 1 )
980 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
1010 if ( MemoryPointExists( slot_name +
"_min" ) )
1012 min_max[0] = GetMemoryPointPos( slot_name +
"_min" );
1014 if ( MemoryPointExists( slot_name +
"_max" ) )
1016 min_max[1] = GetMemoryPointPos( slot_name +
"_max" );
1026 center = ModelToWorld( center );
1032 area_damage.SetExtents( extents[0], extents[1] );
1033 area_damage.SetAreaPosition( center );
1034 area_damage.SetAreaOrientation( orientation );
1037 area_damage.SetHitZones( {
"Torso",
"LeftHand",
"LeftLeg",
"LeftFoot",
"RightHand",
"RightLeg",
"RightFoot" } );
1038 area_damage.SetAmmoName(
"BarbedWireHit" );
1039 area_damage.Spawn();
1047 if ( angle_deg != 0 )
1050 orientation[0] = orientation[0] - angle_deg;
1054 if ( MemoryPointExists(
"rotate_axis" ) )
1056 rotate_axis = ModelToWorld( GetMemoryPointPos(
"rotate_axis" ) );
1058 float r_center_x = (
Math.
Cos( angle_deg *
Math.
DEG2RAD ) * ( center[0] - rotate_axis[0] ) ) - (
Math.
Sin( angle_deg *
Math.
DEG2RAD ) * ( center[2] - rotate_axis[2] ) ) + rotate_axis[0];
1059 float r_center_z = (
Math.
Sin( angle_deg *
Math.
DEG2RAD ) * ( center[0] - rotate_axis[0] ) ) + (
Math.
Cos( angle_deg *
Math.
DEG2RAD ) * ( center[2] - rotate_axis[2] ) ) + rotate_axis[2];
1060 center[0] = r_center_x;
1061 center[2] = r_center_z;
1075 area_damage.Destroy();
1110 switch ( material_type )
1126 switch ( material_type )
1146 SetHealth(slot_name,
"Health",item.GetHealth());
1195 if (players.Count())
1203 bool excluded =
false;
1204 string partName = part.GetPartName();
1207 foreach (
string exclude : excludes)
const int AT_DISMANTLE_PART
const int AT_DESTROY_PART
void AddAction(typename actionName)
void RemoveAction(typename actionName)
const string ANIMATION_DEPLOYED
protected void SoundDestroyStart(string part_name)
void OnPartDismantledClient(string part_name, int action_id)
void UpdateAttachmentVisuals(string slot_name, bool is_locked)
protected void SoundBuildStart(string part_name)
const string SOUND_BUILD_WOOD_LOG
void OnPartDestroyedClient(string part_name, int action_id)
protected void SetActionFromSyncData()
const string SOUND_DISMANTLE_METAL
void GetAttachmentSlots(EntityAI entity, out array< string > attachment_slots)
protected ConstructionPart GetConstructionPartById(int id)
protected string GetDismantleSoundByMaterial(string part_name)
ref array< string > m_HybridAttachments
void UpdateAttachmentPhysics(string slot_name, bool is_locked)
bool IsPartBuildInSyncData(int part_id)
void SetBaseState(bool has_base)
protected void SoundDismantleStart(string part_name)
const string SOUND_BUILD_WOOD_PLANK
ref array< string > m_Mountables
const string SOUND_BUILD_WIRE
ItemBase CreateConstructionKit()
void RegisterPartForSync(int part_id)
Construction GetConstruction()
protected void RegisterActionForSync(int part_id, int action_id)
ref Construction m_Construction
void CheckForHybridAttachments(EntityAI item, string slot_name)
void bsbDebugSpam(string s)
void DestroyConstruction()
const string SOUND_DISMANTLE_WOOD_PLANK
void OnPartBuiltClient(string part_name, int action_id)
const string SOUND_DISMANTLE_WOOD_LOG
class BaseBuildingBase extends ItemBase bsbDebugPrint(string s)
const string SOUND_BUILD_WOOD_STAIRS
protected string GetBuildSoundByMaterial(string part_name)
void SetPartFromSyncData(ConstructionPart part)
protected bool IsAttachmentSlotLocked(EntityAI attachment)
const string SOUND_DISMANTLE_WIRE
float m_ConstructionKitHealth
protected void DebugCustomState()
void CalcDamageAreaRotation(float angle_deg, out vector center, out vector orientation)
void UnregisterPartForSync(int part_id)
void SetPartsFromSyncData()
protected void OnSynchronizedClient()
void SynchronizeBaseState()
ref map< string, ref AreaDamageManager > m_DamageTriggers
const string SOUND_BUILD_METAL
override string GetInvulnerabilityTypeString()
protected void ResetActionSyncData()
void SetPartsAfterStoreLoad()
const string SOUND_DISMANTLE_WOOD_STAIRS
protected void UpdateNavmesh()
const int ECE_PLACE_ON_SURFACE
void Construction(BaseBuildingBase parent)
bool m_FixDamageSystemInit
override string GetDebugName()
Gets the debug name for the ParticleManager.
class JsonUndergroundAreaTriggerData GetPosition
A particular version of the deferred loop used to not damage players inside vehicles.
override void SetDeferDuration(float time)
override void SetLoopInterval(float time)
override array< string > OnDebugSpawnBuildExcludes()
Excludes certain parts from being built by OnDebugSpawn, uses Contains to compare.
override void UpdateVisuals()
override void OnPartBuiltServer(notnull Man player, string part_name, int action_id)
override string GetConstructionKitType()
override vector GetKitSpawnPosition()
proto native void ObjectDelete(Object obj)
proto native DayZPlayer GetPlayer()
override ScriptCallQueue GetCallQueue(int call_category)
proto native void ConfigGetTextArray(string path, out TStringArray values)
Get array of strings from config on path.
proto native World GetWorld()
Wrapper class for managing sound through SEffectManager.
proto native int GetSlot()
returns slot id if current type is Attachment
provides access to slot configuration
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
override void OnDebugSpawn()
void OnPartDismantledServer(notnull Man player, string part_name, int action_id)
protected void SoundDestroyStart(string part_name)
void OnPartDismantledClient(string part_name, int action_id)
protected bool IsAttachmentSlotLocked(string slot_name)
void UpdateAttachmentVisuals(string slot_name, bool is_locked)
protected void SoundBuildStart(string part_name)
void CreateAreaDamage(string slot_name, float rotation_angle=0)
void OnPartDestroyedClient(string part_name, int action_id)
override bool IgnoreOutOfReachCondition()
protected void SetActionFromSyncData()
override bool IsFacingPlayer(PlayerBase player, string selection)
protected bool CheckLevelVerticalDistance(float max_dist, string selection, PlayerBase player)
override bool CanUseConstruction()
bool HasAttachmentsBesidesBase()
override void OnStoreSave(ParamsWriteContext ctx)
void GetAttachmentSlots(EntityAI entity, out array< string > attachment_slots)
override bool ShowZonesHealth()
protected ConstructionPart GetConstructionPartById(int id)
protected string GetDismantleSoundByMaterial(string part_name)
ref array< string > m_HybridAttachments
void UpdateAttachmentPhysics(string slot_name, bool is_locked)
bool IsPartBuildInSyncData(int part_id)
void SetBaseState(bool has_base)
override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
protected void SoundDismantleStart(string part_name)
override bool CanPutInCargo(EntityAI parent)
void OnPartBuiltServer(notnull Man player, string part_name, int action_id)
ref array< string > m_Mountables
ItemBase CreateConstructionKit()
bool IsFacingCamera(string selection)
void RegisterPartForSync(int part_id)
Construction GetConstruction()
override bool IsPlayerInside(PlayerBase player, string selection)
protected void RegisterActionForSync(int part_id, int action_id)
ref Construction m_Construction
protected bool CheckMemoryPointVerticalDistance(float max_dist, string selection, PlayerBase player)
void CheckForHybridAttachments(EntityAI item, string slot_name)
void DestroyConstruction()
override void EEItemDetached(EntityAI item, string slot_name)
override int GetDamageSystemVersionChange()
override bool CanObstruct()
bool HasProperDistance(string selection, PlayerBase player)
override void AfterStoreLoad()
void DestroyAreaDamage(string slot_name)
protected string GetConstructionKitType()
ItemBase FoldBaseBuildingObject()
void OnPartBuiltClient(string part_name, int action_id)
override void EEOnAfterLoad()
override bool CanPutIntoHands(EntityAI parent)
override int GetHideIconMask()
bool PerformRoofCheckForBase(string partName, PlayerBase player, out bool result)
override bool IsIgnoredByConstruction()
protected void OnSetSlotLock(int slotId, bool locked, bool was_locked)
protected vector GetKitSpawnPosition()
array< string > OnDebugSpawnBuildExcludes()
Excludes certain parts from being built by OnDebugSpawn, uses Contains to compare.
bool MustBeBuiltFromOutside()
Some buildings can only be built from outside.
bool CanFoldBaseBuildingObject()
void OnPartDestroyedServer(Man player, string part_name, int action_id, bool destroyed_by_connected_part=false)
protected string GetBuildSoundByMaterial(string part_name)
override bool CanUseConstructionBuild()
void SetPartFromSyncData(ConstructionPart part)
override bool CanRemoveFromCargo(EntityAI parent)
override bool IsDeployable()
protected bool IsAttachmentSlotLocked(EntityAI attachment)
override bool OnStoreLoad(ParamsReadContext ctx, int version)
protected EffectSound m_Sound
override void EEItemAttached(EntityAI item, string slot_name)
void CreateConstructionKitInHands(notnull PlayerBase player)
float m_ConstructionKitHealth
protected void DebugCustomState()
override void OnVariablesSynchronized()
void CalcDamageAreaRotation(float angle_deg, out vector center, out vector orientation)
void UnregisterPartForSync(int part_id)
bool CheckSlotVerticalDistance(int slot_id, PlayerBase player)
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
void SetPartsFromSyncData()
protected void OnSynchronizedClient()
void SynchronizeBaseState()
ref map< string, ref AreaDamageManager > m_DamageTriggers
override string GetInvulnerabilityTypeString()
void DestroyConstructionKit(ItemBase construction_kit)
override void SetActions()
protected void ResetActionSyncData()
void SetPartsAfterStoreLoad()
protected void UpdateNavmesh()
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 ...
Serialization general interface. Serializer API works with:
proto bool Write(void value_out)
proto bool Read(void value_in)
proto native void GetPlayerList(out array< Man > players)
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto native CGame GetGame()
static proto float Cos(float angle)
Returns cosinus of angle in radians.
static const float DEG2RAD
static proto float Sin(float angle)
Returns sinus of angle in radians.
bool Contains(string sample)
Returns true if sample is substring of string.
proto int ToLower()
Changes string to lowercase. Returns length.