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 super.EEDelete(parent);
81 return "disableBaseDamage";
91 return EInventoryIconVisibility.HIDE_VICINITY;
106 super.OnVariablesSynchronized();
130 if ( part_id >= 1 && part_id <= 31 )
132 offset = part_id - 1;
137 else if ( part_id >= 32 && part_id <= 62 )
139 offset = ( part_id % 32 );
144 else if ( part_id >= 63 && part_id <= 93 )
146 offset = ( part_id % 63 );
159 if ( part_id >= 1 && part_id <= 31 )
161 offset = part_id - 1;
166 else if ( part_id >= 32 && part_id <= 62 )
168 offset = ( part_id % 32 );
173 else if ( part_id >= 63 && part_id <= 93 )
175 offset = ( part_id % 63 );
188 if ( part_id >= 1 && part_id <= 31 )
190 offset = part_id - 1;
198 else if ( part_id >= 32 && part_id <= 62 )
200 offset = ( part_id % 32 );
208 else if ( part_id >= 63 && part_id <= 93 )
210 offset = ( part_id % 63 );
242 switch( build_action_id )
255 bool is_base = part.
IsBase();
258 if ( is_part_built_sync )
299 for (
int i = 0; i < construction_parts.Count(); ++i )
301 string key = construction_parts.GetKey( i );
315 for (
int i = 0; i < construction_parts.Count(); ++i )
317 string key = construction_parts.GetKey( i );
320 if ( value.
GetId() ==
id )
360 return construction_kit;
398 super.OnStoreSave( ctx );
410 if ( !super.OnStoreLoad( ctx, version ) )
444 super.AfterStoreLoad();
467 super.OnCreatePhysics();
477 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
483 string part_name = zone;
488 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
490 if ( construction_part && construction.IsPartConstructed( part_name ) )
493 construction.DestroyConnectedParts(part_name);
501 barbed_wire.SetMountedState(
false );
513 super.EEOnAfterLoad();
531 super.EEItemAttached( item, slot_name );
540 super.EEItemDetached( item, slot_name );
568 if (construtionPart.
IsBase())
629 if (construtionPart.
IsBase())
672 if (construtionPart.
IsBase())
690 bool process =
false;
699 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
706 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
707 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
711 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
712 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
713 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
714 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
715 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
716 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
720 maxs[1] = maxs[1] + 0.35;
733 foreach (
EntityAI entity : foundEntities)
771 foreach (
string slotName : attachmentSlots)
787 string slotNameMounted = slot_name +
"_Mounted";
788 EntityAI attachment = FindAttachmentBySlotName(slot_name);
793 if (barbedWire && barbedWire.IsMounted())
800 SetAnimationPhase(slotNameMounted, 0);
801 SetAnimationPhase(slot_name, 1);
805 SetAnimationPhase(slotNameMounted, 1);
806 SetAnimationPhase(slot_name, 0);
811 SetAnimationPhase(slotNameMounted, 1);
812 SetAnimationPhase(slot_name, 1);
830 foreach (
string slotName : attachmentSlots)
861 string slot_name_mounted = slot_name +
"_Mounted";
862 EntityAI attachment = FindAttachmentBySlotName( slot_name );
866 RemoveProxyPhysics( slot_name_mounted );
867 RemoveProxyPhysics( slot_name );
875 AddProxyPhysics( slot_name_mounted );
880 AddProxyPhysics( slot_name );
887 SetAffectPathgraph(
true,
false );
906 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
908 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
922 string config_path =
"CfgVehicles" +
" " + entity.GetType() +
" " +
"attachments";
923 if (
GetGame().ConfigIsExisting( config_path ) )
964 return super.CanReceiveAttachment(attachment, slotId);
969 int attachment_count = GetInventory().AttachmentCount();
970 if ( attachment_count > 0 )
972 if (
HasBase() && attachment_count == 1 )
1049 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
1078 if ( MemoryPointExists( slot_name +
"_min" ) )
1080 min_max[0] = GetMemoryPointPos( slot_name +
"_min" );
1082 if ( MemoryPointExists( slot_name +
"_max" ) )
1084 min_max[1] = GetMemoryPointPos( slot_name +
"_max" );
1094 center = ModelToWorld( center );
1100 areaDamage.SetExtents( extents[0], extents[1] );
1101 areaDamage.SetAreaPosition( center );
1102 areaDamage.SetAreaOrientation( orientation );
1105 areaDamage.SetHitZones( {
"Torso",
"LeftHand",
"LeftLeg",
"LeftFoot",
"RightHand",
"RightLeg",
"RightFoot" } );
1106 areaDamage.SetAmmoName(
"BarbedWireHit" );
1115 if ( angle_deg != 0 )
1118 orientation[0] = orientation[0] - angle_deg;
1122 if ( MemoryPointExists(
"rotate_axis" ) )
1124 rotate_axis = ModelToWorld( GetMemoryPointPos(
"rotate_axis" ) );
1126 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];
1127 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];
1128 center[0] = r_center_x;
1129 center[2] = r_center_z;
1142 areaDamage.Destroy();
1177 switch ( material_type )
1193 switch ( material_type )
1213 SetHealth(slot_name,
"Health",item.GetHealth());
1260 if (players.Count())
1268 bool excluded =
false;
1269 string partName = part.GetPartName();
1272 foreach (
string exclude : excludes)
1302#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 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)
string GetBuildSoundByMaterial(string part_name)
ItemBase CreateConstructionKit()
void HandleItemFalling(ConstructionPart part)
void ItemFall(vector min, vector max)
void SynchronizeBaseState()
void SetBaseState(bool has_base)
bool IsPartBuildInSyncData(int part_id)
const int ECE_PLACE_ON_SURFACE
PlayerSpawnPreset slotName
void Construction(BaseBuildingBase parent)
void DayZPlayerUtils()
cannot be instantiated
bool m_FixDamageSystemInit
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 string GetConstructionKitType()
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()
proto native World GetWorld()
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 DayZPlayer GetPlayer()
proto native void ObjectDelete(Object obj)
Super root of all classes in Enforce script.
static void Log(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message with normal prio.
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)
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.
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()
bool IsFacingCamera(string selection)
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
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)
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()
override bool CanRemoveFromCargo(EntityAI parent)
const string SOUND_DISMANTLE_WOOD_LOG
void SoundDismantleStart(string part_name)
override bool CanObstruct()
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
override bool CanPutInCargo(EntityAI parent)
void GetAttachmentSlots(EntityAI entity, out array< string > attachment_slots)
override void OnDebugSpawn()
void CreateConstructionKitInHands(notnull PlayerBase player)
ref array< string > m_HybridAttachments
ref Construction m_Construction
bool HasAttachmentsBesidesBase()
override bool CanUseConstruction()
override bool IsTakeable()
float m_ConstructionKitHealth
override bool IsIgnoredByConstruction()
bool IsPartBuildInSyncData(int part_id)
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)
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)
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 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)
proto native void GetPlayerList(out array< Man > players)
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
override string GetDebugName()
Serializer ParamsReadContext
proto native CGame GetGame()
Serializer ParamsWriteContext
proto void PrintToRPT(void var)
Prints content of variable to RPT file (performance warning - each write means fflush!...
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
static proto float Max(float x, float y)
Returns bigger of two given values.
static proto float Min(float x, float y)
Returns smaller of two given values.
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
class JsonUndergroundAreaTriggerData GetPosition
bool Contains(string sample)
Returns true if sample is substring of string.
proto int ToLower()
Changes string to lowercase. Returns length.