43 RegisterNetSyncVariableInt(
"m_SyncParts01" );
44 RegisterNetSyncVariableInt(
"m_SyncParts02" );
45 RegisterNetSyncVariableInt(
"m_SyncParts03" );
46 RegisterNetSyncVariableInt(
"m_InteractedPartId" );
47 RegisterNetSyncVariableInt(
"m_PerformedActionId" );
48 RegisterNetSyncVariableBool(
"m_HasBase" );
53 if (ConfigIsExisting(
"hybridAttachments"))
58 if (ConfigIsExisting(
"mountables"))
70 return "disableBaseDamage";
80 return EInventoryIconVisibility.HIDE_VICINITY;
85 super.InitItemSounds();
99 return "putDown_FenceKit_SoundSet";
104 return "Shelter_Site_Build_Loop_SoundSet";
119 super.OnVariablesSynchronized();
143 if ( part_id >= 1 && part_id <= 31 )
145 offset = part_id - 1;
150 else if ( part_id >= 32 && part_id <= 62 )
152 offset = ( part_id % 32 );
157 else if ( part_id >= 63 && part_id <= 93 )
159 offset = ( part_id % 63 );
172 if ( part_id >= 1 && part_id <= 31 )
174 offset = part_id - 1;
179 else if ( part_id >= 32 && part_id <= 62 )
181 offset = ( part_id % 32 );
186 else if ( part_id >= 63 && part_id <= 93 )
188 offset = ( part_id % 63 );
201 if ( part_id >= 1 && part_id <= 31 )
203 offset = part_id - 1;
211 else if ( part_id >= 32 && part_id <= 62 )
213 offset = ( part_id % 32 );
221 else if ( part_id >= 63 && part_id <= 93 )
223 offset = ( part_id % 63 );
255 switch( build_action_id )
268 bool is_base = part.
IsBase();
271 if ( is_part_built_sync )
312 for (
int i = 0; i < construction_parts.Count(); ++i )
314 string key = construction_parts.GetKey( i );
328 for (
int i = 0; i < construction_parts.Count(); ++i )
330 string key = construction_parts.GetKey( i );
333 if ( value.
GetId() ==
id )
373 return construction_kit;
398 g_Game.ObjectDelete( construction_kit );
405 g_Game.ObjectDelete(
this );
411 super.EEDelete(parent);
415 areaDamage.Destroy();
422 super.OnStoreSave( ctx );
434 if ( !super.OnStoreLoad( ctx, version ) )
468 super.AfterStoreLoad();
491 super.OnCreatePhysics();
502 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
512 super.EEOnAfterLoad();
517 super.EEItemAttached( item, slot_name );
526 super.EEItemDetached( item, slot_name );
554 if (construtionPart.
IsBase())
615 if (construtionPart.
IsBase())
655 if (construtionPart.
IsBase())
698 foreach (
string slotName : attachmentSlots)
714 string slotNameMounted = slot_name +
"_Mounted";
715 EntityAI attachment = FindAttachmentBySlotName(slot_name);
720 if (barbedWire && barbedWire.IsMounted())
727 SetAnimationPhase(slotNameMounted, 0);
728 SetAnimationPhase(slot_name, 1);
732 SetAnimationPhase(slotNameMounted, 1);
733 SetAnimationPhase(slot_name, 0);
738 SetAnimationPhase(slotNameMounted, 1);
739 SetAnimationPhase(slot_name, 1);
757 foreach (
string slotName : attachmentSlots)
788 string slot_name_mounted = slot_name +
"_Mounted";
789 EntityAI attachment = FindAttachmentBySlotName( slot_name );
793 RemoveProxyPhysics( slot_name_mounted );
794 RemoveProxyPhysics( slot_name );
802 AddProxyPhysics( slot_name_mounted );
807 AddProxyPhysics( slot_name );
814 SetAffectPathgraph(
true,
false );
833 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
835 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
849 string config_path =
"CfgVehicles" +
" " + entity.GetType() +
" " +
"attachments";
850 if (
g_Game.ConfigIsExisting( config_path ) )
852 g_Game.ConfigGetTextArray( config_path, attachment_slots );
890 int attachment_count = GetInventory().AttachmentCount();
891 if ( attachment_count > 0 )
893 if (
HasBase() && attachment_count == 1 )
964 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
993 if ( MemoryPointExists( slot_name +
"_min" ) )
995 min_max[0] = GetMemoryPointPos( slot_name +
"_min" );
997 if ( MemoryPointExists( slot_name +
"_max" ) )
999 min_max[1] = GetMemoryPointPos( slot_name +
"_max" );
1009 center = ModelToWorld( center );
1015 areaDamage.SetExtents( extents[0], extents[1] );
1016 areaDamage.SetAreaPosition( center );
1020 areaDamage.SetHitZones( {
"Torso",
"LeftHand",
"LeftLeg",
"LeftFoot",
"RightHand",
"RightLeg",
"RightFoot" } );
1021 areaDamage.SetAmmoName(
"BarbedWireHit" );
1030 if ( angle_deg != 0 )
1037 if ( MemoryPointExists(
"rotate_axis" ) )
1039 rotate_axis = ModelToWorld( GetMemoryPointPos(
"rotate_axis" ) );
1041 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];
1042 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];
1043 center[0] = r_center_x;
1044 center[2] = r_center_z;
1057 areaDamage.Destroy();
1092 switch ( material_type )
1108 switch ( material_type )
1128 SetHealth(slot_name,
"Health",item.GetHealth());
1154 for (
int i = constructionParts.Count() - 1; i >= 0; --i )
1171 for (
int i = constructionParts.Count() - 1; i >= 0; --i )
1176 construction.HandleEntityFalling(part.
GetPartName());
1209 if (HasAnyAttachmentsOrCargo())
1240 g_Game.GetWorld().GetPlayerList(players);
1241 if (players.Count())
1249 bool excluded =
false;
1250 string partName = part.GetPartName();
1253 foreach (
string exclude : excludes)
1275 [
Obsolete(
"handled in the Construction component directly")]
1280 [
Obsolete(
"handled in the Construction component directly")]
1285 [
Obsolete(
"obsolete debug method")]
1301#ifdef BSB_DEBUG_SPAM
const int AT_DISMANTLE_PART
const int AT_DESTROY_PART
void AddAction(typename actionName)
void RemoveAction(typename actionName)
void AreaDamageManager(EntityAI parent)
void OnPartDismantledClient(string part_name, int action_id)
void SetActionFromSyncData()
void DropAttachmentAndCargoItems()
void SoundDestroyStart(string part_name)
void SoundBuildStart(string part_name)
void UpdateAttachmentVisuals(string slot_name, bool is_locked)
void CalcDamageAreaRotation(float angle_deg, out vector center, out vector orientation)
void RegisterPartForSync(int part_id)
void SetPartsAfterStoreLoad()
void DestroyConstruction()
string GetDismantleSoundByMaterial(string part_name)
bool IsAttachmentSlotLocked(EntityAI attachment)
void OnPartBuiltClient(string part_name, int action_id)
void RegisterActionForSync(int part_id, int action_id)
void SetPartsFromSyncData()
override string GetInvulnerabilityTypeString()
void CheckForHybridAttachments(EntityAI item, string slot_name)
void GetAttachmentSlots(EntityAI entity, out array< string > attachment_slots)
void OnPartDestroyedClient(string part_name, int action_id)
void UnregisterPartForSync(int part_id)
void bsbDebugSpam(string s)
Construction GetConstruction()
void SoundDismantleStart(string part_name)
ConstructionPart GetConstructionPartById(int id)
class BaseBuildingBase extends ItemBase bsbDebugPrint(string s)
void SetPartFromSyncData(ConstructionPart part)
void UpdateAttachmentPhysics(string slot_name, bool is_locked)
void HandleFallingForConstructedParts()
string GetBuildSoundByMaterial(string part_name)
ItemBase CreateConstructionKit()
void SynchronizeBaseState()
void SetBaseState(bool has_base)
bool IsPartBuildInSyncData(int part_id)
void DestroyConstructedParts()
const int ECE_PLACE_ON_SURFACE
PlayerSpawnPreset slotName
void InitVisuals()
init ConstructionPart visuals
ConstructionMaterialType
used to guide action sound selection, mostly. Could be also used for particles and stuff,...
string GetLoopFoldSoundset()
ItemSoundHandler GetItemSoundHandler()
bool m_FixDamageSystemInit
void ItemSoundHandler(ItemBase parent)
override void SetLoopInterval(float time)
A particular version of the deferred loop used to not damage players inside vehicles.
override void SetDeferDuration(float time)
override void UpdateNavmesh()
override bool DestroyOnFall()
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 vector GetKitSpawnPosition()
static bool GetDisableRefundMaterialsOnFall()
static bool GetDisableDropAttachmentsOnFall()
static bool GetDisableItemFalling()
override void DestroyPartServer(Man player, string part_name, int action_id, bool destroyed_by_connected_part=false)
just declared for module 3 use
Instanced construction part data classes for dynamic data, statics now stored on EntityType level in ...
Wrapper class for managing sound through SEffectManager.
proto native int GetSlot()
returns slot id if current type is Attachment
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
void OnPartDestroyedClient(string part_name, int action_id)
override void EEItemAttached(EntityAI item, string slot_name)
bool CanFoldBaseBuildingObject()
void OnPartDismantledClient(string part_name, int action_id)
void RegisterPartForSync(int part_id)
override string GetFoldSoundset()
void SoundDestroyStart(string part_name)
ref map< string, ref AreaDamageManager > m_DamageTriggers
void SetPartFromSyncData(ConstructionPart part)
const string SOUND_BUILD_WOOD_PLANK
bool MustBeBuiltFromOutside()
Some buildings can only be built from outside.
override void OnItemFallRebuilding()
@Note for modders: This method and is subject to change!
bool IsAttachmentSlotLocked(string slot_name)
void SetBaseState(bool has_base)
override bool OnStoreLoad(ParamsReadContext ctx, int version)
ref array< string > m_Mountables
void UpdateAttachmentVisuals(string slot_name, bool is_locked)
void OnPartDestroyedServer(Man player, string part_name, int action_id, bool destroyed_by_connected_part=false)
override void EEOnAfterLoad()
override void EEDelete(EntityAI parent)
void OnSetSlotLock(int slotId, bool locked, bool was_locked)
void UnregisterPartForSync(int part_id)
ItemBase FoldBaseBuildingObject()
override bool CanPutIntoHands(EntityAI parent)
void SetActionFromSyncData()
override void SetActions()
void OnPartDismantledServer(notnull Man player, string part_name, int action_id)
const string ANIMATION_DEPLOYED
override string GetLoopFoldSoundset()
void ItemFall(vector min, vector max)
override string GetInvulnerabilityTypeString()
override int GetDamageSystemVersionChange()
bool CheckLevelVerticalDistance(float max_dist, string selection, PlayerBase player)
bool IsAttachmentSlotLocked(EntityAI attachment)
override ConstructionBasic GetConstructionBasic()
vector GetKitSpawnPosition()
const string SOUND_BUILD_WOOD_STAIRS
override bool CanUseConstructionBuild()
string GetDismantleSoundByMaterial(string part_name)
void DestroyConstructionKit(ItemBase construction_kit)
void DestroyConstruction()
bool CheckSlotVerticalDistance(int slot_id, PlayerBase player)
void SoundBuildStart(string part_name)
override void OnCreatePhysics()
override int GetHideIconMask()
string GetBuildSoundByMaterial(string part_name)
const string SOUND_DISMANTLE_METAL
string GetConstructionKitType()
override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
override void OnStoreSave(ParamsWriteContext ctx)
bool CheckMemoryPointVerticalDistance(float max_dist, string selection, PlayerBase player)
override void AfterStoreLoad()
override bool IgnoreOutOfReachCondition()
void OnSynchronizedClient()
void OnPartBuiltClient(string part_name, int action_id)
Construction GetConstruction()
override bool IsPlayerInside(PlayerBase player, string selection)
override bool ShowZonesHealth()
override void EEItemDetached(EntityAI item, string slot_name)
void DestroyAreaDamage(string slot_name)
override void OnVariablesSynchronized()
void SynchronizeBaseState()
void DestroyConstructedParts()
override bool CanRemoveFromCargo(EntityAI parent)
const string SOUND_DISMANTLE_WOOD_LOG
void SoundDismantleStart(string part_name)
override bool CanObstruct()
override bool CanPutInCargo(EntityAI parent)
ConstructionBasic CreateConstructionComponent()
void GetAttachmentSlots(EntityAI entity, out array< string > attachment_slots)
override void OnDebugSpawn()
void CreateConstructionKitInHands(notnull PlayerBase player)
ref array< string > m_HybridAttachments
bool HasAttachmentsBesidesBase()
override bool CanUseConstruction()
override bool IsTakeable()
float m_ConstructionKitHealth
override bool IsIgnoredByConstruction()
override void InitItemSounds()
bool IsPartBuildInSyncData(int part_id)
void DropAttachmentAndCargoItems()
void CreateAreaDamage(string slot_name, float rotation_angle=0)
const string SOUND_BUILD_WIRE
void OnPartBuiltServer(notnull Man player, string part_name, int action_id)
const string SOUND_DISMANTLE_WOOD_STAIRS
const string SOUND_BUILD_METAL
void SetPartsFromSyncData()
override bool IsFacingPlayer(PlayerBase player, string selection)
ConstructionPart GetConstructionPartById(int id)
const string SOUND_DISMANTLE_WIRE
void SetPartsAfterStoreLoad()
void CalcDamageAreaRotation(float angle_deg, out vector center, out vector orientation)
void CheckForHybridAttachments(EntityAI item, string slot_name)
ref ConstructionBasic m_Construction
array< string > OnDebugSpawnBuildExcludes()
Excludes certain parts from being built by OnDebugSpawn, uses Contains to compare.
bool HasProperDistance(string selection, PlayerBase player)
override bool IsDeployable()
void RegisterActionForSync(int part_id, int action_id)
void HandleFallingForConstructedParts()
const string SOUND_DISMANTLE_WOOD_PLANK
void UpdateAttachmentPhysics(string slot_name, bool is_locked)
void ResetActionSyncData()
const string SOUND_BUILD_WOOD_LOG
void HandleItemFalling(ConstructionPart part)
ItemBase CreateConstructionKit()
bool PerformRoofCheckForBase(string partName, PlayerBase player, out bool result)
static bool IsBaseBuildingLogEnable()
proto bool Write(void value_out)
proto bool Read(void value_in)
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
override string GetDebugName()
Serializer ParamsReadContext
Serializer ParamsWriteContext
proto void PrintToRPT(void var)
Prints content of variable to RPT file (performance warning - each write means fflush!...
void Obsolete(string msg="")
static proto float Cos(float angle)
Returns cosinus of angle in radians.
static proto float Sin(float angle)
Returns sinus of angle in radians.
static const float DEG2RAD
vector GetPosition()
Get the world position of the Effect.
bool Contains(string sample)
Returns true if sample is substring of string.