2057{
2059
2061
2063
2065
2071
2072
2073
2079
2085
2087
2091
2092
2094 {
2096
2097
2098 RegisterNetSyncVariableInt( "m_SyncParts01" );
2099 RegisterNetSyncVariableInt( "m_SyncParts02" );
2100 RegisterNetSyncVariableInt( "m_SyncParts03" );
2101 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2102 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2103 RegisterNetSyncVariableBool( "m_HasBase" );
2104
2105
2107
2108 if (ConfigIsExisting("hybridAttachments"))
2109 {
2112 }
2113 if (ConfigIsExisting("mountables"))
2114 {
2117 }
2118
2120 }
2121
2123 {
2124 super.EEDelete(parent);
2125
2127 {
2128 areaDamage.Destroy();
2129 }
2130
2131 }
2132
2134 {
2135 return "disableBaseDamage";
2136 }
2137
2139 {
2140 return true;
2141 }
2142
2144 {
2145 return EInventoryIconVisibility.HIDE_VICINITY;
2146 }
2147
2148
2150 {
2152 {
2153 SetSynchDirty();
2154 }
2155 }
2156
2158 {
2160 super.OnVariablesSynchronized();
2161
2163 }
2164
2166 {
2167
2169
2170
2172
2173
2175 }
2176
2177
2179 {
2180
2181 int offset;
2182 int mask;
2183
2184 if ( part_id >= 1 && part_id <= 31 )
2185 {
2186 offset = part_id - 1;
2187 mask = 1 << offset;
2188
2190 }
2191 else if ( part_id >= 32 && part_id <= 62 )
2192 {
2193 offset = ( part_id % 32 );
2194 mask = 1 << offset;
2195
2197 }
2198 else if ( part_id >= 63 && part_id <= 93 )
2199 {
2200 offset = ( part_id % 63 );
2201 mask = 1 << offset;
2202
2204 }
2205 }
2206
2208 {
2209
2210 int offset;
2211 int mask;
2212
2213 if ( part_id >= 1 && part_id <= 31 )
2214 {
2215 offset = part_id - 1;
2216 mask = 1 << offset;
2217
2219 }
2220 else if ( part_id >= 32 && part_id <= 62 )
2221 {
2222 offset = ( part_id % 32 );
2223 mask = 1 << offset;
2224
2226 }
2227 else if ( part_id >= 63 && part_id <= 93 )
2228 {
2229 offset = ( part_id % 63 );
2230 mask = 1 << offset;
2231
2233 }
2234 }
2235
2237 {
2238
2239 int offset;
2240 int mask;
2241
2242 if ( part_id >= 1 && part_id <= 31 )
2243 {
2244 offset = part_id - 1;
2245 mask = 1 << offset;
2246
2248 {
2249 return true;
2250 }
2251 }
2252 else if ( part_id >= 32 && part_id <= 62 )
2253 {
2254 offset = ( part_id % 32 );
2255 mask = 1 << offset;
2256
2258 {
2259 return true;
2260 }
2261 }
2262 else if ( part_id >= 63 && part_id <= 93 )
2263 {
2264 offset = ( part_id % 63 );
2265 mask = 1 << offset;
2266
2268 {
2269 return true;
2270 }
2271 }
2272
2273 return false;
2274 }
2275
2277 {
2280 }
2281
2283 {
2284
2287 }
2288
2290 {
2292 {
2295
2296 switch( build_action_id )
2297 {
2301 }
2302 }
2303 }
2304
2305
2307 {
2309 bool is_base = part.
IsBase();
2312 if ( is_part_built_sync )
2313 {
2315 {
2319
2320 if (is_base)
2321 {
2324 }
2325 }
2326 }
2327 else
2328 {
2330 {
2334
2335 if (is_base)
2336 {
2339 }
2340 }
2341 }
2342
2343
2345 }
2346
2347
2349 {
2352
2353 for ( int i = 0; i < construction_parts.Count(); ++i )
2354 {
2355 string key = construction_parts.GetKey( i );
2358 }
2359
2360
2362 }
2363
2365 {
2368
2369 for ( int i = 0; i < construction_parts.Count(); ++i )
2370 {
2371 string key = construction_parts.GetKey( i );
2373
2374 if ( value.
GetId() ==
id )
2375 {
2376 return value;
2377 }
2378 }
2379
2380 return NULL;
2381 }
2382
2383
2384
2386 {
2388 }
2389
2391 {
2393 }
2394
2396 {
2397 return true;
2398 }
2399
2401 {
2402 return false;
2403 }
2404
2405
2407 {
2410 {
2412 }
2413
2414 return construction_kit;
2415 }
2416
2418 {
2421 {
2423 }
2424 }
2425
2427 {
2429 }
2430
2432 {
2433 return "";
2434 }
2435
2437 {
2440 }
2441
2442
2444 {
2447 }
2448
2449
2451 {
2452 super.OnStoreSave( ctx );
2453
2454
2458
2460 }
2461
2463 {
2464 if ( !super.OnStoreLoad( ctx, version ) )
2465 return false;
2466
2467
2468
2470 {
2472 return false;
2473 }
2475 {
2477 return false;
2478 }
2480 {
2482 return false;
2483 }
2484
2485
2487 {
2489 return false;
2490 }
2491
2492
2493 return true;
2494 }
2495
2497 {
2498 super.AfterStoreLoad();
2499
2501 {
2503 }
2504 }
2505
2507 {
2508
2510
2511
2514
2515
2517 }
2518
2520 {
2521 super.OnCreatePhysics();
2524 }
2525
2527 {
2529 return;
2530
2531 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2532
2534 return;
2535
2537 string part_name = zone;
2539
2541 {
2542 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2543
2544 if ( construction_part && construction.IsPartConstructed( part_name ) )
2545 {
2547 construction.DestroyConnectedParts(part_name);
2548 }
2549
2550
2551 if ( part_name.
Contains(
"barbed") )
2552 {
2553 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2554 if (barbed_wire)
2555 barbed_wire.SetMountedState( false );
2556 }
2557 }
2558 }
2559
2561 {
2563 {
2565 }
2566
2567 super.EEOnAfterLoad();
2568 }
2569
2571 {
2572 super.EEInit();
2573
2574
2576
2577
2578 #ifdef DEVELOPER
2580 #endif
2581 }
2582
2584 {
2585 super.EEItemAttached( item, slot_name );
2586
2590 }
2591
2593 {
2594 super.EEItemDetached( item, slot_name );
2595
2598 }
2599
2600 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2601 {
2604
2607 }
2608
2609
2611 {
2612 return true;
2613 }
2614
2615
2616
2618 {
2620
2621
2622 if (construtionPart.
IsBase())
2623 {
2625
2626
2628 }
2629
2630
2632
2633
2635
2636
2638
2640
2642
2643
2645
2646
2648 }
2649
2651 {
2652
2654 }
2655
2656
2658 {
2661
2662
2664
2665
2667
2668
2670
2671
2673
2675
2676
2678
2679
2681
2682
2683 if (construtionPart.
IsBase())
2684 {
2685
2687 }
2688
2691 }
2692
2694 {
2695
2697 }
2698
2699
2700 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2701 {
2704
2705
2707
2708
2710
2711
2713
2714
2716
2718
2719
2721
2722
2724
2725
2726 if (construtionPart.
IsBase())
2727 {
2728
2730 }
2731
2734 }
2735
2737 {
2738
2740 }
2741
2743 {
2744 bool process = false;
2745
2746
2750
2751 if (process)
2752 {
2753 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2754 {
2756 return;
2757 }
2758
2760 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2761 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2762
2763
2765 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2766 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2767 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2768 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2769 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2770 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2771 mins = minTmp;
2772 maxs = maxTmp;
2773
2774 maxs[1] = maxs[1] + 0.35;
2775
2777 }
2778 }
2779
2781 {
2784
2785
2787 foreach (
EntityAI entity : foundEntities)
2788 {
2791 }
2792 }
2793
2794
2796 {
2798
2802 }
2803
2805 {
2807
2809 {
2811 }
2812 else
2813 {
2815 }
2816
2818 }
2819
2821 {
2823
2825 foreach (
string slotName : attachmentSlots)
2826 {
2828 }
2829
2830
2833 else
2835
2837 }
2838
2840 {
2841 string slotNameMounted = slot_name + "_Mounted";
2842 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2843
2844 if (attachment)
2845 {
2846 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2847 if (barbedWire && barbedWire.IsMounted())
2849 else
2851
2852 if (is_locked)
2853 {
2854 SetAnimationPhase(slotNameMounted, 0);
2855 SetAnimationPhase(slot_name, 1);
2856 }
2857 else
2858 {
2859 SetAnimationPhase(slotNameMounted, 1);
2860 SetAnimationPhase(slot_name, 0);
2861 }
2862 }
2863 else
2864 {
2865 SetAnimationPhase(slotNameMounted, 1);
2866 SetAnimationPhase(slot_name, 1);
2867
2869 }
2870 }
2871
2872
2874 {
2877
2880
2883
2884 foreach (
string slotName : attachmentSlots)
2885 {
2887 }
2888
2889
2891 {
2894
2896 }
2897 else
2898 {
2901
2903 }
2904
2907 }
2908
2910 {
2911
2913 return;
2914
2915 string slot_name_mounted = slot_name + "_Mounted";
2916 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2917
2918
2920 RemoveProxyPhysics( slot_name_mounted );
2921 RemoveProxyPhysics( slot_name );
2922
2923 if ( attachment )
2924 {
2926 if ( is_locked )
2927 {
2929 AddProxyPhysics( slot_name_mounted );
2930 }
2931 else
2932 {
2934 AddProxyPhysics( slot_name );
2935 }
2936 }
2937 }
2938
2940 {
2941 SetAffectPathgraph( true, false );
2943 }
2944
2946 {
2947 return true;
2948 }
2949
2951 {
2952 return true;
2953 }
2954
2956 {
2957 if ( attachment )
2958 {
2960 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2961
2962 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2963 }
2964
2965 return false;
2966 }
2967
2969 {
2971 }
2972
2973
2975 {
2976 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2977 if (
GetGame().ConfigIsExisting( config_path ) )
2978 {
2980 }
2981 }
2982
2984 {
2985 return true;
2986 }
2987
2989 {
2990 return true;
2991 }
2992
2994 {
2995 return true;
2996 }
2997
2998
3000 {
3002 {
3004 }
3005
3007 }
3008
3010 {
3012 }
3013
3014
3015
3017 {
3018 return super.CanReceiveAttachment(attachment, slotId);
3019 }
3020
3022 {
3023 int attachment_count = GetInventory().AttachmentCount();
3024 if ( attachment_count > 0 )
3025 {
3026 if (
HasBase() && attachment_count == 1 )
3027 {
3028 return false;
3029 }
3030
3031 return true;
3032 }
3033
3034 return false;
3035 }
3036
3038 {
3039 return true;
3040 }
3041
3043 {
3044 return false;
3045 }
3046
3047
3049 {
3050 return false;
3051 }
3052
3054 {
3055 return false;
3056 }
3057
3058
3060 {
3061 return false;
3062 }
3063
3064
3065
3067 {
3068 return true;
3069 }
3070
3072 {
3073 return true;
3074 }
3075
3078 {
3079 return false;
3080 }
3081
3082
3084 {
3085 return true;
3086 }
3087
3088
3090 {
3091 return false;
3092 }
3093
3094
3096 {
3097 return true;
3098 }
3099
3100
3102 {
3103 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3104 {
3105 return false;
3106 }
3107
3108 return true;
3109 }
3110
3112 {
3115
3116 return item;
3117 }
3118
3119
3121 {
3123 {
3124
3126
3127
3130
3132 if ( MemoryPointExists( slot_name + "_min" ) )
3133 {
3134 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3135 }
3136 if ( MemoryPointExists( slot_name + "_max" ) )
3137 {
3138 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3139 }
3140
3141
3144
3145
3148 center = ModelToWorld( center );
3149
3150
3153
3154 areaDamage.SetExtents( extents[0], extents[1] );
3155 areaDamage.SetAreaPosition( center );
3156 areaDamage.SetAreaOrientation( orientation );
3159 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3160 areaDamage.SetAmmoName( "BarbedWireHit" );
3161 areaDamage.Spawn();
3162
3164 }
3165 }
3166
3168 {
3169 if ( angle_deg != 0 )
3170 {
3171
3172 orientation[0] = orientation[0] - angle_deg;
3173
3174
3176 if ( MemoryPointExists( "rotate_axis" ) )
3177 {
3178 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3179 }
3180 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];
3181 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];
3182 center[0] = r_center_x;
3183 center[2] = r_center_z;
3184 }
3185 }
3186
3188 {
3190 {
3193 {
3194 if (areaDamage)
3195 {
3196 areaDamage.Destroy();
3197 }
3198
3200 }
3201 }
3202 }
3203
3205 {
3206 return true;
3207 }
3208
3209
3210
3211
3213 {
3215 }
3216
3218 {
3220 }
3221
3223 {
3225 }
3226
3228 {
3230
3231 switch ( material_type )
3232 {
3238 }
3239
3240 return "";
3241 }
3242
3244 {
3246
3247 switch ( material_type )
3248 {
3254 }
3255
3256 return "";
3257 }
3258
3259
3261 {
3263 {
3264
3266 {
3267 SetHealth(slot_name,"Health",item.GetHealth());
3268 }
3269 }
3270 }
3271
3273 {
3274 return 111;
3275 }
3276
3278 {
3279 super.SetActions();
3280
3284 }
3285
3286
3287
3288
3290 {
3291 }
3292
3295 {
3296 return null;
3297 }
3298
3300 {
3302 }
3303
3305 {
3308
3309 Man p;
3310
3311 #ifdef SERVER
3314 if (players.Count())
3315 p = players[0];
3316 #else
3318 #endif
3319
3321 {
3322 bool excluded = false;
3324 if (excludes)
3325 {
3326 foreach (string exclude : excludes)
3327 {
3329 {
3330 excluded = true;
3331 break;
3332 }
3333 }
3334 }
3335
3336 if (!excluded)
3337 {
3339 }
3340 }
3341
3343 }
3344}
3345
3347{
3348#ifdef BSB_DEBUG
3350#else
3351
3352#endif
3353}
3355{
3356#ifdef BSB_DEBUG_SPAM
3358#else
3359
3360#endif
3361}
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)
const string ANIMATION_DEPLOYED
override int GetHideIconMask()
override void OnStoreSave(ParamsWriteContext ctx)
void SetActionFromSyncData()
bool CheckMemoryPointVerticalDistance(float max_dist, string selection, PlayerBase player)
override void OnDebugSpawn()
array< string > OnDebugSpawnBuildExcludes()
Excludes certain parts from being built by OnDebugSpawn, uses Contains to compare.
void SoundDestroyStart(string part_name)
const string SOUND_BUILD_WOOD_LOG
void SoundBuildStart(string part_name)
void UpdateAttachmentVisuals(string slot_name, bool is_locked)
void CalcDamageAreaRotation(float angle_deg, out vector center, out vector orientation)
override bool CanObstruct()
bool HasAttachmentsBesidesBase()
void RegisterPartForSync(int part_id)
const string SOUND_DISMANTLE_METAL
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
void SetPartsAfterStoreLoad()
void DestroyConstruction()
ref array< string > m_HybridAttachments
string GetDismantleSoundByMaterial(string part_name)
bool IsAttachmentSlotLocked(EntityAI attachment)
override bool IsFacingPlayer(PlayerBase player, string selection)
void OnPartBuiltClient(string part_name, int action_id)
bool HasProperDistance(string selection, PlayerBase player)
override void OnCreatePhysics()
void OnPartBuiltServer(notnull Man player, string part_name, int action_id)
void RegisterActionForSync(int part_id, int action_id)
const string SOUND_BUILD_WOOD_PLANK
void SetPartsFromSyncData()
ref array< string > m_Mountables
const string SOUND_BUILD_WIRE
void ResetActionSyncData()
override string GetInvulnerabilityTypeString()
void OnPartDismantledServer(notnull Man player, string part_name, int action_id)
void CheckForHybridAttachments(EntityAI item, string slot_name)
override void EEOnAfterLoad()
override void EEItemDetached(EntityAI item, string slot_name)
vector GetKitSpawnPosition()
ref Construction m_Construction
bool IsFacingCamera(string selection)
bool CheckSlotVerticalDistance(int slot_id, PlayerBase player)
void GetAttachmentSlots(EntityAI entity, out array< string > attachment_slots)
override bool IsDeployable()
void OnPartDestroyedClient(string part_name, int action_id)
void UnregisterPartForSync(int part_id)
void bsbDebugSpam(string s)
override void OnVariablesSynchronized()
bool PerformRoofCheckForBase(string partName, PlayerBase player, out bool result)
Construction GetConstruction()
void SoundDismantleStart(string part_name)
ConstructionPart GetConstructionPartById(int id)
string GetConstructionKitType()
bool CheckLevelVerticalDistance(float max_dist, string selection, PlayerBase player)
void OnPartDestroyedServer(Man player, string part_name, int action_id, bool destroyed_by_connected_part=false)
bool CanFoldBaseBuildingObject()
override int GetDamageSystemVersionChange()
const string SOUND_DISMANTLE_WOOD_PLANK
override void EEItemAttached(EntityAI item, string slot_name)
const string SOUND_DISMANTLE_WOOD_LOG
class BaseBuildingBase extends ItemBase bsbDebugPrint(string s)
const string SOUND_BUILD_WOOD_STAIRS
ItemBase FoldBaseBuildingObject()
override bool CanPutInCargo(EntityAI parent)
override bool CanUseConstruction()
override void AfterStoreLoad()
void SetPartFromSyncData(ConstructionPart part)
override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
override bool IgnoreOutOfReachCondition()
override bool OnStoreLoad(ParamsReadContext ctx, int version)
override bool ShowZonesHealth()
void UpdateAttachmentPhysics(string slot_name, bool is_locked)
override bool IsPlayerInside(PlayerBase player, string selection)
string GetBuildSoundByMaterial(string part_name)
ItemBase CreateConstructionKit()
const string SOUND_DISMANTLE_WIRE
bool MustBeBuiltFromOutside()
Some buildings can only be built from outside.
override bool IsTakeable()
float m_ConstructionKitHealth
override void EEDelete(EntityAI parent)
override void SetActions()
void HandleItemFalling(ConstructionPart part)
void DestroyConstructionKit(ItemBase construction_kit)
void CreateConstructionKitInHands(notnull PlayerBase player)
void ItemFall(vector min, vector max)
override bool CanUseConstructionBuild()
void OnSynchronizedClient()
void SynchronizeBaseState()
override bool IsIgnoredByConstruction()
ref map< string, ref AreaDamageManager > m_DamageTriggers
void SetBaseState(bool has_base)
const string SOUND_BUILD_METAL
void OnSetSlotLock(int slotId, bool locked, bool was_locked)
override bool CanPutIntoHands(EntityAI parent)
bool IsPartBuildInSyncData(int part_id)
override bool CanRemoveFromCargo(EntityAI parent)
const string SOUND_DISMANTLE_WOOD_STAIRS
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)
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
override bool CanUseConstruction()
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.